Skip to Content

ABAP Developers: Have you ever encountered the situation in which the output of a standard SAPGUI ALV report could help meet a certain requirement but the report program is not written in a way that makes its data extraction and data processing code easily reusable? Frustrating, isn’t it?!

If a report is built using correct layers of abstraction, there is an opportunity to reuse the data processing logic in a totally different user interface technology or output medium (such as a batch interface?). Unfortunately though, most standard SAP reports were born before the Separation of Concerns (SoC) and Model-View-Controller (MVC) concepts became popular in the SAP world and, with the prolific use of things like logical databases in standard report programs, you’ll find that there are very few standard Models (refer to the MVC concept) that can be reused easily. Yes, there are plenty of lower-level BAPIs and function modules that can be called however reports often add so much logic on top of these that fully replicating it would require great swathes of copied code.

Wrapping Reports

If you do find a report that contains logic you want to use there might be another way to reuse it without resorting to cloning whole programs or copying-and-pasting code… you can try “wrapping” the report program in your own custom program and treat the original report somewhat like a simple subroutine.

In some cases, standard report programs specifically cater for this scenario and allow custom wrapper programs to gain access to their data. These report programs will, after extraction and processing, put their data into a globally accessible area of memory and allow the wrapper to import it after submitting the report. Often this is done using the EXPORT TO MEMORY/IMPORT FROM MEMORY technique. Transaction IA09/program RIPLKO10, which is used for reporting and managing Tasklists, is an example of this:

* Execute transaction IA09 to get all Functional Location Tasklists
  SUBMIT riplko10
    WITH SELECTION-TABLE lt_selscreen
    WITH pn_iflo  = abap_true  "Select Func Loc Tasklists
    WITH dy_tcode = 'IA09'
    WITH dy_selm  = 'D'        "Dark mode
    AND RETURN
  IMPORT sel_tab FROM MEMORY ID 'RIPLKO10'.

This can be a very useful way of reusing report logic and I have even seen instances of Developers creating modifications or enhancements to add this functionality to standard reports where it doesn’t already exist. While it is a practical solution in some situations, a downfall is that it relies on the original Developer of the report programs to enable the export to memory or it means you, the custom Developer, need to enhance each and every report you want to reuse.

Quite recently, though, I discovered something that provides access to the data of any SAPGUI ALV report without modification or enhancement.

Introducing Class CL_SALV_BS_RUNTIME_INFO

When an ALV report is executed, the ALV runtime information (the layout, field catalog, key fields, filters, etc. plus the data table) is stored away by methods of class CL_SALV_BS_RUNTIME_INFO for later use. (Incidentally, the class uses the same EXPORT TO MEMORY mechanism to store the runtime info however the class handles all this internally and provides API methods to access the information, meaning we don’t have to care how it is actually stored.) Now, with a submit statement and a few simple method calls, we can gain direct access to the data table of a report without making any changes to it.

FIELD-SYMBOLS <lt_pay_data>   TYPE ANY TABLE.
DATA lr_pay_data              TYPE REF TO data.
  cl_salv_bs_runtime_info=>set(
    EXPORTING display  = abap_false
              metadata = abap_false
              data     = abap_true ).
* Submit Wage Type Reporter
  SUBMIT h99cwtr0
    WITH SELECTION-TABLE lt_selscreen
    AND RETURN.
  TRY.
      cl_salv_bs_runtime_info=>get_data_ref(
        IMPORTING r_data = lr_pay_data ).
      ASSIGN lr_pay_data->* TO <lt_pay_data>.
    CATCH cx_salv_bs_sc_runtime_info.
      MESSAGE `Unable to retrieve ALV data` TYPE 'E'.
  ENDTRY.
  cl_salv_bs_runtime_info=>clear_all( ).

Explanation Time!

Whilst there are nearly twenty methods in CL_SALV_BS_RUNTIME_INFO there are only three or four of interest in the retrieval of data from an ALV report:

SET( ) – this method initialises the class (clears its memory areas) and then allows the setting of flags to tell any subsequent ALV objects how to behave. It should be called in your wrapper program before submitting the wrapped ALV report program.

Parameters:

  • DISPLAY – set this to abap_false to force all subsequent ALV reports to run in “dark mode”, that is, the ALV will not be output to the GUI.
  • METADATA – set this to abap_false to prevent the metadata (layout, field catalog, etc) being exported to memory… we don’t need it in this scenario.
  • DATA – set this to abap_true to force the data table to be exported to memory

You would normally only need one of the next two methods. Call it after the wrapped ALV report program has been submitted.

GET_DATA_REF( ) – by far the most flexible of the two GET_DATA* methods, this method can be used to access a reference to the data table variable. It is useful when the structure of the data table is not known, not of importance in the wrapper program or is dynamic so a variable cannot be statically typed in the wrapper program.

Parameters:

  • R_DATA – exporting parameter for the reference to the data table variable.
  • R_DATA_LINE – if the ALV report executed is a hierarchical list report this exporting parameter will hold the reference to the item data table variable.

GET_DATA( ) – this method can be used to access the data table when the structure is known by the wrapper program. Note: If the wrapper program doesn’t know the structure of the data table because it is dynamic or it just doesn’t need to know the structure then use method GET_DATA_REF( ) instead.

Parameters:

  • T_DATA – exporting parameter for the data table.
  • T_DATA_LINE – if the ALV report executed is a hierarchical list report this exporting parameter will hold the item data table.

CLEAR_ALL( ) – this method clears all memory areas thus resetting any of the flags that may have been set in the SET( ) method. Calling this method is especially important if you have set the DISPLAY flag to false but you want to display your own SAPGUI ALV report after submitting the wrapped one – if the DISPLAY flag is not reset to its initial value of true before executing your own ALV, then your ALV will not be displayed either.

Things to Note

  1. The technique described above can be used to access the data of any report program that uses SAPGUI ALV, regardless of the type of ALV. It will work for ALV Grid, ALV List and even Hierarchical ALV List reports but it will obviously not work for reports that output to the GUI using WRITE statements, dynpro table controls or anything other than SAPGUI ALV.
  2. I don’t think there are many (if any) situations where this technique would be more efficient than a well coded method or function module to extract and process data – the benefits really lie in the reduction of development effort and reuse of existing development objects. So if you require a high performing solution then this technique might not be the one for you.
  3. The class is simple but powerful which could lead to overuse or use in inappropriate situations. I encourage all developers to use it where it is needed (don’t go looking for a problem for this solution!) and to discuss this technique with colleagues and development managers before implementing.

Wrap Up (pun intended!)

That’s all there is to it, really. It’s so simple that I was sure that it must have been documented or discussed on SDN somewhere but I was very surprised that nothing turned up in a search. This blog should fix that…

I hope that others can share their innovative uses of this simple technique as I want to do in my next blog… “A framework to create quick POWL front-ends to SAPGUI ALV reports” (when I find some time to write it!)

To report this post you need to login first.

72 Comments

You must be Logged on to comment or reply to a post.

  1. Alejandro Bindi
    This is great to know, but you 3rd note can’t be emphazised enough: this should be used in rare circumstances, where other alternatives are not doable. I can see hordes of lazy developers comming to do this instead of properly analyzing programs, to get the underlying data retrieval function module / method. For instance, I’d never do this with a Z report, instead it’s data retrieval logic should be properly encapsulated and made reusable (if not already). But to avoid a standard modification, it’s a good alternative.

    I ran a google search and found something strange, apparently this same technique is patented by SAP AG: http://www.patentgenius.com/patent/7899841.html. Maybe the company has something else in the works for the future, using this concept…

    Regards

    (0) 
    1. Glen Simpson Post author
      Hi Alejandro

      I totally agree with your first comment – maybe I should have put the whole note in bold! Thanks for reinforcing the point.

      That patent you mention is quite interesting. I wonder whether this patent prevents use of the class by customers for their own purposes – the class is released afterall and not just released internally…

      Regards
      Glen

      (0) 
  2. Kumud Singh
    Hi There,

    I understand that this class is used to gain access to output of existing developed reports with ALV output.
    It would not be helpful If I need to make changes
    in the existing report , right?

    Thanks,
    Kumud.

    (0) 
    1. Glen Simpson Post author
      Hi Kumud
      I can’t say that I’ve tried to change the data table or metadata of the existing report at runtime but I suspect you can’t change them using CL_SALV_BS_RUNTIME_INFO as you can only access these properties of the ALV report *after* it has been submitted. Let us know if you discover anything different to this.
      Regards
      Glen
      (0) 
    1. Glen Simpson Post author
      Hi Sikken

      In the example code I gave, lr_pay_data contains a reference to the internal table and, after the ASSIGN statement, the internal table will be assigned to the<lt_pay_data > field symbol.

      Are you asking how to process the table data via the untyped field symbol? If so then please see this SAP Help article and particular the section on “Using a Field Symbol”:
      http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb381a358411d1829f0000e829fbfe/frameset.htm

      In brief, you will use something like
      LOOP AT<lt_pay_data > ASSIGNING<ls_pay_data >
      followed by
      ASSIGN COMPONENT fieldname_or_index_here OF STRUCTURE<ls_pay_data > TO<lv_field >

      Kind Regards
      Glen

      (0) 
  3. Deepak Dhamat
    hi glen   ,

    before Using your techniqe  . i made full use  of Export to memory  and Then to Asci  function modules  to extract  data  from standard OR Zreport and was succesful for the same  .Working  for Bharatforge Manufacturing Organisation there is lot of Customization  and Use  of BI Report (Maia TOOLS)
    Here needs output of lots of report for summarise data . so used your logic  and worked wonder as it reduced my code and time  . I know it will  create lazyness  for new abapers  but still . it is good to USE Andriod and Blackberry instead of NOKIA 3315 .

    Nice work Glen   .

    regards
    Deepak  dhamat 

    (0) 
  4. Alejandro Bindi

    I’m finding (the hard way) the first problem with this approach, which happens if the standard report being called issues MESSAGE statements. This of course is not because of the ALV runtime class, but because of the SUBMIT behaviour.

    Since in this case it’s an S message, i’ve managed to get around it by issuing my own S message, “overwriting” the standard one (if I don’t, calling program flow is affected).

    I still think it is a serious issue to be considered because it limits the usage of this approach.

    Did you find this issue as well?
    Regards

    (0) 
    1. Glen Simpson Post author

      Hi Alejandro

      I have mainly used this approach to create web dynpro front-ends to GUI ALV reports and when an S, I or W message is raised by the submitted program it is ignored by the web dynpro framework and doesn’t cause any problems. So I can’t say I’ve shared your exact issue.

      I have had problems, however, when the submitted program raises E messages as this causes the web dynpro app to short dump. In these cases I’ve had to look for ways to suppress the error by either changing the type of message (if configurable) or look to see if the report developer has provided a way to suppress the message (often using a flag exported to memory). If I can’t find a way to suppress the error then I resort to finding another report or rewriting the report logic.

      You’re right, there are limits to this technique but then, there often are limits to short-cuts, aren’t there? 🙂

      Thanks for sharing the warning for others. If you ever find a way to overcome the problem then please let me know.

      Regards

      Glen

      PS. This reminds me that I have to do something about the “next blog” I promised over a year ago…

      (0) 
      1. Alejandro Bindi

        I’ve been researching this the last couple of days, and found no totally satisfactory solution, just that if I give my own message, the standard one is not shown and doesn’t affect the program flow (although, for some strange reason, the variant selection button for my report selection screen stops working after this situation). For now at least, I prefer this minor glitch than having to copy and modify a standard report with several includes (with the associated maintenance burden).

        This is a problem inherent to the SUBMIT statement (which doesn’t provide a way to bypass messages, similarily to the ERROR_MESSAGE predefined exception in function modules). So this approach is still very valid, my intent was mostly to warn others as you said.

        So far, i’ve considered:

        – Background execution (no use, because we need the report output in this case)

        – SUBMIT variations (EXPORTING LIST TO MEMORY, TO SAP-SPOOL, etc) change nothing regarding message behaviour, contrarily to some forum suggestions.

        – CALL TRANSACTION…MESSAGES INTO: This is a problem because, in my case (like most uses of this approach i’d suppose) i have lots of select options. The code to fill BDCDATA in this case is cumbersome at the least, and I haven’t found any function module which could do this for me.

        – Submitting the report from a Function module and using ERROR_MESSAGE exception, then calling the function module: changes nothing.

        This guy went through very similar problems years ago, so I think there’s really no solution:

        http://scn.sap.com/thread/15461

        So, bottom line is, check for disrupting MESSAGE statements in your called report when considering this alternative.

        Waiting for your next blog! (and hoping it is at least as informative as this one 😉 )

        Regards

        (0) 
      2. Alejandro Bindi

        Just another important point to remark: ALWAYS call CL_SALV_BS_RUNTIME_INFO=>CLEAR_ALL after SUBMIT. Solving a problem with another ALV which called my report, I also solved the problem of the variant selection button (which also happens to be an ALV): In case of error, I wasn’t calling the CLEAR_ALL method. So the variant selection was never displayed.

        I changed this code:

        TRY.

           cl_salv_bs_runtime_info=>get_data( IMPORTING t_data = et_std_outtab ).

              CATCH cx_salv_bs_sc_runtime_info.

              RAISE ex_error.

        ENDTRY.

        cl_salv_bs_runtime_info=>clear_all( ).

        With this:

        TRY.

           cl_salv_bs_runtime_info=>get_data( IMPORTING t_data = et_std_outtab ).

              CATCH cx_salv_bs_sc_runtime_info.

              l_error = abap_true.

        ENDTRY.

        cl_salv_bs_runtime_info=>clear_all( ).

        IF l_error = abap_true.

           RAISE ex_error.

        ENDIF.

        And it began to work.

        (0) 
        1. Glen Simpson Post author

          Hi Alejandro

          Thanks for reinforcing the need to use the CLEAR_ALL method. I agree that it is very important.

          As a side note: Rather than use the l_error flag flag, why don’t you call the CLEAR_ALL method in the CATCH block before you raise the ex_error exception? Another alternative might be to add a CLEANUP block to the TRY and call the CLEAR_ALL method there (I’m not sure how the CLEANUP works when you raise another exception in the CATCH but it might be worth a look)

          Thanks again

          Glen

          (0) 
    1. Glen Simpson Post author

      Hi Prashant

      Yes, I agree. I’ve never been happy with the solution that is often suggested in forum postings, to send the ALV output to spool, read it back from spool and then attempt to interpret the data again in your calling code. That option relies on the layout containing the fields you need (as you pointed out) and is very prone to formatting errors.

      I hope you can make good (and legitimate! 🙂 ) use of this technique.

      Regards

      Glen

      (0) 
  5. Michelle Crapo

    Interesting way of doing things.   I perfer using a user enhancement.   BUT if I needed something quick and dirty, this would do the trick.

    I’m a LAZY programmer when I need something yesterday.   Although at some point later, I would be re-writing this.

    This is much better than cloning.

    Michelle

    (0) 
    1. Glen Simpson Post author

      Hi Michelle

      Sorry. I’ve been very slack in responding… 🙁

      I’d be interested in your thoughts on why an enhancement would be a better way to gain access to the data of an ALV report than using the technique above.

      I very much agree with your sentiments regarding cloning… In my view, a clone is a far worse option than a modification/implicit enhancement and should be avoided at all costs!

      Regards

      Glen

      (0) 
      1. vamsilakshman pendurti

        Hi Glen ,

        Its really very helpful ,

        I have small doubt …

        If we want to get the out put of hierarchical data into our program i am getting header information  only…..how to get item data into my internal table .

        When i use the R_DATA_LINE  parameter then it will go to dump…

        could you please give me the reason ..

        Thanks ,

        vamsi.

        (0) 
  6. Yuvaraj Shanmugam

    Hi Glen,

    Its a great post, neatly laid out and eaily understandable.. I was able to read it like reading a newspapaer..

    Secondly, as you said,this technique will be uselful in situations where we dont have to bother about the performance. It can be used in places where we need to mimic the standard logic.

    Also I got an idea where to use it perfectly. I guess using this, we can create a program called Universal Downloader. This program will help you in downloading the data of any report in any file format so that we dont have to add the same annoying downloading functionality in every report.

    What do you think?

    (0) 
    1. Glen Simpson Post author

      Hi Yuvaraj

      Thanks for your kind comments. 🙂

      You could certainly use this class to create a “Universal Downloader” but, as you would need to wrap the existing ALV report in your own program with its own selection screen (to specify the name of the ALV report and the download format at least), I wonder whether users might find this a little “clunky”? But maybe you have a different idea on how this might work and still be user friendly? I’d like to hear about it.

      Regards

      Glen

      (0) 
  7. Satish Chandra

    Brother, if ther is only one record to be produced as out put, then the screen is getting displayed rather than a list display.

    could you tell me how could i resolve this issue.

    Regards

    Satish Chandra

    (0) 
  8. Mohan Babu K J

    Nice trick.. the result is awesome..

    I was looking to get whole internal table values in my program for submit.. exporting to memory list. But it brought only the layout fields and not whole table values. this helped a lot for my requirement.

    thank you 🙂 !!!

    (0) 
  9. Yuvaraj S

    Hi Glen,

    I cannot thank you enough.

    I just happened to come across your blog and it helped me in a similar situation where I had to get the back the ALV from a program being ‘Submittet’

    I had a requirement to develop a report to reprocess IDOCs that got failed. The users wanted to use the same report to reprocess (Select IDOCs from ALV list and reprocess them) and not via BD87. So to cater this, I did a digging over how BD87 works and there was a class BD_LS_MON which had a method PROCESS_IDOCS(). With this method, it was a cake walk to process the IDOCs.

    But there is no way to get back on what happened to the IDOCs that are being reprocessed. This is when you blog did taught me how to do tricks and get back the ALV which had old_status and new_status of IDOCs and with that I can see what happened to them.

    Keep up the good work.
    Yuvaraj S

    (0) 
    1. Glen Simpson Post author

      Hi Yuvaraj

      Sorry that it took me so long to reply but I wanted to thank you for taking the time to share how you were able to use this technique. Thanks for your comment.

      Cheers

      Glen

      (0) 
  10. Shilpa Bansal

    Dear Glen,

    I have used the below code. But i don’t get any memory address is lr_pay_data.

    Can you please help?

       FIELD-SYMBOLS <lt_pay_data>   TYPE ANY TABLE.
    DATA lr_pay_data              TYPE REF TO data.
    cl_salv_bs_runtime_info=>set(
       EXPORTING display  = abap_false
                 metadata = abap_false
                 data     = abap_true ).
    SUBMIT Zabc_RLLL0100 WITH PLGNUM = <value> EXPORTING LIST TO MEMORY and RETURN.
    TRY.
        cl_salv_bs_runtime_info=>get_data_ref(
               IMPORTING r_data = lr_pay_data ).
        ASSIGN lr_pay_data->* TO <lt_pay_data>.
      CATCH
        cx_salv_bs_sc_runtime_info.
        MESSAGE `Unable to retrieve ALV data` TYPE ‘E’.
    ENDTRY.
    cl_salv_bs_runtime_info=>clear_all( ).

    Regards,

    Shilpa

    (0) 
    1. Glen Simpson Post author

      Hi Shilpa

      Is the report ZABC_RLLL0100 a copy of standard report RLLL0100? RLLL0100 is not an ALV report and as explained in the blog post above, CL_SALV_BS_RUNTIME_INFO class will not work on anything except SAPGUI ALV reports.

      Regards

      Glen

      (0) 
      1. Shilpa Bansal

        Hi Glen,

        Yes this report is a copy of standard report RLLL0100.

        I want to display the results of T-code LL01 in an expanded form as default and send it to spool because the output of LL01 is an ALV TREE report.

        How can i achieve this?

        Regards,

        Shilpa

        (0) 
        1. Glen Simpson Post author

          Hi Shilpa

          Please correct me if I’m wrong but RLLL0100 uses function module RS_TREE_LIST_DISPLAY to display its data but this is not an ALV tree. Even if it was a true ALV tree, the CL_SALV_BS_RUNTIME_INFO class only works for ALV grids, ALV lists and hierarchical ALV lists, not ALV trees.

          I don’t think the information in this blog post will help with your requirement.

          I suggest that if you have a specific question about that report that you should create a discussion thread in the ABAP Development space. I’m sure that people will be able to help you there. Good luck with it.

          Kind Regards

          Glen

          (0) 
        2. Deepak Dhamat

          Hi Shilpa ,

          i think you should Play with below  code   .

          Create one work area to hold  output of  report data   .

          say w_donco  with all fields  which you want  .

          you will get all data  in listtab  . after that you decide how to arrange data  .

          Regards

          Deepak 

          example below code

          DATA : listtab        LIKE abaplist OCCURS 1 .

          DATA : it_txtline TYPE STANDARD TABLE OF w_docno WITH HEADER LINE .

          SUBMIT Zabc_RLLL0100 WITH PLGNUM =

          = <value> EXPORTING LIST TO MEMORY and RETURN.

          CALL FUNCTION ‘LIST_FROM_MEMORY’

            TABLES

              listobject = listtab

            EXCEPTIONS

              not_found  = 1

              OTHERS     = 2.

          IF sysubrc <> 0.

          ENDIF.

          CALL FUNCTION ‘LIST_TO_ASCI’

            TABLES

              listobject         = listtab

              listasci           = txtlines

            EXCEPTIONS

              empty_list         = 1

              list_index_invalid = 2

              OTHERS             = 3.

          *    CHECK sy-subrc = 0.

          DESCRIBE TABLE txtlines LINES n .

          LOOP AT txtlines .

            IF   cnt = 1   OR cnt  = 3.

              DELETE txtlines .

            ENDIF.

            IF cnt = n .

              DELETE txtlines .

            ENDIF.

            cnt = cnt + 1 .

            CLEAR txtlines .

          ENDLOOP.

          (0) 
          1. Matthew Billingham

            Problem resolution is not appropriate for blog comments. I’ve removed the rest of the comments in reply to this and instructed Shilpa Bansal to start a new discussion.

            (0) 
  11. SINDHUJA CHANDRASEKARAN

    Hi Glen Simpson

         This is a useful information.    

         I tried this with the standard wage type report which worked fine.

         Then i moved to next level where i would select some options from Object selection of standard program(wage type report), but am stuck with there because when ever i click on the object selection a screen is called so moved up with module pool program and thus how could i proceed then??

    Thanks and Regards,

    Sindhu.

    (0) 
  12. kranthi kumar

    hi,

    If i have a classical report like ‘S_ALR_87012178 ‘, here we can extract the ABAP_LIST  output   but here i am unable to get the final internal table of the Report . this is not an ALV report. so when i exported the Report output i am getting the data in ABAP_LIST format.

    But i need the final internal table with data .

    How to Resolve this .

    Thanks,

    Kranthi Kumar M.

    (0) 
  13. Endy Limantara

    Hi Glen, thanks for sharing this 🙂

    I’ve tried to change the SUBMIT part to call transaction using bdc and it’s work too. The reason i’m using bdc instead of submit, because inside the program that i want to call there’s a coding for submit too. So if i use a submit and return, the screen won’t come back to my program.

    But, i have a problem when retrieving ALV data. I just want the data that displayed in the alv grid. For example, the data consist of 50 columns. But i’m already set the default layout just for 12 columns. Can i retrieve this 12 columns? I’m already try using metadata but it’s not working. Maybe you can help me 😕

    Thanks before 😀

    (0) 
    1. Endy Limantara

      Hi Glen, I’m already find the solution. It’s using another method (get_metadata). Here’s the code:

      data ls_metadata type cl_salv_bs_runtime_info=>s_type_metadata.

      cl_salv_bs_runtime_info=>get_metadata(receiving value = ls_metadata ).


      From there we can get the layout in table  t_fcat. Thanks 🙂

      (0) 
  14. TONY CHU

    Hi expterts,

    This is a great tool.

    When I tried it, somehow the return table misses some records.

    Below are the codes:

    FIELD-SYMBOLS: <lt_alv_data>      TYPE ANY TABLE,
                                     <lw_bal>           TYPE ypmpro_s_balance,
                                    <lw_ldg>           TYPE ypmtrack_s_rpt1.

      REFRESH: itab_bal, itab_ldg.

    * Initialization
      cl_salv_bs_runtime_info=>set( EXPORTING display  = abap_false
                                              metadata = abap_false
                                              data     = abap_true ).

    * Get data selection
      SUBMIT (p_rpt) WITH SELECTION-TABLE p_sel AND RETURN.

      TRY.
          cl_salv_bs_runtime_info=>get_data_ref(
             IMPORTING
               r_data      = lr_data ).

          ASSIGN lr_data->*      TO <lt_alv_data>.

        CATCH cx_salv_bs_sc_runtime_info.
          MESSAGE ‘Unable to retrieve ALV data'(017) TYPE ‘E’.
      ENDTRY.

      cl_salv_bs_runtime_info=>clear_all( ).

    Below is the Selection Table content:

    1 PA_ALTUM P
    2 PA_LV P   /V001
    3 PA_NOBAL P
    4 S_ABTNR S
    5 S_BUKRS S I EQ IT01
    6 S_BUPER S I EQ 201301
    7 S_KNFIX S
    8 S_KNTYP S I EQ 27 00
    9 S_KONTO S I EQ 27020
    10 S_KONTO S I EQ 27021

    The original report has two records display in ALV Grid (account 27020 & 27021).
    However, in the calling program, lr_data->* points to the data with only one record.

    Does anyone have the idea or it’s the method issue ?

    Thank you for help.

    Tony

    (0) 
  15. Michael Lee

    Hi,

    I am excited about this solution.  I will try it with FBL3N and FAGLL03 in my next project.  Thanks a lot for providing this solution.

    (0) 
  16. zongjie zhang

    Hi Glen Simpson,

        This is very usefully! Thanks for your share.

        I have one question need your help. When I run an ALV report in background job, it will have a spool. If I want to get this ALV runtime information (the layout, field catalog, key fields, filters, etc. plus the data table)  by spool no, how can I realize this function ?

    (0) 
  17. Massimo Coletti

    Hi Glen Simpson

    I tried to play with your solution, using a SAP Query (SQ01) as a source.

    The problem is that the ALV list includes a field %ALVCOUNT, that is impossible to exclude, which causes an exception CX_SY_STRUCT_COMP_NAME in the method CREATE_DATA_FOR_COMPONENT of the class CL_SALV_BS_DDIC, that checks for valid field names, and doesn’t allow for ‘%’ character.

    The exception is raised using cl_salv_bs_runtime_info=>get_data_ref.

    😕

    (0) 
  18. sriramula kishore

    Hi Glen,

    Thanks for the good blog.It works like a charm. I have made changes in my old report and i am very happy with the performance.

    Any chance of getting header data of the ALV ?

    Regards

    SSK

    (0) 
  19. Swati Singh

    well this help me to great extent. However, the alv output of my submit program has subtotals and totals. Also the submit program has multiple all layouts

    . would this work in such dynamic scenario. I need to send the output of RPCPRRU0 in pdf

    (0) 
  20. KIRAN RAJAN

    Hi Glen,

    I have tried your solution for calling a standard report :- Tcode VL10c.To get the data in the Custom Report  I need to run standard tcode VL10c at least once in respective system .Then only I got data in the custom report.Please help to resolve the issue.

    (0) 
  21. IBABAP IBABAP

    Dear Glen,

    I am still getting a blank field, I tried class CL_SALV_BS_RUNTIME_INFO to fetch the data in the internal table from the standard report  rfitemgl for t-code FBL3N but it is not returning me the data from the field EBELN.

    Previously i tried fetching data from LIST_TO_ASCII function module, but there also same problem is coming, it is not returning the data of field EBELN from the report rfitemgl for t-code FBL3N.

    Please help me.

    Regards,

    Prameet Gopal Verma

    (0) 
  22. John K

    Hi Glen Simpson,

    Thanks for sharing your knowledge. It is very useful to my requirement. I will let you know once I get update from my customer side.

    Thanks & Regards,

    John K.

    (0) 
  23. Juan Lee

    I am having some issues with this class. When I call this within SAP ,  works well, but when I convert the same FM to a RFC and call it from external source, nothing is returned the field symbol.

    Any ways to fix this issue?

    thanks

    Update: Problem solved.

    if you using this class for a submit <program>  , make sure the events such as

    AT USER-COMMAND are  being triggered. When I call from my RFC from  HTTP, this user command doesn’t get triggered for some reason.

    (0) 
  24. Justin Santhanam

    Hello Glen and everyone,

    I’m using this method to get data from IH08. It’s working great, but I also need Classifications to be exported, since it’s not available in ALV ( I mean you have to manually choose Show/hide classifications), I  guess I don’t see it in the exported table from memory. Not sure how to achieve this so that I can get the classifications as well.

    (0) 
  25. Bartosz Ziólkowski

    Hi Glen Simpson

    Very interesting solution. I gave it a try with transaction FAGLL03H (report FAGL_LINE_ITEM_BROWSER) but unfortunately is seems the data retrieved using method GET_DATA_REF in case of that particular report is layout dependent which is a bit unwanted. That report allows user to specify layout on selection screen so mentioned solution could be stll used with own-defined layout but I expected it to be layout independent.

    Nevertheless very thank you for very useful and well written blog.

    Regards,

    Bartosz

     

    (0) 
  26. Mariusz Wielgus

    Hi Glen,

    this solution works for ‘old’ tcodes. What about tcodes with ‘N’? e.g. ME21n, CN43N? how to correctly export to memory list ?

     

    Regards,

    Mariusz

     

    (0) 

Leave a Reply