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

Explain code

Former Member
0 Likes
630

in one of the programs i saw(see the below code) both the selects are written one after other as shown below

if s_paledg-low = '02'.

clear w_waers.

select * from t001

where bukrs = s_bukrs-low.

w_waers = t001-waers.

endselect.

elseif s_paledg-low = '01'.

w_waers = 'USD'.

endif.

select * from t001 client specified

where bukrs = s_bukrs-low.

endselect.

both the selects are on t001, they used first select to get the value of WAERS

but for the second select they are not using the values of t001 any where in the complete code

can any one clarify why they have written like this with out using this

Edited by: Alvaro Tejada Galindo on Apr 22, 2008 3:00 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
609

Hi,

Yes, the selects do not make any sense since that value is no longer used in the program. It probably was at an earlier point, then someone removed the usage and forgot to remove the selects.

Furthermore the CLIENT SPECIFIED in the second select does not make any sense either because no MANDT is specified meaning it will read the data from the current client only anyway.

Regards,

Michael

5 REPLIES 5
Read only

Former Member
0 Likes
609

hi,

If the values of t001 which are taken in the work area i,e, t001 are not being used any where in the program you can avoid the select statement as it has no significance of its usage.

Regards,

Santosh

Read only

Former Member
0 Likes
610

Hi,

Yes, the selects do not make any sense since that value is no longer used in the program. It probably was at an earlier point, then someone removed the usage and forgot to remove the selects.

Furthermore the CLIENT SPECIFIED in the second select does not make any sense either because no MANDT is specified meaning it will read the data from the current client only anyway.

Regards,

Michael

Read only

Former Member
0 Likes
609

Hi Ram,

I think that select statement is compulsary one. They might have been using the other fields of table T001 in the rest of the program.(I mean other than the field WAERS).

They should have written select statement before the if condition as shown below.

select * from t001 client specified

where bukrs = s_bukrs-low.

clear w_waers.

if s_paledg-low = '02'.

w_waers = t001-waers.

elseif s_paledg-low = '01'.

w_waers = 'USD'.

endif.

Read only

Former Member
0 Likes
609

Hi Ram,

I think that select statement is compulsary one. They might have been using the other fields of table T001 in the rest of the program.(I mean other than the field WAERS).

They should have written select statement before the if condition as shown below.

select * from t001 client specified

where bukrs = s_bukrs-low.

clear w_waers.

if s_paledg-low = '02'.

w_waers = t001-waers.

elseif s_paledg-low = '01'.

w_waers = 'USD'.

endif.

Read only

Former Member
0 Likes
609

thanks