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

Error in BAPI CAD_CREATE_BOM_WITH_SUB_ITEMS

thangam_perumal
Contributor
0 Likes
899

Dear Friends,

                     Am trying to Create BOM with Sub items . while using Standard FM (CAD_CREATE_BOM_WITH_SUB_ITEMS) it shows the error

Please refer my code

REPORT ZTEST_ABAP1  .

  data: bom_header     like cad_bicsk,

         bom_item       like cad_bom_item occurs 0 with header line,

         bom_sub_item   like cssubitem occurs 0 with header line,

         dms_class_data like cls_charac occurs 0 with header line,

         sap_field_data like rfcdmsdata occurs 0 with header line,

         e_return       like cad_return-value,

         e_message      like message-msgtx,

         e_message_len  like cad_return-message_len.

   clear: bom_header, bom_item, bom_sub_item.

   refresh: bom_item, bom_sub_item.

* fill BOM header

   bom_header-matnr = 'HBBT00006'.

   bom_header-werks = '1001'.

   bom_header-datuv = '19.11.2014'.

*  bom_header-stlal = '02'.

   bom_header-stlan = '1'.

*  bom_header-cadkz = ' '.

*  bom_header-bmeng = '1'.

*  bom_header-stktx = 'BOM text'.

*  bom_header-ztext = 'BOM textt'.

   clear:   bom_item, bom_sub_item.

   refresh: bom_item, bom_sub_item.

* fill item

   bom_item-upskz     = 'X'.

   bom_item-idnrk     = 'RALW00003'.

   bom_item-posnr     = '10'.

   bom_item-postp     = 'L'.

   bom_item-menge     = '1'.

   bom_item-meins     = 'KG'.

   append bom_item.

   bom_item-upskz     = 'X'.

   bom_item-idnrk     = 'RBOB00003'.

   bom_item-posnr     = '20'.

   bom_item-postp     = 'L'.

   bom_item-menge     = '1'.

    bom_item-meins     = 'NOS'.

   append bom_item.

* fill sub item

   bom_sub_item-posid = '0001'.

   bom_sub_item-ebort = 'test'.

   bom_sub_item-upmng = '1'.

   bom_sub_item-uposz = '0001'.

   bom_sub_item-uptxt = 'test'.

   append bom_sub_item.

   bom_sub_item-posid = '0002'.

   bom_sub_item-ebort = 'left'.

   bom_sub_item-upmng = '1'.

   bom_sub_item-uposz = '0001'.

   bom_sub_item-uptxt = 'left side'.

   append bom_sub_item.

* Call function

   call function 'CAD_CREATE_BOM_WITH_SUB_ITEMS'

        exporting

             i_bom_header   = bom_header

*            I_AUTO_POSNR   = ' '

        IMPORTING

             E_RETURN       = e_return

             E_MESSAGE      = e_message

             E_MESSAGE_LEN  = e_message_len

             E_BOM_HEADER   = bom_header

        tables

             bom_item       = bom_item

             bom_sub_item   = bom_sub_item

             dms_class_data = dms_class_data

             sap_field_data = sap_field_data

        exceptions

              others         = 1.




if anyone found mistake in my code.please suggest me.



Regards,

   Thangam.P

1 REPLY 1
Read only

thangam_perumal
Contributor
0 Likes
652

Hi ,

      Anyone Please suggest me. its quite urgent.

Regards,

  Thangam.P