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

Problem in select query

Former Member
0 Likes
1,407

Hi experts,

I am trying to pick the data from mard table..but values are not fetched to my internal table

as of now my code is

tables: mard.

SELECT-OPTIONS: s_werks FOR mard-werks.

TYPES : BEGIN OF TT_MARD,

MATNR TYPE MATNR ,

WERKS TYPE WERKS_D,

LGORT TYPE LGORT_D,

VMLAB TYPE VMLAB,

VMINS TYPE VMINS,

VMSPE TYPE VMSPE,

VMRET TYPE VMRET,

END OF TT_MARD .

DATA: GT_MARD type TABLE OF TT_MARD,

GS_MARD TYPE TT_MARD.

SELECT MATNR WERKS LGORT VMLAB VMINS VMSPE VMRET FROM MARd INTO TABLE GT_MARD

WHERE werks in s_werks.

Actullly for this selection criteria i have 11,000 records in MARD table...but internal table is blank.

can any body plz help me...

regards,

Praveena.

13 REPLIES 13
Read only

Former Member
0 Likes
1,362

hai friend,

the select query works only when were u can mainatin werks data on the selection-screen only

because you can maintain werks as selection screen.

in select query werks as the condition so based on that condition only it fetches the data ok.

thanks,

anji.

Read only

Former Member
0 Likes
1,362

Hi,

Check the values in your select option "s_werks". If you have passed any 'E' for sign .

Regards,

Srini.

Read only

Former Member
0 Likes
1,362

hai ,

its workin fine .

tables: mard.

SELECT-OPTIONS: s_werks FOR mard-werks.

TYPES : BEGIN OF TT_MARD,

MATNR TYPE MATNR ,

WERKS TYPE WERKS_D,

LGORT TYPE LGORT_D,

VMLAB TYPE VMLAB,

VMINS TYPE VMINS,

VMSPE TYPE VMSPE,

VMRET TYPE VMRET,

END OF TT_MARD .

DATA: GT_MARD type TABLE OF TT_MARD,

GS_MARD TYPE TT_MARD.

SELECT MATNR WERKS LGORT VMLAB VMINS VMSPE VMRET FROM MARd INTO TABLE GT_MARD

WHERE werks in s_werks.

loop at gt_mard into gs_mard.

write : / gs_mard-matnr,

gs_mard-werks,

gs_mard-lgort.

endloop.

thanks,

anji.

Read only

0 Likes
1,362

Hi anji..

Thanks for giving reply

for me why it is not working?

plz help me out

Read only

0 Likes
1,362

hello ,

are you getting any error

i think you have no data in the database check it once .

thanks,

anji.

Read only

0 Likes
1,362

Hi..

in databased i have 11000 records..i am not getting any error..

Read only

0 Likes
1,362

Hi Praveena,

what is the subrc value you getting after select query.

Regards,

karthikeyan k s.

Read only

0 Likes
1,362

R U checking in the same client?

If Yes Check without giving values in selection screen.

R there any alphabets in company code? If yes check Lower case and Upper case of the selection screen.

Thanks and Regards,

Chandra

Read only

0 Likes
1,362

Hi karthick...

thanks for giving reply

i am getting sy-subrc value is 4.

Read only

0 Likes
1,362

Hi

Just 2 questions:

A) Which values have you inserted in S_WERKS?

B) Are you sure your program works in the same client where you're checking the hits of MARD?

Max

Read only

0 Likes
1,362

Hi max...

Thnaks for giving reply...

i am passing plant as INDW it is there in database..

for this selection criteria i have 11000 records in database...but i did'nt get values in internal table...

can you plz help e?

Read only

0 Likes
1,362

Hi Praveena ,

I pasted your code in my system and i get records in my table .

So as Max had mentioned in his reply , please check again if the client in which you are executing the report has records for that plant in the MARD table.

Regards

Arun

Read only

0 Likes
1,362

Hi all..

Now i ma getting values...actually In test client i have no data.now they have updated...Thanks to every body for your replies...

Thanks alot..