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

Querry problem

Former Member
0 Likes
713

Hi friends,

if itab-vrkme = 'SET'.

select idnrk from stpo into corresponding fields of itab3

where matkl = '4-1'.

endselect.

endif.

dis is d querry i hv written.

My requirement is to fetch only the semi-finished components from BOM when i hv the SU as 'SET'. (i e. itab-vrkme) in Sales Order.

Where,

'4-1' is d material group for Semi-finished material.

Wen i debug dis particular querry i m not able to get the value for the field idnrk wen the SU is 'SET'.

Plz reply.

Its urgent.

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
681

Hi,

make it like this.

loop at itab into wa.

if wa-vrkme = 'SET'.

select idnrk from stpo into corresponding fields of itab3

where matkl = '4-1'.

endselect.

endif.

Regards,

Renjith Michael.

6 REPLIES 6
Read only

Former Member
0 Likes
682

Hi,

make it like this.

loop at itab into wa.

if wa-vrkme = 'SET'.

select idnrk from stpo into corresponding fields of itab3

where matkl = '4-1'.

endselect.

endif.

Regards,

Renjith Michael.

Read only

Former Member
0 Likes
681

Hi Purva,

The select querry is fine but when you are checking whether the vrkme field is SET or not,you are not looping the table.

You will have to loop the table itab and check for VRKME to be set or not because the interanal table may contain multiple entries and it cannot check for all the entries untill it is looped. i.e.,

loop at itab.

if itab-vrkme = 'SET'.

select idnrk from stpo into corresponding fields of itab3

where matkl = '4-1'.

endselect.

endif.

endloop.

This will loop the internal table and the value VRKME is checked each time in the loop whether it is SET or not for all the values in the internal table.

Or you will have to create a work area (e.g. WA)with the same structure as that of ITAB and then loop at ITAB into WA.

Then the code will be:

loop at ITAB into WA.

if wa-vrkme = 'SET'.

select idnrk from stpo into corresponding fields of itab3

where matkl = '4-1'.

endselect.

endif.

endloop.

This will fetch each record into the wa and from the work area VRKME is checked if it is SET or not.

Reward if usefull.

Thanks,

Kashyap

Read only

0 Likes
681

Hi,

I used loop at itab.

but still it is not working.

I am not able to get the value of idnrk into the internal table.

can i use a separate int. table to store the value of idnrk?????

Plz reply.

Thanks

Read only

0 Likes
681

Hi,

Thanks 4 ur reply.

I am getting the result.

But my problem is i m not able to apply the filter for the querry dat is (where matkl = '4-1' ) becoz the value is not getiing stored in the matkl field of STPO table.

select idnrk matkl from stpo into corresponding fields of itab3

For the above querry it picks up all the materials dat r der in d BOM.

but i want to pick up only the semi-finished material.

i.e matkl = '4-1'.

Reply.

Thanks,

Purva

Read only

0 Likes
681

Hi Purva,

Is the value '4-1' that you are searching for is present in MATKL field of STPO table?

Regards,

Srikanth

Read only

0 Likes
681

Hi,

no. the value '4-1' is not present in the field matkl of STPO table.

So my question is how do i filter my querry so dat i pick up only the semi-finished material from the BOM.

Thanks n regards,

Purva.