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 |
Why do we use dynamic where conditions?
How will u handle the situation – In a report using function module to generate a IDOC, How will u handle the error IDOC in the same report ?
Hi all, For the past 1 year, I have been trying for job in SAP as a fresher, but no calls,no interviews.I know showing fake experience is unethical, but i dont have any alternative.After showing fake experience now iam getting calls,but still i feel guilty.Friends i have some questions. 1. If suppose i tell the truth in interview that i have shown fake experience,what would be the interviewer's reaction? Will accepting the fake go negative against me? 2.Whether i should accept the fake in technical round itself? (or) Maintain the fake,prove myself strong in technical round &then accept the fake in HR round? 3.Some of my friends(who have shown fake and well settled in MNC's ) are telling that during interview u should never accept as fake i.e., u should act confidently as a real experienced guy.Even if the interviewer come to know that u r a fake guy, but seeing ur confidence level ,he/she will select u ? Is it true? Friends, particularly interviewer's , HR's please give me ur valuabe solutions.Other's suggestions are also welcome.
What is the difference between Selection Screen on Request and Selection screen on input?
What is the difference between occurs 1 and occurs 2
Can you give the Example for the structure of an ABAP program? REPORT... NODES: SPFLI, SFLIGHT. DATA:... INITIALIZATION. AT SELECTION-SCREEN. START-OF-SELECTION. GET SPFLI... GET SFLIGHT... GET SPFLI LATE. END-OF-SELECTION. FORM... ENDFORM.
How to Raise a Particular Ticket in Realtime ?
How to Reprocess an Idoc ?
what is difference between break and watch point
What is repetitive structure and for which Infotype do we have
what does it mean occurs 0 while creating an internal table?
How do you create secondary index. Do you have access to create secondary index?