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
Explain the difference between free and refresh?
there are 2 selection screens. material num in screen 200 and plant in screen 300. so how can you write in INITIALISATION event?
What is the difference between dialog program and a report?
Differentiate between static and dynamic step loops?
Can any tell me ECC 5.0, ECC 6.0 Released year? and difference between them?
What is a logical database?
what is friend class
What is the definition of modification in an sap system and how do they impact an upgrade?
What are the basic functions of database utility? : abap data dictionary
What are the different types of parameters? How can you distinguish between different kinds of parameters?
What are the merits of its?-
Rp_provide_from_last contains how many parameters ? : abap hr
Is there any BAPI to retrieve list of customers and their sales areas i.e., Cust No, Distr Channel and Division for all the customers.
Name some system global variables you can use in abap programs?
What are the 3 types of tables in sap? : abap data dictionary