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


Please Help Members By Posting Answers For Below Questions

Explain the advantages of different types of bdc's?

530


What is singleton pattern in OOPS?

964


What are the different types of work process?

586


What should be declared explicitly in the corresponding abap/4 statements to access internal tables without header lines & why?

590


What is macro? : abap hr

633






What are Table control and tab strip control in dialog programming ?

5236


What is the difference between collect and append statements?

556


How to write a bdc – how do you go about it?

655


1.why dont use top of page. wat is the use? 2. wat is sub screen? 3. why u select the session method in bdc ? how many records wil be updated on that time? 4.why dont use start form in script? 5.wat is difference b/w dilldown and interactive report? 6. wat is pf status interactine report?

2350


What is the structure of the bdc table? : abap bdc

721


SAP Script for Billing in which Billing document number was displayed as header, Bill Type, Bill Category, Bill Item, Cost, Base Unit of Measurement and Material number were categorically displayed for each billing document number. plz mention the detail coding Tahnks, Rahul

2085


What are the merits of its?-

626


What is generic area buffering in abap?

565


What are the check tables?

554


What is the function of the correction system?

568