Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to call a transaction to fetch the values into internal tabe in report

Former Member
0 Kudos

Hi all,

In a report program , i need to call a transaction and based on some selection criteria i need to fetch the values into an Internal table and use the data in later part of report.

can someone explain me how to handle this

Thanks,

Pavan..

5 REPLIES 5

former_member226519
Active Contributor
0 Kudos

there are losts of fm RS_VARIANT* you could use, e.g. RS_VARIANT_VALUES_TECH_DATA

Former Member
0 Kudos

Hi ,

try thias way...



**** Subroutine to get the print parameters
* Function Module to get the print parameters
  CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
      destination            = 'LP01'
      list_name              = 'TEST'
      list_text              = 'SUBMIT ... TO SAP-SPOOL'
      immediately            = ' '
      line_size              = '2000'
      no_dialog              = 'X'
    IMPORTING
      out_parameters         = wa_pri_params
      valid                  = w_valid
  CONCATENATE 'QU'
               sy-datum+4(4)
               sy-uzeit INTO
               wa_pri_params-plist.
*   Submit report in background and creating spool
  SUBMIT (w_rname) USING SELECTION-SET p_var        "go to TSTC table and get the report name for the transaction do the following
      TO SAP-SPOOL WITHOUT SPOOL DYNPRO
      SPOOL PARAMETERS wa_pri_params AND RETURN.
  COMMIT WORK AND WAIT.
*   To fetch the spool number from TSP01 table
  IF sy-subrc EQ 0.
    SELECT rqident
           FROM tsp01
           INTO p_spool
*             UP TO 1 ROWS
           WHERE rq2name = wa_pri_params-plist.
    ENDSELECT.
  ENDIF.
* Fetching Spool data into internal table
  CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
    EXPORTING
      rqident              = p_spool
    TABLES
      buffer               = t_Internaltable

Prabhudas

Former Member
0 Kudos

How can i use IMPORT/EXPORT or GET/SET PARAMETERS in this scenario or let me know how to handle this

Regards,

Pavan.

former_member378318
Contributor
0 Kudos

All you need is available if you search the forums.

Do a help on CALL TRANSACTION and SUBMIT PROGRAM it will show you how to branch to the transaction.

When returning from the called transaction use EXPORT TO MEMORY to pass data (including tables) back to the calling report.

Use IMPORT FROM MEMORY to import the data exported earlier.

Former Member
0 Kudos

Example:- 1


REPORT  ztest01.
DATA: v_name TYPE char20 VALUE 'hello''.
 
EXPORT v_name TO MEMORY ID 'TEST'.
 
SUBMIT ztest02 AND RETURN.



REPORT  ztest02.
DATA: v_name TYPE char20.
 
IMPORT v_name FROM MEMORY ID 'TEST'.
IF sy-subrc = 0.
  WRITE: / v_name.
ENDIF.

Example :- 2



REPORT  ztest01.
*pass customer code , compy code and date and the using this data run  zreport2 and get data into internal table
 EXPORT dd_bukrs TO MEMORY ID 'BUK'.
  EXPORT dd_kunnr TO MEMORY ID 'AKO'.
  EXPORT dd_stida TO MEMORY ID'IDT'.

  SUBMIT ztest2 USING SELECTION-SCREEN '1000'  AND RETURN.
  IMPORT rtab1 FROM MEMORY ID 'table'.
  break developer.
  LOOP AT itab.
endloop

----------------------------------------------------------------------
REPORT  ztest02.

IMPORT dd_bukrs FROM MEMORY ID 'BUK'.
    IMPORT dd_kunnr FROM MEMORY ID 'AKO'.
    IMPORT dd_stida FROM MEMORY ID 'IDT'.


 EXPORT rtab1 TO MEMORY ID 'table'.


Edited by: kk.adhvaryu on Oct 1, 2010 9:22 AM