Entering content frameProgram Statements to Leave a Called Program Locate the document in its SAP Library structure

Usually, the user exits a program you called using SUBMIT ... AND RETURN by choosing F3 or F15 from list level 0 of the called report.

However, if you need to execute further statements before returning to the called program (for example, to place data in ABAP memory using the EXPORT statement), you need to modify the user interface of the called program. For example, you can define your own function code for the Back function and process it in the AT USER-COMMAND event. After you have written your additional statements, you can leave the called program using the LEAVE statement.

Control then returns to the point from which the program was called.

Example

REPORT REP1 NO STANDARD PAGE HEADING.

DATA: ITAB TYPE I OCCURS 10,
      NUM TYPE I.

SUBMIT REP2 AND RETURN.

IMPORT ITAB FROM MEMORY ID 'HK'.

LOOP AT ITAB INTO NUM.
  WRITE / NUM.
ENDLOOP.

TOP-OF-PAGE.
WRITE 'Report 1'.
ULINE.

This program calls the following executable program (report):

REPORT REP2 NO STANDARD PAGE HEADING.

DATA: NUMBER TYPE I,
      ITAB TYPE I OCCURS 10.

SET PF-STATUS 'MYBACK'.

DO 5 TIMES.
  NUMBER = SY-INDEX.
  APPEND NUMBER TO ITAB.
  WRITE / NUMBER.
ENDDO.

TOP-OF-PAGE.
WRITE 'Report 2'.
ULINE.

AT USER-COMMAND.
  CASE SY-UCOMM.
    WHEN 'MBCK'.
      EXPORT ITAB TO MEMORY ID 'HK'.
      LEAVE.
  ENDCASE.

In the status MYBACK, the function code MBCK is assigned to the function keys F3 and F15 :

This graphic is explained in the accompanying text

If the user chooses Back from the interface MYBACK, the system transfers table ITAB into ABAP memory and then leaves SAPMZTS1. In SAPMZTST, it reads table ITAB again.

 

 

 

 

 

Leaving content frame