09-27-2010 1:58 PM
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..
09-27-2010 2:25 PM
there are losts of fm RS_VARIANT* you could use, e.g. RS_VARIANT_VALUES_TECH_DATA
09-27-2010 2:30 PM
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
09-28-2010 9:41 AM
How can i use IMPORT/EXPORT or GET/SET PARAMETERS in this scenario or let me know how to handle this
Regards,
Pavan.
09-28-2010 11:21 AM
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.
10-01-2010 8:22 AM
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