Search code examples
abapsap-erp

How to extract the output of called program RAZUGA01


My custom report has to call the standard report RAZUGA01 and extract its output (to get the amounts).

The following instruction does not extract the output:

  SUBMIT razuga01
    WITH SELECTION-TABLE it_selection
    EXPORTING LIST TO MEMORY
    AND RETURN.

Solution

  • For me this code works:

    DATA: lt_seltab  TYPE TABLE OF rsparams,
          ls_seltab  LIKE LINE OF lt_seltab,
          t_list     TYPE TABLE OF abaplist.
    
    DATA: xlist TYPE TABLE OF abaplist.
    DATA: xtext TYPE TABLE OF char200.
    
    ls_seltab-kind    = 'S'.
    ls_seltab-sign    = 'I'.
    ls_seltab-option  = 'EQ'.
    
    ls_seltab-selname = 'BERDATUM'.          " Name of parameter on submitted program
    ls_seltab-low     = '20061231'.
    APPEND ls_seltab TO lt_seltab.
    
    ls_seltab-selname = 'BUKRS'.
    ls_seltab-low     = '0005'.
    APPEND ls_seltab TO lt_seltab.
    
    SUBMIT razuga01 WITH SELECTION-TABLE lt_seltab EXPORTING LIST TO MEMORY AND RETURN.
    
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = xlist.
    
    CALL FUNCTION 'LIST_TO_TXT'
      EXPORTING
        list_index         = -1
      TABLES
        listtxt            = xtext
        listobject         = xlist.
    

    enter image description here

    If it doesn't work for you, probably you have some erroneous parameters in seltab.

    Of course you will have to do some additional parsing to transform these result into human-readable form.