‎2007 Mar 21 11:11 AM
hi, may i know what would be a better programming technic for the following?
there is too many if statement.
any better advice? thanks
select single from table1........
if sy-subrc = 0
select single from table2.........
if sy-subrc = 0
select single from table3........
if sy-subrc = 0
do something
endif
endif
endif
‎2007 Mar 21 11:14 AM
Hi
you can use :
if (condition ).
code......
elseif.
code..............
endif.
rgds
Deepak .
‎2007 Mar 21 11:17 AM
hi do this way ...
select single * from ...into table it_mara...
if not it_mara[] is initial.
select single * from ....
endif.Regards,
Santosh
‎2007 Mar 21 11:20 AM
Hi el,
That means if first select works means then only second select has to work. Are u using the first select fields in the second selct where condition.in that case means your logic is correct.
I f you are not using the first select fields in second select where condition. Similarly second & 3rd means , you can write seperate if condition not the nested if.
If not itab1[] is initial.
select2.
endif.
If not itab2[] is initial.
select3.
endif.
Plz reward points if helpful.
Thanks,
Suma.
‎2007 Mar 21 11:25 AM
select single from table1........
check sy-subrc = 0
select single from table2.........
check sy-subrc = 0
select single from table3........
check sy-subrc = 0
do something
regards,
Hans
Please reward all helpful answers !!!!!