The sap abap syntax for perform has different variants an shown below.
Variant 1
PERFORM form.
Additions
1. ... USING p1 p2 p3 ...
2. ... CHANGING p1 p2 p3 ...
3. ... TABLES itab1 itab2 ...
Effect
Calls the subroutine form specified in the FORM statement. On completion, processing in the main program resumes.
Example
PERFORM HELP_ME.
...
FORM HELP_ME.
...
ENDFORM.
The PERFORM statement calls the subroutine HELP_ME .
Nested calls are allowed (i.e. PERFORM within a FORM ... ENDFORM ).Recursive calls are also possible.
To define local data, use the DATA statement after FORM . Each time you enter the subroutine, the data is recreated (with an initial value) and released at the end (from the stack).
To define global data used within a subroutine, use the LOCAL statement after FORM . The values are saved when you enter the subroutine and then released at the end (from the stack).
Runtime errors
· PERFORMANCE_PARAMETER_MISSING : The called form expects more parameters than were specified.
· PERFORM_PARAMETER_COUNT ,
· PERFORM_TOO_MANY_PARAMETERS : More parameters were given than the FORM expected.
· PERFORM_CONFLICT_TYPE ,
· PERFORM_CONFLICT_GENERIC_TYPE ,
· PERFORM_BASE_WRONG_ALIGNMENT ,
· PERFORM_PARAMETER_TOO_SHORT ,
· PERFORM_TABLE_REQUIRED : The parameter type does not match the type specified in the FORM definition.
· PERFORM_BASE_LITL : A literal was passed to a structured parameter.
Addition 1
... USING p1 p2 p3 ...
Addition 2
... CHANGING p1 p2 p3 ...
Effect
These additions are equivalent to each other.
Parameter offset and length can be passed as variables. The addition ' ...USING p1+off(*) ' causes parameter p1 to be passed with offset off so that the field limits of p1 are not exceeded.
Example
DATA: NUMBER_I TYPE I VALUE 5,
NUMBER_P TYPE P VALUE 4,
BEGIN OF PERSON,
NAME(10) VALUE 'Paul',
AGE TYPE I VALUE 28,
END OF PERSON,
ALPHA(10) VALUE 'abcdefghij'.
FIELD-SYMBOLS .
ASSIGN NUMBER_P TO .
PERFORM CHANGE USING 1
NUMBER_I
NUMBER_P
PERSON
ALPHA+NUMBER_I().
FORM CHANGE USING VALUE(PAR_1)
PAR_NUMBER_I
PAR_NUMBER_P
PAR_POINTER
PAR_PERSON STRUCTURE PERSON
PAR_PART_OF_ALPHA.
ADD PAR_1 TO PAR_NUMBER_I.
PAR_NUMBER_P = 0.
PAR_PERSON-NAME+4(1) = ALPHA.
PAR_PERSON-AGE = NUMBER_P + 25.
ADD NUMBER_I TO PAR_POINTER.
PAR_PART_OF_ALPHA = SPACE.
ENDFORM.
Field contents after the PERFORM call are as follows:
NUMBER_I = 6
NUMBER_P = 6
= 6
PERSON-NAME = 'Paula'
PERSON-AGE = 25
ALPHA = 'abcde j'
The field type and length of the parameters remain. If parameter values change within the subroutine, these new values remain after you leave the subroutine. However, this does not apply to parameters passed with VALUE (see FORM )
If you pass literals, you must either leave them unchanged or pass them in the FORM definition with the USING VALUE statement.
OOPS ABAP
ALE
IDOC'S
BADI
BAPI
Syntax Check
Interview Questions
ALV Reports with sample code
ABAP complete course
ABAP Dictionary
SAP Scripts
Script Controls
Smart Forms
Work Flow
Work Flow MM
Work Flow SD
Communication Interface
Variant 1
PERFORM form.
Additions
1. ... USING p1 p2 p3 ...
2. ... CHANGING p1 p2 p3 ...
3. ... TABLES itab1 itab2 ...
Effect
Calls the subroutine form specified in the FORM statement. On completion, processing in the main program resumes.
Example
PERFORM HELP_ME.
...
FORM HELP_ME.
...
ENDFORM.
The PERFORM statement calls the subroutine HELP_ME .
Nested calls are allowed (i.e. PERFORM within a FORM ... ENDFORM ).Recursive calls are also possible.
To define local data, use the DATA statement after FORM . Each time you enter the subroutine, the data is recreated (with an initial value) and released at the end (from the stack).
To define global data used within a subroutine, use the LOCAL statement after FORM . The values are saved when you enter the subroutine and then released at the end (from the stack).
Runtime errors
· PERFORMANCE_PARAMETER_MISSING : The called form expects more parameters than were specified.
· PERFORM_PARAMETER_COUNT ,
· PERFORM_TOO_MANY_PARAMETERS : More parameters were given than the FORM expected.
· PERFORM_CONFLICT_TYPE ,
· PERFORM_CONFLICT_GENERIC_TYPE ,
· PERFORM_BASE_WRONG_ALIGNMENT ,
· PERFORM_PARAMETER_TOO_SHORT ,
· PERFORM_TABLE_REQUIRED : The parameter type does not match the type specified in the FORM definition.
· PERFORM_BASE_LITL : A literal was passed to a structured parameter.
Addition 1
... USING p1 p2 p3 ...
Addition 2
... CHANGING p1 p2 p3 ...
Effect
These additions are equivalent to each other.
Parameter offset and length can be passed as variables. The addition ' ...USING p1+off(*) ' causes parameter p1 to be passed with offset off so that the field limits of p1 are not exceeded.
Example
DATA: NUMBER_I TYPE I VALUE 5,
NUMBER_P TYPE P VALUE 4,
BEGIN OF PERSON,
NAME(10) VALUE 'Paul',
AGE TYPE I VALUE 28,
END OF PERSON,
ALPHA(10) VALUE 'abcdefghij'.
FIELD-SYMBOLS .
ASSIGN NUMBER_P TO .
PERFORM CHANGE USING 1
NUMBER_I
NUMBER_P
PERSON
ALPHA+NUMBER_I().
FORM CHANGE USING VALUE(PAR_1)
PAR_NUMBER_I
PAR_NUMBER_P
PAR_POINTER
PAR_PERSON STRUCTURE PERSON
PAR_PART_OF_ALPHA.
ADD PAR_1 TO PAR_NUMBER_I.
PAR_NUMBER_P = 0.
PAR_PERSON-NAME+4(1) = ALPHA.
PAR_PERSON-AGE = NUMBER_P + 25.
ADD NUMBER_I TO PAR_POINTER.
PAR_PART_OF_ALPHA = SPACE.
ENDFORM.
Field contents after the PERFORM call are as follows:
NUMBER_I = 6
NUMBER_P = 6
= 6
PERSON-NAME = 'Paula'
PERSON-AGE = 25
ALPHA = 'abcde j'
The field type and length of the parameters remain. If parameter values change within the subroutine, these new values remain after you leave the subroutine. However, this does not apply to parameters passed with VALUE (see FORM )
If you pass literals, you must either leave them unchanged or pass them in the FORM definition with the USING VALUE statement.
ABAP TOPIC WISE COMPLETE COURSE
BDCOOPS ABAP
ALE
IDOC'S
BADI
BAPI
Syntax Check
Interview Questions
ALV Reports with sample code
ABAP complete course
ABAP Dictionary
SAP Scripts
Script Controls
Smart Forms
Work Flow
Work Flow MM
Work Flow SD
Communication Interface
No comments:
Post a Comment