Can we call a subroutine in a script? If so, how?
Answer Posted / kiran kumar v
Yes. Subroutine can be called using ITCSY structure.
Sample Code:
/: PERFORM SUM IN PROGRAM ZPROGRAM
/: USING &VAR1&
/: USING &VAR2&
/: CHANGING &RESULT&
/: ENDPERFORM
In the program(ZPROGRAM), we need to write the form ....
FORM SUM TABLES INTAB STRUCTURE ITCSY
OUTTAB STRUCTURE ITCSY.
data: field1 type i,
field2 type i,
result type i.
TO read the values from the ITAB you have to use this logic.
READ TABLE INTAB WITH KEY NAME = 'VAR1'.
IF SY-SUBRC = 0.
FIELD1 = INTAB-VALUE.
ENDIF.
READ TABLE INTAB WITH KEY NAME = 'VAR2'.
IF SY-SUBRC = 0.
FIELD2 = ITAB-VALUE.
ENDIF.
RESULT = V_FIELD1 + V_FIELD2.
READ TABLE OUTTAB INDEX 1.
IF SY-SUBRC = 0.
OTAB-VALUE = RESULT.
MODIFY OUTTAB INDEX 1 .
ENDIF.
ENDFORM.
| Is This Answer Correct ? | 6 Yes | 2 No |
Post New Answer View All Answers
Do we create table fields with out data elements and domains?
What is the meaning of table buffer? This buffer is used by which type oftable?
What is occurs in internal table?
Is logo in script 1st stored as tiff format before uploading or in jpeg format?and where is that stored after uploading?
Write syntax for message error (report)?
Filter badi and multiple used badi? Will the sequence matter of the badi implementation in case of multiple used badi?
Explain buffering concept usage?
What is a transaction variant and why are they used?
Why do we need enhancements?
What are pooled tables?
what are the two methods of modifying sap standard tables ?
What are screen painter and menu painter? : abap hr
How do you find the information on the current screen?
What is the difference between select statement and provide statement ? : abap hr
Is the basic list deleted when the new list is created?