Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
ipravir
Active Contributor
6,075

Hello,

Some of the customize reports, which takes more time to execute in foreground and after some time it gives the time out error.

and we suggest users to execute the report in background.

But then after they get the information in list view format.

For these, they go through with the customize T-code and then SM37, there they have to find the related report background job.

And execute the same for the final result.

To overcome the issues faced by the users, I have come-up with a solution in the customize report,

where i have added two more option, as show below.

1. Background Process: -

I have created a Function Module, which executes the program directly in background with auto generated job id.

In this function module, a programmer needs to create a logic, where they have to pass only those input field information's

which contains the values.

I have used one of my created program, with that user can fetch the field combination information's between SAP tables.

http://scn.sap.com/docs/DOC-48837

Screen Logic: -

SELECTION-SCREEN:   BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.

  SELECTION-SCREEN:    BEGIN OF LINE,
    PUSHBUTTON 2(20) BTN_BACK USER-COMMAND BTTN_BACK.
  SELECTION-SCREEN:    END OF LINE.

  SELECTION-SCREEN:    BEGIN OF LINE.
  SELECTION-SCREEN:    END OF LINE,
   PUSHBUTTON 2(20) BTN_DISP USER-COMMAND BTTN_DISP.
SELECTION-SCREEN:   END OF BLOCK B2.

DATA:   GIT_SCR TYPE STANDARD TABLE OF RSPARAMS,
         GFL_SCR LIKE LINE OF GIT_SCR.


AT SELECTION-SCREEN.
   CASE SY-UCOMM.
     WHEN 'BTTN_BACK'.
       REFRESH: GIT_SCR.
       PERFORM SUB_UPDATE_SCREEN_INFO USING 'P_FLDNM' 'P' 'I' 'EQ' P_FLDNM ''.
       IF S_DATELM-LOW NE SPACE.
         PERFORM SUB_UPDATE_SCREEN_INFO USING 'S_DATELM' 'S' 'I' 'EQ' S_DATELM-LOW ''.
       ENDIF.
       IF S_WIDFL-LOW NE SPACE.
         PERFORM SUB_UPDATE_SCREEN_INFO USING 'S_WIDFL'  'S' 'I' 'EQ' S_WIDFL-LOW ''.
       ENDIF.
       IF S_CLASS-LOW NE SPACE.
         PERFORM SUB_UPDATE_SCREEN_INFO USING 'S_CLASS'  'S' 'I' 'EQ' S_CLASS-LOW ''.
       ENDIF.
       CALL FUNCTION 'ZPRV_BACKGROUND_PROCESS'
         EXPORTING
           G_PROG              = SY-REPID
         TABLES
           VARI_CONTENTS       = GIT_SCR.

     WHEN OTHERS.
   ENDCASE.

If the function module executes successfully, then a pop will display, "Program Executed Successfully!'.

2. Display Output

To display the all background jobs of the respective report.

Create a program with refer to below blog.

http://scn.sap.com/docs/DOC-48984

And write the below code for Display Output option.


     WHEN 'BTTN_DISP'.
       DATA: L_BTCJOB  TYPE BTCJOB.
       CONCATENATE SY-REPID '*' INTO L_BTCJOB.
       SUBMIT ZPRV_DISPLAY_BACKGROUND WITH P_JOB = L_BTCJOB.

Here the ZPRV_DISPLAY_BACKGROUND is the program name, which created with refer the http://scn.sap.com/docs/DOC-48984  blog.

If the Display Output option is selected, then if any background job exists based on the customize report, it will display the job information's in ALV grid.

By double clicking on any one of the records, the respective list information will display in formatted ALV Grid.

Thanks & Regards.

Praveer Kumar Sen

2 Comments
Labels in this area