‎2007 Feb 08 9:17 AM
I have written a inner join on mchb and mara but the values are not matching on matnr so i need to insert the data into mara-matnr from program, how can i do this i need code.
‎2007 Feb 08 9:24 AM
Hi,
try this out.
SELECT matnr werks lgort
FROM mard INTO TABLE git_mard
WHERE werks EQ p_werks AND
lgort EQ p_lgort AND
labst GT gc_labst.
if the internal table is not initial then select the required fields
into an internal table
IF git_mard IS NOT INITIAL.
SELECT matnr werks lgort charg clabs
FROM mchb INTO TABLE git_mchb
FOR ALL ENTRIES IN git_mard
WHERE matnr EQ git_mard-matnr AND
werks EQ git_mard-werks AND
lgort EQ git_mard-lgort AND
lvorm EQ gc_null.
ENDIF.
IF git_mchb IS NOT INITIAL.
SELECT matnr meins FROM mara
INTO TABLE git_mara
FOR ALL ENTRIES IN git_mchb
WHERE matnr EQ git_mchb-matnr.
ENDIF.
‎2007 Feb 08 10:21 AM