on 05-31-2011 1:51 PM
Hello experts,
1) How many changing parameters can we have while calling a perform <form name> in prg <prg name>.. in script?
/: PERFORM TOT_VAL IN PROGRAM Z_CHK
/: USING ®UP-VBLNR&
/: USING ®UP-GJAHR&
/: USING ®UP-ZBUKR&
/: CHANGING &W_DEBIT&
/: ENDPERFORM
SE38
form TOT_VAL TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
2) above is code similar to my code , in script after endform when i'm trying to print another field &xxx& along with the changing parameters in the perform its not displaying it
can u plz help
Hi,
Have a look on the below link,
[http://wiki.sdn.sap.com/wiki/display/Snippets/Callingasub-routineinSAP+scripts]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thread answered
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
There shouldnt be any problem is displaying The parameters from Subroutine.
Its better if you could debug and check following:
1)The parameter is populated in the subroutine pool.
2)The changed value is passed to the Script.
3)The script executes that particular statement.
It would be better if you paste the exact code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Keep a break point in the subroutinue and check that chnaging parameter is updating into the structure out_tab properly..
Regards,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
PERFORM TOT_VAL IN PROGRAM ZFI_CHK
USING ®UP-VBLNR&
USING ®UP-GJAHR&
USING ®UP-ZBUKR&
CHANGING &W_DEBIT&
CHANGING &W_CREDIT&
ENDPERFORM
&W_DEBIT& &W_CREDIT&,, ®UH_WRBTR&
form TOT_VAL TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
TABLES :BSEG.
TYPES : BEGIN OF t_bseg,
BUKRS TYPE BSEG-BUKRS,
BELNR TYPE BSEG-BELNR,
GJAHR TYPE BSEG-GJAHR,
BUZEI TYPE BSEG-BUZEI,
AUGBL TYPE BSEG-AUGBL,
SHKZG TYPE BSEG-SHKZG,
WRBTR TYPE BSEG-WRBTR,
END OF t_bseg.
DATA : IT_BSEG TYPE STANDARD TABLE OF BSEG,
WA_BSEG TYPE BSEG,
V_VBLNR TYPE BSEG-AUGBL,
V_BUKRS TYPE BSEG-BUKRS,
V_GJAHR TYPE BSEG-GJAHR,
V_credit TYPE STRING,
V_debit TYPE STRING.
READ TABLE IN_TAB WITH KEY 'REGUP-VBLNR'.
IF SY-SUBRC = 0.
V_VBLNR = IN_TAB-VALUE.
ENDIF.
READ TABLE IN_TAB WITH KEY 'REGUP-GJAHR'.
IF SY-SUBRC = 0.
V_GJAHR = IN_TAB-VALUE.
ENDIF.
READ TABLE IN_TAB WITH KEY 'REGUP-ZBUKR'.
IF SY-SUBRC = 0.
V_BUKRS = IN_TAB-VALUE.
ENDIF.
select BUKRS
GJAHR
AUGBL
SHKZG
WRBTR
FROM BSEG
INTO CORRESPONDING FIELDS OF TABLE IT_BSEG
WHERE AUGBL = V_VBLNR AND
GJAHR = V_GJAHR AND
BUKRS = V_BUKRS AND
BUZEI = '001'.
IF SY-SUBRC = 0.
LOOP AT IT_BSEG INTO WA_BSEG.
IF WA_BSEG-SHKZG = 'H'.
V_CREDIT = V_CREDIT + WA_BSEG-WRBTR.
ELSEIF WA_BSEG-SHKZG = 'S'.
V_DEBIT = V_DEBIT + WA_BSEG-WRBTR.
ENDIF.
ENDLOOP.
READ TABLE OUT_TAB INDEX 1.
OUT_TAB-VALUE = V_DEBIT .
MODIFY OUT_TAB INDEX 1.
READ TABLE OUT_TAB INDEX 2.
OUT_TAB-VALUE = V_CREDIT .
MODIFY OUT_TAB INDEX 2.
endform.
i have checked by debugging the code values are gettign populated ,as itcsy(out_tab) is a structure its over writing the values
and when i say &W_DEBIT& &E_CREDIT& ,,,,®UH_WRBTR&
it is dispalying only &W_DEBIT& value ,
Hi,
In that perform your giving W_CREDIT
PERFORM TOT_VAL IN PROGRAM ZFI_CHK
USING ®UP-VBLNR&
USING ®UP-GJAHR&
USING ®UP-ZBUKR&
CHANGING &W_DEBIT&
CHANGING &W_CREDIT& "passing w_credit
ENDPERFORM
while printing your giving &E_CREDIT&.
and when i say &W_DEBIT& &E_CREDIT& ,,,,®UH_WRBTR&" why use &E_CREDIT&
use &W_CREDIT& instead of &E_CREDIT&.
Regards,
Dhina..
Hi,
I think you are not populating the out_tab properly :
READ TABLE OUT_TAB INDEX 2.
OUT_TAB-VALUE = V_CREDIT .
MODIFY OUT_TAB INDEX 2.
endform.
You dont read outtab with index.
read it like:
READ TABLE OUT_PAR WITH KEY u2018W_CREDITu2019.
IF sy-subrc = 0.
OUT_TAB-VALUE = V_CREDIT .
MODIFY OUT_TAB sy-tabix.
Endif.
hi,
When you print : &W_DEBIT& &W_CREDIT& ,,,,®UH_WRBTR&
Hav eyou checke din debugging if these variables are populated?
I mean are they passed from subroutine to the script.
IF these are populated in the script, and not being displayed only, then it might just be teh problem in the way you are printing them.
Hi,
Instead of below code
READ TABLE OUT_TAB INDEX 1.
OUT_TAB-VALUE = V_DEBIT .
MODIFY OUT_TAB INDEX 1.
READ TABLE OUT_TAB INDEX 2.
OUT_TAB-VALUE = V_CREDIT .
MODIFY OUT_TAB INDEX 2.
Use
READ TABLE OUT_TAB WITH KEY 'W_DEBIT'.
OUT_TAB-VALUE = V_DEBIT .
MODIFY OUT_TAB INDEX SY-TABIX.
READ TABLE OUT_TAB WITH KEY 'W_DEBIT'.
OUT_TAB-VALUE = V_CREDIT .
MODIFY OUT_TAB INDEX SY-TABIX.
Regards,
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.