07-22-2008 8:45 AM
Hi friends,
i have my code like this...
if filed1 is initial.
if sy-subrc Eq 0.
do something...
endif.
endif.
after if condition (i.e if filed1 is initial),is it possible to check sy-sybrc.please tell me
but in above code if field1 is initial,i am not getting sy-subrc 0.
please tell me
Thanks,
kishore.
07-22-2008 8:47 AM
hi,
Checking for sy-subrc is not required ... you can remove that ...
if filed1 is initial.
*if sy-subrc Eq 0.
do something...
*endif.
endif.
07-22-2008 8:49 AM
07-22-2008 8:48 AM
hi,
sy-subrc returns 0 if a preceding statement was executed successfully.
in your case, the if statement for field1 is true that is why subrc returns 0.
regards,
Peter
07-22-2008 8:49 AM
with If condition sy-subrc is not req.
Sy-subrc have the value of last condition.
Edited by: shilpi agarwal on Jul 22, 2008 9:49 AM
07-22-2008 8:49 AM
hi ,
here the sy-subrc check is not required.
you can just check the conditiond
if field1 is initial
do something.
endif.
07-22-2008 8:50 AM
Hi Kishore,
If your field1 is a Table field which is fetched from a table then u need to check the sy-subrc otherwise it is not required. Usually it holds the return value for ABAP Statements.
Regards,
Sai
Edited by: Sai Krishna Kowluri on Jul 22, 2008 9:50 AM
07-22-2008 9:21 AM
Hi,
Thanks for all u r answers...
but with the value of sy-subrc ,i want to check another condition with in same if and endif.
That's why i checking the value of sy-subrc
Thanks,
kishore.
07-22-2008 9:27 AM
hi,
You can very well check the other conditions that you wanted to check for without the sy-subrc ... as the sy-subrc has no significance ...
Regards,
Santosh
07-22-2008 9:54 AM
Kishor,
Try to use
if filed1 = space.
if sy-subrc = 0.
do something...
endif.
endif.
Check out all possible scenarios....
07-22-2008 10:17 AM
Sy-subrc should be written immediately after the concerned statement Eg. Read statement, select statement.
for eg:
read table tab1 into wa1 with key f1 = 'a'.
-->
if sy-subrc eq 0. (or if wa1 is not initial)
do something.
endif..
if you write some command statement which has a sy-subrc return code in between read and if statement.
for eg you are doing a select statement in between then the system variable Sy-subrc would give you the result of the select statement not the read
07-23-2008 9:04 AM