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

Do we create table fields with out data elements and domains?

1097


What is the meaning of table buffer? This buffer is used by which type oftable?

1229


What is occurs in internal table?

1088


Is logo in script 1st stored as tiff format before uploading or in jpeg format?and where is that stored after uploading?

2073


Write syntax for message error (report)?

1102


Filter badi and multiple used badi? Will the sequence matter of the badi implementation in case of multiple used badi?

1715


Explain buffering concept usage?

1020


What is a transaction variant and why are they used?

1083


Why do we need enhancements?

1172


What are pooled tables?

1055


what are the two methods of modifying sap standard tables ?

1069


What are screen painter and menu painter? : abap hr

1050


How do you find the information on the current screen?

1070


What is the difference between select statement and provide statement ? : abap hr

1075


Is the basic list deleted when the new list is created?

1110