cancel
Showing results for 
Search instead for 
Did you mean: 

changing parameters in script

Former Member
0 Kudos

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 &REGUP-VBLNR&

/: USING &REGUP-GJAHR&

/: USING &REGUP-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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Have a look on the below link,

[http://wiki.sdn.sap.com/wiki/display/Snippets/Callingasub-routineinSAP+scripts]

Answers (3)

Answers (3)

Former Member
0 Kudos

thread answered

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi,

Keep a break point in the subroutinue and check that chnaging parameter is updating into the structure out_tab properly..

Regards,

Chandra

Former Member
0 Kudos

PERFORM TOT_VAL IN PROGRAM ZFI_CHK

USING &REGUP-VBLNR&

USING &REGUP-GJAHR&

USING &REGUP-ZBUKR&

CHANGING &W_DEBIT&

CHANGING &W_CREDIT&

ENDPERFORM

&W_DEBIT& &W_CREDIT&,, &REGUH_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& ,,,,&REGUH_WRBTR&

it is dispalying only &W_DEBIT& value ,

Former Member
0 Kudos

Hi ,

DId you define w_debit before calling the perform in script?

"/:DEFINE &NAME& "

Former Member
0 Kudos

yes i have defined w_debit and credit also befor ecallign the perform..

Former Member
0 Kudos

Hi,

In that perform your giving W_CREDIT



PERFORM TOT_VAL IN PROGRAM ZFI_CHK
USING &REGUP-VBLNR&
USING &REGUP-GJAHR&
USING &REGUP-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& ,,,,&REGUH_WRBTR&" why use &E_CREDIT&

use &W_CREDIT& instead of &E_CREDIT&.

Regards,

Dhina..

Former Member
0 Kudos

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.

Former Member
0 Kudos

sorry its typing mistake in the sentence but the in the code it is &W_CREDIT&

Former Member
0 Kudos

READ TABLE OUT_TAB WITH KEY 'W_CREDIT'.

IF SY-SUBRC = 0.

OUT_TAB-VALUE = V_CREDIT.

MODIFY OUT_TAB INDEX sy-tabix.

endif..

tried this way also but no use..

Former Member
0 Kudos

then do the change wht sap_wiz saying..

Former Member
0 Kudos

hi,

When you print : &W_DEBIT& &W_CREDIT& ,,,,&REGUH_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.

Former Member
0 Kudos

yes fields are gettign populated..

Former Member
0 Kudos

Then problem is in printing.Change there positons and try and print each one in a new line.

Former Member
0 Kudos

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,

Former Member
0 Kudos

Hi ,

use this


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_CREDIT'.
OUT_TAB-VALUE = V_CREDIT .
MODIFY OUT_TAB INDEX SY-TABIX.

Regards,

Dhina,,

Former Member
0 Kudos

Thank you all ......:)

Former Member
0 Kudos

Hi,

Could you tell what was the problem.