cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding subroutine pool

Former Member
0 Kudos

Hi,

I have a requierement of cheque printing for which i have created a z-sapscript with std driver routine attached to it. Now the thing is that i have to assign value of structure field REGUD-SWENES to some variable . How can i do it as i can't write any code in SAPSCRIPT? Please provide me with syntax alongwith proper guidelines as i am new to this type of requirement.

Thanks

Parag

Accepted Solutions (1)

Accepted Solutions (1)

former_member585865
Contributor
0 Kudos

Hi Parag,

Could you please say in brief why do you want to pass it to variable what is your exact requirement?

Former Member
0 Kudos

Hi,

My requirement is like this . There are total 7 windows in script and in main window there are 4-5 elements. In one of element

i am geeting the correct value which is to be printed in variable REGUD-SWENES on cheque but in another element the same field is again getting modified as it is adding TDS to this value. for example

in main window

MAIN WINDOW

/E ELEMENT 1

value of REGUD-SWENES : 1200

/E ELEMENT 2

value of REGUD-SWENES : 1204 as it is adding TDS here

and because of this there is one window CHEQUE where i am getting wrong value

CHEQUE WINDOW

value of REGUD-SWENES : 1204

Please provide me some solution

Former Member
0 Kudos

Hi Parag Gavkar,

This could be easy way:

MAIN WINDOW

/E ELEMENT 1

value of REGUD-SWENES : 1200

After this ....in script do like this

/: PERFORM GET_SWENES IN PROGRAM Z_TEST

/: USING &REGUD-SWENES&

/: CHANGING &V_SWENES&

/: ENDPERFORM.

Use/Print the value like this in script

P1 &V_SWENES&

Then create a z_test program of type sub routine pool program.

FORM get_sbgrp TABLES input_tab STRUCTURE itcsy

output_tab STRUCTURE itcsy.

DATA: V_SWENES TYPE REGUD-SWENES.

READ TABLE input_tab WITH KEY name = 'REGUD-SWENES'.

IF sy-subrc = 0.

V_SWENES = input_tab-value.

ENDIF.

READ TABLE output_tab WITH KEY name = 'V_SWENES'.

IF SY-SUBRC = 0.

output_tab-value = V_SWENES.

MODIFY output_tab TRANSPORTING value

WHERE name = 'V_SWENES'.

ENDIF.

ENDFORM.

Regards,

Suneel G

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

U can do it in 2 ways, either by using 'DEFINE' in the Script form or Using 'PERFORM'..

1. 😕 DEFINE &gv_swenes& = &REGUD-SWENES&.

2. PERFORM get_var IN PROGRAM Z_TEST using &REGUD-SWENES&

changing &gv_swenes&.

call the PERFORM like above in the script, then define the same in Z_TEST.

FORM get_var int_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

READ TABLE int_tab index 1.

IF sy-subrc EQ 0.

READ TABLE out_tab index 1.

out_tab-value = int_tab-value.

MODIFY out_tab TRANSPORTING value index sy-index.

ENDIF.

ENDFORM.

Hope it helps!!

Rgds,

Pavan

venkat_o
Active Contributor
0 Kudos

Hi,

Just do it like

😕 DEFINE &var1& = &REGUD-SWENES&.

Thanks

Venkat.O