2006 Sep 21 3:00 AM
Hi all experts! I have a question concerning sap script
First some background information:
Ive created a sap script that is called from a function module and from an executable program, when I run the executable program the sap script work fine, but when I run the function module, all the variables in the sap script dont have value
In the function module the variables are defined in the top include
I dont know why these variables dont take his value from the function module
Any ideas?
Thanks in advance.
Message was edited by: Gerardo hernandez
2006 Sep 21 3:04 AM
Hi,
Your problem is because you select your data in your program and not inside the function module.
You only pass the internal table from your calling program into the function module, so when you run the functional module alone, you wont get any values.
Hope it solved your problem.
2006 Sep 21 3:04 AM
Hi,
Your problem is because you select your data in your program and not inside the function module.
You only pass the internal table from your calling program into the function module, so when you run the functional module alone, you wont get any values.
Hope it solved your problem.
2006 Sep 21 3:28 AM
Hi,
Check in debug mode, whether the Function module is passing data correctly to the Script. I think FM is not passing data correctly.
May be the fields are not populated correctly in the FM.
Best regards,
Prashant
2006 Sep 21 4:45 AM
Hello,
1.First Debug the function module and check h data is being extracted.
2.Now debug the script with function module.
Check and let me know.
Regards
2006 Sep 21 3:51 PM
Hi
When I debug the function Module, the field KUNNR-NAME1 has a correct value in the function module, before the "write_form", but in the sapscript debug this field "KUNNR-NAME1" has not value
any ideas ?
thanks
2006 Sep 22 3:50 AM
Hi Gerardo,
Did you put your field name as &KUNNR-NAME1& inside your sapscript rather than putting KUNNR-NAME1 only?
Make sure you put your field name as &KUNNR-NAME1& inside your sapscript.
2006 Sep 22 5:00 AM
Hello,
Check wether spelling of ur text element in script and write_form are same.
Check and if u still face the problem let me know.
regards
2006 Sep 22 5:07 AM
hi,
check the variable names once. it could be &KNA1-NAME1&..am i not correct?
2006 Sep 22 5:12 AM
I think that sapscript expects its variables to be in the program which calls the fm <b>by default</b>. When you test via SE37 the framework itself is the calling program and it's unlikely that it will have a variable named kunnr-name1.
To over-ride this default, inside your fm pass the 'options' parameter(type itcpo) to 'open_form' and set the 'tdprogram' value to sy-repid in the function module.
I have tested this in my own environemnt and initially got the same error as you. When I set the tdprogram variable it started working!