Skip to Content
author's profile photo Former Member
Former Member

'BAPI_CONTRACT_CREATEFROMDATA' Characteristic Value Assignment

Hello Experts

I got a requirement where I need to create load program for contracts, then assign equipments and characteristic to the material in contracts. I am using BAPI 'BAPI_CONTRACT_CREATEFROMDATA' for this. Contract is getting created and equipment assignment is also happening. Only part left is to assign characteristics to material in contract

Table CONTRACT_CFGS_VALUE is provided in BAPI for this, does anyone knows how to pass the values to CONFIG_ID and INST_ID of this table .I tried different combinations but assignment is not happening in the contract. Any help will be appreciated.

Thanks,

Harkamal

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 08, 2009 at 08:34 PM

    Hi,

    I am not providing an answer to your solution but trying to find an answer to my issue that I posted here sometime back.

    Could you inform how you are populating the equipment in this BAPI?

    I am unable to find a field to populate the equipment in there.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Sure Ravi.. I can answer your question.

      I am using following 4 function modules in a sequence as below for contract creation and equipment assignment:

      'BAPI_CONTRACT_CREATEFROMDATA'

      'IWOL_WV_ADD_OBJECTS'

      'IWOL_WV_POST_OBJECT_LIST'

      'BAPI_TRANSACTION_COMMIT'

      Hope this help. Please someone answer my question too 😊

      Thanks,

      Harkamal

  • author's profile photo Former Member
    Former Member
    Posted on Jul 13, 2009 at 03:46 AM

    I found solution for this and thought of sharing this as lot of people are asking this question. Please see code below it works perfectly:

    data: header type BAPISDHD1,

    HEADer_X TYPE BAPISDHD1X,

    ITEM TYPE BAPISDITM occurs 0 WITH HEADER LINE,

    ITEM_X TYPE BAPISDITMX occurs 0 WITH HEADER LINE,

    PART TYPE BAPIPARNR occurs 0 WITH HEADER LINE,

    return TYPE BAPIRET2 OCCURS 0 WITH HEADER LINE,

    sd type BAPIVBELN-VBELN,

    obj type RIWOL1 OCCURS 0 WITH HEADER LINE,

    char type BAPICUVAL OCCURS 0 WITH HEADER LINE,

    cont type BAPICTR OCCURS 0 WITH HEADER LINE,

    contx TYPE BAPICTRX OCCURS 0 WITH HEADER LINE.

    data RSERXX type RSERXX OCCURS 0 WITH HEADER LINE.

    data: CFG_ref type BAPICUCFG OCCURS 0 WITH HEADER LINE,

    cfg_inst type BAPICUINS OCCURS 0 WITH HEADER LINE,

    cfg_partof TYPE BAPICUPRT OCCURS 0 WITH HEADER LINE.

    HEADER-DOC_TYPE = 'Z1'.

    HEADER-SALES_ORG = '1234'.

    HEADER-DISTR_CHAN = '01'.

    HEADER-DIVISION = '00'.

    header-ref_1 = 'My Reference'.

    header_X-UPDATEFLAG = 'I'.

    HEADER_X-DOC_TYPE = 'X'.

    HEADER_X-SALES_ORG = 'X'.

    HEADER_X-DISTR_CHAN = 'X'.

    HEADER_X-DIVISION = 'X'.

    header-ref_1 = 'X'.

    item-ITM_NUMBER = '000010'.

    item-MATERIAL = '0000000000123232'.

    item-TARGET_QTY = '1'.

    item-po_itm_no = '000010'.

    append item.

    item_X-ITM_NUMBER = '000010'.

    item_X-MATERIAL = 'X'.

    item_X-TARGET_QTY = 'X'.

    item_x-po_itm_no = 'X'.

    item_x-UPDATEFLAG = 'I'.

    append item_X.

    item-ITM_NUMBER = '000020'.

    item-MATERIAL = 'HIGH-PRIORITY'.

    item-TARGET_QTY = '1'.

    item-po_itm_no = '000020'.

    append item.

    item_X-ITM_NUMBER = '000020'.

    item_X-MATERIAL = 'X'.

    item_X-TARGET_QTY = 'X'.

    item_x-po_itm_no = 'X'.

    item_x-UPDATEFLAG = 'I'.

    append item_X.

    item-ITM_NUMBER = '000030'.

    item-MATERIAL = 'MATERIAL_3'.

    item-TARGET_QTY = '1'.

    item-po_itm_no = '000030'.

    append item.

    item_X-ITM_NUMBER = '000030'.

    item_X-MATERIAL = 'X'.

    item_X-TARGET_QTY = 'X'.

    item_x-po_itm_no = 'X'.

    item_x-UPDATEFLAG = 'I'.

    append item_X.

    part-PARTN_ROLE = 'AG'.

    part-PARTN_NUMB = 'Partner'.

    part-REFOBJTYPE = 'part_ref'.

    append part.

    cont-ITM_NUMBER = '000000'.

    cont-CON_ST_DAT = '20090808'.

    cont-CON_EN_DAT = '20101212'.

    APPEND cont.

    cont-ITM_NUMBER = '000010'.

    cont-CON_ST_DAT = '20090808'.

    cont-CON_EN_DAT = '20101212'.

    APPEND cont.

    cont-ITM_NUMBER = '000020'.

    cont-CON_ST_DAT = '20090808'.

    cont-CON_EN_DAT = '20101212'.

    APPEND cont.

    cont-ITM_NUMBER = '000030'.

    cont-CON_ST_DAT = '20090808'.

    cont-CON_EN_DAT = '20101212'.

    *cont-CON_ST_RUL = '5'.

    *cont-CON_EN_RUL = '8'.

    APPEND cont.

    contx-ITM_NUMBER = '000000'.

    contx-ITM_NUMBER = 'X'.

    contx-CON_ST_DAT = 'X'.

    contx-CON_EN_DAT = 'X'.

    contx-CON_ST_RUL = 'X'.

    contx-CON_EN_RUL = 'X'.

    contx-UPDATEFLAG = 'I'.

    APPEND cont.

    contx-ITM_NUMBER = '000010'.

    contx-ITM_NUMBER = 'X'.

    contx-CON_ST_DAT = 'X'.

    contx-CON_EN_DAT = 'X'.

    contx-CON_ST_RUL = 'X'.

    contx-CON_EN_RUL = 'X'.

    contx-UPDATEFLAG = 'I'.

    APPEND cont.

    contx-ITM_NUMBER = '000020'.

    contx-ITM_NUMBER = 'X'.

    contx-CON_ST_DAT = 'X'.

    contx-CON_EN_DAT = 'X'.

    contx-CON_ST_RUL = 'X'.

    contx-CON_EN_RUL = 'X'.

    contx-UPDATEFLAG = 'I'.

    APPEND cont.

    contx-ITM_NUMBER = '000030'.

    contx-ITM_NUMBER = 'X'.

    contx-CON_ST_DAT = 'X'.

    contx-CON_EN_DAT = 'X'.

    contx-CON_ST_RUL = 'X'.

    contx-CON_EN_RUL = 'X'.

    contx-UPDATEFLAG = 'I'.

    APPEND contx.

    *shiping condition 07

    cfg_ref-posex = '000020'.

    cfg_ref-config_id = '000001'.

    cfg_ref-root_id = '00000001'.

    append cfg_ref.

    cfg_ref-posex = '000030'.

    cfg_ref-config_id = '000002'.

    cfg_ref-root_id = '00000001'.

    append cfg_ref.

    cfg_inst-config_id = '000001'.

    cfg_inst-inst_id = '00000001'.

    cfg_inst-obj_type = 'MARA'.

    cfg_inst-class_type = '300'.

    cfg_inst-obj_key = 'CLASS1'.

    append cfg_inst.

    cfg_inst-config_id = '000002'.

    cfg_inst-inst_id = '00000001'.

    cfg_inst-obj_type = 'MARA'.

    cfg_inst-class_type = '300'.

    cfg_inst-obj_key = 'CLASS2'.

    append cfg_inst.

    char-CONFIG_ID = '000001'.

    char-INST_ID = '00000001'.

    char-CHARC = 'HIGH'.

    char-VALUE = 'C04'.

    append char.

    char-VALUE = 'C05'.

    append char.

    char-CHARC = 'HIGH-CODES'.

    char-VALUE = 'C02'.

    append char.

    char-VALUE = 'C03'.

    append char.

    char-CONFIG_ID = '000002'.

    char-CHARC = 'REGLABOR'.

    char-VALUE = '40'.

    APPEND char.

    char-CHARC = 'PREML'.

    APPEND char.

    CALL FUNCTION 'BAPI_CONTRACT_CREATEFROMDATA'

    EXPORTING

    • SALESDOCUMENTIN =

    CONTRACT_HEADER_IN = header

    CONTRACT_HEADER_INX = header_X

    • SENDER =

    • BINARY_RELATIONSHIPTYPE = ' '

    INT_NUMBER_ASSIGNMENT = 'X'

    • BEHAVE_WHEN_ERROR = ' '

    • LOGIC_SWITCH =

    • TESTRUN =

    • CONVERT = ' '

    IMPORTING

    SALESDOCUMENT = sd

    TABLES

    RETURN = return[]

    CONTRACT_ITEMS_IN = item[]

    CONTRACT_ITEMS_INX = item_X[]

    CONTRACT_PARTNERS = part[]

    • CONTRACT_CONDITIONS_IN =

    • CONTRACT_CONDITIONS_INX =

    CONTRACT_CFGS_REF = cfg_ref[]

    CONTRACT_CFGS_INST = cfg_inst[]

    • CONTRACT_CFGS_PART_OF =

    CONTRACT_CFGS_VALUE = char[]

    • CONTRACT_CFGS_BLOB =

    • CONTRACT_CFGS_VK =

    • CONTRACT_CFGS_REFINST =

    CONTRACT_DATA_IN = cont[]

    CONTRACT_DATA_INX = contx[]

    • CONTRACT_TEXT =

    • CONTRACT_KEYS =

    • EXTENSIONIN =

    • PARTNERADDRESSES =

    .

    obj-equnr = '000000000900000176'.

    append obj.

    CALL FUNCTION 'IWOL_WV_ADD_OBJECTS'

    EXPORTING

    I_SDAUFNR = sd

    I_SDPOSNR = '000020'

    TO_TYPE = 'SD'

    • I_KUNDE =

    • I_VBTYP =

    I_SD_AUART = 'ZS'

    • I_POSTYP =

    TABLES

    T_RIWOL1 = obj[]

    T_SER02 = RSERXX[]

    • T_RIWOL =

    EXCEPTIONS

    NO_OBJECT_LIST = 1

    ENTRY_EXISTS = 2

    INVALID_MATERIAL = 3

    INVALID_SERIALNR = 4

    INVALID_EQUIPMENT = 5

    INVALID_LOCATION = 6

    INVALID_ASSEMBLY = 7

    STATUS_NOT_ALLOWED = 8

    EQUI_FOREIGN_KEY = 9

    EQUI_SYSTEM_FAILURE = 10

    CUSTOMER_EXIT_ERROR = 11

    OTHERS = 12

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    CALL FUNCTION 'IWOL_WV_POST_OBJECT_LIST'

    EXPORTING

    I_SDAUFNR = sd

    I_SDPOSNR = '000020'

    TABLES

    I_SER02 = RSERXX[]

    EXCEPTIONS

    NO_OBJECT_LIST = 1

    OTHER_ERRORS = 2

    OTHERS = 3

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

    • EXPORTING

    • WAIT =

    • IMPORTING

    • RETURN =

    .

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.