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

where condition problem

Former Member
0 Likes
752

Hi everybody

i got struck in problem related to "where condition"

1) i have to select mblnr , mjahr and budat from MKPF into itab (internal table) for user input in the selection screen

+++(Inner join)

and

select zeile,bwart,matnr,werks,lgort,charg,sobkz,erfmg,erfme,kzbew,kzvbr,kzzug,shkzg from MSEG into itab(internal table) for user input in the selection screen

2) now i got confused in "For user input in the selection screen " because at selection screen i have only following fields

matnr , werks , lgort,charg,lifnr,kunnr,bwart,sobkz,usnam,vgart.

and i am using a query like this

select a-mblnr

a-mjahr

a-budat

b-zeile

b-bwart

b-matnr

b-werks

b-lgort

b-charg

b-sobkz

b-erfmg

b-erfme

b-kzbew

b-kzvbr

b-kzzug

b-shkzg into table t_mat_data from mkpf

as a join mseg as b on a-mblnr = b-mblnr

and a-mjahr = b-mjahr

where .....................

so wat should i written in Where condition plz reply

thanks

points will be awarded

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
708

Hi,

Always use the Character '~' instead of '-' in joins:

select a-mblnr

a~mjahr

a~budat

b~zeile

b~bwart

b~matnr

b~werks

b~lgort

b~charg

b~sobkz

b~erfmg

b~erfme

b~kzbew

b~kzvbr

b~kzzug

b~shkzg

into table t_mat_data

from mkpf as a join mseg as b

on amblnr = bmblnr

and amjahr = bmjahr

where mseg~matnr in s_matnr ...

reward if useful

regards,

Anji

8 REPLIES 8
Read only

Former Member
0 Likes
708

hi

where a~field name IN ur input

and b~fields name IN ur input

and A~FIELDNAME = UE INOUT .

Read only

Former Member
0 Likes
708

Hi..

select a-mblnr

a-mjahr

a-budat

b-zeile

b-bwart

b-matnr

b-werks

b-lgort

b-charg

b-sobkz

b-erfmg

b-erfme

b-kzbew

b-kzvbr

b-kzzug

b-shkzg into table t_mat_data from mkpf

as a join mseg as b on a-mblnr = b-mblnr

and a-mjahr = b-mjahr

<b>where mseg~matnr in s_matnr and

mseg~werks in s_werks and

mseg~igort in s_igort and

mseg~charg in s_charg and

mseg~kunnr in s_kunnr and

mseg~bwart in s_bwart and

mseg~sobkz in s_sobkz and

mseg~usnam in s_usnam.<b>

Read only

Former Member
0 Likes
708

Hi..,

u need to use the TILT operator here !!! "~"

select a~mblnr

a~mjahr

a~budat

b~zeile

b~bwart

b~matnr

b~werks

b~lgort

b~charg

b~sobkz

b~erfmg

b~erfme

b~kzbew

b~kzvbr

b~kzzug

b~shkzg into table t_mat_data from mkpf

as a join mseg as b on amblnr = bmblnr

and amjahr = bmjahr

where msegmatnr in s_matnr and <i>**If it is a parameter then u need to use msegmatnr eq p_matnr.</i>

werks eq p_werks and

lgort eq p_lgort and

charg eq p_charg and

...

<b>not the ' -' u need to use "~".</b>

regards,

sai ramesh

Read only

Former Member
0 Likes
708

Hi Gaurav,

I find the select query absolutely correct.

In the where clause just write what all fields you have on the selection screen.

where matnr = s_matnr

and werks = s_werks

and lgort = s_lgort

and .............so on.

Internally the join will take care of fields as to which table it belongs to.

Thank you.

Reward if useful.

Read only

Former Member
0 Likes
709

Hi,

Always use the Character '~' instead of '-' in joins:

select a-mblnr

a~mjahr

a~budat

b~zeile

b~bwart

b~matnr

b~werks

b~lgort

b~charg

b~sobkz

b~erfmg

b~erfme

b~kzbew

b~kzvbr

b~kzzug

b~shkzg

into table t_mat_data

from mkpf as a join mseg as b

on amblnr = bmblnr

and amjahr = bmjahr

where mseg~matnr in s_matnr ...

reward if useful

regards,

Anji

Read only

0 Likes
708

hi thanks to all of u for your help.

query is working very fine but data is not found in Internal table . i am getting an error as " data not found"

plz help me

thanks

Read only

0 Likes
708

Hi Gaurav,

I hope you are using all the screen fields as SELECT-OPTIONS. If yes without entering anything on the screen, execute the report. It should give some records in the table provided you have entries in table MKPF and then in MSEG. Confirm this using transaction SE16 first.

Thanks.

Read only

0 Likes
708

yes u r rite it works well . so wat should i do now when i will execute by filling up the enteries at selection screen . so that table will be full

thanks