SAP Script call subroutine - shawnhuang1970/SAP-Development GitHub Wiki
You can use the PERFORM command to call an ABAP subroutine (form) from any program, subject to the normal ABAP runtime authorization checking. You can use such calls to subroutines for carrying out calculations, for obtaining data from the database that is needed at display or print time, for formatting data, and so on. PERFORM commands, like all control commands, are executed when a document is formatted for display or printing. Communication between a subroutine that you call and the document is by way of symbols whose values are set in the subroutine. NoteThe system does not execute the PERFORM command within SAPscript replace modules, such as TEXT_SYMBOL_REPLACE or TEXT_INCLUDE_REPLACE. The replace modules can only replace symbol values or resolve include texts, but not interpret SAPscript control commands. Syntax in a form window: /: PERFORM
IN PROGRAM /: USING &INVAR1& /: USING &INVAR2& ...... /: CHANGING &OUTVAR1& /: CHANGING &OUTVAR2& ...... /: ENDPERFORM INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types. OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings. The ABAP subroutine called via the command line stated above must be defined in the ABAP report prog as follows: FORM TABLES IN_TAB STRUCTURE ITCSY OUT_TAB STRUCTURE ITCSY. ... ENDFORM.