Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Parameter ID for multiple select - Materials MATNR

Former Member
0 Likes
1,271

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

2 REPLIES 2
Read only

Former Member
0 Likes
911

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

Read only

0 Likes
911

Hi Archer,

Thank you for your reply.

None of the userexits populate matnr in i_komp. Is there any other way?

Thanks,

Srini