You can use the PERFORM command to call an ABAP subroutine
any program, subject to the normal ABAP runtime
checking. You can use such calls to subroutines for
calculations, for obtaining data from the database that is
display or print time, for formatting data, and so on.
PERFORM commands, like all control commands, are executed
document is formatted for display or printing.
Communication between a
subroutine that you call and the document is by way of
values are set in the subroutine.
The system does not execute the PERFORM command within
replace modules, such as TEXT_SYMBOL_REPLACE or
The replace modules can only replace symbol values or
texts, but not interpret SAPscript control commands.
Syntax in a form window:
/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: USING &INVAR2&
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
INVAR1 and INVAR2 are variable symbols and may be of any of
SAPscript symbol types.
OUTVAR1 and OUTVAR2 are local text symbols and must
The ABAP subroutine called via the command line stated
above must be
defined in the ABAP report prog as follows:
The values of the SAPscript symbols passed with /: USING...
stored in the internal table IN_TAB . Note that the system
values as character string to the subroutine, since the
VALUE in structure ITCSY has the domain TDSYMVALUE (CHAR
80). See the
example below on how to access the variables.
The internal table OUT_TAB contains names and values of the
parameters in the PERFORM statement. These parameters are
symbols, that is, character fields. See the example below
on how to
return the variables within the subroutine.
From within a SAPscript form, a subroutine GET_BARCODE in
program QCJPERFO is called. Then the simple barcode
('First page', 'Next page', 'Last page') is printed as
Definition in the SAPscript form:
/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
/: USING &PAGE&
/: USING &NEXTPAGE&
/: CHANGING &BARCODE&
Coding of the calling ABAP program:
FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
READ TABLE OUT_PAR WITH KEY 'BARCODE'.
CHECK SY-SUBRC = 0.
IF PAGNUM = 1.
OUT_PAR-VALUE = '|'. "First page
OUT_PAR-VALUE = '||'. "Next page
IF NEXTPAGE = 0.
OUT_PAR-VALUE+2 = 'L'. "Flag: last page
MODIFY OUT_PAR INDEX SY-TABIX.
What are Subroutines and Types of Subroutines?
Subroutines are program modules which can be called from other ABAP/4 programs or within the same program.Are introduced with form statement & ended with endform statement. you call subroutines...
How can we call a Report in SAP Script
We cannot directly call Report from script. We can call form not report. But we can pass values using perform statement from sap script to driver Program and do the manipulations. We need to...
ABAP Scripts Interview Questions
SAP ABAP Scripts FAQWhat is sap script and layout set?Ans - SAPscript is the integrated text management system of the SAP R/3 System. SAPscript is tightly integrated into the SAP System. It is used...
SAP ABAP Scripts Question and Answers
1. What is SAPscript and explain its purpose? Ans:- SAP Script is the SAP system’s own text-proessing system. You’ll find that it looks and feels a lot like other leading...