cancel
Showing results for 
Search instead for 
Did you mean: 

FM BBP_PD_PO_UPDATE is not updating Purchase Order

Former Member
0 Kudos
453

Hi Experts,

I am trying to update Final Delivery and Final Invoice indicator for a PO using FM BBP_PD_PO_UPDATE.

Code Snippet for FM call is as follows: -


      CALL FUNCTION 'BBP_PD_PO_UPDATE'
        EXPORTING
          i_header                = wa_po_header1
          i_save                  = 'X'
          iv_with_change_approval = 'X'
        IMPORTING
          es_header               = wa_po_hdr_upd
        TABLES
          i_item                  = it_po_item1
          e_messages              = it_po_message.

Here all the variables are declared same they are in FM. Later on to save PO I am using FM BBP_PD_PO_SAVE.

Can anybody tell me what am I missing?

Thanks

Siddarth

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Siddarth,

I am also facing the same problem, I mean not able to update PO using BBP_PD_PO_UPDATE.

The way I am using all FM's in my program is as below

1. BBP_PD_PO_GETDETAIL - Importing parameter lv_changed returning value X but not saving the data

2. BBP_PD_PO_UPDATE

3 BBP_PD_PO_SAVE

4. COMMIT WORK AND WAIT.

So you please suugest me how to save the Updated PO.

Rewards will be added if this issue is resolved.

Thanks,

Arun.

Former Member
0 Kudos

Hey Jay,

I tried your approach already. it is not working.

Hi Robin,

I am using the same GUID which you have mentioned but it is not working.

Hi Ofer,

It is working fine in our system for Tax Code update as well but it is not updating FINAL_ENTRY and FINAL_INV Indicators. Can you please check this for these indicators in your system and let me know. These indicators are in item internal table of both the FMs.

Thanks

Siddarth.

michael_saulo2
Discoverer
0 Kudos

"It is working fine in our system for Tax Code update as well but it is not updating FINAL_ENTRY and FINAL_INV Indicators."

Take a look at SAP Include LBBP_PDIGPF14 where those flags are set:

  • mix up final entry/ invoice ind for change versions (very complicated)

IF p_object_type EQ c_po.

CASE new_itmigp-final_entry.

WHEN c_on OR c_off.

new_itmigp-final_entry = old_itmigp-final_entry.

WHEN gc_unchecked_manually OR gc_checked_manually.

  • keep it

WHEN gc_to_set.

new_itmigp-final_entry = c_on.

WHEN gc_to_delete.

new_itmigp-final_entry = c_off.

WHEN OTHERS.

PERFORM abort.

ENDCASE.

CASE new_itmigp-final_inv.

WHEN c_on OR c_off.

new_itmigp-final_inv = old_itmigp-final_inv.

WHEN gc_unchecked_manually OR gc_checked_manually.

  • keep it

WHEN gc_to_set.

new_itmigp-final_inv = c_on.

WHEN gc_to_delete.

new_itmigp-final_inv = c_off.

WHEN OTHERS.

PERFORM abort.

ENDCASE.

ENDIF.

If you want to set the Final_Inv or Final_Entry flags, you need to send 'S' in as the value to set the switch.

I realize this forum is listed as answered, but in case anybody else comes across this issue of setting these flags via the BBP_PD_PO_UPDATE FM.

laurent_burtaire
Active Contributor
0 Kudos

Hello Siddarth,

Do the same as in include LBBP_PD_POF14 (FORM update_final_flags ).

If it does not work, just call BAPI_TRANSACTION_COMMIT function module.

Regards.

Laurent.

Former Member
0 Kudos

Hi Laurent,

I made my code exactly similar to the example you gave me but still there is no change in PO line items. See below code snippet: -


      CALL FUNCTION 'BBP_PD_PO_UPDATE'
        EXPORTING
          i_header                = wa_po_header1
          i_save                  = 'X'
          iv_with_change_approval = ' '
        IMPORTING
          es_header               = wa_po_hdr_upd
        TABLES
          i_item                  = it_po_item1
          e_messages              = it_po_message.

I have also included CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. before CALL FUNCTION 'BBP_PD_PO_SAVE'. It is still not updating POs. I also tried by first calling CALL FUNCTION 'BBP_PD_PO_SAVE' then CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. But still no success.

Can you tell me what am I missing?

Thanks

Siddarth

Former Member
0 Kudos

I have also included CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. before CALL FUNCTION 'BBP_PD_PO_SAVE'.

The correct sequence of calls should be

1. 'BBP_PD_PO_UPDATE'

2. 'BBP_PD_PO_SAVE'

3. any FM or statement that involves "commit work"

RobinJanke
Contributor
0 Kudos

With what GUID are you calling the BBP_PD_PO_SAVE? Should be wa_po_hdr_upd-guid.

Did it really update in the BBP_PD_PO_UPDATE? Check by using the importing parameter (or if you have a new guid in the importing header).

And as always with all these FMs (as already mentioned by others):

1. Get

2. Update

3. Save

4. COMMIT WORK.

Regards,

Robin

Former Member
0 Kudos

hi a small example that works fine we have srm 7.0

REPORT Z_TEST_EAT019.

" MBT_PO_MASS_CREATE

DATA: lv_obj_id type CRMD_ORDERADM_H-OBJECT_ID,

lv_hdr type BBP_PDS_PO_HEADER_D,

lt_item_d type table of BBP_PDS_PO_ITEM_D,

ls_item_d like line of lt_item_d,

lt_item_u type table of BBP_PDS_PO_ITEM_ICU,

lt_prt type TABLE OF BBP_PDS_PARTNER,

ls_item_u like line of lt_item_u,

ls_hdr_u type BBP_PDS_PO_HEADER_U,

lv_lines_a type i,

lv_lines_b like lv_lines_a,

lv_changed type XFELD,

lt_messages type table of BBP_PDS_MESSAGES.

"Bestellung

  • lv_obj_id = is_purchase_order_message-PURCHASE_ORDER-ID-value.

lv_obj_id = '2000000177'.

"Bestellung lesen

CALL FUNCTION 'BBP_PD_PO_GETDETAIL'

EXPORTING

I_OBJECT_ID = lv_obj_id

I_ATTACH_WITH_DOC = ' '

I_WITH_ITEMDATA = 'X'

I_READ_BE_DATA = ' '

  • I_ITEM_SORTED_BY_HIERARCHY =

  • I_WITHOUT_HEADER_TOTALS = 'X'

  • I_READ_TEXT_FLAGS =

  • I_READ_FROM_ARCHIVE = ' '

IMPORTING

E_HEADER = lv_hdr

  • ET_ATTACH =

TABLES

E_ITEM = lt_item_d

  • E_ACCOUNT =

E_PARTNER = lt_prt

  • E_CONFIRM =

  • E_LONGTEXT =

  • E_SDLN =

  • E_LIMIT =

  • E_ORGDATA =

  • E_TAX =

  • E_PRIDOC =

  • E_HCF =

  • E_ICF =

  • E_TOL =

  • E_MESSAGES =

  • E_ACTVAL =

  • E_ACTVAL_SDLN =

  • E_ACC_ACTVAL =

  • E_VERSION =

  • E_HEADER_REL =

  • E_ITMLIM_REL =

  • E_STATUS =

  • E_HISTORY_ARCH =

.

BREAK-POINT.

  • CALL FUNCTION 'BBP_PD_PO_GETDETAIL'

  • EXPORTING

  • i_object_id = lv_po_id

  • i_attach_with_doc = ' '

  • i_with_itemdata = 'X'

  • i_read_be_data = ' '

  • IMPORTING

  • e_header = ls_header_d

  • TABLES

  • e_item = lt_item_d

  • e_account = lt_account_d

  • e_partner = lt_partner_d

  • e_longtext = lt_longtext_d

  • e_orgdata = lt_orgdata_d.

DESCRIBE TABLE lt_item_d LINES lv_lines_a.

loop at lt_item_d into ls_item_d.

MOVE-CORRESPONDING ls_item_d to ls_item_u.

if sy-tabix = 1.

ls_item_u-QUANTITY = 2.

ls_item_u-description = 'test 2'.

  • ls_item_u-UNIT = 1.

  • ls_item_u-PRICE_UNIT = 'ST'.

  • ls_item_u-price = '20'.

  • ls_item_u-GROSS_PRICE = 20.

  • ls_item_u-CATALOG_PRICE = 20.

endif.

append ls_item_u to lt_item_u.

ENDLOOP.

ls_hdr_u = lv_hdr.

CALL FUNCTION 'BBP_PD_PO_UPDATE'

EXPORTING

  • I_PARK = 'X'

I_HEADER = ls_hdr_u

I_SAVE = 'X'

  • IV_REJECT =

  • IV_USE_GROUP_CONDITIONS =

  • IT_ATTACH =

IV_WITH_CHANGE_APPROVAL = space

  • I_CALLING_OBJ =

IMPORTING

E_CHANGED = lv_changed

  • ES_HEADER =

TABLES

I_ITEM = lt_item_u

  • I_ACCOUNT =

  • I_PARTNER =

  • I_CONFIRM =

  • I_LONGTEXT =

  • I_LIMIT =

  • I_ORGDATA =

  • I_TAX =

  • I_PRIDOC =

  • I_SDLN =

E_MESSAGES = lt_messages

  • I_HCF =

  • I_ICF =

  • I_TOL =

.

BREAK-POINT.

CALL FUNCTION 'BBP_PD_PO_SAVE'

  • EXPORTING

  • IV_WORKITEM_ID =

  • IV_USERTYPE =

  • IV_HEADER_GUID = ls_hdr_u-GUID

  • IV_CREATE_HIST_VERSION =

  • IV_KEEP_OLD_CHANGER =

  • IV_NEW_CHANGED_BY =

  • IV_KEEP_OLD_CREATER =

  • IV_NEW_CREATED_BY =

.

CALL FUNCTION 'BBP_PROCDOC_RESET_BUFFER'.

commit work and WAIT.