cancel
Showing results for 
Search instead for 
Did you mean: 

pass a structure from script to the program

Former Member
0 Kudos

Hi experts,

I have a structure LFA1, in the script, I need to use this in the subroutine pool and do some calicultaion.

How can i pass the this structure form script to my program

Iam trying to use the syntax in the script

perform f_getdetails in program z_test

using &lfa1&

endperform

but it doesnt work

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You should pass data to subroutine in this way LFA1-LIFNR .

So try this:

perform f_getdetails in program z_test

using &lfa1-lifnr&

endperform.

Then in the subroutine, you can get further data from LFA1 from LIFNR by using a select statement.

I hope you know how to read the data passed from script to the subroutine.

Anyway here is the sample code:

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

FORM F_get_details IN_TAB STRUCTURE itcsy

OUT_TAB STRUCTURE itcsy.

DATA: V_LIFNR LIKE LFA1-LIFNR.

READ TABLE IN_TAB WITH KEY NAME = 'LFA1-LIFNR'.

MOVE IN_TAB-VALUE TO V_LIFNR.

SELECT * FROM LFA1 WHERE LIFNR = V_LIFNR.

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

Hope this helps.

Thanks & Regards,

Fawaz

Former Member
0 Kudos

Thanks,

But i want to avoid selects , since i already have data avilable in script.

Former Member
0 Kudos

Hi,

In this case, if you dont want to use select statement then

pass all the values from LFA1 that you need from script to the subroutine.

For Ex:

/:PERFORM GET_CREATED_BY IN PROGRAM yxz

/: USING &LFA1-LIFNR&

/: USING &LFA1-NAME1&

/: USING &........&

/: CHANGING &CREATED_BY&

/: CHANGING &DI&

/:ENDPERFORM

Regards,

Fawaz

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Inside the program apply a loop on input structure.

Then all the fields will come.For getting values in script use changing also.

Refer this:

https://forums.sdn.sap.com/click.jspa?searchID=13516478&messageID=3239606

Regards,

Shiva Kumar.