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
What is the difference between a structure and an append structure?
Can you delete data element, which is being used by table fields?
What is difference between check table and value table ?
Explain the call transaction method? : abap bdc
What is the use of info groups? : sap abap hr
what precautions or prerequisites do you follow to update a record into database table and how
hi my name is amit i have passed BE(CSE) with honours(72%) in 2006 yr. i have completed SAP/ABAP training with good exposer. i need a staffing company which can provide me real time exposer in SAP R/3. so plz help me out and send any information regarding on my mail id or tele. no. 9999784331 thanks
did u done enhancement framework?how u implemented?
I have 3 transactions,where the output of one transaction is input of another and output of 2nd transaction is input of 3rd transaction.i have one flat file with all data for the 3 transaction.if the 3rd transaction failed can we rollback the remaining 2 transactions or not.Is this possible in BDC,How/
How would you set the formatting options statically and dynamically within a report?
What is the syntax for ‘call transaction’?
Difference between function group and function module?
What is the difference between tables and structures?
Are you familiar with all steps for setting up a workflow?
What is the difference between semi-monthly and Bi-weekly payroll area