‎2013 Jan 15 6:24 PM
Hi,
I'm having an issue with a SAPscript calling a Subroutine Form. I looked around for a solution with no luck.
The cause of my issue is that my SAPscript is using my variable names as their values.
This is my code of the SAPscript:
| /: | DEFINE &OUTSTREET& = ' ' | |
| /: | PERFORM GET_STREET4 IN PROGRAM ZF_RFW1099M_2001_SUB | |
| /: | USING &LFA1-LIFNR& | |
| /: | CHANGING &OUTSTREET& | |
| /: | ENDPERFORM |
This is what is displayed in the debugger:
| /: | DEFINE &OUTSTREET& = ' ' | |
| /: | PERFORM GET_STREET4 IN PROGRAM ZF_RFW1099M_2001_SUB | |
| /: | USING 300000 | |
| /: | CHANGING | |
| /: | ENDPERFORM |
As you can see, the values are in the debugger instead of the variables.
This is causing the subroutine code not to work because the Internal Table is not being populated.
Here's the code of my subroutine form:
form get_street4 tables in_tab structure itcsy
out_tab structure itcsy.
data: lv_adrnr type lfa1-adrnr,
lv_str_suppl3 type adrc-str_suppl3,
lv_vendor type itcsy-value.
read table in_tab with key 'LFA1-LIFNR'.
check sy-subrc eq 0.
lv_vendor = in_tab-value.
select single lifnr
into lv_adrnr
from lfa1
where lifnr eq lv_vendor.
check sy-subrc eq 0.
select single str_suppl3
into lv_str_suppl3
from adrc
where addrnumber eq lv_adrnr.
check sy-subrc eq 0.
read table out_tab with key 'OUTSTREET'.
check sy-subrc eq 0.
out_tab-value = lv_str_suppl3.
modify out_tab index sy-tabix.
endform.
How can I make it so that the variables are being used and not the values, so that my internal table is populated properly?
Any help would be appreciated.
Thank you.
‎2013 Jan 15 7:24 PM
Hi.
I use some similar code.
1.- I don't define out parameters, so I don't use
| /: | DEFINE &OUTSTREET& = ' ' |
2.- in the subroutine I have this:
sy-tabix = 1.
MOVE 'OUTSTREET' to out_tab-name.
MOVE v_value_street to out_tab-value.
MODIFY out_tab INDEX sy-tabix.
hope this helps.
‎2013 Jan 15 7:27 PM
One more thing, the input parameter is the one i define
DEFINE &LIFNR& = &LFA1-LIFNR&
...
USING &LIFNR&
...
‎2013 Jan 15 9:32 PM
For some reason, the command lines were not working properly with the text elements. I separated both in their own boxes and it worked.