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

BAPI_SALESORDER_CREATEFROMDAT2 , cannot update ZFIELD

former_member1137458
Participant
0 Likes
2,083

reference note: 143580

VBAK (Append ZZFIELD1 CHAR4)

VBAKKOZ (Append ZZFIELD1 CHAR4)

VBAKKOZX (Append ZZFIELD1 CHAR1)

BAPE_VBAK (Append ZZFIELD1 CHAR4)

BAPE_VBAKX (Append ZZFIELD1 CHAR1)

  DATA: WA_EXTENSION TYPE BAPIPAREX,
        WA_BAPE_VBAK TYPE BAPE_VBAK,
        WA_BAPE_VBAKX TYPE BAPE_VBAKX.


  WA_BAPE_VBAK-ZZFIELD1 = 'ABCD'.
  WA_BAPE_VBAKX-ZZFIELD1 = 'X'.

  MOVE 'BAPE_VBAK' TO WA_EXTENSION-STRUCTURE.
  MOVE WA_BAPE_VBAK TO WA_EXTENSION-VALUEPART1.
  APPEND WA_EXTENSION TO EXTENSIONIN.

  CLEAR WA_EXTENSION.

  MOVE 'BAPE_VBAKX' TO WA_EXTENSION-STRUCTURE.
  MOVE WA_BAPE_VBAKX TO WA_EXTENSION-VALUEPART1.
  APPEND WA_EXTENSION TO EXTENSIONIN.

Finally, Sales Order is created, but does not update ZZFIELD1.

what's problem?

7 REPLIES 7
Read only

madhu_vadlamani
Active Contributor
0 Likes
1,336

Hi Cpliu,

I did this at item level.

1) VBAP: In your append structure you specify your ZZFIELD with the data type as needed

2) BAPE_VBAP: In the append structure here also add the ZZFIELD with the data type as needed with limitations. No decimals. Try and stick to char characters

3) BAPE_VBAPX: In the append structure add the field ZZFIELD of type BAPIUPDATE

(NOTE: (2) and (3) must have the same number of fields in the same order)

4) VBAPKOZ: In the append structure here also add the ZZFIELD with the data type as needed with limitations. No decimals. Try and stick to char characters

5) VBAPKOZX: In the append structure add the field ZZFIELD of type BAPIUPDATE

(4) and (5) must have the same number of fields in the same order)

Similarly do for VBAK, BAPE_VBAK, BAPE_VBAKX, VBAKKOZ and VBAKKOZX.

Check this and see.

Regards,

Madhu.

Read only

0 Likes
1,336

Thanks reply.

I haven't try to update VBAP,

(VBAKKOZX and BAPE_VBAKX) ZZFIELD1 data type was changed to BAPIUPDATE.

It's also not work.

Read only

0 Likes
1,336

Hi,

That is fine .Try the same way to update vbak.

Regards,

Madhu.

Read only

0 Likes
1,336

Hi

Madhu is right. See SAP Note 143580 - Information on SD BAPIs and customer enhancement concept

This IDOC call the function module SD_SALESDOCUMENT_CREATE. In the subroutine



  perform ms_move_extensionin tables extensionin
                                     sales_items_in
                                     sales_schedules_in
                              using
                                     sales_header_in.

In this subroutine, in this coding and so on, debug it, with the aim to know what happens.



  LOOP AT extensionin.
    CASE extensionin-structure.
* BAPI-Schnittstelle für Kundenerweiterungen zur Tabelle VBAK
      WHEN 'BAPE_VBAK'.
        call method cl_abap_container_utilities=>read_container_c
          exporting
            im_container           = extensionin+lv_length
          importing
            ex_value               = wa_bape_vbak
          exceptions
            illegal_parameter_type = 1
            others                 = 2.
        CATCH SYSTEM-EXCEPTIONS conversion_errors  = 1.     "#EC *
          MOVE-CORRESPONDING wa_bape_vbak TO e_vbakkom.
        ENDCATCH.
* BAPI-Ankreuzleiste für Kundenerweiterungen zur Tabelle VBAK
      WHEN 'BAPE_VBAKX'.
        MOVE extensionin+lv_length TO wa_bape_vbakx.
        CATCH SYSTEM-EXCEPTIONS conversion_errors  = 1.     "#EC *
          MOVE-CORRESPONDING wa_bape_vbakx TO e_vbakkomx.
        ENDCATCH.
 .............

ie: check if data is trasfered to E_VBAKKOM as note says in point 8

I hope this helps you

Regards

Eduardo

Read only

0 Likes
1,336

Thanks reply.

I have been debug, the output value is:

E_VBAKKOM-ZZFIELD1 = 'ABCD'.

Read only

0 Likes
1,336
perform map_vbak_to_bapisdhd tables   return
                                        extensionex
                               using    da_vbak
                               changing sales_header_out.

* fill the extension structure for the header bapi
     if da_extension_needed = charx.
        move-corresponding da_vbak to da_bape_vbak.
        catch system-exceptions conversion_errors  = 1.
* Belegnummer übernehmen
              move da_vbak-vbeln to da_bape_vbak-vbeln.
* Strukturnamen setzen
              move 'BAPE_VBAK'   to da_parex-structure.
* Daten übertragen
              move da_bape_vbak  to da_parex-values.
              move da_parex      to ch_parex.
        endcatch.
* Erweiterungsstruktur aufbauen
        append ch_parex.
     endif.

Finally, in table "ch_parex", output is

CH_PAREX-STRUCTURE = 'BAPE_VBAK'

CH_PAREX-VALUEPART1 = '1234567890ABCD'

at this line, it seems no problem..?

Read only

former_member1137458
Participant
0 Likes
1,336

Thanks all. problem is solved.

Finally, I found this user exit effect result.

USEREXIT_SAVE_DOCUMENT_PREPARE