Application Development 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: 

Regarding sql query

Former Member
0 Kudos

Hi Guriji,s

i have written one sql query. In tis query iwe written some condition. but we are getting the output only for 261 movement .

but i need the output both '201' or '261' movement type .

Plz check my query and tell me the solution.

IF DAYS IS NOT INITIAL.

WB2_V_MKPF_MSEG2-BUDAT = SY-DATUM - DAYS.

SELECT MATNR_I WERKS_I BWART_I BUDAT FROM WB2_V_MKPF_MSEG2 INTO CORRESPONDING FIELDS OF TABLE T_ITAB4

WHERE WERKS_I IN PLANT AND BWART_I IN ('201' , '261') AND BUDAT BETWEEN WB2_V_MKPF_MSEG2-BUDAT AND SY-DATUM.

ENDIF.

Thanks

1 ACCEPTED SOLUTION

raviprakash
Advisor
Advisor
0 Kudos

Your Query:-

SELECT MATNR_I WERKS_I BWART_I BUDAT FROM WB2_V_MKPF_MSEG2 INTO CORRESPONDING FIELDS OF TABLE T_ITAB4

WHERE WERKS_I IN PLANT AND BWART_I IN ('201' , '261') AND BUDAT BETWEEN WB2_V_MKPF_MSEG2-BUDAT AND SY-DATUM.

Do following check:-

In se11, open table WB2_V_MKPF_MSEG2, in BWART_I provide 201 and 261. Check whether your imput for plant and budat is same or not.

4 REPLIES 4

Former Member
0 Kudos

Hi Sachin,

Just check whether all rest of the conditions are satisfying for Movement type '201'.

Because all the Where conditions are with 'AND' so all the conditions should be satisfied together.

Regards,

Nitin.

former_member222860
Active Contributor
0 Kudos

Check in SE16, if you have data for the given condition of the SELECT statement

raviprakash
Advisor
Advisor
0 Kudos

Your Query:-

SELECT MATNR_I WERKS_I BWART_I BUDAT FROM WB2_V_MKPF_MSEG2 INTO CORRESPONDING FIELDS OF TABLE T_ITAB4

WHERE WERKS_I IN PLANT AND BWART_I IN ('201' , '261') AND BUDAT BETWEEN WB2_V_MKPF_MSEG2-BUDAT AND SY-DATUM.

Do following check:-

In se11, open table WB2_V_MKPF_MSEG2, in BWART_I provide 201 and 261. Check whether your imput for plant and budat is same or not.

Former Member
0 Kudos

Hi,

Your query for movement types is correct.

Other where conditions are not getting satisfied.Just remove other where conditions and check if its working fine only for movement types where conditions.It will work fine.

Regards,

Subhashini