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

Please validate my select stmt

Former Member
0 Likes
437

SELECT * " bukrs lifnr gjahr belnr blart

FROM bsak

  • appending table gt_bsak

INTO CORRESPONDING FIELDS OF TABLE gt_bsak

WHERE cpudt in r_cpudt

AND blart in r_blart

AND bukrs in s_bukrs

  • AND lifnr in s_lifnr

AND belnr in s_belnr

AND gjahr in s_gjahr

What is wrong in above stmt .

As one record is selecting from db table (se11) bsak with the set of values of

r_cpudt, r_blart, s_bukrs, s_belnr, s_gjahr .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
409

Hi,

Nothing is wrong the select statement..

Compare the values you give in SE11 with the values in the where clause..

Check your values in r_cpudt and r_blart..looks like you are populating manually in your program..

Populate the range only if the value is present..

Example..

RANGES r_matnr for mara-matnr.

if not v_matnr is initial.

r_matnr-sign = 'I'.

r_matnr-option = 'EQ'.

r_matnr-low = v_matnr.

append r_matnr.

endif.

Thanks,

Naren

Hi,

Nothing is wrong the select statement..

Compare the values you give in SE11 with the values in the where clause..

Check your values in r_cpudt and r_blart..looks like you are populating manually in your program..

Populate the range only if the value is present..

Example..

RANGES r_matnr for mara-matnr.

if not v_matnr is initial.

r_matnr-sign = 'I'.

r_matnr-option = 'EQ'.

r_matnr-low = v_matnr.

append r_matnr.

endif.

Thanks,

Naren

2 REPLIES 2
Read only

Former Member
0 Likes
410

Hi,

Nothing is wrong the select statement..

Compare the values you give in SE11 with the values in the where clause..

Check your values in r_cpudt and r_blart..looks like you are populating manually in your program..

Populate the range only if the value is present..

Example..

RANGES r_matnr for mara-matnr.

if not v_matnr is initial.

r_matnr-sign = 'I'.

r_matnr-option = 'EQ'.

r_matnr-low = v_matnr.

append r_matnr.

endif.

Thanks,

Naren

Read only

Former Member
0 Likes
409

It would be correct if you left it by selecting on lifnr. But since you are now selecting on bukrs, belnr and gjahr, you should select against BSEG and not BSAK. This way you will use the primary index. As coded, you will not. If you only want cleared items (what you would get if you kept it against BSAK) you should also add AUGDT <> ' ' and KUART = 'K'.

Rob