‎2013 Sep 17 5:20 AM
Good morning friends, I'm programming with objects the following query, I have as input values ​​the type of material and the center, but I get an error, this is the code:
MODULE user_command_0500 INPUT.
CASE ok_code.
WHEN 'EXECUTE'.
SELECT mapl~werks mapl~plnty mapl~plnnr mapl~plnal mapl~datuv mapl~matnr
plko~ktext mara~mtart
FROM mapl INNER JOIN plko ON mapl~werks = plko~werks
AND mapl~plnty = plko~plnty
AND mapl~plnnr = plko~plnnr
AND mapl~plnal = plko~plnal
INNER JOIN mara ON mapl~matnr = mara~matnr
INTO TABLE t_mapl
WHERE mtart eq mara-mtart
AND werks eq mapl-werks. "HERE THE FAILED"
IF sy-subrc <> 0.
ENDIF.
CALL METHOD r_grid->refresh_table_display.
WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
ENDCASE.
ENDMODULE.
The following message appears:
The column name "WERKS" is unclear .
The data type MARA can be enhanced in any way. After a structure enhancement, this assignment or parameter might be syntactically incorrect.
Please I hope you can help me. Thank you very much.
Best regards
‎2013 Sep 17 7:18 AM
Hi,
please replace line
AND werks eq mapl-werks.
with
AND mapl~werks eq mapl-werks.
for PLKO~WERKS is defined through JOIN and MTART is unique in the JOIN tables.
Regards,
Klaus
‎2013 Sep 17 7:11 AM
You need to specify from which table the werks is taken from
e.g: map1~werks (or map1-werks, check both)
‎2013 Sep 17 7:18 AM
You have to specify the tables in the where condition:
WHERE mara~mtart eq mara-mtart
AND mapl~werks eq mapl-werks.
This make sense only in case you have workareas mara and mapl filled with the values in your program before.
Otherwise remove the where condition.
/Michael
‎2013 Sep 17 7:18 AM
Hi Brujo ,
From the code you have provided what my assumption is that there is some problem in the WHERE clause of the query .
Have you declared any workarea for mara and mapl tables , if yes , is there any data that you passing into the fields you are referring in the WHERE clause .
if there is no data in the fields used in the WHERE clause the query wil not work .
Regards,
Parth Sharma
‎2013 Sep 17 7:18 AM
Hi,
please replace line
AND werks eq mapl-werks.
with
AND mapl~werks eq mapl-werks.
for PLKO~WERKS is defined through JOIN and MTART is unique in the JOIN tables.
Regards,
Klaus
‎2013 Sep 17 7:21 AM
Hi Brujo ,
The column name "WERKS" is unclear . " says that for which WERKS you are equating for ?.
You have declared WERSK in MAPL & PLKO . So make clear for which WERKS you are equating.
For Example :: AND plko~werks = mapl-werks.
Thanks,
S.Rajendranath Raparthi.
‎2013 Sep 17 7:30 AM
Hi,
You are trying to map map1 werks to itself in where condition.
Also there is no werks field in mara table, i think that condition is not required.
Please check and let me know.
Best Regards,
Abirami
‎2013 Sep 17 7:43 AM
‎2013 Sep 17 2:52 PM
Thank you very much to all for your responses, all are correct.
Have a great day.