Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 difference between free and refresh?

1171


there are 2 selection screens. material num in screen 200 and plant in screen 300. so how can you write in INITIALISATION event?

2205


What is the difference between dialog program and a report?

1066


Differentiate between static and dynamic step loops?

1056


Can any tell me ECC 5.0, ECC 6.0 Released year? and difference between them?

2480


What is a logical database?

1199


what is friend class

1375


What is the definition of modification in an sap system and how do they impact an upgrade?

1101


What are the basic functions of database utility? : abap data dictionary

1075


What are the different types of parameters? How can you distinguish between different kinds of parameters?

975


What are the merits of its?-

1064


Rp_provide_from_last contains how many parameters ? : abap hr

1503


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.

2068


Name some system global variables you can use in abap programs?

1010


What are the 3 types of tables in sap? : abap data dictionary

1095