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_PO_CHANGE - Confirmation

SimoneMilesi
Active Contributor
0 Likes
4,870

Hi gurus!

I'm facing some trouble using the BAPI in object to confirm some Purchase Order positions.

I don't have any errors, but in ME23N, under confirmation labels, I don't find anything and positions doesn't seems to be confirmed.

I'm missing something?


SELECT ebelp menge eindt lpein etenr uzeit
  INTO (l_confirmation-po_item, l_confirmation-quantity,
        l_confirmation-deliv_date, l_confirmation-del_datcat_ext,
        l_confirmation-conf_ser, l_confirmation-deliv_time )

                          FROM eket WHERE ebeln EQ l_ebeln.

    MOVE:  'AB'         TO l_confirmation-conf_type,
*      'ZMREMO40'   to l_confirmation-CONF_NAME,
          'D'        TO l_confirmation-del_datcat_ext,
          l_confirmation-del_datcat_ext TO l_confirmation-del_datcat,
          'X'           TO l_confirmation-dispo_rel.
    APPEND l_confirmation.
    MOVE: l_confirmation-po_item TO poitem-po_item,
          l_confirmation-po_item TO poitemx-po_item,
          'X'                    TO poitemx-po_itemx.
    APPEND poitem.
    APPEND poitemx.
    CLEAR l_confirmation.

  ENDSELECT.
  MOVE l_ebeln TO poheader-po_number.
  MOVE 'X' TO poheaderx-po_number.

  CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
      purchaseorder  = l_ebeln
      poheader       = poheader
      poheaderx      = poheaderx
      no_authority   = 'X'
    TABLES
      return         = l_return
      poitem         = poitem
      poitemx        = poitemx
      poconfirmation = l_confirmation.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

1 ACCEPTED SOLUTION
Read only

SimoneMilesi
Active Contributor
0 Likes
3,527

Hi gurus!

For a new implementation, i need to use this BAPI (or another FM that do the same) to update PO Confirmations!

Any Hints?

Hi gurus!

I'm facing some trouble using the BAPI in object to confirm some Purchase Order positions.

I don't have any errors, but in ME23N, under confirmation labels, I don't find anything and positions doesn't seems to be confirmed.

I'm missing something?


SELECT ebelp menge eindt lpein etenr uzeit
  INTO (l_confirmation-po_item, l_confirmation-quantity,
        l_confirmation-deliv_date, l_confirmation-del_datcat_ext,
        l_confirmation-conf_ser, l_confirmation-deliv_time )

                          FROM eket WHERE ebeln EQ l_ebeln.

    MOVE:  'AB'         TO l_confirmation-conf_type,
*      'ZMREMO40'   to l_confirmation-CONF_NAME,
          'D'        TO l_confirmation-del_datcat_ext,
          l_confirmation-del_datcat_ext TO l_confirmation-del_datcat,
          'X'           TO l_confirmation-dispo_rel.
    APPEND l_confirmation.
    MOVE: l_confirmation-po_item TO poitem-po_item,
          l_confirmation-po_item TO poitemx-po_item,
          'X'                    TO poitemx-po_itemx.
    APPEND poitem.
    APPEND poitemx.
    CLEAR l_confirmation.

  ENDSELECT.
  MOVE l_ebeln TO poheader-po_number.
  MOVE 'X' TO poheaderx-po_number.

  CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
      purchaseorder  = l_ebeln
      poheader       = poheader
      poheaderx      = poheaderx
      no_authority   = 'X'
    TABLES
      return         = l_return
      poitem         = poitem
      poitemx        = poitemx
      poconfirmation = l_confirmation.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

13 REPLIES 13
Read only

Former Member
0 Likes
3,527

check this:

--

Reddy

Read only

0 Likes
3,527

Sorry, but the thread you linked me doesn't fit!

The question is the same, but proposed solutions don't works.

Read only

0 Likes
3,527

Have a check like: with your inputs just check if the bapi can change some other filed like qty. If not you should provide more inputs to the BAPI.

--

Reddy

Read only

0 Likes
3,527

I already use this bapi to change almost everything in a PO (conditions, partners, item data and so on..) and every time it worked fine.

I never used it to confirm positions and i'm stucked here.

Read only

0 Likes
3,527
MOVE: l_confirmation-po_item TO poitem-po_item,
          l_confirmation-po_item TO poitemx-po_item,
          'X'                    TO poitemx-po_itemx.
    APPEND poitem.
    APPEND poitemx.
    CLEAR l_confirmation.
 
  ENDSELECT.
  MOVE l_ebeln TO poheader-po_number.
  MOVE 'X' TO poheaderx-po_number.

with this information you changed every thing..i mean condition..qty..ect?

--

Reddy

Read only

0 Likes
3,527

No.

Read only

0 Likes
3,527

Ok, i worked a bit on the bapi


SELECT ebelp menge eindt lpein  uzeit etenr
  INTO (l_confirmation-po_item, l_confirmation-quantity,
        l_confirmation-deliv_date, l_confirmation-del_datcat_ext,
        l_confirmation-deliv_time, l_confirmation-conf_ser  )
                          FROM eket WHERE ebeln EQ l_ebeln.

    MOVE:  'AB'         TO l_confirmation-conf_type,
           'D'        TO l_confirmation-del_datcat_ext.
    MOVE: l_confirmation-po_item TO poschedule-po_item,
          l_confirmation-conf_ser TO poschedule-sched_line,
          l_confirmation-po_item TO poschedulex-po_item,
          l_confirmation-conf_ser TO poschedulex-sched_line,
          l_confirmation-quantity TO poschedule-com_qty,
          l_confirmation-deliv_date TO poschedule-com_date,
          'X' TO poschedulex-com_qty,
          'X' TO poschedulex-com_date.

    APPEND l_confirmation.
    APPEND poschedule.
    APPEND poschedulex.
    MOVE: l_confirmation-po_item TO poitem-po_item,
          l_confirmation-po_item TO poitemx-po_item,
          'Z001'                 to poitem-conf_ctrl,
          'X'                    to poitemx-conf_ctrl.
    APPEND poitem.
    APPEND poitemx.
    CLEAR l_confirmation. CLEAR: poschedule, poschedulex.

  ENDSELECT.

  CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
      purchaseorder  = l_ebeln
     no_authority   = 'X'
    TABLES
      return         = l_return
      poschedule     = poschedule
      poschedulex    = poschedulex
      poitem         = poitem
      poitemx        = poitemx
      poconfirmation = l_confirmation.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

now i get the message "Unable to update confirmed quantity".

Any suggestion?

Read only

SimoneMilesi
Active Contributor
0 Likes
3,528

Hi gurus!

For a new implementation, i need to use this BAPI (or another FM that do the same) to update PO Confirmations!

Any Hints?

Read only

0 Likes
3,527

I found on SDN the suggestion to use ME_CONFIRMATION_UPDATE and ME_CONFIRMATION_REDISTR_ITEMS but i still have the already spotted issue with MD04.

This is my code


SELECT ebeln ebelp INTO CORRESPONDING FIELDS OF TABLE ti_ekpo_key
                                      FROM ekpo WHERE ebeln EQ p_ebeln.

LOOP AT ti_ekpo_key.

  MOVE-CORRESPONDING ti_ekpo_key TO xekes.
  xekes-eindt = sy-datum + 20.
  xekes-eindt(4) = 2020.
  MOVE: 1     TO xekes-etens, 
        'AB'  TO xekes-ebtyp,
        1     TO xekes-lpein,
        sy-uzeit TO xekes-uzeit,
        sy-datum TO xekes-erdat,
        sy-uzeit TO xekes-ezeit,
        1     TO xekes-menge,
        1     TO xekes-dabmg,
        1     TO xekes-estkz,
        'NU'  TO xekes-ekpomeins, 
        'TEST' TO xekes-xblnr,
        ' '   to xekes-KZDIS,
        'I'   TO xekes-kz.
 SELECT SINGLE lgort werks INTO CORRESPONDING FIELDS OF xekes FROM ekpo
                           WHERE ebeln EQ xekes-ebeln
                             AND ebelp EQ xekes-ebelp.
  APPEND xekes. CLEAR xekes.
ENDLOOP.
CALL FUNCTION 'ME_CONFIRMATION_UPDATE'
  EXPORTING
    i_ebeln = p_ebeln
  TABLES
    xekes   = xekes.
COMMIT WORK AND WAIT.
CALL FUNCTION 'ME_CONFIRMATION_REDISTR_ITEMS'
  TABLES
    ti_ekpo_key = ti_ekpo_key.

COMMIT WORK AND WAIT.

Any suggestion?

Read only

0 Likes
3,527

Hello, the function "ME_CONFIRMATION_UPDATE" work well, The problem is in the table XEKES, you are not fill the data XEKES-KZDIS with 'X'.

If you fill the data XEKES-KZDIS = 'X', The system will be update the transacion MD04.

Thanks.

Read only

0 Likes
3,527

I cannot get any confirmation created using these function modules. Have you had any luck with them yet?

Read only

0 Likes
3,527

I cannot get any confirmation created using these function modules. Have you had any luck with them yet?

Read only

0 Likes
3,527

Yes, with the flag you told me, it works!