2007 Apr 03 12:49 PM
Hi,
Is it possible to call a report writer report in an ABAP program (with CALL TRANSACTION Start_report) and capture the data in an internal table.
I have already explored the following options:
- Exporting the data to a file but that requires additional work to get the data into a table like format
- Retrieving the data from stored data extract however I could not find a function or object method that returns the data in an internal table
Any tips are welcome.
Regards,
Dennis
2007 Apr 03 8:31 PM
Dennis,
If the report writer is a Z program, you can export data using the EXPORT command, and in the ABAP program you can get this data using the IMPORT program.
Here's a sample code to use this program.
I hope it works,
Marcelo
************************************************************************
REPORT ztest.
DATA: t_mara TYPE TABLE OF mara,
t_mara1 TYPE TABLE OF mara,
t_t000 TYPE TABLE OF t000,
t_t0001 TYPE TABLE OF t000,
e_mara LIKE LINE OF t_mara.
BREAK-POINT.
*Instead to call this form you can call the other program
PERFORM call_transaction.
*Here you import data selected to memory
IMPORT materials = t_mara1
mandants = t_t0001
FROM MEMORY ID 'ZTEST'.
BREAK-POINT.
&----
*& Form call_transaction
&----
FORM call_transaction.
DATA: lt_mara TYPE TABLE OF mara,
lt_t000 TYPE TABLE OF t000.
SELECT * INTO TABLE lt_mara FROM mara UP TO 10 ROWS.
SELECT * INTO TABLE lt_t000 FROM t000 UP TO 10 ROWS.
*-Here you export data selected to memory
EXPORT materials = lt_mara
mandants = lt_t000
TO MEMORY ID 'ZTEST'.
ENDFORM. " call_transaction
Hi,
Is it possible to call a report writer report in an ABAP program (with CALL TRANSACTION Start_report) and capture the data in an internal table.
I have already explored the following options:
- Exporting the data to a file but that requires additional work to get the data into a table like format
- Retrieving the data from stored data extract however I could not find a function or object method that returns the data in an internal table
Any tips are welcome.
Regards,
Dennis
2007 Apr 03 8:31 PM
Dennis,
If the report writer is a Z program, you can export data using the EXPORT command, and in the ABAP program you can get this data using the IMPORT program.
Here's a sample code to use this program.
I hope it works,
Marcelo
************************************************************************
REPORT ztest.
DATA: t_mara TYPE TABLE OF mara,
t_mara1 TYPE TABLE OF mara,
t_t000 TYPE TABLE OF t000,
t_t0001 TYPE TABLE OF t000,
e_mara LIKE LINE OF t_mara.
BREAK-POINT.
*Instead to call this form you can call the other program
PERFORM call_transaction.
*Here you import data selected to memory
IMPORT materials = t_mara1
mandants = t_t0001
FROM MEMORY ID 'ZTEST'.
BREAK-POINT.
&----
*& Form call_transaction
&----
FORM call_transaction.
DATA: lt_mara TYPE TABLE OF mara,
lt_t000 TYPE TABLE OF t000.
SELECT * INTO TABLE lt_mara FROM mara UP TO 10 ROWS.
SELECT * INTO TABLE lt_t000 FROM t000 UP TO 10 ROWS.
*-Here you export data selected to memory
EXPORT materials = lt_mara
mandants = lt_t000
TO MEMORY ID 'ZTEST'.
ENDFORM. " call_transaction
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |