BAPE_VBAK

Hey gurus,
in one of mu pgms i declared like this in Mysap  ERP version....
T_EXTENSIONIN      LIKE BAPIPAREX OCCURS 0 WITH HEADER LINE.
DATA: W_BAPE_VBAK  LIKE BAPE_VBAK
T_EXTENSIONIN-VALUEPART1 = W_BAPE_VBAK.
But i am getting erros like
1.T_EXTENSIONIN-VALUEPART1 and W_BAPE_VBAK are not mutually convertible in a Unicode program.
2.The enhancement specification of the structutre type BAPE_VBAK is not consistent.
How can we rectify this?
Regards

Hi,
T_EXTENSIONIN-VALUEPART1 field is 240 Char field.
and BAPE_VBAK is the structure with just a single field VBELN of char10.
How it will match?
Change the declarations.
Regards,
Anji

Similar Messages

  • BAPE_VBAK from 4.6c in ERP

    Hi,
    I assume I'm using the correct forum, if not please advise where to post this, thanks.
    Currently we are "upgrading" our R/3 4.6c to ERP and encountered a problem with the structure BAPE_VBAK. The error message reads like this (shortened):
    "The table or structure 'BAPE_VBAK' was enhanced by an append. In the target release, the required enhancement differs from the table or structure extensibility that is defined in the ABAP Dictionary. Error '2' has occurred [...]
    '2' Table or structure 'BAPE_VBAK' was enhanced by an append in the source release. I nthe target release, table or structure 'BAPE_VBAK' can only be enhanced by appends that contain character-type fields, however this append also contains non-character fields.
    I assume that his problem derives from a field of type CURR as all the other feilds are either of type CHAR or DATS.
    If this is true then I guess SAP has got some inconsitency inside the ERP Dictionary:
    The table VBAK can be enhanced (via an append) using a field of type CURR whereas the structure BAPE_VBAK cannot. This means any changes of VABK, using one of the various BAPI's, cannot be used for any currency like fields.
    How would you proceed in this case. Dismiss the currency field is not acceptable in this case.

    Wolfgang,
    yes, you're right. We are setting up a unicode system. But still I think that this problem occurs because of a slight inconsitency of both, structure and table VBAK.
    Reading both OSS notes I guess that there is no way to get around this problem and I will have to change the appropriate coding and use, as advised, some new structures.
    Thanks!
    Message was edited by:
            Michael Fritz

  • Error message is 'TYPE' is not a component of data object 'PAYLOAD'.

    Hello,
    I have sceanrio  where file->Synchronus bapi ->File.
    For this I have defined a  bpm.
    Text file inut will be read and converted using sender FCC.
    Bpm will call a synchronus bapi from r/3 and collect response. I need to create a success or error response file from the status of bapi response. I have used switch step to do that.
    But here when I give condtion as this XPath SOResonse./p1:Z_BAPI_SALESORDER_CREATEFROM3.Response/RETURN1/TYPE = S, SXI_CACHE gives status of bpm as 99 and error message is 'TYPE' is not a component of data object 'PAYLOAD'.
    At the same time if i just put a condition of simple type container variable (SuccessCounter = 0), it  gives status 0 in SXI_CACHE.
    Pl can anyone suggest on this as its urgent.
    thanks in advance,
    Sharada

    Thanks for quick response.
    Yes BAPI response has TYPE field.
    Pl cehck this response xml
    <?xml version="1.0" encoding="UTF-8" ?>
    - <rfc:Z_BAPI_SALESORDER_CREATEFROM3.Response xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    - <RETURN1>
      <TYPE>E</TYPE>
      <ID>V4</ID>
      <NUMBER>115</NUMBER>
      <MESSAGE>Purchase order number in document number: 304928 already exists</MESSAGE>
      <LOG_NO />
      <LOG_MSG_NO>000000</LOG_MSG_NO>
      <MESSAGE_V1>304928</MESSAGE_V1>
      <MESSAGE_V2 />
      <MESSAGE_V3 />
      <MESSAGE_V4 />
      <PARAMETER>SALES_HEADER_IN</PARAMETER>
      <ROW>0</ROW>
      <FIELD />
      <SYSTEM>DEV200</SYSTEM>
      </RETURN1>
      <SALESDOCUMENT />
    - <EXTENSIONIN>
    - <item>
      <STRUCTURE>BAPE_VBAK</STRUCTURE>
      <VALUEPART1>X</VALUEPART1>
      <VALUEPART2 />
      <VALUEPART3 />
      <VALUEPART4 />
      </item>
      </EXTENSIONIN>
      <ORDER_CCARD />
      <ORDER_CFGS_BLOB />
      <ORDER_CFGS_INST />
      <ORDER_CFGS_PART_OF />
      <ORDER_CFGS_REF />
      <ORDER_CFGS_REFINST />
      <ORDER_CFGS_VALUE />
      <ORDER_CFGS_VK />
      <ORDER_CONDITIONS_IN />
      <ORDER_CONDITIONS_INX />
      <ORDER_ITEMS_IN />
      <ORDER_ITEMS_INX />
    - <ORDER_KEYS>
    - <item>
      <REFOBJTYP />
      <REFOBJECT>HEADER</REFOBJECT>
      <REFOBJKEY />
      <REFLOGSYS />
      <DOC_NUMBER />
      <ITM_NUMBER>000000</ITM_NUMBER>
      <SCHED_LIN>0000</SCHED_LIN>
      <COND_NO />
      <CONDITEMNO>000000</CONDITEMNO>
      <COND_ST_NO>000</COND_ST_NO>
      <COND_COUNT>00</COND_COUNT>
      <COND_TYPE />
      <STATUS />
      <TINDEX>000000</TINDEX>
      <ADDRESS />
      <ABRLI>0000</ABRLI>
      <ABART />
      </item>
    - <item>
      <REFOBJTYP />
      <REFOBJECT>ADDRESS</REFOBJECT>
      <REFOBJKEY />
      <REFLOGSYS />
      <DOC_NUMBER />
      <ITM_NUMBER>000000</ITM_NUMBER>
      <SCHED_LIN>0000</SCHED_LIN>
      <COND_NO />
      <CONDITEMNO>000000</CONDITEMNO>
      <COND_ST_NO>000</COND_ST_NO>
      <COND_COUNT>00</COND_COUNT>
      <COND_TYPE />
      <STATUS />
      <TINDEX>000001</TINDEX>
      <ADDRESS />
      <ABRLI>0000</ABRLI>
      <ABART />
      </item>
    - <item>
      <REFOBJTYP />
      <REFOBJECT>ADDRESS</REFOBJECT>
      <REFOBJKEY />
      <REFLOGSYS />
      <DOC_NUMBER />
      <ITM_NUMBER>000000</ITM_NUMBER>
      <SCHED_LIN>0000</SCHED_LIN>
      <COND_NO />
      <CONDITEMNO>000000</CONDITEMNO>
      <COND_ST_NO>000</COND_ST_NO>
      <COND_COUNT>00</COND_COUNT>
      <COND_TYPE />
      <STATUS />
      <TINDEX>000002</TINDEX>
      <ADDRESS />
      <ABRLI>0000</ABRLI>
      <ABART />
      </item>
    - <item>
      <REFOBJTYP />
      <REFOBJECT>ADDRESS</REFOBJECT>
      <REFOBJKEY />
      <REFLOGSYS />
      <DOC_NUMBER />
      <ITM_NUMBER>000000</ITM_NUMBER>
      <SCHED_LIN>0000</SCHED_LIN>
      <COND_NO />
      <CONDITEMNO>000000</CONDITEMNO>
      <COND_ST_NO>000</COND_ST_NO>
      <COND_COUNT>00</COND_COUNT>
      <COND_TYPE />
      <STATUS />
      <TINDEX>000003</TINDEX>
      <ADDRESS />
      <ABRLI>0000</ABRLI>
      <ABART />
      </item>
    - <item>
      <REFOBJTYP />
      <REFOBJECT>ADDRESS</REFOBJECT>
      <REFOBJKEY />
      <REFLOGSYS />
      <DOC_NUMBER />
      <ITM_NUMBER>000000</ITM_NUMBER>
      <SCHED_LIN>0000</SCHED_LIN>
      <COND_NO />
      <CONDITEMNO>000000</CONDITEMNO>
      <COND_ST_NO>000</COND_ST_NO>
      <COND_COUNT>00</COND_COUNT>
      <COND_TYPE />
      <STATUS />
      <TINDEX>000004</TINDEX>
      <ADDRESS />
      <ABRLI>0000</ABRLI>
      <ABART />
      </item>
      </ORDER_KEYS>
    - <ORDER_PARTNERS>
    - <item>
      <PARTN_ROLE>RE</PARTN_ROLE>
      <PARTN_NUMB>LS-RETAIL</PARTN_NUMB>
      <ITM_NUMBER>000000</ITM_NUMBER>
      <TITLE />
      <NAME />
      <NAME_2 />
      <NAME_3 />
      <NAME_4 />
      <STREET />
      <COUNTRY />
      <COUNTR_ISO />
      <POSTL_CODE />
      <POBX_PCD />
      <POBX_CTY />
      <CITY />
      <DISTRICT />
      <REGION />
      <PO_BOX />
      <TELEPHONE />
      <TELEPHONE2 />
      <TELEBOX />
      <FAX_NUMBER />
      <TELETEX_NO />
      <TELEX_NO />
      <LANGU />
      <LANGU_ISO />
      <UNLOAD_PT />
      <TRANSPZONE />
      <TAXJURCODE />
      <ADDRESS />
      <PRIV_ADDR />
      <ADDR_TYPE />
      <ADDR_ORIG />
      <ADDR_LINK>0001</ADDR_LINK>
      <REFOBJTYPE />
      <REFOBJKEY />
      <REFLOGSYS />
      </item>
    - <item>
      <PARTN_ROLE>WE</PARTN_ROLE>
      <PARTN_NUMB>LS-RETAIL</PARTN_NUMB>
      <ITM_NUMBER>000000</ITM_NUMBER>
      <TITLE />
      <NAME />
      <NAME_2 />
      <NAME_3 />
      <NAME_4 />
      <STREET />
      <COUNTRY />
      <COUNTR_ISO />
      <POSTL_CODE />
      <POBX_PCD />
      <POBX_CTY />
      <CITY />
      <DISTRICT />
      <REGION />
      <PO_BOX />
      <TELEPHONE />
      <TELEPHONE2 />
      <TELEBOX />
      <FAX_NUMBER />
      <TELETEX_NO />
      <TELEX_NO />
      <LANGU />
      <LANGU_ISO />
      <UNLOAD_PT />
      <TRANSPZONE />
      <TAXJURCODE />
      <ADDRESS />
      <PRIV_ADDR />
      <ADDR_TYPE />
      <ADDR_ORIG />
      <ADDR_LINK>0002</ADDR_LINK>
      <REFOBJTYPE />
      <REFOBJKEY />
      <REFLOGSYS />
      </item>
    - <item>
      <PARTN_ROLE>Z1</PARTN_ROLE>
      <PARTN_NUMB>LS-RETAIL</PARTN_NUMB>
      <ITM_NUMBER>000000</ITM_NUMBER>
      <TITLE />
      <NAME />
      <NAME_2 />
      <NAME_3 />
      <NAME_4 />
      <STREET />
      <COUNTRY />
      <COUNTR_ISO />
      <POSTL_CODE />
      <POBX_PCD />
      <POBX_CTY />
      <CITY />
      <DISTRICT />
      <REGION />
      <PO_BOX />
      <TELEPHONE />
      <TELEPHONE2 />
      <TELEBOX />
      <FAX_NUMBER />
      <TELETEX_NO />
      <TELEX_NO />
      <LANGU />
      <LANGU_ISO />
      <UNLOAD_PT />
      <TRANSPZONE />
      <TAXJURCODE />
      <ADDRESS />
      <PRIV_ADDR />
      <ADDR_TYPE />
      <ADDR_ORIG />
      <ADDR_LINK>0003</ADDR_LINK>
      <REFOBJTYPE />
      <REFOBJKEY />
      <REFLOGSYS />
      </item>
    - <item>
      <PARTN_ROLE>AG</PARTN_ROLE>
      <PARTN_NUMB>LS-RETAIL</PARTN_NUMB>
      <ITM_NUMBER>000000</ITM_NUMBER>
      <TITLE />
      <NAME />
      <NAME_2 />
      <NAME_3 />
      <NAME_4 />
      <STREET />
      <COUNTRY />
      <COUNTR_ISO />
      <POSTL_CODE />
      <POBX_PCD />
      <POBX_CTY />
      <CITY />
      <DISTRICT />
      <REGION />
      <PO_BOX />
      <TELEPHONE />
      <TELEPHONE2 />
      <TELEBOX />
      <FAX_NUMBER />
      <TELETEX_NO />
      <TELEX_NO />
      <LANGU />
      <LANGU_ISO />
      <UNLOAD_PT />
      <TRANSPZONE />
      <TAXJURCODE />
      <ADDRESS />
      <PRIV_ADDR />
      <ADDR_TYPE />
      <ADDR_ORIG />
      <ADDR_LINK />
      <REFOBJTYPE />
      <REFOBJKEY />
      <REFLOGSYS />
      </item>
      </ORDER_PARTNERS>
      <ORDER_SCHEDULES_IN />
      <ORDER_SCHEDULES_INX />
    - <ORDER_TEXT>
    - <item>
      <DOC_NUMBER />
      <ITM_NUMBER>000020</ITM_NUMBER>
      <TEXT_ID>Z001</TEXT_ID>
      <LANGU>E</LANGU>
      <LANGU_ISO />
      <FORMAT_COL />
      <TEXT_LINE />
      <FUNCTION />
      </item>
    - <item>
      <DOC_NUMBER />
      <ITM_NUMBER>000030</ITM_NUMBER>
      <TEXT_ID>Z001</TEXT_ID>
      <LANGU>E</LANGU>
      <LANGU_ISO />
      <FORMAT_COL />
      <TEXT_LINE />
      <FUNCTION />
      </item>
    - <item>
      <DOC_NUMBER />
      <ITM_NUMBER>000040</ITM_NUMBER>
      <TEXT_ID>Z001</TEXT_ID>
      <LANGU>E</LANGU>
      <LANGU_ISO />
      <FORMAT_COL />
      <TEXT_LINE />
      <FUNCTION />
      </item>
    - <item>
      <DOC_NUMBER />
      <ITM_NUMBER>000050</ITM_NUMBER>
      <TEXT_ID>Z001</TEXT_ID>
      <LANGU>E</LANGU>
      <LANGU_ISO />
      <FORMAT_COL />
      <TEXT_LINE />
      <FUNCTION />
      </item>
    - <item>
      <DOC_NUMBER />
      <ITM_NUMBER>000020</ITM_NUMBER>
      <TEXT_ID>Z001</TEXT_ID>
      <LANGU>E</LANGU>
      <LANGU_ISO />
      <FORMAT_COL />
      <TEXT_LINE />
      <FUNCTION />
      </item>
    - <item>
      <DOC_NUMBER />
      <ITM_NUMBER>000030</ITM_NUMBER>
      <TEXT_ID>Z001</TEXT_ID>
      <LANGU>E</LANGU>
      <LANGU_ISO />
      <FORMAT_COL />
      <TEXT_LINE />
      <FUNCTION />
      </item>
    - <item>
      <DOC_NUMBER />
      <ITM_NUMBER>000040</ITM_NUMBER>
      <TEXT_ID>Z001</TEXT_ID>
      <LANGU>E</LANGU>
      <LANGU_ISO />
      <FORMAT_COL />
      <TEXT_LINE />
      <FUNCTION />
      </item>
    - <item>
      <DOC_NUMBER />
      <ITM_NUMBER>000050</ITM_NUMBER>
      <TEXT_ID>Z001</TEXT_ID>
      <LANGU>E</LANGU>
      <LANGU_ISO />
      <FORMAT_COL />
      <TEXT_LINE />
      <FUNCTION />
      </item>
      </ORDER_TEXT>
    - <PARTNERADDRESSES>
    - <item>
      <ADDR_NO>0001</ADDR_NO>
      <FORMOFADDR />
      <NAME />
      <NAME_2 />
      <NAME_3 />
      <NAME_4 />
      <C_O_NAME />
      <CITY />
      <DISTRICT />
      <CITY_NO />
      <POSTL_COD1 />
      <POSTL_COD2 />
      <POSTL_COD3 />
      <PO_BOX />
      <PO_BOX_CIT />
      <DELIV_DIS />
      <STREET />
      <STREET_NO />
      <STR_ABBR />
      <HOUSE_NO />
      <STR_SUPPL1 />
      <STR_SUPPL2 />
      <LOCATION />
      <BUILDING />
      <FLOOR />
      <ROOM_NO />
      <COUNTRY />
      <LANGU />
      <REGION />
      <SORT1 />
      <SORT2 />
      <TIME_ZONE />
      <TAXJURCODE />
      <ADR_NOTES />
      <COMM_TYPE />
      <TEL1_NUMBR />
      <TEL1_EXT />
      <FAX_NUMBER />
      <FAX_EXTENS />
      <STREET_LNG />
      <DISTRCT_NO />
      <CHCKSTATUS />
      <PBOXCIT_NO />
      <TRANSPZONE />
      <HOUSE_NO2 />
      <E_MAIL />
      <STR_SUPPL3 />
      <TITLE />
      <COUNTRYISO />
      <LANGU_ISO />
      <BUILD_LONG />
      <REGIOGROUP />
      <HOME_CITY />
      <HOMECITYNO />
      <PCODE1_EXT />
      <PCODE2_EXT />
      <PCODE3_EXT />
      <PO_W_O_NO />
      <PO_BOX_REG />
      <POBOX_CTRY />
      <PO_CTRYISO />
      <HOMEPAGE />
      <DONT_USE_S />
      <DONT_USE_P />
      <HOUSE_NO3 />
      <LANGU_CR />
      <LANGUCRISO />
      </item>
    - <item>
      <ADDR_NO>0002</ADDR_NO>
      <FORMOFADDR />
      <NAME>SUPERIOR SELECTED STONE</NAME>
      <NAME_2 />
      <NAME_3>33-53 10TH STREET</NAME_3>
      <NAME_4 />
      <C_O_NAME />
      <CITY />
      <DISTRICT />
      <CITY_NO />
      <POSTL_COD1 />
      <POSTL_COD2 />
      <POSTL_COD3 />
      <PO_BOX />
      <PO_BOX_CIT />
      <DELIV_DIS />
      <STREET />
      <STREET_NO />
      <STR_ABBR />
      <HOUSE_NO />
      <STR_SUPPL1 />
      <STR_SUPPL2 />
      <LOCATION />
      <BUILDING />
      <FLOOR />
      <ROOM_NO />
      <COUNTRY />
      <LANGU />
      <REGION />
      <SORT1 />
      <SORT2 />
      <TIME_ZONE />
      <TAXJURCODE />
      <ADR_NOTES />
      <COMM_TYPE />
      <TEL1_NUMBR />
      <TEL1_EXT />
      <FAX_NUMBER />
      <FAX_EXTENS />
      <STREET_LNG />
      <DISTRCT_NO />
      <CHCKSTATUS />
      <PBOXCIT_NO />
      <TRANSPZONE />
      <HOUSE_NO2 />
      <E_MAIL />
      <STR_SUPPL3 />
      <TITLE />
      <COUNTRYISO />
      <LANGU_ISO />
      <BUILD_LONG />
      <REGIOGROUP />
      <HOME_CITY />
      <HOMECITYNO />
      <PCODE1_EXT />
      <PCODE2_EXT />
      <PCODE3_EXT />
      <PO_W_O_NO />
      <PO_BOX_REG />
      <POBOX_CTRY />
      <PO_CTRYISO />
      <HOMEPAGE />
      <DONT_USE_S />
      <DONT_USE_P />
      <HOUSE_NO3 />
      <LANGU_CR />
      <LANGUCRISO />
      </item>
    - <item>
      <ADDR_NO>0003</ADDR_NO>
      <FORMOFADDR />
      <NAME>Langenscheidt Publishers Inc.</NAME>
      <NAME_2 />
      <NAME_3 />
      <NAME_4 />
      <C_O_NAME />
      <CITY />
      <DISTRICT />
      <CITY_NO />
      <POSTL_COD1 />
      <POSTL_COD2 />
      <POSTL_COD3 />
      <PO_BOX />
      <PO_BOX_CIT />
      <DELIV_DIS />
      <STREET />
      <STREET_NO />
      <STR_ABBR />
      <HOUSE_NO />
      <STR_SUPPL1 />
      <STR_SUPPL2 />
      <LOCATION />
      <BUILDING />
      <FLOOR />
      <ROOM_NO />
      <COUNTRY />
      <LANGU />
      <REGION />
      <SORT1 />
      <SORT2 />
      <TIME_ZONE />
      <TAXJURCODE />
      <ADR_NOTES />
      <COMM_TYPE />
      <TEL1_NUMBR />
      <TEL1_EXT />
      <FAX_NUMBER />
      <FAX_EXTENS />
      <STREET_LNG />
      <DISTRCT_NO />
      <CHCKSTATUS />
      <PBOXCIT_NO />
      <TRANSPZONE />
      <HOUSE_NO2 />
      <E_MAIL />
      <STR_SUPPL3 />
      <TITLE />
      <COUNTRYISO />
      <LANGU_ISO />
      <BUILD_LONG />
      <REGIOGROUP />
      <HOME_CITY />
      <HOMECITYNO />
      <PCODE1_EXT />
      <PCODE2_EXT />
      <PCODE3_EXT />
      <PO_W_O_NO />
      <PO_BOX_REG />
      <POBOX_CTRY />
      <PO_CTRYISO />
      <HOMEPAGE />
      <DONT_USE_S />
      <DONT_USE_P />
      <HOUSE_NO3 />
      <LANGU_CR />
      <LANGUCRISO />
      </item>
      </PARTNERADDRESSES>
    - <RETURN>
    - <item>
      <TYPE>E</TYPE>
      <ID>V4</ID>
      <NUMBER>115</NUMBER>
      <MESSAGE>Purchase order number in document number: 304928 already exists</MESSAGE>
      <LOG_NO />
      <LOG_MSG_NO>000000</LOG_MSG_NO>
      <MESSAGE_V1>304928</MESSAGE_V1>
      <MESSAGE_V2 />
      <MESSAGE_V3 />
      <MESSAGE_V4 />
      <PARAMETER>SALES_HEADER_IN</PARAMETER>
      <ROW>0</ROW>
      <FIELD />
      <SYSTEM>DEV200</SYSTEM>
      </item>
    - <item>
      <TYPE>E</TYPE>
      <ID>V4</ID>
      <NUMBER>219</NUMBER>
      <MESSAGE>Sales document was not changed</MESSAGE>
      <LOG_NO />
      <LOG_MSG_NO>000000</LOG_MSG_NO>
      <MESSAGE_V1 />
      <MESSAGE_V2 />
      <MESSAGE_V3 />
      <MESSAGE_V4 />
      <PARAMETER />
      <ROW>0</ROW>
      <FIELD />
      <SYSTEM>DEV200</SYSTEM>
      </item>
      </RETURN>
      </rfc:Z_BAPI_SALESORDER_CREATEFROM3.Response>

  • BAPI SALES ORDER & Copy with reference

    Hello,
    I'm creating sales order copied with reference to an invoice. My problem is that the data item is empty. When I create the sales order manually and use the option 'Create with reference' and choose an invoice, the sales order is created with all data item. I don't know how I can get to copy the data item from the invoice in the new sales order. The code that I'm using is the following:
    DATA: order_header_in      LIKE bapisdhd1,
          order_partners       LIKE bapiparnr OCCURS 0 WITH HEADER LINE,
          order_text           LIKE bapisdtext OCCURS 0 WITH HEADER LINE,
          order_header_inx     LIKE bapisdhd1x,
          order_item_in        LIKE bapisditm OCCURS 0 WITH HEADER LINE,
          order_schedules_in   LIKE bapischdl OCCURS 0 WITH HEADER LINE,
          order_conditions_in  LIKE bapicond OCCURS 0 WITH HEADER LINE,
          extensionin          LIKE bapiparex OCCURS 0 WITH HEADER LINE,
          partneraddresses     LIKE bapiaddr1 OCCURS 0 WITH HEADER LINE,
          order_cfgs_ref       like BAPICUCFG occurs 0 with header line.
    DATA: salesdocument LIKE bapivbeln-vbeln.
    DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    order_header_in-doc_type   = 'ZA09'.
    order_header_in-sales_org  = '1700'.
    order_header_in-distr_chan = '01'.
    order_header_in-division   = '01'.
    order_header_in-BILL_DATE   = '20060701'.
    order_header_in-ref_doc    = '0900000019'.
    order_header_in-refdoc_cat = 'M'.
    *order_header_in-REF_DOC_L_LONG = '0900000019'.
    order_header_in-purch_no_c  ='prueba'.
    *order_header_in-ord_reason = '003'.
    *order_header_in-pmnttrms   = '0002'.
    *order_header_in-sales_off  = '2800'.
    order_header_in-ref_doc_l  = 'FACTURA ES'.
    *order_header_in-fix_val_dy = '20060701'.
    *order_header_in-currency   = 'USD'.
    *order_header_in-exchg_rate = '1.2'.
    order_partners-partn_role = 'AG'.
    order_partners-partn_numb = '0000000001'.
    order_partners-langu      = 'EN'.
    order_partners-name       = 'El corte aleman'.
    order_partners-country = 'ES'.
    APPEND order_partners.
    order_partners-partn_role = 'RE'.
    order_partners-partn_numb = 'ARR000'.
    order_partners-addr_link  = '0000030044'.
    APPEND order_partners.
    CALL FUNCTION 'ADDR_GET_COMPLETE_ALL_TYPES'
      EXPORTING
        addrnumber                 = order_partners-addr_link
      PERSNUMBER                 =
        address_object_type        = '1'
      IV_CURRENT_COMM_DATA       = 'X'
    IMPORTING
      ADDR1_COMPLETE             =
      ADDR2_COMPLETE             =
      ADDR3_COMPLETE             =
       ADDR1_COMPLETE_BAPI        = partneraddresses
      ADDR2_COMPLETE_BAPI        =
      ADDR3_COMPLETE_BAPI        =
    EXCEPTIONS
      PARAMETER_ERROR            = 1
      ADDRESS_NOT_EXIST          = 2
      PERSON_NOT_EXIST           = 3
      INTERNAL_ERROR             = 4
      OTHERS                     = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    data: vl_texto(40) value 'NUEVOOOOO'.
    partneraddresses-name    = vl_texto. clear vl_texto.
    partneraddresses-name_2  = vl_texto.
    partneraddresses-name_3  = vl_texto.
    partneraddresses-name_4  = vl_texto.
    partneraddresses-langu   = 'E'.
    APPEND partneraddresses.
    DATA: vl_cantidad LIKE bapisditm-target_qty.
    vl_cantidad = 1.
    order_item_in-itm_number = 10.
    order_item_in-material = 'HONORARIOS'.
    order_item_in-ref_doc = '0900000019'.
    order_item_in-ref_doc_it = 10.
    order_item_in-ref_doc_ca = 'M'.
    APPEND order_item_in.
    order_schedules_in-itm_number = 10.
    order_schedules_in-req_qty = vl_cantidad.
    APPEND order_schedules_in.
    order_text-text_id = 'Z001'.
    order_text-ITM_NUMBER = ''.
    order_text-langu = 'EN'.
    order_text-text_line = 'Hola, CARACOLAcola'.
    APPEND order_text.
    order_text-text_id = 'Z001'.
    order_text-langu = 'EN'.
    order_text-text_line = 'Adios caracol'.
    APPEND order_text.
    order_text-itm_number = '000010'.
    order_text-text_id = '0001'.
    order_text-langu = 'EN'.
    order_text-text_line = 'Hola, POSICIÓN'.
    APPEND order_text.
    extensionin-structure = 'BAPE_VBAK'.
    extensionin-valuepart1 = '          BCL  7'.
    APPEND extensionin.
    order_cfgs_ref-posex = '10'.
    order_cfgs_ref-config_id = '10'.
    order_cfgs_ref-root_id = '00000001'.
    append order_cfgs_ref.
    CALL FUNCTION 'ZBAPI_SALESORDER_CREATEFROMDT2'
      EXPORTING
       SALESDOCUMENTIN               =  salesdocument
        order_header_in               =  order_header_in
       ORDER_HEADER_INX              =  order_header_inx
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
    IMPORTING
       salesdocument                 = salesdocument
      TABLES
        return                        = return
        order_items_in                = order_item_in
      ORDER_ITEMS_INX               =
        order_partners                = order_partners
        order_schedules_in            = order_schedules_in
      ORDER_SCHEDULES_INX           =
        order_conditions_in           = order_conditions_in
      ORDER_CONDITIONS_INX          =
        ORDER_CFGS_REF                = order_cfgs_ref
      ORDER_CFGS_INST               =
      ORDER_CFGS_PART_OF            =
      ORDER_CFGS_VALUE              =
      ORDER_CFGS_BLOB               =
      ORDER_CFGS_VK                 =
      ORDER_CFGS_REFINST            =
      ORDER_CCARD                   =
        order_text                    = order_text
      ORDER_KEYS                    =
       extensionin                   = extensionin
        partneraddresses              = partneraddresses
    PERFORM  report TABLES return.
    *DATA: salesdocument LIKE bapivbeln-vbeln.
    *DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    *refresh return.
    *CALL FUNCTION 'BAPI_SALESDOCUMENT_COPY'
    EXPORTING
       salesdocument          = '0400000191'
       documenttype           = 'ZA04'
      TESTRUN                = ' '
    IMPORTING
       SALESDOCUMENT_EX       = salesdocument
    TABLES
       RETURN                 = return
    *PERFORM  report TABLES return.
    *write: / salesdocument.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT          =
    IMPORTING
      RETURN        =
    *&      Form  report
          text
         -->P_MENSAJE  text
    FORM report  TABLES   p_mensaje STRUCTURE bapiret2.
      DATA: vl_mensaje TYPE string.
      LOOP AT return.
        CLEAR vl_mensaje.
        MESSAGE ID     return-id
                TYPE   return-type
                NUMBER return-number
                INTO   vl_mensaje
                WITH   return-message_v1
                       return-message_v2
                       return-message_v3
                       return-message_v4.
        WRITE: / vl_mensaje.
      ENDLOOP.
    ENDFORM.                    " report

    Hi Manuel,
    There are some function modules which is there to copy the order details. I am not sure about the function module name. But you can search in SE37. But bapi for creating the sales order does not have the functionality of copying the data from one document to another document.
    You can try using this function module.
    BAPI_SALESDOCUMENT_COPY
    Data will be copied based on the copy control routines that is set between the two document types.
    Thanks,
    Arun

  • WBS element not populating at item level

    Hi Gurus,
    <br>I am trying to create a new sales order using the function module SD_SALESDOCUMENT_CREATE but when i pass a <br>value for the WBS element at item level it is not getting populated in the back end system.
    <br>
    <br>  data :LT_RETURN                     TYPE TABLE OF  BAPIRET2,
    <br>         LT_SALES_ITEMS_IN             TYPE STANDARD TABLE OF  BAPISDITM,
    <br>         LT_SALES_ITEMS_INX            TYPE TABLE OF  BAPISDITMX ,
    <br>        LT_SALES_PARTNERS             TYPE TABLE OF  BAPIPARNR ,
    <br>        LT_SALES_SCHEDULES_IN         TYPE TABLE OF  BAPISCHDL ,
    <br>        LT_SALES_SCHEDULES_INX        TYPE TABLE OF  BAPISCHDLX ,
    <br>        LT_SALES_CONDITIONS_IN        TYPE TABLE OF  BAPICOND ,
    <br>        LT_SALES_CONDITIONS_INX       TYPE TABLE OF  BAPICONDX,
    <br>        LT_SALES_CFGS_REF             TYPE TABLE OF  BAPICUCFG ,
    <br>        LT_SALES_CFGS_INST            TYPE TABLE OF  BAPICUINS ,
    <br>        LT_SALES_CFGS_PART_OF         TYPE TABLE OF  BAPICUPRT,
    <br>        LT_SALES_CFGS_VALUE           TYPE TABLE OF  BAPICUVAL ,
    <br>        LT_SALES_CFGS_BLOB            TYPE TABLE OF  BAPICUBLB ,
    <br>        LT_SALES_CFGS_VK              TYPE TABLE OF  BAPICUVK ,
    <br>        LT_SALES_CFGS_REFINST         TYPE TABLE OF  BAPICUREF ,
    <br>        LT_SALES_CCARD                TYPE TABLE OF  BAPICCARD ,
    <br>        LT_SALES_TEXT                 TYPE TABLE OF  BAPISDTEXT ,
    <br>        LT_SALES_KEYS                 TYPE TABLE OF  BAPISDKEY ,
    <br>        LT_SALES_CONTRACT_IN          TYPE TABLE OF  BAPICTR ,
    <br>        LT_SALES_CONTRACT_INX         TYPE TABLE OF  BAPICTRX,
    <br>        LT_EXTENSIONIN                TYPE TABLE OF  BAPIPAREX ,
    <br>        LT_PARTNERADDRESSES           TYPE TABLE OF  BAPIADDR1 ,
    <br>        LT_SALES_SCHED_CONF_IN        TYPE TABLE OF  BAPISCHDL2 ,
    <br>        LT_ITEMS_EX                   TYPE TABLE OF  BAPISDIT ,
    <br>        LT_SCHEDULE_EX                TYPE TABLE OF  BAPISDHEDU ,
    <br>        LT_BUSINESS_EX                TYPE TABLE OF  BAPISDBUSI ,
    <br>        LT_INCOMPLETE_LOG             TYPE TABLE OF  BAPIINCOMP ,
    <br>        LT_EXTENSIONEX                TYPE TABLE OF  BAPIPAREX ,
    <br>        LT_CONDITIONS_EX              TYPE TABLE OF  BAPICOND ,
    <br>        LT_PARTNERS_EX                TYPE TABLE OF  BAPISDPART ,
    <br>        LT_TEXTHEADERS_EX             TYPE TABLE OF  BAPISDTEHD ,
    <br>       LT_TEXTLINES_EX               TYPE TABLE OF  BAPITEXTLI ,
    <br>       LT_BATCH_CHARC                TYPE TABLE OF  BAPIBTSEL ,
    <br>        LT_CAMPAIGN_ASGN              TYPE TABLE OF  BAPISDCA ,
    <br>        LT_CONDITIONS_KONV_EX         TYPE TABLE OF  KONV .
    <br>
    <br>  DATA: LV_SALESDOCUMENT_EX           TYPE           BAPIVBELN-VBELN,
    <br>        LT_SALES_HEADER_OUT           TYPE           BAPISDHD,
    <br>        LT_SALES_HEADER_STATUS        TYPE           BAPISDHDST.
    <br>
    <br>  DATA: LV_VALUE_SALESDOCUMENT        TYPE           BAPIVBELN-VBELN,
    <br>        LT_SALES_HEADER_IN            TYPE           BAPISDHD1,
    <br>        LT_SALES_HEADER_INX           TYPE TABLE OF  BAPISDHD1X,
    <br>        LT_SENDER                     TYPE TABLE OF  BDI_LOGSYS,
    <br>        LV_BINARY_RELATIONSHIPTYPE    TYPE           BRELTYP-RELTYPE,
    <br>        LV_INT_NUMBER_ASSIGNMENT      TYPE           BAPIFLAG-BAPIFLAG VALUE 'R',
    <br>        LV_BEHAVE_WHEN_ERROR          TYPE           BAPIFLAG-BAPIFLAG VALUE ' ',
    <br>        LT_LOGIC_SWITCH               TYPE TABLE OF  BAPISDLS,
    <br>        LV_BUSINESS_OBJECT            TYPE           BAPIUSW01-OBJTYPE VALUE ' ',
    <br>        LT_TESTRUN                    TYPE TABLE OF  BAPIFLAG-BAPIFLAG ,
    <br>        LV_CONVERT_PARVW_AUART        TYPE           BAPIFLAG-BAPIFLAG VALUE ' ',
    <br>        LV_STATUS_BUFFER_REFRESH      TYPE           BAPIFLAG-BAPIFLAG VALUE 'X',
    <br>        LV_CALL_ACTIVE                TYPE           CHAR4.
    <br>
    <br>  DATA: WA_SALES_PARTNERS             LIKE LINE OF   LT_SALES_PARTNERS,
    <br>        WA_SALES_SCHEDULES_IN         LIKE LINE OF   LT_SALES_SCHEDULES_IN,
    <br>        WA_SALES_CONDITIONS_IN        LIKE LINE OF   LT_SALES_CONDITIONS_IN,
    <br>        WA_EXTENSIONIN                LIKE LINE OF   LT_EXTENSIONIN,
    <br>        WA_SALES_ITEMS_IN             LIKE LINE OF   LT_SALES_ITEMS_IN,
    <br>        WA_SALES_TEXT                 LIKE LINE OF   LT_SALES_TEXT.
    <br>
    <br>  LT_SALES_HEADER_IN-DOC_TYPE       = 'ZSAL'.
    <br>  LT_SALES_HEADER_IN-SALES_ORG      = '1000'.
    <br>  LT_SALES_HEADER_IN-DISTR_CHAN     = '02'.
    <br>  LT_SALES_HEADER_IN-DIVISION       = '01'.
    <br>  LT_SALES_HEADER_IN-PMNTTRMS       = 'Z020'.
    <br>  LT_SALES_HEADER_IN-DUN_COUNT      = '0'.
    <br>  LT_SALES_HEADER_IN-ADD_VAL_DY     = '00'.
    <br>  LT_SALES_HEADER_IN-EXCHG_RATE     = '0'.
    <br>   LT_SALES_HEADER_IN-BILL_DATE      = SY-DATUM.
    <br>
    <br>data lv_kunnr type kunnr value '106475'.
    <br>
    <br>CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    <br>  EXPORTING
    <br>    INPUT         = lv_kunnr
    <br> IMPORTING
    <br>   OUTPUT        = lv_kunnr.
    <br>
    <br>  WA_SALES_PARTNERS-PARTN_ROLE      = 'AG'.
    <br>  WA_SALES_PARTNERS-PARTN_NUMB      = lv_kunnr.
    <br>  APPEND WA_SALES_PARTNERS TO LT_SALES_PARTNERS.
    <br>
    <br>  WA_SALES_PARTNERS-PARTN_ROLE      = 'WE'.
    <br>  WA_SALES_PARTNERS-PARTN_NUMB      = lv_kunnr.
    <br>  APPEND WA_SALES_PARTNERS TO LT_SALES_PARTNERS.
    <br>
    <br>  WA_SALES_TEXT-ITM_NUMBER = '000010'.
    <br>  WA_SALES_TEXT-TEXT_ID = 'ZS01'.
    <br>  WA_SALES_TEXT-LANGU =  SY-LANGU.
    <br>  APPEND WA_SALES_TEXT TO LT_SALES_TEXT.
    <br>
    <br>  WA_SALES_TEXT-ITM_NUMBER = '000010'.
    <br>  WA_SALES_TEXT-TEXT_ID = '3010'.
    <br>  WA_SALES_TEXT-LANGU =  SY-LANGU.
    <br>  APPEND WA_SALES_TEXT TO LT_SALES_TEXT.
    <br>
    <br>  WA_SALES_SCHEDULES_IN-ITM_NUMBER  = '000010'.
    <br>  WA_SALES_SCHEDULES_IN-REQ_QTY     = '22'.
    <br>  APPEND WA_SALES_SCHEDULES_IN TO LT_SALES_SCHEDULES_IN.
    <br>
    <br>  WA_SALES_CONDITIONS_IN-ITM_NUMBER = '000010'.
    <br>  WA_SALES_CONDITIONS_IN-COND_TYPE  = 'ZMAN'.
    <br>  WA_SALES_CONDITIONS_IN-CURRENCY   = 'NOK' .
    <br>  APPEND WA_SALES_CONDITIONS_IN TO LT_SALES_CONDITIONS_IN.
    <br>
    <br>  WA_EXTENSIONIN-STRUCTURE          = 'BAPE_VBAK'.
    <br> *  WA_EXTENSIONIN-VALUEPART1         = '090000000200'.
    <br>  APPEND WA_EXTENSIONIN TO LT_EXTENSIONIN.
    <br>
    <br>data lv_MATNR type MATNR value '000000000000000031'.
    <br>
    <br>CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    <br>  EXPORTING
    <br>    INPUT         = lv_MATNR
    <br> IMPORTING
    <br>   OUTPUT        = lv_MATNR.
    <br>
    <br>  WA_SALES_ITEMS_IN-ITM_NUMBER      = '10'.
    <br>  WA_SALES_ITEMS_IN-MATERIAL        = lv_MATNR.
    <br>  WA_SALES_ITEMS_IN-TARGET_QTY      = '1'.
    <br>  WA_SALES_ITEMS_IN-TARGET_QU       = 'ST'.
    <br>  WA_SALES_ITEMS_IN-SHORT_TEXT      = 'TESST AJ'.
    <br>  WA_SALES_ITEMS_IN-SALES_UNIT      = 'ST'.
    <br>  WA_SALES_ITEMS_IN-CURRENCY        = 'NOK'.
    <br>  WA_SALES_ITEMS_IN-WBS_ELEM        = '011215'.
    <br>  APPEND WA_SALES_ITEMS_IN TO LT_SALES_ITEMS_IN.
    <br>
    <br>  DATA : WA_ORDER_ITEMS_INX TYPE BAPISDITMX.
    <br>  DATA : LT_ORDER_ITEMS_INXN TYPE STANDARD TABLE OF BAPISDITMX.
    <br>  DATA : WA_ORDER_HEADER_INX TYPE BAPISDHD1X.
    <br>  DATA : LT_ORDER_HEADER_INXN TYPE STANDARD TABLE OF BAPISDHD1X.
    <br>
    <br>  WA_ORDER_ITEMS_INX-UPDATEFLAG = ' '.
    <br>  WA_ORDER_ITEMS_INX-ITM_NUMBER = '000010'.
    <br>  WA_ORDER_ITEMS_INX-MATERIAL        = 'X'.
    <br>  WA_ORDER_ITEMS_INX-TARGET_QTY      = 'X'.
    <br>  WA_ORDER_ITEMS_INX-TARGET_QU       = 'X'.
    <br>  WA_ORDER_ITEMS_INX-SHORT_TEXT      = 'X'.
    <br>  WA_ORDER_ITEMS_INX-SALES_UNIT      = 'X'.
    <br>    WA_ORDER_ITEMS_INX-WBS_ELEM   = 'X'.
    <br>
    <br>  APPEND WA_ORDER_ITEMS_INX TO LT_ORDER_ITEMS_INXN.
    <br>
    <br>  CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
      <br>   EXPORTING
    <br>     SALESDOCUMENT                 = LV_VALUE_SALESDOCUMENT
    <br>      SALES_HEADER_IN               = LT_SALES_HEADER_IN
    <br>*     SALES_HEADER_INX              =
    <br>*     SENDER                        =
    <br>*     BINARY_RELATIONSHIPTYPE       = ' '
    <br>     INT_NUMBER_ASSIGNMENT         = LV_INT_NUMBER_ASSIGNMENT
    <br>*     BEHAVE_WHEN_ERROR             = ' '
    <br>*     LOGIC_SWITCH                  = ' '
    <br>     BUSINESS_OBJECT               = ' '
    <br>*     TESTRUN                       =
    <br>*     CONVERT_PARVW_AUART           = ' '
    <br>     STATUS_BUFFER_REFRESH         = 'X'
    <br>*     CALL_ACTIVE                   = ' '
    <br>   IMPORTING
    <br>     SALESDOCUMENT_EX              = LV_SALESDOCUMENT_EX
    <br>     SALES_HEADER_OUT              = LT_SALES_HEADER_OUT
    <br>     SALES_HEADER_STATUS           = LT_SALES_HEADER_STATUS
    <br>   TABLES
    <br>     RETURN                        = LT_RETURN
    <br>     SALES_ITEMS_IN                = LT_SALES_ITEMS_IN
    <br>*     SALES_ITEMS_INX               =
    <br>     SALES_PARTNERS                = LT_SALES_PARTNERS
    <br>     SALES_SCHEDULES_IN            = LT_SALES_SCHEDULES_IN
    <br>*     SALES_SCHEDULES_INX           =
    <br>     SALES_CONDITIONS_IN           = LT_SALES_CONDITIONS_IN
    <br>*     SALES_CONDITIONS_INX          =
    <br>*     SALES_CFGS_REF                =
    <br>*     SALES_CFGS_INST               =
    <br>*     SALES_CFGS_PART_OF            =
    <br>*     SALES_CFGS_VALUE              =
    <br>*     SALES_CFGS_BLOB               =
    <br>*     SALES_CFGS_VK                 =
    <br>*     SALES_CFGS_REFINST            =
    <br>*     SALES_CCARD                   =
    <br>     SALES_TEXT                    = LT_SALES_TEXT
    <br>*     SALES_KEYS                    =
    <br>*     SALES_CONTRACT_IN             =
    <br>*     SALES_CONTRACT_INX            =
    <br>     EXTENSIONIN                   = LT_EXTENSIONIN
    <br>*     PARTNERADDRESSES              =
    <br>*     SALES_SCHED_CONF_IN           =
    <br>     ITEMS_EX                      = LT_ITEMS_EX
    <br>     SCHEDULE_EX                   = LT_SCHEDULE_EX
    <br>*     BUSINESS_EX                   =
    <br>*     INCOMPLETE_LOG                =
    <br>     EXTENSIONEX                   = LT_EXTENSIONEX
    <br>*     CONDITIONS_EX                 =
    <br>*     PARTNERS_EX                   =
    <br>*     TEXTHEADERS_EX                =
    <br>*     TEXTLINES_EX                  =
    <br>*     BATCH_CHARC                   =
    <br>*     CAMPAIGN_ASGN                 =
    <br>*     CONDITIONS_KONV_EX            =
    <br>.
    <br>
    <br> commit work.
    <br>
    <br>I am aware that there are other BAPI's available to create  a new sales order(BAPI_SALESORDER_CREATEFROMDAT2  <br>etc.) but the problem with using them is they internally call the same function module 'SD_SALESDOCUMENT_CREATE'. i  <br>have already tried to create the sales order using  'BAPI_SALESORDER_CREATEFROMDAT' but the effect is the same.
    <br>When I pass WBS element value in VA01 and create a sales order I can see that WBS element value is coming correctly.  <br>But when i create the sales order using ABAP code WBS element is coming as blank. When I execute this standard FM it  <br>creates the sales order correctly with a blank against WBS element. I checked in the VBAP table the value is not even  <br>populated there . Kindly share your valuable inputs for the same.
    - Akshay

    May be you have to post this in ABAP forum to get suitable suggestions.
    G. Lakshmipathi

  • Populating Customized fields in Sales Order Creation using BAPI

    Hi All,
    I have a requirement that, I need to populate 2 customized fields which are appedned in the VBAK tables through Append structure. I am using BAPI_SALESORDER_CREATEFROMDAT2 FM for creating it.
    Could anybody tell me how to send these 2 coustomized field values in this BAPI using EXTERNIN parameter.
    Regards
    Rajesh
    [email protected]

    Hi,
    To add data to custom fields there are two appraoches.
    <b>1)</b>Using the <b>EXTENSIONIN</b> in the Tables option in the FM <b>BAPI_SALESORDER_CREATEFROMDAT2</b>
    Check the Documentation for the same,
    <b>Customer Enhancement for VBAK, VBAP, VBEP</b>
    <i>Description</i>
    You can use this parameter to transfer user-specific enhancments to a BAPI. The customer has to complete the EXTENSION structure and the system automatically continues processing it. If you have not defined any user-specific fields, then you can transfer a blank EXTENSIONIN structure.
    <b>Technical information about Customer Enhancements</b>
    The following description uses an example to explain how to proceed with customer enhancements to the SD tables VBAK, VBKD, VBAP and VBEP.
    The customer has added their own fields to table VBAP using the INCLUDE structure CUTEST. This structure contains 2 fields:
    CFIELD1, CHAR 10
    CFIELD2, CHAR 3.
    The customer also requires that these two fields can be maintained with the BAPI.
    1. Maintain structure CUTEST in table VBAP
    2. Because the BAPIs work with checkboxes, you must also define a CUTESTX checkbox for the customer structure. It should be structured like this:
    Field name       Data element
    CFIELD1            CHAR1
    CFIELD2          CHAR1
    3. Define these customer structures in the structures VBAPKOZ und VBAPKOZX using INCLUDE or APPEND.
    4. Add the customer structures to the BAPE_VBAP and BAPE_VBAPX BAPI structures using the APPEND technique.
    5. Adjust the following structures for customer enhancements to table VBAK:
    a) VBAKKOZ
    b) VBAKKOZX
    c) BAPE_VBAK
    d) BAPE_VBAKX
    6. Adjust the following structures for customer enhancements to table VBEK:
    a) VBEPKOZ
    b) VBEPKOZX
    c) BAPE_VBEP
    d) BAPE_VBEPX
    7. Generally, the data should be added to the BAPI interface in the internal communication structures (VBAKKOM, and so on). There, you can process the data in the SD tables (VBAK, and so on).
    8. If the EXTENSIONIN parameter contains customer data, you must complete at least the key fields in the relevant standard parameters.
    <i>For example:</i>
    You want to change customer field VBAP-CFIELD2 for item 20 to "XYZ" in order 4711.
    The following entries are expected:
    Import:     BAPIVBELN-VBELN       = '0000004711'  Document number
                BAPISDHD1X-UPDATEFLAG = 'U'           UPDKZ for doc header
    Tables:     BAPISDITM-ITM_NUMBER  = '000020'      Item number
                BAPISDITMX-ITM_NUMBER = '000020'      Item number
              + BAPISDITMX-UPDATEFLAG = 'U'           UPDKZ for item
    You must complete the EXTENSION table as follows:
    STRUCTURE                          VALUEPART1       1234561234567890123
    BAPE_VBAP                       0000004711000020                 XYZ
    BAPE_VBAPX                      0000004711000020       X
    <b>Further Information</b>
    You can find more information in the BAPI programming guide in the chapter for enhancements to BAPIs.
    Notes
    You must complete the STRUCTURE field with the name of the relevant enhancement structure (BAPE_VBAK, BAPE_VBAP, BAPE_VBEP). You can complete the remaining fields with the append structures from the enhancement structures.
    At the moment, you can use the BAPI to store enhancements in the following structures:
    VBAK : An enhancement to header data requires an append structure to BAPE_VBAK and an enhancement to structure VBAKKOZ.
    VBAP : An enhancement to item data requires an append structure to BAPE_VBAP and an enhancment to structure VBAPKOZ.
    VBEP : An enhancement to schedule line data requires an append structure to BAPE_VBEP and an enhancement to structure VBEPKOZ.
    VBKD : If you are using an enhancement for header data, you must add an append structure to BAPE_VBAK. You also need to enhance structure VBAKKOZ. If it is for item data, you need to add an append structure to BAPE_VBAP. You must also enhance structure VBAPKOZ.
    If you also want to work with checkboxes, each X-structure must also contain an append structure.
    For example:
    A customer has created an order and wants to include the material long text (50 digits long).
    The EXTENSIONIN structure must be completed with BAPE_VBAP. Two fields have fixed definitions in this structure. These are in the VBAP host key (VBELN, POSNR). The customer sets up an append structure that contains field ZMAT50.
    Because the VBELN is normally blank when you create an order, the data can look like this:
    STRUCTURE   |BAPE_VBAP
    <b>2)</b> Create the Sales Document using the FM and when successfully craeted you will get the Sales Document No in the Export parameter <b>SALESDOCUMENT</b>.
    After its created and Committed using <b>BAPI_TRANSACTION_COMMIT</b> , do a <b>BDC</b> recording for the same to (<b>VA02</b> Change Sales Order) update the fields only and save the document.
    Regards,
    AS

  • Replication of custom z fields from CRM to ECC

    Hello,
    I have created custom fields in CRM - Order using EEWB.  Similarly I have created custom fields in ECC - VBAK.  I want to replicate these custom fields from CRM to ECC.  Somebody had suggested to use CRM_DATAEXCHG_BADI and method -  CRM_DATAEXCHG_AFTER_BAPI_FILL.  Can anybody give me a sample code of how to populate table - CT_BAPIPAREX within this method? 
    Process followed was -
    1. ECC - Extend VBAK with zfld1
    2. ECC - Extend BAPE_VBAK, BAPE_VBAKX with zfld1
    3. CRM - Add zdoc1 using EEWB
    4. CRM -  Extend BAPE_VBAK, BAPE_VBAKX with zfld1 (same as ECC?)
    5. CRM -  CRM_DATAEXCHG_BADI and method -  CRM_DATAEXCHG_AFTER_BAPI_FILL. - This is where I need to map zdoc1 of CRM to zfld1 of ECC.  And then populate CT_BAPIIPAREX.  This is where I am stuck. 
    Thanks!

    HI,
    If you have added field in EEWB chosen R/3 Adapter, then it will also enhance the Exchange structures and thus i guess CRM_DATAXCHange_badi shud contain in one of its changing parameters
    The following blogs gives a good idea in the similar lines.
    /people/vikash.krishna/blog/2009/07/21/exchange-ecc-customer-master-standard-field-with-the-crm-z-fields-ecc--crm
    /people/vikash.krishna/blog/2009/07/14/crm-70-how-to--4-adding-custom-fields-with-the-new-application-enhancement-tool-aet
    Revert if you need further help.
    -Satish

  • Prblm in Extnsn of VBAK : Quotation creation BAPI_QUOTATION_CREATEFROMDATA2

    Hi ALL,
    Problem in Extension of VBAK during Quotation creation Using BAPI BAPI_QUOTATION_CREATEFROMDATA2.
    I have some Custom field of VBAK in Addional data tab B of transaction VA22.
    I am populating these fields using BAPI_QUOTATION_CREATEFROMDATA2.
    Passing table parameter EXTENSIONIN as shown below.
    some of the fields are getting updated with these BAPI but some are not.
    Say for example I added two custom field ZRORD and ZEON in table VBAK and Addional data tab B screen as well.
    To get these field updated by BAPI I appended these two fields  in structure VBAKKOZ ,VBAKKOZX and BAPE_VBAK.
    Field ZRORD is getting updated but facing problem with ZEON.Please help.
    For ur info,If I run transaction VA22 and enter some value in ZEON and click on SAVE then its getting updated.
    w_bapiparex-structure   = 'BAPE_VBAK'.
    w_bape_vbak-zrord = 'xxX'.
    w_bape_vbak-zeon = 'x'.
    w_bapiparex-valuepart1  = w_bape_vbak.
    APPEND w_bapiparex TO t_bapiparex.
    Roshan

    Hi singh,
    Try with this code.
    data: w_bapi_vbak_in type bape_vbakx.
       w_bapi_vbak_in-zrord  = 'X'.
       w_bapi_vbak_in-zeon = 'X'.
    w_bapiparex-structure = 'BAPE_VBAKX'.
    w_bapiparex-valuepart1 = w_bapi_vbak_in.
    append  w_bapiparex to t_bapiparex.
    Regards,
    Raji.

  • ISA B2B Generic SAP R/3 Extensions

    Hi All,
    I am just going through the ISA tutorials as described in the ISA Extension Guide.
    Unfortunately there seems to be many problems with the Extensions Demo 5 which
    could have partly been solved but right now it stucks at Extension Demo5 Approach 3.
    I think this is more a general issue realted to how to use the generic SAP R/3
    extensions.
    The idea of this tutorial is to set the deliver block in R/3 for an order, so that the users
    chose a delivery block ID depending on which the corresponding delivery block is then set on R/3 site.
    Inside backendobject-config.xml is the following entry:
    <config isa:extends="../config[@id='r3pidefault']">
          <businessObject type="EXTENSION_DOCUMENT_CREATE" name="EXTENSION_DOCUMENT_CREATE">
                                    <params>
                                            <param name="fields" value="LIFSK,2"/>
                                    </params>
          </businessObject>
          <businessObject type="EXTENSION_DOCUMENT_READ" name="EXTENSION_DOCUMENT_READ" >
                                    <params>
                                            <param name="fields" value="LIFSK,2"/>
                                    </params>
          </businessObject>
    </config>
    The structure VBAK contains the field LIFSK with the data element LIFSK which is
    linked to the DLV_BLOCK field containing the actual delivery value of the sales
    document (order).
    I followed the instructions and created the append structure BAPE_VBAK that contains
    component LIFSK of component type LIFSK.
    Class Z_OrderR3 extends OrderR3 overwrites updateInBackend(SalesDocumentData posd, ...) method like:
    //fetch the delivery id from the R/3 version of the document
    if (isExistsInR3()){
        // DeliveryBlock.EXT_KEY_DELIVBLOCK_HEADER == LIFSK
        posd.getHeaderData().addExtensionData(DeliveryBlock.EXT_KEY_DELIVBLOCK_HEADER,
        getDocumentR3Status().getHeader().getExtensionData(DeliveryBlock.EXT_KEY_DELIVBLOCK_HEADER));
    this code is never executed because isExistsInR3() returns false. If the if-statement is
    deleted a null pointer exception is thrown by getDocumentR3Status(). I also tried this
    code snipset in saveInBackend() which behaves alike.
    So why does isExistsInR3() return fales? It should exist at that point of time. Shouldn't
    it?
    And what does "LIFSK,2" in backendobject-config.xml mean? Why is there ",2"?
    Another thing is that reading the delivery block out of the R/3 also does not work.
    If the user clicks on an order number within the ISA web-shop the method
    Z_OrderR3.setDeliveryBlockText(SalesDocumentData ordr, ...) is called. There is this
    code:
        HeaderData header = ordr.getHeaderData();
        //DeliveryBlock.EXT_KEY_DELIVBLOCK_HEADER == LIFSK
        (String) header.getExtensionData(DeliveryBlock.EXT_KEY_DELIVBLOCK_HEADER);
    which returns null.
    Any clue what is going wrong here? Could this be a bug or did I lose sight on sth?
    We are using Web-As 6.20 and ISA 4.0 SP11.
    Help is highly appreciated.
    Best Regards and Thanks in Advance,
    Martin Muellenberg

    Hi Martin,
    although I cannot determine the exact reason for your problems I can give some coding help on the items below, because from what I have seen the below code will never work...
    First I see that you are extending the r3pidefault configuration, is this the configuration you are using, if not adjust to the appropriate one. If this is ok, then good work, I had a lot of problems one searching for this one...
    in backend-object-config.xml you should have structures like:
    <businessObject type="EXTENSION_DOCUMENT_CREATE" name="EXTENSION_DOCUMENT_CREATE">
             <params>
                    <param name="structure" value="BAPE_VBAK"/>
                    <param name="fields" value="LIFSK,2"/>
             </params>
    </businessObject>
    where bape_vbak is the name of the structure in R/3 or CRM you wish to extend
    you could also make a BAPE_VBAP for extensions at item level but I guess you will not be needing it here.
    The LFISK ,2 means that an extensionfield exists in your R/3 structure BAPE_VBAK at that it has length 2. The fields of the extension structures always get passed on as strings and the same order and length should be maintained on the java and R/3 side. (in your case only 1 field so no problem).
    Normally now for both your extended methods (there are 4 in total you extend only create and read) this field should be available and you can just access them on the appropriate header by :
    String LFISK = (String)  <some header>.getExtensionData("LFISK");
    <some header>.addExtensionData("LFISK", some string);
    I hope this helps a little bit, I know the application is a little hard at first to get into,
    if you keep having problems, post a copy of your extension structure as well so we can make a comparison.
    Regards,
    Allan

  • BAPI for Sales Order Creation.

    Hello gurus,
    I want to create a sales order using BAPI.
    I have tried some BAPI's like BAPI_SALESORDER_CREATEFROMDAT1, BAPI_SALESORDER_CREATEFROMDAT2, BAPI_SALESORDER_CREATEFROMDATA, BAPI_SALESDOCU_CREATEWITHDIA.
    But I am not able to update the Miscellaneous Information like Mode of transport(VBAP-OIC_MOT), Forwarding Agent(VBAP-OIC_LIFNR), Base Location(VBAP-OIA_BASELO), Truck Number(VBAP-OIC_TRUCKN), Pipeline trip No.(VBAP-OIC_PTRIP), Pipeline operator´s external batch number(VBAP-OIC_PBATCH).
    Is there any other BAPI thru which i can update these fields while creation of Sales Order.
    The Fields which I can provide to BAPI as import parameter is:
    Order Type(VBAK-AUART),
    Contract(VBAK_VGBEL),
    SALES Org (VBAK-VGORT),
    Dist Channel(VBAK-VTWEG),
    Division (VBAK-SPART),
    Open Quantity (VBAK-KWMENG)
    Plant(VBAP-WERKS)
    Storage Location (VBAP-LGORT)
    Mode of transport(VBAP-OIC_MOT), Forwarding Agent(VBAP-OIC_LIFNR), Base Location(VBAP-OIA_BASELO), Truck Number(VBAP-OIC_TRUCKN), Pipeline trip No.(VBAP-OIC_PTRIP), Pipeline operator´s external batch number(VBAP-OIC_PBATCH).
    Thanks In Advance,
    Points will be rewarded for Best Solution......
    Yogesh Sharma

    hi,
    I can give u a suggestion .. try it ..
    its a quite a long process....
    in BAPI_SALESORDER_CREATEFROMDAT2
    there is a table EXTENSIONIN...
    here u can add append structure and carry on ur sales order creation
    Follow the process
    Customer Enhancement for VBAK, VBAP, VBEP
    Description
    You can use this parameter to transfer user-specific enhancments to a BAPI. The customer has to complete the EXTENSION structure and the system automatically continues processing it. If you have not defined any user-specific fields, then you can transfer a blank EXTENSIONIN structure.
    Technical information about Customer Enhancements
    The following description uses an example to explain how to proceed with customer enhancements to the SD tables VBAK, VBKD, VBAP and VBEP.
    The customer has added their own fields to table VBAP using the INCLUDE structure CUTEST. This structure contains 2 fields:
    CFIELD1, CHAR 10
    CFIELD2, CHAR 3.
    The customer also requires that these two fields can be maintained with the BAPI.
    1. Maintain structure CUTEST in table VBAP
    2. Because the BAPIs work with checkboxes, you must also define a CUTESTX checkbox for the customer structure. It should be structured like this:
    Field name       Data element
    CFIELD1            CHAR1
    CFIELD2          CHAR1
    3. Define these customer structures in the structures VBAPKOZ und VBAPKOZX using INCLUDE or APPEND.
    4. Add the customer structures to the BAPE_VBAP and BAPE_VBAPX BAPI structures using the APPEND technique.
    5. Adjust the following structures for customer enhancements to table VBAK:
    a) VBAKKOZ
    b) VBAKKOZX
    c) BAPE_VBAK
    d) BAPE_VBAKX
    6. Adjust the following structures for customer enhancements to table VBEK:
    a) VBEPKOZ
    b) VBEPKOZX
    c) BAPE_VBEP
    d) BAPE_VBEPX
    7. Generally, the data should be added to the BAPI interface in the internal communication structures (VBAKKOM, and so on). There, you can process the data in the SD tables (VBAK, and so on).
    8. If the EXTENSIONIN parameter contains customer data, you must complete at least the key fields in the relevant standard parameters.
    For example:
    You want to change customer field VBAP-CFIELD2 for item 20 to "XYZ" in order 4711.
    The following entries are expected:
    Import:     BAPIVBELN-VBELN       = '0000004711'  Document number
                BAPISDHD1X-UPDATEFLAG = 'U'           UPDKZ for doc header
    Tables:     BAPISDITM-ITM_NUMBER  = '000020'      Item number
                BAPISDITMX-ITM_NUMBER = '000020'      Item number
              + BAPISDITMX-UPDATEFLAG = 'U'           UPDKZ for item
    You must complete the EXTENSION table as follows:
    STRUCTURE                          VALUEPART1       1234561234567890123
    BAPE_VBAP                       0000004711000020                 XYZ
    BAPE_VBAPX                      0000004711000020       X
    Further Information
    You can find more information in the BAPI programming guide in the chapter for enhancements to BAPIs.
    Notes
    You must complete the STRUCTURE field with the name of the relevant enhancement structure (BAPE_VBAK, BAPE_VBAP, BAPE_VBEP). You can complete the remaining fields with the append structures from the enhancement structures.
    At the moment, you can use the BAPI to store enhancements in the following structures:
    VBAK : An enhancement to header data requires an append structure to BAPE_VBAK and an enhancement to structure VBAKKOZ.
    VBAP : An enhancement to item data requires an append structure to BAPE_VBAP and an enhancment to structure VBAPKOZ.
    VBEP : An enhancement to schedule line data requires an append structure to BAPE_VBEP and an enhancement to structure VBEPKOZ.
    VBKD : If you are using an enhancement for header data, you must add an append structure to BAPE_VBAK. You also need to enhance structure VBAKKOZ. If it is for item data, you need to add an append structure to BAPE_VBAP. You must also enhance structure VBAPKOZ.
    If you also want to work with checkboxes, each X-structure must also contain an append structure.
    For example:
    A customer has created an order and wants to include the material long text (50 digits long).
    The EXTENSIONIN structure must be completed with BAPE_VBAP. Two fields have fixed definitions in this structure. These are in the VBAP host key (VBELN, POSNR). The customer sets up an append structure that contains field ZMAT50.
    Because the VBELN is normally blank when you create an order, the data can look like this:
    STRUCTURE   |BAPE_VBAP
    VALUEPART1  |          000010Customermateriallongtext50
                  VBELN     POSNR ZMAT50

  • Short dump in bapi

    hi gurus,
           i have a z-bapi (Z_BAPI_SB_SALESORDER_CREATE), where i added some import parameters(z-fields),
    i need to populate these fields on the sales order screen 'additional data B'.. In the structure bape_vbak which in turn has a append structure zabap_vbak i added the z-fields..
    now in the source code of Z_BAPI_SB_SALESORDER_CREATE  added the following code
    Data :
      customdatavbak  LIKE bape_vbak,
      w_bape_vbakx TYPE bape_vbakx.
    wvbak_bape_vbakx type bape_vbakx
    if i_usertype <> 'NBSS'.
            MOVE I_BILLING_TYPE_OTHER to customdatavbak-ZZOBILLTYP.
           MOVE I_TYPE_SALES_ORDER_OTHER to customdatavbak-ZZOSOTYPE.
    MOVE I_BILLING_COMPANY to customdatavbak-ZZBILCO.
    MOVE I_BILLING_CONTACT_COMPANY to customdatavbak-ZZBILCNM.
    MOVE I_BUSINESS_CONTACT_NAME to customdatavbak-ZZBUSCNM.
    MOVE I_PROJECT_NAME to customdatavbak-ZZPRJNM.
    MOVE I_BELL_REFERENCE_NO to customdatavbak-ZZBELLREF.
    MOVE I_PS_CONTRACT_MGMT_PRIME to customdatavbak-ZZPSCMPRM.
    MOVE 'BAPE_VBAK'         TO IT_EXTENSIONIN-structure.
            MOVE customdatavbak      TO IT_EXTENSIONIN-valuepart1.
            MOVE customdatavbak+240  TO IT_EXTENSIONIN-valuepart2.
            MOVE customdatavbak+480  TO IT_EXTENSIONIN-valuepart3.
            APPEND IT_EXTENSIONIN.
    add check box info for: Billing Type, Other Billing Type,
                 Type of Sales Order, Other Type of Salers Order.
                 to VBAK.
          w_bape_vbakx-ZZBILLTYPE = 'X'.
          w_bape_vbakx-ZZOBILLTYP = 'X'.
          w_bape_vbakx-ZZSOTYPE = 'X'.
          w_bape_vbakx-ZZOSOTYPE = 'X'.
          wvbak_bape_vbakx-ZZBILCNM = 'X'.
          wvbak_bape_vbakx-ZZBUSCNM = 'X'.
          wvbak_bape_vbakx-ZZPRJNM = 'X'.
          wvbak_bape_vbakx-ZZBELLREF = 'X'.
          wvbak_bape_vbakx-ZZPSCMPRM = 'X'.
          wvbak_bape_vbakx-ZZBILCO = 'X'.
          MOVE : 'BAPE_VBAKX'  TO IT_EXTENSIONIN-structure,
                  w_bape_vbakx TO IT_EXTENSIONIN-valuepart1.
          MOVE: wvbak_bape_vbakx TO IT_EXTENSIONIN-valuepart2.
          APPEND IT_EXTENSIONIN.
          clear IT_EXTENSIONIN.
    After this i am calling the FMCALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
               EXPORTING
                    order_header_in     = IT_ORDER_HEADER
               IMPORTING
                    salesdocument       = E_SALESDOCUMENT
               TABLES
                    return              = T_RETURNTBL
                    order_items_in      = IT_ORDER_ITEMS_IN
                    order_partners      = IT_ORDER_PARTNERS
                    order_schedules_in  = IT_ORDER_SCHED_IN
                    order_conditions_in = IT_ORDER_COND_IN
                    order_text          = IT_ORDER_TEXT
                    extensionin         = IT_EXTENSIONIN.
    but in the include LVBAK001 i am getting short dump  SAYING "Invalid subfield access: Offset and length too large"
    THIS IS THE PLACE I AM GETTING DUMP
    Daten übertragen * CHECKMAN / UNICODE
                  call method cl_abap_container_utilities=>fill_container_c
                       exporting
                          im_value     = da_bape_vbak
                       importing
                          ex_container = ch_parex+lenstruc(da_length_bape_vbak)
                       exceptions
                          illegal_parameter_type = 1
                          others                 = 2.
    PLEASE HELP ME...

    issue solved

  • Sales Order BAPI Extension

    Hi,
        We would like to pass custom fields data to Custom screens in VA01 Standard Sales Order. For that we are extending standard BAPI BAPI_SALESORDER_CREATEFROMDAT2 using EXTENSION parameter. We have appended custom structures to VBAKKOZ. VBAKKOZX, BAPE_VBAK,BAPE_VBAKX and able to pass information from portal upto 480 characters using
    valuepart1 and valuepart2.
    But when we are trying to extend it further, standard sales order BAPI
    BAPI_SALESORDER_CREATEFROMDAT2 is going to dump at :
             CALL METHOD cl_abap_container_utilities=>fill_container_c
                            EXPORTING
                               im_value     = da_bape_vbap
                            IMPORTING
                               ex_container =
    ch_parex+lenstruc(da_length_bape_vbap)
                            EXCEPTIONS
                               illegal_parameter_type = 1
                               OTHERS                 = 2.
    We need to extend it up to 900 chars.
    Any help on this will be greatly apprecited.
    Thanks
    Kalyan

    I found shortly after posting my message that the notes had not been correctly applied as the Notes Assistant ended with an error, and the error that resulted in this failure had not been corrected.  The basis folks failed to inform me that this error had occured in applying the notes.  I discovered it through testing.  Had you applied the notes and run into the same error?
    When we subsequently corrected for this, the issue with lenstruc went away and everything appears to be OK.  The real problem was that due to the error in the Notes Assistant the updated version of LVBAKTOP with the definition of lenstruc did not get activated.  It was left in a state where it needed an SSCR key to be applied manually, which should all have been handled automatically with SNOTE.
    Once this was done and the source was activated, the original error went away.  The two notes seem to have solved the original Unicode issue as well.
    We still have this update in the development area only since the CRM enhancements that caused the original problem with an append to the VBAK structure are also still in development.   We will be testing those changes together before moving everything up.  If there are any further issues that come up, I'll let you know.
    What I am wondering is if you had a similar problem applying the above notes, since the problem went away for us when the notes to handle the Unicode conversion were properly applied.
    Brian
    Edited by: Brian Sammond on Jul 24, 2008 10:55 AM

  • BAPI_SALESORDER_CHANGE -Problem in Background

    Hi all,
    There is a requirement to change pricing conditions in Sales order.The pricing condition is based some values passed in tab
    additional data B. Am using the standard BAPI for modifying the value.
    But the changed pricing appears only when the SO is opened in Change mode but not in display mode.On adding the
    LOGIC_SWITCH -PRICING = 'B', this problem was eliminated.But now wat happens is if there are two pricing conditions, only the first condition appears in display mode whereas both conditions appear in change mode.
    Tried adding LOGIC_SWITCH --cond_handl = 'X' but to no avail, still the same. can anyone help me please.
    This problemm is faced only wen the BAPI_SALESORDER_CHANGE is run in Background.
    Else everything is fine in Foreground.
    Thanks in advance.

    HI kavitha
    I used the same bapi to update pricing field for sales order.
    Please specify which fields you want to update.
    are these fields present in bapi import or tables parameters.
    If no then these fields are Z fields and they have to be enhanced in tables first and then in exit.
    below is the demo program to pass z fields (ZZAGMID ) in bapi ( note : tables has to be enhanced before )
    this code will help u to understand how to update z fields
    let me if you are not able to follow..
    REPORT  ZTEST_BAPI.
    PARAMETERS: P_VBELN TYPE VBAK-VBELN,
                p_posnr TYPE vbap-posnr,
                P_AGMID type BAPE_VBAP-ZZAGMID.
    DATA: T_LINE LIKE BAPISDITM OCCURS 0 WITH HEADER LINE.
    DATA: T_LINEX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE.
    DATA: T_EXTEN LIKE BAPIPAREX OCCURS 0 WITH HEADER LINE.
    DATA: T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
    DATA: BAPE_VBAP LIKE BAPE_VBAP.
    DATA: BAPE_VBAPX LIKE BAPE_VBAPX.
    DATA: ORDER_HEADERX LIKE BAPISDH1X.
    DATA: BAPE_VBAK type BAPE_VBAK .
    DATA: BAPE_VBAKX LIKE BAPE_VBAKX.
    DATA: W_RETURN LIKE BAPIRET2.
    data: v_val TYPE BAPIPAREX-VALUEPART1.
    data: v_number(5) TYPE c.
    ORDER_HEADERX-UPDATEFLAG = 'U'.
    T_LINE-ITM_NUMBER = p_posnr.
    T_LINE-PLANT = '5AP1'.
    APPEND T_LINE.
    T_LINEX-ITM_NUMBER = p_posnr.
    T_LINEX-UPDATEFLAG = 'U'.
    T_LINEX-PLANT = 'X'.
    APPEND T_LINEX.
    T_EXTEN-STRUCTURE = 'BAPE_VBAP'.
    BAPE_VBAP-vbeln = p_vbeln.
    BAPE_VBAP-posnr = p_posnr.
    BAPE_VBAP-ZZAGMID = P_AGMID.
    T_EXTEN+30 = BAPE_VBAP.
    APPEND t_exten.
    BAPE_VBAPX-VBELN = P_VBELN.
    BAPE_VBAPX-POSNR = p_posnr.
    BAPE_VBAPX-ZZAGMID = 'X'.
    T_EXTEN-STRUCTURE = 'BAPE_VBAPX'.
    T_EXTEN+30 = BAPE_VBAPX.
    APPEND T_EXTEN.
    IMPORT v_number from MEMORY ID v_number.
    BREAK-POINT.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = p_vbeln
    order_header_inx = ORDER_HEADERX
    tables
    return = T_RETURN
    ORDER_ITEM_IN = T_LINE
    ORDER_ITEM_INX = T_LINEX
    EXTENSIONIN = T_EXTEN.
    call function 'BAPI_TRANSACTION_COMMIT'
    * EXPORTING
    * WAIT =
    * IMPORTING
    * RETURN =
    CLEAR: W_RETURN.
    LOOP AT T_RETURN INTO W_RETURN.
    WRITE: W_RETURN-MESSAGE,/.
    ENDLOOP.

  • Extension for BAPI_SALESORDER_CREATEFROMDAT2

    Hi everybody,
    could anyone please help me, I have to create a sales order with BAPI_SALESORDER_CREATEFROMDAT2.
    there is 2 customer fields in table VBAK, I checked the documentation for the bapi extensions parameters and I dont understand how should the structures VBAKKOZ  and VBAKKOZX be processed.
    could anyone explain me about this structures??

    Follow this steps for the field in the extension:
    1. Append one structure in BAPE_VBAK with the fields which need to be changed.
    E.g. append strucutre name ZZAPE_VBAK and fields ZZ_Z1 and ZZ_Z2 with its original type.
    2. Append one structure in BAPE_VBAKX with the fields with one character fields.
    E.g. append strucutre name ZZAPE_VBAKX. Here Fields ZZ_Z1 and ZZ_Z2 must be of type CHAR1.
    3. Append the same fields of the structure which was appended in the BAPE_VBAK to VBAKKOZ.
    E.g. Append strucutre Name ZZ_VBAKKOZ and fields ZZ_Z1 and ZZ_Z2 with its original type.
    4. Append the same structure which was appended in the BAPE_VBAKX to VBAKKOZX.
    E.g. Append strucutre Name ZZ_VBAKKOZX. Here Fields ZZ_Z1 and ZZ_Z2 must be of type CHAR1.
    To use it in the program:
    * Fill the ZZ fields
        t_ext-structure = 'BAPE_VBAK'.      "Structure with the fields
        t_ext-valuepart1+0(10) = v_vbeln.
        t_ext-valuepart1+10(10) = V_ZZ1 .  " value of the ZZ_Z1 field
        append t_ext.
    *  Mark for changes
        t_ext-structure = 'BAPE_VBAKX'.     " Structure with the flags
        t_ext-valuepart1+0(10) = v_vbeln.
        t_ext-valuepart1+10(1) = 'X'.
        append t_ext.
    Regards,
    Naimesh Patel

  • Getting error when passing custom fields to BAPI extension

    Hi ,
    I have problem with standard BAPI_PO_CREATE1 bapi function.
    ERROR DETAILS
    when FM:- BAPI_PO_CREATE1 first time executed  getting error  "Check item number 30 in table EXTENSIONIN" and PO not creating.
    when using function key reverse(cntl+f12) in BAPI_PO_CREATE1 in same execution ,po document  creating ,but data is not papulating custom field.
    CODE USING IN MY PROGRAM
    DATA : 
           ltab_extensionin TYPE TABLE OF bapiparex,
           wa_extensionin TYPE bapiparex,
           wa_BAPI_TE_MEPOITEM type BAPI_TE_MEPOITEM.
    wa_bapi_te_mepoitem-po_item = wa_itab-item.
    wa_bapi_te_mepoitem-zvsart  = wa_itab-ship_type.
    move 'BAPI_TE_MEPOITEM' to wa_extensionin-structure.
    move wa_BAPI_TE_MEPOITEM to  wa_extensionin-VALUEPART1 .
    APPEND wa_extensionin TO ltab_extensionin.
       CALL FUNCTION 'BAPI_PO_CREATE1'
        EXPORTING
          poheader         = wa_pohead
          poheaderx        = wa_poheadx
          testrun          = ' '
        IMPORTING
          exppurchaseorder = v_po_number
        TABLES
          return           = itab_return
          poitem           = itab_poitem
          poitemx          = itab_poitemx
          poschedule       = itab_posched
          poschedulex      = itab_poschedx
          poshipping       = itab_poshipping
          poshippingx      = itab_poshippingx
          extensionin      = ltab_extensionin.
    Could one of u help me ?? .
    Regards,
    Nayak

    Hi,
    Try populating the ltab_extensionin as the code given below:
    Maybe it can help you.
    Constants: c_flag_bape_vbak TYPE  char10 VALUE  'BAPE_VBAK', " Constant
                     c_flag_bape_vbakx TYPE char10 VALUE  'BAPE_VBAKX'," Constant
      wa_bape_vbap-vbeln             = space.
       wa_bape_vbap-posnr            = wa_order_items_in-in_linenumber.
       MOVE c_flag_bape_vbak TO wa_extensionin-structure.
       MOVE c_flag_bape_vbap TO wa_extensionin-structure.
       CALL METHOD cl_abap_container_utilities=>fill_container_c
         EXPORTING
           im_value       = wa_bape_vbap
         IMPORTING
           ex_container = wa_extensionin-valuepart1.
       APPEND wa_extensionin TO it_extensionin.
       CLEAR : wa_extensionin.
       MOVE c_flag_bape_vbapx TO wa_extensionin-structure.
       wa_extensionin-valuepart1+0(10) = space.
       wa_extensionin-valuepart1+10(6) = wa_order_items_in-in_linenumber.
       wa_extensionin-valuepart1+80(3) = abap_true.
       APPEND wa_extensionin TO it_extensionin.
       CLEAR : wa_extensionin.
    Regards,
    Shweta

Maybe you are looking for