‎2008 Aug 08 4:46 PM
Hi guys,
with the bellow code I'd like to fill the column vmsta in my itab from the table vmke.
My question is why the compiler says "The field mvke-matnr unknown". Even if I delete mvke-matnr it would say "The field mvke-vkorg is unknow".
I have already declared the table mvke and itab has head line as well
Thanks for you help.
LOOP AT itab.
SELECT SINGLE vmsta INTO itab-vmsta
FROM mvke
WHERE mvke-matnr = itab-matnr
AND
mvke-vkorg = itab-vkorg.
IF sy-subrc = 0.
MODIFY itab.
ENDIF.
ENDLOOP.
‎2008 Aug 08 4:51 PM
Remove 'MVKE-' from the fields in your where clause. It is not necessary to specify the table name since you are only selecting from MVKE.
Best Regards,
Chris H.
‎2008 Aug 08 4:50 PM
You don't need to specifiy the Table name in the where condition.
Change query to:
SELECT SINGLE vmsta INTO itab-vmsta
FROM mvke
WHERE MATNR = itab-matnr " <<
AND
VKORG = itab-vkorg. "<<
Regards,
Naimesh Patel
‎2008 Aug 08 4:51 PM
Remove 'MVKE-' from the fields in your where clause. It is not necessary to specify the table name since you are only selecting from MVKE.
Best Regards,
Chris H.
‎2008 Aug 08 4:55 PM
O no you all are right. I just didn't see it. Sorry guys.
I better stop working today and go home.
Thanks all
‎2008 Aug 08 4:53 PM
LOOP AT itab.
SELECT SINGLE vmsta INTO itab-vmsta
FROM mvke
WHERE mvke-matnr = itab-matnr
AND vkorg = itab-vkorg. <---change to vkorg from mvke-vkorg
IF sy-subrc = 0.
MODIFY itab.
ENDIF.
ENDLOOP.
‎2008 Aug 08 4:55 PM
Hi,
LOOP AT itab.
SELECT SINGLE vmsta INTO itab-vmsta
FROM mvke
WHERE matnr = itab-matnr
AND
vkorg = itab-vkorg.
IF sy-subrc = 0.
MODIFY itab.
ENDIF.
ENDLOOP.
hope it will work.
Thanks,
Kamesh