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

Scripts

Former Member
0 Likes
704

Hi All,

Am working on Scripts.

In print program I have given select query and i have given sysubrc to check the records.

Am getting records which doesn't have values.

In print program :

SELECT SINGLE KBETR FROM KONV INTO TOTAL_1 WHERE KNUMV = VBDKA-KNUMV AND KPOSN = VBDPA-POSNR AND KSCHL = 'PROO'.

IF SY-SUBRC = 0.

FLAG_1 = 1.

Endif.

In script :

IF &FLAG_1& NE 0

&TOTAL_1&

ENDIF.

The problem is am getting the zero value if there is no value in &TOTAL_1& even though i mentioned the

SY-SUBRC condition.

I have given this condition also IF &FLAG_1& NE 0 AND &TOTAL_1& NE 0

&TOTAL_1&

ENDIF

How I can prevent zero values.

Please help me.

Thanks In advance,

Regards,

Murthy.

Please use meaningful subject in furture

Edited by: Vijay Babu Dudla on Dec 1, 2008 8:31 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
686

i would write:

SELECT SINGLE KBETR FROM KONV INTO TOTAL_1 WHERE KNUMV = VBDKA-KNUMV AND KPOSN = VBDPA-POSNR AND KSCHL = 'PROO'.

IF SY-SUBRC EQ 0

and not TOTAL_1 is intitial.

FLAG_1 = 1.

else.

flag = 0.

Endif.

In script :

IF &FLAG_1& NE 0

&TOTAL_1&

ENDIF.

if u dont get any results maybe the flag isnt defined global

dont forget 2 clear the flag if the statement aint true

Regards

Stefan Seeburger

5 REPLIES 5
Read only

Former Member
0 Likes
686

Hello,

Try to write it as:

IF &FLAG_1& EQ C_1. --> As you are passing 1 to flag if sy-subrc <> 0.

&TOTAL_1& --> Print the total

ENDIF.

Hope it helps.

Thanks,

Jayant

Read only

0 Likes
686

Hi Jayant,

Thanks for ur quick reply.

I have given that condition also like IF &FLAG_1& EQ 1

&TOTAL_1&

ENDIF

Then am not geting any values (even zero values and actual values)

Thanks & regards,

Murthy.

Read only

0 Likes
686

Hello Kan,

Select query is in your driver program, are you passing the flag information to the Sap Script? Did you try to debug the value in the script.

Best possible solution would be to check if the Total that you have used in the program is initial.

If the total value is 2 decimal places then check it as.

if &TOTAL_1& NE '0.00'.

<print the total here>.

endif.

Hope this will solve your problem.

Thanks,

Jayant

Read only

Former Member
0 Likes
686

Dear friend,

In script :

IF &FLAG_1& EQ 1

&TOTAL_1&

ENDIF.

Read only

Former Member
0 Likes
687

i would write:

SELECT SINGLE KBETR FROM KONV INTO TOTAL_1 WHERE KNUMV = VBDKA-KNUMV AND KPOSN = VBDPA-POSNR AND KSCHL = 'PROO'.

IF SY-SUBRC EQ 0

and not TOTAL_1 is intitial.

FLAG_1 = 1.

else.

flag = 0.

Endif.

In script :

IF &FLAG_1& NE 0

&TOTAL_1&

ENDIF.

if u dont get any results maybe the flag isnt defined global

dont forget 2 clear the flag if the statement aint true

Regards

Stefan Seeburger