Skip to Content

How to update cdpos from the user exit MV45AFZZ.

Hi Experts,

I've a requirement as below. Would like to seek for your advice. May i know how to update the cdpos table if there is a change of incoterms made by the userexit. Thanks in advance.

Requirement.

Change the inco1 to DAP of the sales order at item level if the sold to party is 50999. If the condition is met, the change log should be recorded in table cdpos.

Steps taken:

I've create a new include program under subroutine userexit_save_document_prepare.

*Store original/before change value to yvbkd.

READ TABLE yvbkd WITH KEY posnr = vbkd-posnr.

IF sy-subrc NE 0.
MOVE-CORRESPONDING vbkd TO yvbkd.
APPEND yvbkd TO yvbkd.
ENDIF.

*Get sold to party.

READ TABLE xvbpa WITH KEY parvw = 'AG'.

IF xvbpa-kunnr = '50999'.

READ TABLE xvbkd WITH KEY posnr = xvbap-posnr.

IF sy-subrc = 0.

xvbkd-inco1 = 'DAP'.

xvbkd-updkz = 'U'.

MODIFY xvbkd.

ENDIF.

ENDIF.

Roadblock:

I've checked in the cdpos table, there is no log being created for the changes made but the change appear in VA03 when i view the sales order again.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jun 04, 2014 at 07:06 AM

    Shawn,

    I think we need to check on enabling the change logs for INCOTERMS field rather than updating CDHDR/CDPOS tables from a User exit.

    K.Kiran.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Jarek,

      Thanks for your reply. Can you share me some light on how to use this? I've tried to add in my programming code as below. But when i checked in the table cdpos, there is no change log being recorded in the table.

      * Create a log in cdhdr and cdpos table.
      lv_objectid_017 = xvbap-vbeln.

      CALL FUNCTION 'VERKBELEG_WRITE_DOCUMENT'
      EXPORTING
      OBJECTID = lv_objectid_017
      TCODE = sy-tcode
      UTIME = sy-uzeit
      UDATE = sy-datum
      USERNAME = sy-uname
      * PLANNED_CHANGE_NUMBER = ' '
      OBJECT_CHANGE_INDICATOR = 'U'
      * PLANNED_OR_REAL_CHANGES = ' '
      * NO_CHANGE_POINTERS = ' '
      * UPD_ICDTXT_VERKBELEG = ' '
      * UPD_FPLA = ' '
      * UPD_FPLT = ' '
      * UPD_FPLTC = ' '
      * UPD_KONVC = ' '
      * UPD_PAYSP_HL = ' '
      N_VBAK = vbak
      O_YVBAK = vbak
      * UPD_VBAK = ' '
      * UPD_VBAP = ' '
      * UPD_VBEP = ' '
      UPD_VBKD = 'U'
      * UPD_VBLB = ' '
      * UPD_VBPA = ' '
      * UPD_VBPA2 = ' '
      * UPD_VBSN = ' '
      N_VBUK = vbuk
      O_YVBUK = *vbuk
      * UPD_VBUK = ' '
      * UPD_VEDA = ' '
      TABLES
      ICDTXT_VERKBELEG = icdtxt_verkbeleg
      XFPLA = XFPLA
      YFPLA = YFPLA
      XFPLT = XFPLT
      YFPLT = YFPLT
      XFPLTC = XFPLTC
      YFPLTC = YFPLTC
      XKONVC = XKONVC
      YKONVC = YKONVC
      XPAYSP_HL = XPAYSP_HL
      YPAYSP_HL = YPAYSP_HL
      XVBAP = XVBAP
      YVBAP = YVBAP
      XVBEP = XVBEP
      YVBEP = YVBEP
      XVBKD = xvbkd
      YVBKD = yvbkd
      XVBLB = XVBLB
      YVBLB = YVBLB
      XVBPA = XVBPA
      YVBPA = YVBPA
      XVBPA2 = XVBPA2
      YVBPA2 = YVBPA2
      XVBSN = XVBSN
      YVBSN = YVBSN
      XVEDA = XVEDA
      YVEDA = YVEDA
      .

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.