cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with printing variable

Former Member
0 Kudos

Hi guys,

I want to print variable w_result. I have form ZBT_RACUN, in form I write like this:

&w_result& , but instead of real value just 0.00 is printed

In driver program I have like this:

data: w_result type p decimals 2.

...................

w_result = gs_sales_i-mpv / gs_sales_i-kol.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'POZICIJE_I'

function = 'APPEND'

window = 'MAIN'.

...................

When I debugg w_result has correct value, but 0.00 is printed???

Do u have idea how to solve this?

Thanks,

Nihad

Edited by: nihad omerbegovic on Jun 17, 2009 1:40 PM

Accepted Solutions (0)

Answers (9)

Answers (9)

Former Member
0 Kudos

Hi,

Put a Debugging for Script and check teh variable w_result having data or not.

Former Member
0 Kudos

Hi Nihad,

In sap script when u print the variable print it as command line

For Example :

/: &W_RESULT&

this would solve ur prob...

also do 1 thing...debug ur script...in SE71 put the script name...do activate debugger from menu.

and chk wat value the variable takes.

that wud give u a clear idea, wats going wrong and where.

All The Best

Regards,

Radhika

Former Member
0 Kudos

Hi

In the driver program

DATA: w_result type char15.

w_result = gs_sales_i-mpv / gs_sales_i-kol.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'POZICIJE_I'

window = 'MAIN'.

In script

&W_RESULT(.2)&

Try this one. I think It will work.

Thanks

Sriiiiiiii(srikanth)

rashmi_purohit2
Explorer
0 Kudos

Hi Ninad,

yes you will need to declare the variable in the top include that you have to make it global.

Also,try giving Function as "SET" in the Call function.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'POZICIJE_I'

function = 'SET'

window = 'MAIN'.

Hope it helps,

Rashmi.

former_member585865
Contributor
0 Kudos

Hi Nihad,

After getting the result in w_result pass to character field say w_result1 surely it will work ,in sap script we have to pass character field then only the Packed decimals format will print.

Former Member
0 Kudos

Hi, thanks for replies.

I tried with statement:

data: w_result type c.

write w_result to w_result1.

In form I changed SYMBOL to &W_RESULT&

but again nothing, it is written 0.

How to declare w_result globally?

In my program I have one include ZBT_FISK_RACTOP, should I declare in it?

Thanks,

nihad

Former Member
0 Kudos

Hi

Yes declare it in that include . That will do.

Gr., Frank

PS: remember for the future only globally declared variables will be printed in an sapscript.

Former Member
0 Kudos

Hi,

all printing variables/internal tables in script should be declared globally in Driver Program.

check whether u r declaring it as globally or not in the program (data: w_result type p decimals 2.).

Hope it helps!!

Rgds,

Pavan

Former Member
0 Kudos

please try to use ONLY upper case characters in forms.

i estimate that &W_RESULT& will work.

besides, did you make sure the driver program already got the data when you reach the point where to print this variable?

Former Member
0 Kudos

Hi,

Just try this, it will work.

Take a character field say w_result1. use the statement write w_result to w_result1.

regards

Hari reddy

Former Member
0 Kudos

Hi Nihad,

Have you debug the script also. What code you have writtne in the form?

You have not wriiten the complete code of WRITE FORM including this line.

also mention the command line of script.

Code in driver program is ok. It might be some problem with script only.

Regds,

Anil