2014 Mar 11 11:47 AM
Hello All,
I have written the following code in an user exit "EXIT_SAPLKASC_002" for costing CK11N or CK40N to pick up %'s from Z table.
*Create structure for additive costs
TYPES : BEGIN OF ty_data,
KSCHL TYPE KSCHL,
KOZGF TYPE kozgf,
DATAB TYPE datab,
DATBI TYPE datbi,
KOKRS TYPE kokrs,
AUFZA TYPE aufza,
BUKRS TYPE bukrs,
WERKS TYPE werks_d,
AUFZSCHL TYPE aufzschl,
MATNR TYPE matnr,
KBETR TYPE obetr,
KONWA TYPE konwa,
END OF ty_data.
data: gt_data type ty_data.
data: i_matnr TYPE matnr.
* Clear export parameters
clear: E_PCENT,
E_AMONT,
E_CURCY,
E_PERQT,
E_QUNIT.
* Material not held in Import structures....
get PARAMETER ID 'MAT' FIELD I_MATNR.
* Check if record exists on override table
select single * from ZFI_FR_DTY_HC into CORRESPONDING FIELDS OF gt_data
where matnr eq i_matnr
and kschl eq i_ohead
and bukrs eq i_komk-bukrs
and werks eq i_komp-werks
and datab le i_date
and datbi ge i_date
and aufzschl eq i_komk-zschl
and kokrs eq i_komk-kokrs.
* If record found check if percentage or amount
if sy-subrc = '0'.
case gt_data-konwa.
when '%'.
E_PCENT = gt_data-kbetr.
when others.
E_AMONT = gt_data-kbetr.
endcase.
endif.
It is working fine for single materials when I try to use CK11N but not working for multiple materials in CK40N? Any ideas how to use parameter id for multiple materials. The reason we are using parameter id for materials because SAP user exit doesn't populate MATNR in I_KOMP or i_komk import parameters.
Any help is highly appreciated.
Thanks,
Srini
2014 Mar 11 1:02 PM
hi Srini
Try to find other exit in this tcode where i_komp populated with MATNR, then export it to ABAP memory. EXPORT i_komp TO MEMORY ID 'MA1'.
Then back to this exit, import the ABAP memory. IMPORT itab FROM MEMORY ID 'MA1'.
hope can help you.
regards,
Archer
2014 Mar 11 1:38 PM
Hi Archer,
Thank you for your reply.
None of the userexits populate matnr in i_komp. Is there any other way?
Thanks,
Srini