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

question concerning sap script

Former Member
0 Likes
830

Hi all experts! I have a question concerning sap script

First some background information:

I’ve 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 don’t have value

In the function module the variables are defined in the top include

I don’t know why these variables don’t take his value from the function module

Any ideas?

Thanks in advance.

Message was edited by: Gerardo hernandez

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
802

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.

8 REPLIES 8
Read only

Former Member
0 Likes
803

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.

Read only

Former Member
0 Likes
802

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

Read only

Former Member
0 Likes
802

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

Read only

0 Likes
802

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

Read only

0 Likes
802

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.

Read only

0 Likes
802

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

Read only

0 Likes
802

hi,

check the variable names once. it could be &KNA1-NAME1&..am i not correct?

Read only

former_member186741
Active Contributor
0 Likes
802

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!