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

any better abap coding

Former Member
0 Likes
473

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

4 REPLIES 4
Read only

Former Member
0 Likes
456

Hi

you can use :

if (condition ).

code......

elseif.

code..............

endif.

rgds

Deepak .

Read only

Former Member
0 Likes
456

hi do this way ...

select single * from ...into table it_mara...

if not it_mara[]  is initial.
  select single * from  ....
endif.

Regards,

Santosh

Read only

Former Member
0 Likes
456

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.

Read only

h_senden2
Active Contributor
0 Likes
456

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 !!!!!