09-28-2007 2:58 AM
hi,
my requirement is like below.
1)i have internal table it_mat_plant.
2)select plant type from zpalnt table for the it_mat_plant-werks.
3)if plant type = 'External mfg" then delete record other wise step 4.
4) select matnr mtart from MARA table into it_mara where matnr = it_mat_plant-matnr.
please tell me how to code this requirement.
please give me sample code
thanks
satish
09-28-2007 4:12 AM
Hi,
Use the below code for ref...
SELECT plant type
FROM zplant
INTO TABLE it_zplant
FOR ALL ENTRIES IN it_mat_plant
WHERE werks = it_mat_plant-werks.
IF sy-subrc = 0.
DELETE it_zplant WHERE plant_type = 'External mfg'.
ENDIF.
SELECT matnr mtart
FROM mara
INTO TABLE it_mara
FOR ALL ENTRIES IN it_mat_plant
WHERE matnr = it_mat_plant-matnr.
reward if helpful,
Karthik
Message was edited by:
Karthik
09-28-2007 4:12 AM
Hi,
Use the below code for ref...
SELECT plant type
FROM zplant
INTO TABLE it_zplant
FOR ALL ENTRIES IN it_mat_plant
WHERE werks = it_mat_plant-werks.
IF sy-subrc = 0.
DELETE it_zplant WHERE plant_type = 'External mfg'.
ENDIF.
SELECT matnr mtart
FROM mara
INTO TABLE it_mara
FOR ALL ENTRIES IN it_mat_plant
WHERE matnr = it_mat_plant-matnr.
reward if helpful,
Karthik
Message was edited by:
Karthik
09-28-2007 4:16 AM
Karthik, just to correct you.
SELECT plant type
FROM zplant
INTO TABLE it_zplant
FOR ALL ENTRIES IN it_mat_plant
WHERE werks = it_mat_plant-werks.
IF sy-subrc = 0.
DELETE it_zplant WHERE plant_type = 'External mfg'.
ENDIF.
SELECT matnr mtart
FROM mara
INTO TABLE it_mara
for all entries in it_mat_plant " missing for all entries
WHERE matnr = it_mat_plant-matnr.
Regards
Gopi
09-28-2007 4:19 AM