cancel
Showing results for 
Search instead for 
Did you mean: 

Change Log is not getting updated for Z fields in VBAP Table

former_member515329
Participant
0 Kudos

Hi All,

I have created 2 z fields in VBAP table(accordingly i have created in bape_vbap, bape_vbapx, VBAPKOZ, VBAPKOZX) - these fields are visible in VA01/VA02/VA03 tcode in Additional data B tab.

I have written a zprogram to update these zfields using update statement( UPDATE vbap from TABLE ltab. COMMIT WORK.) It is working fine the values are getting updated - when i see this values in VA03 and VBAP table - BUT the change log is NOT getting updated, when i view this in Environment->Changes. i have checked the data element for the zfields - the Change document checkbox is marked in further characteristics but still the change log are not captured.

Is it true that if i update the zfields using FM BAPI_SALESORDER_CHANGE the change log will be created?

Thanks in advance.

Accepted Solutions (0)

Answers (4)

Answers (4)

raymond_giuseppi
Active Contributor

Well, search and read some documentation on change documents first. You should realize that there is no chance an update SQL statement will trigger the update FM that generate those documents. Look for differences between change documents (program) and log data changes (SQL).

Look with SCDO (object VERKBELEG for sales orders) for the correct include/FM that generates those documents. Then if, as I hope, the update statement is to be called only once for legacy data, adapt your report to generate the change document with an explicit call.

If you correctly implemented the new fields, as seems to be the case as you mentionned the correct append structures, yes, a call of the BAPI will also generate the documents.

former_member515329
Participant
0 Kudos

Thanks for your reply!

Currently i have removed the UPDATE statement and written code for BAPI to update zfields in VBAP - BUT below code somehow is not getting updated in VA03 tcode

SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }

order_headerx-updateflag = 'U'.
t_line-itm_number = ls_tab-posnr.
t_line-MATERIAL = ls_tab-MATNR.
t_line-HG_LV_ITEM = ls_tab-posnr.
APPEND t_line.


t_linex-itm_number = ls_tab-posnr.
t_linex-updateflag = 'U'.
* t_linex-HG_LV_ITEM = ls_tab-posnr.
* t_linex-MATERIAL = ls_tab-MATNR.
APPEND t_linex.

CLEAR : wa_bape_vbap.
wa_bape_vbap-vbeln = ls_tab-vbeln.
wa_bape_vbap-posnr = ls_tab-posnr.
wa_bape_vbap-zzrcdtp = ls_tab-zzrcdtp.
t_exten-structure = 'BAPE_VBAP'.
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = wa_bape_vbap
IMPORTING
ex_container = t_exten+30."t_exten-valuepart1.
APPEND t_exten.
clear : t_exten.

CLEAR : wa_bape_vbapx.
wa_bape_vbapx-vbeln = ls_tab-vbeln.
wa_bape_vbapx-posnr = ls_tab-posnr.
wa_bape_vbapx-zzrcdtp = 'X'."ls_tab-zzrcdtp.
t_exten-structure = 'BAPE_VBAPX'.
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = wa_bape_vbapx
IMPORTING
ex_container = t_exten+30."t_exten-valuepart1.

APPEND t_exten.
clear : t_exten.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = ls_tab-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'..

raymond_giuseppi
Active Contributor
0 Kudos

Check your implementation of the fields, also read the EXTENSIONIN parameter documentation carefully -> BAPE_VBAP but also VBAPKOZ should contain the zz-fields.

Also if you work with an outdated version (very old) of SAP, check for available OSS notes.

former_member515329
Participant
0 Kudos

Yes - populated the fields correctly::

BAPE_VBAP - first i have VBELN, POSNR and then my zfields - ZZRCDTP - Char 4 length, ZZRCDTR - Char 4 length

BAPE_VBAPX-first i have VBELN, POSNR and then my zfields - ZZRCDTP - Char 1 length, ZZRCDTR - Char 1 length

VBAPKOZ- DUMMY,ZZLIFNR -char 10,ZZRCDTP- char4, ZZRCDTR - char4

VBAPKOZX - DUMMY, ZZRCDTP - CHAR01, ZZRCDTR - CHAR01

do i need to maintain zzlifnr in VBAPKOZX aswell??

raymond_giuseppi
Active Contributor

I would expect the same list of field names appended in every structure (Read also 143580 - Information on SD BAPIs and customer enhancement concept if the BAPI documentation doesn't look accurate enough to you )

Jelena
Active Contributor

Did you append Z field(s) to VBAP correctly? Did you check the "Change document" checkbox in the data element? If you update the Z field(s) in VA02, are the change documents created?

If the answer to all these questions is "yes" and BAPI does not create change documents then I'd suggest to contact SAP Support.

sathyags
Active Participant

I think you should use BAPI_SALESORDER_CHANGE instead of direct update to the standard table!.

former_member515329
Participant
0 Kudos

Can anyone help on this.