Application Development and Automation 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: 
Read only

Report Writer

Former Member
0 Likes
821

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

1 ACCEPTED SOLUTION
Read only

0 Likes
727

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

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

1 REPLY 1
Read only

0 Likes
728

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