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 creating Alternative BOM using IDOC_INPUT_BOMMAT

Former Member
0 Likes
2,118

Hi all,

I am trying to create an Alternative BOM using IDoc BOMMAT03.I have checked this IDoc will use FM IDOC_INPUT_BOMMAT inside.

In this function module, it is using FM CSAP_MAT_BOM_CREATE and CSAP_MAT_BOM_MAINTAIN to create and change.

This FM is allowing to create an Alterative BOM = '01' but it is not creating for Alt BOM = '02'.

Can anyone provide inputs on this .

Regards

Sathibabu

6 REPLIES 6
Read only

Former Member
0 Likes
1,437

Hi,

First try manually whether it is allowing you to creating the same or not.

Because as I guess, for the alternative bom of 02, there could be some more dependencies or restriction on usage of the main material itself.

Please check.

Regards,

Santhosh.

Read only

0 Likes
1,437

Hi ,

I am able to create the Alternative BOM through CS01 but it doesn't allow me when i use IDOC inbound Function module .

Read only

0 Likes
1,437

Hi Sathi Babu, Iam also having the same Issue while creating Alternate BOM by IDOC_INPUT_BOMMAT, able to create manualy.

STALL = '01'. is hard coded by SAP in IDOC_INPUT_BOMMAT, I tried to changed it many time in Debugging Mode still it is taking only '01'.

I am keep trying many time but not successfull, let me know if u had a solution for this issue that will be hlpful 4 me.

Advance Thanks

Bhaskar

Read only

Former Member
0 Likes
1,437

Hi Sathibabu,

I am facing same issue. Kindly help to solve the issue. I am waiting for your valuable reply.

Thanks,

Durai V

Read only

KiranJ
Active Participant
0 Likes
1,437

Hai Guy,

use below code for Alternate BOM with sub item .

Part 1.

DATA: bom_header     LIKE cad_bicsk,
      bom_item       type table of  cad_bom_item WITH HEADER LINE,
      bom_sub_item   type table of cssubitem WITH HEADER LINE,
      dms_class_data type table of cls_charac  WITH HEADER LINE,
      sap_field_data type table of rfcdmsdata  WITH HEADER LINE,
      e_return       LIKE cad_return-value,
      e_message      LIKE message-msgtx,
      e_message_len  LIKE cad_return-message_len.
DATA v_ITEM  TYPE I.
TYPES : BEGIN OF ty_data,
        level TYPE i,
        matnr TYPE cad_bicsk-matnr,
        werks TYPE werks_d,
        usage TYPE stlan,
        qty   TYPE cad_bom_item-menge,
        fqty type fmeng, " Quantity is Fixed
        sub_upmng type upmng,
        text type cad_bicsk-ztext,
        END OF ty_data.

DATA : it_data TYPE TABLE OF ty_data ,
       wa_data TYPE ty_data.

*
**---selection screen
PARAMETERS:p_file TYPE ibipparms-path OBLIGATORY.
*
**---f4 help for the file from PC
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
*
  PERFORM get_f4help.
*
*--start-of-selection .
START-OF-SELECTION.
*
PERFORM upload_file_itab.


CLEAR: bom_header, bom_item, bom_sub_item.
REFRESH: bom_item, bom_sub_item.

data : v_lineitem type SPOSN value '0000',
       v_slineitem type SPOSN value '0'.

  LOOP AT it_data INTO wa_data.

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = wa_data-matnr
    IMPORTING
      output = wa_data-matnr.

  IF wa_data-level = 0.

* fill BOM header
clear  bom_header.
      bom_header-matnr = wa_data-matnr. "'000000000200000016'.
*      bom_header-stlal = '1'. " Alternative Bom
      bom_header-werks = wa_data-werks. "'1000'.
      bom_header-stlan = wa_data-usage."'3'.
      bom_header-bmeng = wa_data-qty.
      bom_header-cadkz = 'X'.
      bom_header-stktx = wa_data-text.
*      bom_header-ztext = wa_data-text.
      bom_header-datuv = '01.10.2010'.

ELSEIF wa_data-level = 1.
* fill item
v_lineitem = v_lineitem + 10.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = v_lineitem
    IMPORTING
      output = v_lineitem.

*    bom_item-upskz     = 'X'.     " If We hav the Sub items Enable it.
    bom_item-idnrk     = wa_data-matnr. "'000000000200000017'.
    bom_item-posnr     = v_lineitem.
    bom_item-postp     = 'L'.
    bom_item-menge     = wa_data-qty. "'1'.
    bom_item-fmeng     = wa_data-fqty.
    APPEND bom_item.
    CLEAR: bom_item.

*** fill sub item
CLEAR V_ITEM .
v_slineitem = v_slineitem + 1.
ELSEIF wa_data-level = 2.

*  V_ITEM =  V_ITEM + 1.
*  bom_sub_item-posid = v_slineitem.
*  bom_sub_item-ebort = 'test'.
*  bom_sub_item-upmng = wa_data-sub_upmng.
*  bom_sub_item-uposz =  V_ITEM.
*  bom_sub_item-uptxt = 'test'.
*  append bom_sub_item.
*  clear bom_sub_item.

ENDIF.
if wa_data-level = 0.

 else.
at END OF LEVEL.
* 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.
  refresh bom_item.
  write : e_message.
  ENDAT.

ENDIF.
CLEAR wa_data.
endloop.

Read only

KiranJ
Active Participant
0 Likes
1,437

Part 2.

**&---------------------------------------------------------------------*
**&      Form  GET_F4HELP
**&---------------------------------------------------------------------*
FORM get_f4help .

  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      program_name  = syst-cprog
      dynpro_number = syst-dynnr
    IMPORTING
      file_name     = p_file.

ENDFORM.                    " GET_F4HELP
**&---------------------------------------------------------------------*
**&      Form  UPLOAD_FILE_ITAB
**&---------------------------------------------------------------------*
FORM upload_file_itab .

  DATA:v_file TYPE string.
  MOVE p_file TO v_file.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename            = v_file
      filetype            = 'ASC'
      has_field_separator = 'X'
    TABLES
      data_tab            = it_data
     EXCEPTIONS
     FILE_OPEN_ERROR               = 1
     FILE_READ_ERROR               = 2
     NO_BATCH                      = 3
     GUI_REFUSE_FILETRANSFER       = 4
     INVALID_TYPE                  = 5
     NO_AUTHORITY                  = 6
     UNKNOWN_ERROR                 = 7
     BAD_DATA_FORMAT               = 8
     HEADER_NOT_ALLOWED            = 9
     SEPARATOR_NOT_ALLOWED         = 10
     HEADER_TOO_LONG               = 11
     UNKNOWN_DP_ERROR              = 12
     ACCESS_DENIED                 = 13
     DP_OUT_OF_MEMORY              = 14
     DISK_FULL                     = 15
     DP_TIMEOUT                    = 16
     OTHERS                        = 17
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


ENDFORM.                    " UPLOAD_FILE_ITAB

when u people uploading the filat file use the

HEader Material as Level 0(zero)

All Components as level 1 (one).

I hope this code is use full for every one.

Regards

Sree.