Problem solve Get help with specific problems with your technologies, process and projects.

Get variables/internal tables from a report while in a function

You can get variables or internal tables of a report when you are in a function. This can be very useful for user exits.

You can get variables or internal tables of a report when you are in a function. This can be very useful for user...

exits. For the example below you need to create report ZREPORT and function ZFUNCTION. The code was written in R/3 4.6B.

* Report ZREPORT * REPORT zreport NO STANDARD PAGE HEADING. TABLES: spfli. DATA dbcnt LIKE sy-dbcnt. DATA: itab LIKE spfli OCCURS 0 WITH HEADER LINE. SELECT * FROM spfli INTO TABLE itab UP TO 2 ROWS. dbcnt = sy-dbcnt. CALL FUNCTION 'ZFUNCTION'. * Report ZREPORT * * function ZFUNCTION * FUNCTION zfunction. DATA: field(50). * For the variable FIELD-SYMBOLS: <dbcnt>. field = '(ZREPORT)dbcnt'. ASSIGN (field) TO <dbcnt>. WRITE <dbcnt>. * For the itab DATA: itab LIKE spfli OCCURS 0 WITH HEADER LINE. TYPES: aux LIKE itab OCCURS 0. FIELD-SYMBOLS: <itab> TYPE aux. field = '(ZREPORT)ITAB[]'. ASSIGN (field) TO <itab>. LOOP AT <itab> INTO itab. WRITE: / itab-carrid, itab-connid. ENDLOOP. ENDFUNCTION. * function ZFUNCTION *

This was last published in September 2003

Dig Deeper on SAP ABAP

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close