Modify the serial number in the delivery ticket

Source: Internet
Author: User

*&---------------------------------------------------------------------*
* & Report ztest_dn_update_serial_no
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

Report ztest_dn_update_serial_no.
Data: dn_header_data like bapiobdlvhdrchg,
Dn_header_control like bapiobdlvhdrctrlchg,
Dn_delivery like likp-vbeln,
Dn_return like bapiret2 occurs 0 with header line,
Dn_item_data like table of bapiobdlvitemchg with header line,
Dn_item_control like bapiobdlvitemctrlchg occurs 0 with header line,
Dn_item_serial_no like table of bapidlvitmserno with header line,
Dn_techn_control like bapidlvcontrol. "Add By changgf 20110219
Data: g_transaction_id like arfctid,
G_status_of_transaction (15 ).

Start-of-selection.

* Call function 'transaction _ in in'
* Importing
* Transaction_id = g_transaction_id.

Dn_header_data-deliv_numb = '000000 '.
Dn_header_control-deliv_numb = '000000 '.

Dn_item_serial_no-deliv_numb = '000000 '.
Dn_item_serial_no-itm_number = '000000 '.
Dn_item_serial_no-serialno = 'zsd-mjm10 '.
Append dn_item_serial_no.

Dn_item_serial_no-itm_number = '000000 '.
Dn_item_serial_no-serialno = 'zsd-mjm11 '.
Append dn_item_serial_no.

Dn_item_serial_no-itm_number = '000000 '.
Dn_item_serial_no-serialno = 'zsd-mjm12 '.
Append dn_item_serial_no.

Dn_item_serial_no-itm_number = '000000 '.
Dn_item_serial_no-serialno = 'zsd-mjm13 '.
Append dn_item_serial_no.

Dn_item_serial_no-itm_number = '000000 '.
Dn_item_serial_no-serialno = 'zsd-mjm14 '.
Append dn_item_serial_no.

Dn_item_serial_no-itm_number = '000000 '.
Dn_item_serial_no-serialno = 'zsd-mjm15 '.
Append dn_item_serial_no.

Dn_item_serial_no-itm_number = '000000 '.
Dn_item_serial_no-serialno = 'zsd-mjm17 '.
Append dn_item_serial_no.

Dn_item_serial_no-itm_number = '000000 '.
Dn_item_serial_no-serialno = 'zsd-mjm18 '.
Append dn_item_serial_no.

Dn_item_serial_no-itm_number = '000000 '.
Dn_item_serial_no-serialno = 'zsd-safhoagh15b '.
Append dn_item_serial_no.

Dn_item_serial_no-itm_number = '000000 '.
Dn_item_serial_no-serialno = 'zsd-mjm16 '.
Append dn_item_serial_no.

Call function 'bapi _ outb_delivery_change'
Exporting
Header_data = dn_header_data
Header_control = dn_header_control
Delivery = dn_delivery
Tables
Return = dn_return
Item_serial_no = dn_item_serial_no.
Read Table dn_return with key type = 'E '.
If sy-subrc <> 0.
* Call function 'transaction _ status'
* Importing
* Status = g_status_of_transaction.

If g_status_of_transaction = 'commit _ work '.
Call function 'bapi _ transaction_commit'
Exporting
Wait = 'x '.
Else.
Call function 'bapi _ transaction_rollback '.
Endif.

* Call function 'transaction _ end'
* Exporting
* Transaction_id = g_transaction_id
* Exceptions
* Others = 1.

Endif.

Refresh dn_return.

Delete dn_item_serial_no where serialno = 'zsd-mjm10 '.
Dn_item_serial_no-itm_number = '000000 '.
Dn_item_serial_no-serialno = 'zsd-safhoagh16 '.
Append dn_item_serial_no.

Call function 'serial _ inttab_refresh'
Exporting
Objects_status_refresh = 'E '.

Call function 'bapi _ outb_delivery_change'
Exporting
Header_data = dn_header_data
Header_control = dn_header_control
Delivery = dn_delivery
Tables
Return = dn_return
Item_serial_no = dn_item_serial_no.
Read Table dn_return with key type = 'E '.
If sy-subrc <> 0.
* Call function 'transaction _ status'
* Importing
* Status = g_status_of_transaction.

If g_status_of_transaction = 'commit _ work '.
Call function 'bapi _ transaction_commit'
Exporting
Wait = 'x '.
Else.
Call function 'bapi _ transaction_rollback '.
Endif.

* Call function 'transaction _ end'
* Exporting
* Transaction_id = g_transaction_id
* Exceptions
* Others = 1.

Endif.

End-of-selection.

 

 

The above test program is mainly used to solve the problem of scanning the serial number from the RF scan to the delivery order. If a scanning error is found midway through, an error will be reported when the data is scanned and corrected again after the bapi is executed, indicates that the serial number is occupied by other items. Later, the following functions solved the problem.

 

Call function 'serial _ inttab_refresh'
Exporting
Objects_status_refresh = 'E '.

 

 

Google Search: ws_delivery_update_2 serial

 

Https://forums.sdn.sap.com/thread.jspa? Threadid = 1397725

 

To update serial Nos to delivery in RF use the following FM l_ser_ws_delivery_update.

Use as follows :-

    CALL FUNCTION 'SERIAL_INTTAB_REFRESH'      EXPORTING        objects_status_refresh = 'E'.     CALL FUNCTION 'L_SER_WS_DELIVERY_UPDATE'      EXPORTING        vbkok_wa                 = y_wa_vbkok        synchron                 = 'X'        commit                   = ' '        delivery                 = y_p_vbel        nicht_sperren            = 'X'        if_get_delivery_buffered = ' '        if_error_messages_send_0 = 'X'        it_sernr_update          = y_li_sernr      EXCEPTIONS        error_message            = 1        OTHERS                   = 2.     CASE sy-subrc.      WHEN 0.        COMMIT WORK.      WHEN OTHERS.         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

 

Internally it is just making a call to 'ws _ delivery_update_2'
So try using the FM ws_delivery_update_2

 

Https://forums.sme.sap.com/message.jspa? Messageid = 8847913

Bapi_outb_delivery_change/ws_delivery_update

Bapi_outb_delivery_change & l_ser_ws_delivery_update

One of these two functions will check the serial number, and the other will not check the serial number. They will be saved directly.

 

Call function 'ws _ delivery_update'
Exporting
Vbkok_wa = w_vbkok_wa
* Commit = 'X'
Delivery = v_delivery
If_database_update = '1'
If_error_messages_send_0 = 'X'
It_sernr_update = t_sernr_update

 

 

Http://sap.ittoolbox.com/groups/technical-functional/sap-dev/serial-number-in-handling-unit-308912

I am trying to add serial numbers to items in a handling unit in an outbound delivery (sales order) calling 1. serial_inttab_refresh, 2. sernr_add_to_hu and 3. serial_liste_post_hu. I don't get errors but the serial number does not get added to the Hu.

 

Http://forums.sdn.sap.com/thread.jspa? Threadid = 576174

Https://forums.sme.sap.com/thread.jspa? Threadid = 1779645 & tstart = 0

 

Ws_delivery_update_2

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.