‎2008 Dec 01 1:19 PM
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
‎2008 Dec 01 8:52 PM
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
‎2008 Dec 01 1:24 PM
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
‎2008 Dec 01 1:31 PM
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.
‎2008 Dec 01 1:47 PM
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
‎2008 Dec 01 1:42 PM
‎2008 Dec 01 8:52 PM
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