Skip to Content
0

Confirming a POD using a Function Module (FM)

Mar 22, 2017 at 03:08 PM

123

avatar image

Hi SCN,

I've spent the last week or so searching for an answer to this but I still keep coming up short. I'm trying to confirm a POD using a FM or Class for a mobile app we're building.

I'm currently trying to use the FM WS_DELIVERY_UPDATE and it seems to work because it updates the POD confirmation date and time. However, it does not update the POD confirmation status from A to C which is the crucial change I'm trying to achieve.

I also notice that sometimes I get the exception CX_SY_OPEN_SQL_DB and I'm not sure why?

Am I on the right track to updating the POD confirmation status using this FM? Or is there perhaps another way? I'm not sure if it's worth just updating the Database directly?

Here's the code I'm using:

REPORT z_del_confirm.

DATA:   ef_error_any_0              TYPE xfeld,
        ef_error_in_item_deletion_0 TYPE xfeld,
        ef_error_in_pod_update_0    TYPE xfeld,
        ef_error_in_interface_0     TYPE xfeld,
        ef_error_in_goods_issue_0   TYPE xfeld,
        ef_error_in_final_check_0   TYPE xfeld,
        ef_error_partner_update     TYPE xfeld,
        ef_error_sernr_update       TYPE xfeld.

DATA: ls_ret    TYPE bapiret2,
      ct_return TYPE TABLE OF bapiret2.


DATA: lt_lips  TYPE TABLE OF lips,
      lt_prot  TYPE TABLE OF prott,
      lt_verko TYPE TABLE OF verko,
      lt_verpo TYPE TABLE OF verpo,
      lt_vbpok TYPE TABLE OF vbpok,
      ls_vbpok TYPE vbpok,
      ls_vbkok TYPE vbkok,
      lv_vbeln TYPE likp-vbeln,
      lv_posnr TYPE lips-posnr.

lv_vbeln = '0080013339'.
ls_vbkok-podat = '20040227'.
ls_vbkok-potim = '031800'.
ls_vbkok-kzpod = 'D'.

SELECT * FROM lips INTO TABLE lt_lips
  WHERE vbeln = lv_vbeln.

* Feed the picking interface table
LOOP AT lt_lips ASSIGNING FIELD-SYMBOL(<fs_lips>).
  CLEAR ls_vbpok.
  MOVE-CORRESPONDING <fs_lips> TO ls_vbpok .
  ls_vbpok-vbeln = <fs_lips>-vbeln.
  ls_vbpok-vbeln_vl = <fs_lips>-vbeln.
  ls_vbpok-posnr_vl = <fs_lips>-posnr.
  ls_vbpok-posnn = <fs_lips>-posnr.
  ls_vbpok-pikmg = <fs_lips>-lgmng.     "Picking Qty
*  ls_vbpok-matnr = <fs_lips>-matnr.
*  ls_vbpok-matnr = <fs_lips>-matnr.
*  ls_vbpok-charg = <fs_lips>-charg.
  ls_vbpok-lfimg = <fs_lips>-lfimg.
*  ls_vbpok-vrkme = <fs_lips>-vrkme.
*  ls_vbpok-brgew = <fs_lips>-brgew.
*  ls_vbpok-ntgew = <fs_lips>-ntgew.
*  ls_vbpok-gewei = <fs_lips>-gewei.
*  ls_vbpok-volum = <fs_lips>-volum.
*  ls_vbpok-voleh = <fs_lips>-voleh.
  ls_vbpok-lianp = 'X'.
*  ls_vbpok-kzbrg = 'X'.
*  ls_vbpok-kzntg = 'X'.
*  ls_vbpok-kzvol = 'X'.

  APPEND ls_vbpok TO lt_vbpok.
ENDLOOP.

TRY.
    CALL FUNCTION 'WS_DELIVERY_UPDATE'
      EXPORTING
        vbkok_wa                    = ls_vbkok
        synchron                    = 'X'
        no_messages_update          = ' '
        commit                      = 'X'
        delivery                    = lv_vbeln
        update_picking              = 'X'
*       nicht_sperren               = 'X'
*       IF_CONFIRM_CENTRAL          = ' '
*       IF_WMPP                     = ' '
*       IF_GET_DELIVERY_BUFFERED    = ' '
*       IF_NO_GENERIC_SYSTEM_SERVICE       = ' '
*       IF_DATABASE_UPDATE          = '1'
*       IF_NO_INIT                  = ' '
*       IF_NO_READ                  = ' '
        if_error_messages_send_0    = ' '
*       IF_NO_BUFFER_REFRESH        = ' '
*       IT_PARTNER_UPDATE           =
*       IT_SERNR_UPDATE             =
*       IF_NO_REMOTE_CHG            = ' '
*       IF_NO_MES_UPD_PACK          = ' '
*       IF_LATE_DELIVERY_UPD        = ' '
      IMPORTING
        ef_error_any_0              = ef_error_any_0
        ef_error_in_item_deletion_0 = ef_error_in_item_deletion_0
        ef_error_in_pod_update_0    = ef_error_in_pod_update_0
        ef_error_in_interface_0     = ef_error_in_interface_0
        ef_error_in_goods_issue_0   = ef_error_in_interface_0
        ef_error_in_final_check_0   = ef_error_in_final_check_0
        ef_error_partner_update     = ef_error_partner_update
        ef_error_sernr_update       = ef_error_sernr_update
      TABLES
        vbpok_tab                   = lt_vbpok
        prot                        = lt_prot
*       VERKO_TAB                   =
*       VERPO_TAB                   =
*       VBSUPCON_TAB                =
*       IT_VERPO_SERNR              =
*       IT_PACKING                  =
*       IT_PACKING_SERNR            =
*       IT_REPACK                   =
*       IT_HANDLING_UNITS           =
*       IT_OBJECTS                  =
*       ET_CREATED_HUS              =
*       TVPOD_TAB                   =
*       IT_TMSTMP                   =
*       IT_BAPIADDR1                =
*       IT_TEXTL                    =
*       IT_TEXTH                    =
*       IT_AAC_ITEM_BLOCK           =
*       IT_HU_HEADER_EPC            =
*       IT_HU_ITEMS_EPC             =
      .

  CATCH cx_root INTO DATA(lx_data_root).
    MESSAGE lx_data_root->get_longtext( ) TYPE 'I'.
ENDTRY.

LOOP AT lt_prot ASSIGNING FIELD-SYMBOL(<fs_prot>).
*  CLEAR ct_return.
  IF <fs_prot>-msgty = 'E' OR
    <fs_prot>-msgty = 'A' .
* An error has occured.
    DATA(ef_error_occured) = 'X'.
  ENDIF.
  ls_ret-type = <fs_prot>-msgty.
  ls_ret-id = <fs_prot>-msgid.
  ls_ret-number = <fs_prot>-msgno.
  ls_ret-message_v1 = <fs_prot>-msgv1.
  ls_ret-message_v2 = <fs_prot>-msgv2.
  ls_ret-message_v3 = <fs_prot>-msgv3.
  ls_ret-message_v4 = <fs_prot>-msgv4.
  APPEND ls_ret TO ct_return.
ENDLOOP.

Any help would be hugely appreciated.

Thanks,

B

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

G Lakshmipathi
Mar 22, 2017 at 04:05 PM
0
it seems to work because it updates the POD confirmation date and time

In standard, if there is no difference between the delivered quantity and customer confirmed quantity, then when confirming the delivery via VLPOD or VLPODQ, automatically, system would change the status to "C". Let me know if there is a difference in your case. By the way, if you are a technical guy, did you discuss with your functional team who should be knowing this.

Share
10 |10000 characters needed characters left characters exceeded