Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAPSCRIPT: PLZ CHECK THE CODES

Former Member
0 Likes
564

HEY HI ALL,

I HAVE A TRIAL CODE BUT I AM NOT ABLE TO PASS THE VALUE OF MY VARIABLE PLZ CHK:

CODES:

/: pERFORM GET_DATA IN PROGRAM ZF_D_INT_SCALE_1

/: USING &ZIS_FORM-HKONT&

/: CHANGING &VARIABLE&

/: ENDPERFORM

/P &VARIABLE&

***************************************

REPORT ZF_D_INT_SCALE_1 .

FORM GET_DATA TABLES in_par STRUCTURE ITCSY

out_par STRUCTURE ITCSY.

out_par-value = 333333.

MODIFY out_par TRANSPORTING VALUE .

endform.

******************************************

THANKS TO ALL IN ADVANCE !!!

5 REPLIES 5
Read only

Former Member
0 Likes
527

Hi,

In the code you have used this statement.

MODIFY out_par TRANSPORTING VALUE .

Use the INDEX addtion instead of TRANSPORTING.

change the above statement like

MODIFY out_par index sy-tabix.

Read only

Former Member
0 Likes
527

hi,

give like this..

data: var1 like...

read table in_tab with key name = 'VAR1'.

if sy-subrc = 0.

move in_tab-value to var1.

endif.

read table out_tab with key name = 'VAR_OUT'.

if sy-subrc = 0.

move 333333 to out_tab-value.

modify out_tab index sy-tabix.

endif.

hope this helps,

do reward if it helps,

priya.

Read only

Former Member
0 Likes
527

Hi Anupama,

I think all of your code is ok , you need to only add the index sy-tabix to your modify statement while passing the value to the output table.

Regards.

Sunmit.

Please reward points if helpful.

Read only

Former Member
0 Likes
527

Hi Anupma,

Please change ur code as per below:

CODES:

/: pERFORM GET_DATA IN PROGRAM ZF_D_INT_SCALE_1

/: USING &ZIS_FORM-HKONT&

/: CHANGING &VARIABLE&

/: ENDPERFORM

/P &VARIABLE&

***************************************

REPORT ZF_D_INT_SCALE_1.

FORM GET_DATA TABLES in_par STRUCTURE ITCSY

out_par STRUCTURE ITCSY.

READ TABLE in_par WITH KEY 'ZIS_FORM-HKONT'.

IF SY-SUBRC = 0.

  • Do your further coding here.

READ TABLE out_par WITH KEY 'VARIABLE'.

IF SY-SUBRC = 0.

out_par-value = 333333.

MODIFY out_par INDEX sy-tabix.

ENDIF.

ENDIF.

endform.

******************************************

Hope it helps.

Cheers,

Patrick

Read only

Former Member
0 Likes
527

MODIFY out_par TRANSPORTING VALUE <b>where name = 'VARIABLE'</b>. "This the name of the variable you want to modify its value.

name should be in where condition is required.

else use SY-tabix = 1.

MODIFY out_par TRANSPORTING VALUE <b>INDEX 1</b>.

and one more suggestion,

as the VALUES are treated as character , you use

OTAB-VALUE = '333333'.

Regards

srikanth

Message was edited by: Srikanth Kidambi