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: 

SELECT statement not working

Former Member
0 Kudos

I have a select statement it is not working properly

SORT i_bom_temp BY idnrk.

DELETE ADJACENT DUPLICATES FROM i_bom_temp COMPARING idnrk.

SELECT bdart matnr werks bdmng INTO TABLE i_resb

FROM resb

FOR ALL ENTRIES IN i_bom_temp

WHERE

  • matnr = 'RSG67FG'.

matnr = i_bom_temp-idnrk.

RESB has 24 table entries for the material. The SELECT statement featched me 2 entries. If i hard code the material it gives me all 24 entries in the material

Very weired.

Any suggestions.

Thanks,

AP

10 REPLIES 10

Former Member
0 Kudos

One thing I noticed is that it is giving only uniques combination in output.

Thanks

AP

Former Member
0 Kudos

u need to do type casting of material..means data element for two material fields seems to be different..

use FM CONVERSION_EXIT_ALPHA_INPUT to convert into teaget data type of material then do the select statement..

cheers

Former Member
0 Kudos

Once I had the same problem ..

what is internal table type for matnr?

regards

0 Kudos

If I do in loop than working fine. Doing select for each material. Very weired. PLEASE GIVE SUGGESTIONS.

LOOP AT i_bom_temp INTO k_bom_2.

SELECT bdart matnr werks bdmng INTO TABLE i_resb

FROM resb

  • FOR ALL ENTRIES IN i_bom_temp_2

WHERE

  • bdart IN r_bdart AND

  • matnr = '55-24612-3'.

matnr = k_bom_2-idnrk.

ENDLOOP.

former_member156446
Active Contributor
0 Kudos

>

> SORT i_bom_temp BY idnrk.

> DELETE ADJACENT DUPLICATES FROM i_bom_temp COMPARING idnrk.

> If not i_bom_temp[] is initial. "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

> SELECT bdart matnr werks bdmng INTO TABLE i_resb

> FROM resb

> FOR ALL ENTRIES IN i_bom_temp

> WHERE

> * matnr = 'RSG67FG'.

> matnr = i_bom_temp-idnrk.

> endif.

or try to use before coming into the select..CONVERSION_EXIT_MATN1_RANGE_I

0 Kudos

Joy-

The first one did not work.

Whst will the FM CONVERSION_EXIT_MATN1_RANGE_I

do???

Thanks,

AP

0 Kudos

It will convert the value into Matnr format.. say 1234 would be converted to Char18 of Matnr

0 Kudos

Soved the issue on own. Thanks a lot for all your suggestions and help.

Put all the materials in RANGE and then used RANGE in SELECT statement instead of FOR ALL ENTRIES.

Thanks,

AP

0 Kudos

hmm Using range tables would be a pit on performance... so make sure its not performance critical Object.

Former Member
0 Kudos

Hi,

Have you selected all the primary keys of 'RESB' table, if not put all the key fields in your select statement, else you will

get wrong result.

When ever using for all entries, do select all primary keys.

Tks,

Krishna..