Quantcast
Channel: ABAP Development
Viewing all articles
Browse latest Browse all 948

Using the output of a Standard/Already Developed ALV report

$
0
0

So Recently, in one of my Objects that a member of my team was supposed to develop an ABAP Report which had to have an output that was exactly same as the one of the standard Transactions(IE05) . 

 

Here's what i ended up doing:

 

  1. We need to call the SET method of the class CL_SALV_BS_RUNTIME_INFO as shown below :
      • cl_salv_bs_runtime_info=>set(

                             EXPORTING

                                 display  = abap_false

                                 metadata = abap_false

                                 data     = abap_true

                          ) .

      •   What this does is to tell the system that the report has to be running with no DISPLAY no METADATA on only get the ALV DATA.                   

 

     2. Z* report where i used the used the SUBMIT Statement so call the standard report .

                              SUBMIT riequi20 AND RETURN .

    • The AND RETURN addition ensures that the the control is returned to the calling program .
    • You can use the various other additions of the SUBMIT statement to pass on the selection screen parameters .

         3. Next use the GetDataRef method of the class CL_SALV_BS_RUNTIME_INFO to get the actual data  into a local object  type ref'ed to DATA.

                        DATA obj_data TYPE REF TO data .

                       FIELD-SYMBOL <fs_data> TYPE any .

     

                        TRY.

                             cl_salv_bs_runtime_info=>get_data_ref(

                              IMPORTING

                                  r_data = obj_data

                                 ) .

                              ASSIGN obj_data->* TO <fs_data>.

     

                        CATCH cx_salv_bs_sc_runtime_info.

                             Write : / data not captured.

                         ENDTRY.

          4. The data from the ALV should now be in the fs_data Field-Symbol. We can now change or do any further validations on it.

     

    Thanks to Glen Simpsons Blog for this, it saved me lot of time .

     

    Oputput Problems

     

    I ran into one tiny little problem. Some of the fields like the System Status and the User Status and others did not have any values in them. This was very Weird as when i Ran the Standard report with the same selection screen parameters the values were populated.

     

    So as mentioned in my SCN discussion.

     

    I had the complete set of data that the Standard report outputs in my internal table and i just the ALV Class to output it to my screen.

     

    PROBLEM:

     

    But after checking the data (100+ fields) in the ALV report my Z program creates, I found that some of the Fields which the Standard report does have values for are not populated.

     

    Debugging:

     

    So, i decided to debug the Standard program so see why i didn't get some of the fields into my output.

     

    Turned out that the internal table that was being fed into the REUSE_ALV_GRID_DISPLAY( Location: RIEQUI20 > MIEQUI20 > MIOLXF14 line 108 of include )  FM in the Standard report also does not have the values for the same fields when the FM for ALV is called. (PFA image of the point where the FM is being called.(in case some of you want to debug it yourselves )

     

    e.g. : the value of the table OBJECT_TAB-STTXT is Empty  when the REUSE_ALV_GRID_DISPLAY is called ,

    but in the final ALV output  the fields System Status (STTXT) has the corresponding values . This was very troubling and as with all such situations it had a very simple solution.

     

    http://f.cl.ly/items/0L3X2H2107043c3G242G/Screen%20Shot%202013-08-03%20at%202.20.54%20PM.png

     

    Solution and Reason


    What was happening was that the there was a default LAYOUT on the ALV screen that was set based on which the standard program did not fetch some of the fields that it did not have to display.

    So i went into the standard Report output, click on the change layout button (Ctrl + F8 ) and create a New Default Layout with all the fields i wanted an output for .

     

    Hope this helps some save some time.

     

    Have a Good day.

    Amarpreet.


    Viewing all articles
    Browse latest Browse all 948

    Trending Articles