Can we call a subroutine in a script? If so, how?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / chittidi
YES , WE CAN CALL SUBROUTINES IN SCRIPTS WITH OUT
CHANGING THE STANDARD DRIVER PROGRAM TO FETCH ADDITONAL
DATA TO PRINT IT ON LAYOUT.
WRITE SUBROUTINES IN MAIN PROGRAM AND CALL THE SUBROUTINE
ie PERFORM in page WINDOW OF THE LAYOT.
SYNTAX :
/: PERFORM <FORM>IN PROGRAM <PROG> USING &INVAR1& &INVAR2&
........
........
/: CHANGING &OUTPUT1& &OUTPUT2&.
........
ENDFORM.
FORM <FORM> TABLES IN_TAB STRUCTURE ITCSY OUT_TAB STRUCTURE
ITCSY.
........
ENDFORM.
HERE INVAR1 , INVAR2 ARE VARIABLE SYMBOLS WHICH MAY BE ONE
OF THE FOUR SCRIPT SYMBOL TYPES.
OUTPUT1 , 2 ARE LOCAL TEXT SYMBOLS AND MUST BE CHAR STRINGS.
THE INTERNAL TABLE OUT_TAB CONTAINS 2 FIELDS THAT IS
NAMES AND VALUES OF THE CHANGING PARAMETERS IN THE PERFORM
STATEMENT.
Is This Answer Correct ? | 1 Yes | 1 No |
How to Business addin function in Standars transactiion code. how it is steps
What is the difference of update types in call transaction method ? : abap bdc
Explain what are the events in screen programming?
what is the AT-SELECTION EVENT?
What is the Procedure for BDC?
2 Answers Accenture, SAP Labs,
stock transfer from one plant to another plant ? i want the total description.
What is the function of a domain?
Can a domain, assigned to a data element be changed?
Type casting and error handling
what is actaul procedure of session method of bdc. pls me complete steps.
what is EDI ,ALE , Debugging, Smart Forms ,IDOC'S & BDOC'S
2 Answers IBM, Yash Technologies,
what is meant by serialization ?