Create a background job from ABAP code

FORM run_background . DATA: lv_jobname TYPE tbtcjob–jobname. DATA: lv_jobcount   LIKE tbtcjob–jobcount, lv_release(1) TYPE c. lv_jobname = ‘jobname’. CALL FUNCTION ‘JOB_OPEN’ EXPORTING jobname          = lv_jobname IMPORTING jobcount         = lv_jobcount EXCEPTIONS cant_create_job  = 1 invalid_job_data = 2 jobname_missing  = 3 OTHERS           = 4. IF sy–subrc <> 0. MESSAGE ‘Open job error’ TYPE ‘S’ DISPLAY LIKE ‘E’. LEAVE LIST-PROCESSING. ELSE.

Read more

Refresh ALV

FORM refresh_alv. DATA go_gui_alv_grid TYPE REF TO cl_gui_alv_grid. * Get the current grid control instance CALL FUNCTION ‘GET_GLOBALS_FROM_SLVC_FULLSCR’ IMPORTING e_grid = go_gui_alv_grid. “Set layout again to optimize column width with new data DATA ls_layout TYPE lvc_s_layo. ls_layout–zebra = ‘X’. ls_layout–cwidth_opt = ‘X’. ls_layout–box_fname = ‘SEL’. go_gui_alv_grid->set_frontend_layout( is_layout = ls_layout ). * Refresh go_gui_alv_grid->refresh_table_display( ). ENDFORM.

Read more