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

hi to all abap interview guys please notify this .. first if u have any doubts please go through google search or else please do debugging with some sample programs . but don't post even silly questions too. thanking you.

2014


What are the different window types in sapscript?

1061


How move-corresponding works

1446


What abap statement will trigger list generation?

1115


Explain what is the significance of hide?

1168


What is evaluation path, where do we do it and why? : sap abap hr

1243


What are the advantages/ dis-advantages of logical databases?

1020


What is buffering in abap?

1275


What does the extract statement do in extract datasets?

1146


Can you assign a matchcode object to a parameter? If so how?

1092


Write the bdc table structure? : abap bdc

1090


What is the logo in sap script?

1099


what next in SAP-ABAP/4 is it going to be change?

2184


What is the difference between field-group header and other field groups? : abap modularization

1041


What is the use of enqueue function module? : sap abap data dictionary

1163