‎2009 Apr 07 9:44 PM
Hi all,
I have a d/b table called QMEL and i picked VBELN from that table. Now if the VBELN value in that table is NULL i have to wtite an if condition.
Can i say it like this
IF VBELN = ' '.
write: enter into the if condition.
ELSE.
write: enter into the else condition.
ENDIF.
or should is say some thing else? my objective is ..i should execute some statments if VBELN has no value and i should execute some othet statements if VBELN has a value.
Kindly help..as even though i put above condition..it deosnot work
Regards,
Jessica Sam
‎2009 Apr 08 5:18 AM
hi,
u can write like this
IF itab-VBELN = ' '.
write: enter into the if condition.
ELSE.
write: enter into the else condition.
ENDIF.
or
IF itab-VBELN is INITIAL.
write: enter into the if condition.
ELSE.
write: enter into the else condition.
ENDIF.
‎2009 Apr 07 9:48 PM
Yes you can validate as you mentioned or
if qmel-vbeln is initial. " I think qmel is your internal table
" do something
else.
" do something
endif.
‎2009 Apr 07 9:52 PM
Hi jessica ,
The logic which u gave will work fine.
The only modification u need to do is write the the if condition with the table name followed by the field into which ur are storing the value for VBELN.
lets say u r stroing value for vbeln into field vbeln of internal table itab.
If itab-vbeln = ' '.
do something.
Else.
do something.
Endif.
If u r storing the value into a variable then u need to give the variable name only
If z_vbeln = ' '.
do something
else.
do something.
Endif.
Regards,
Anuj
Edited by: ANUJ SRIVASTAVA on Apr 7, 2009 10:57 PM
Edited by: ANUJ SRIVASTAVA on Apr 7, 2009 11:06 PM
‎2009 Apr 07 9:54 PM
IF VBELN = space.
write: enter into the if condition.
ELSE.
write: enter into the else condition.
ENDIF.
‎2009 Apr 08 4:36 AM
You have to use Internal table name followed by field.
I.e ITAB-FIELD.
The same is applicable always when you are working on the records of the internal table.
‎2009 Apr 08 4:58 AM
hi
check this
if u r using selection optins use this code
IF NOT s_material[] IS INITIAL.
SELECT material
FROM marc
INTO l_material
WHERE material IN s_material.
ENDSELECT.
IF sy-subrc NE 0 AND l_material IS INITIAL.
MESSAGE e302 WITH space.
ENDIF.
ENDIF.
if u r using parameter then
IF NOT P_material IS INITIAL.
SELECT material
FROM marc
INTO l_material
WHERE material EQ P_material.
ENDSELECT.
IF sy-subrc NE 0 AND l_material IS INITIAL.
MESSAGE e302 WITH space.
ENDIF.
ENDIF.
~linganna
Edited by: katigiri linganna on Apr 8, 2009 5:58 AM
‎2009 Apr 08 5:12 AM
Hi Jessica,
After your Select Query when it fills some internal table suppose
itab, then you can use statement :
If not itab is initial. "that is your intenral table contains some value
" and is not empty
Then your logic.
endif.
Hope it helps
Regards
Mansi
‎2009 Apr 08 5:18 AM
hi,
u can write like this
IF itab-VBELN = ' '.
write: enter into the if condition.
ELSE.
write: enter into the else condition.
ENDIF.
or
IF itab-VBELN is INITIAL.
write: enter into the if condition.
ELSE.
write: enter into the else condition.
ENDIF.
‎2009 Apr 08 6:10 PM
Hi all,
I am putting this condition in an iterative loop.
So should I be clearing the qmel-vbeln field each time before entering into the loop?
because it is not working as exptected.so i am wondring what else could be wrong.
Regards,
Jessica Sam
‎2009 Apr 08 6:28 PM
if you are using a work area it should not be a problem, if you are using the old Header line concept you might have to clear the header line.
‎2009 Apr 08 10:16 PM
Hi Jay,
Say, my_wa-vbeln = 000123456
So, do u mean that, If I use explicit work area(my_wa), then, there is no need to CLEAR (my_wa-vbeln) in every iteration? Is it automatically CLEARs the value(say, 000123456) in every iteration?as layed-off, these days, i dont hv SAP access to check my self.
Hi Jessica,
Just info: I guess, you can not write logic solely depending on VBELN(space/value) value of the VQMEL/QMEL table...I mean, u hv to add some more conditions too it(ur IF condition).......ask ur functional guy.
thanq
Edited by: SAP ABAPer on Apr 8, 2009 11:20 PM
‎2009 Apr 09 4:19 PM