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

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchHRSoftware

Close