Application Development 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: 

Function Module or BAPI to update Delivery

Former Member
0 Kudos

Hello all;

I'm looking to identify two function modules or BAPI to update SD customer deliveries of finished goods. My immediate need is to update serial numbers in delivery and then PGI the delivery. Our inventory is serialized and as such I will be pull serial numbers from an external source to update serial number reqirements in the delivery document. My second need is identify a FM or BAPI that picks and packs a delivery. This is for a project we are doing with a third party logistics provider and as such we are running this in Inventory Managed storage locations.

Thanks!

1 ACCEPTED SOLUTION

former_member186078
Active Participant
0 Kudos

Hi Joseph,

Any update on the function modules and the method I suggested. I am also very much eager to know whether these are working for Delivery also or not?

18 REPLIES 18

Former Member
0 Kudos

Hello Joseph,

Trz with these fms.

V50I Delivery BAPIs

BAPI_INB_DELIVERY_CONFIRM_DEC BAPI for inbound delivery verification from a decentralized system

BAPI_INB_DELIVERY_SAVEREPLICA BAPI Function Module for Replication of Inbound Deliveries

BAPI_OUTB_DELIVERY_CONFIRM_DEC BAPI for Outbound Delivery Verification from a Decentralized System

BAPI_OUTB_DELIVERY_SAVEREPLICA BAPI Function Module for Replication of Outbound Deliveries

BAPI_OUTB_DELIVERY_SPLIT_DEC BAPI for Subsequent Outbound-Delivery Split from a Decentralized Syste

V50R_CREA Create Delivery from Delivery Due List

BAPI_DELIVERYPROCESSING_EXEC Delivery Processing: Deliver Preceding Document, Expand Delivery

If useful reward.

Vasanth

Former Member
0 Kudos

Joseph,

Refer to the function module WS_DELIVERY_UPDATE for pick, pack, update serial numbers & PGI functions of the delivery.

Manoj

0 Kudos

Thanks for the FM, I'll look into it.

Do you have a sample ABAP code using this FM with error handling?

0 Kudos

Also, my immediate is to update serial numbers on a delivery then PGI the delivery, the delivery will already be picked/packed from a WHSCON message DELVRY03 IDoc processing. Unfortunately this IDoc processing does not update serial numbers and PGI. So I'm writing an application to pull the serial numbers from the IDoc then update the delivery with the serials and PGI..

0 Kudos

I found FM SERNR_ADD_TO_DOCUMENT, anybody use this before? I can't find much on it.

0 Kudos

Hi Joseph,

I had also one case of updating the serial to the document, but its not the Delivery. It was the Sales order. I have worked with the function module SERNR_ADD_TO_AU which is internally using the function module what you are using i.e., SERNR_ADD_TO_DOCUMENT. I think the same function module I have used will work for ur scenario also. The following is the sample code for it:


  CALL FUNCTION 'SERNR_ADD_TO_AU'
    EXPORTING
      sernr                 = w_sernr
      profile               = c_zd01
      material              = w_matnr
      quantity              = '1'
      document              = w_vbeln
      item                  = '00010'
      debitor               = fs_header-sap_ship_to
      vbtyp                 = 'C'
      sd_auart              = w_doc_type
      sd_postyp             = w_item_cat
    IMPORTING
      anzsn                 = w_anzsn
      zeilen_id             = w_zeile
      serial_commit         = w_serial_commit
    EXCEPTIONS
      konfigurations_error  = 1
      serialnumber_errors   = 2
      serialnumber_warnings = 3
      no_profile_operation  = 4
      OTHERS                = 5.
  IF sy-subrc eq 0.
    CALL FUNCTION 'SERIAL_LISTE_POST_AU'.
    COMMIT WORK.
  ENDIF.

I think you know about all the parameters I am passing to the function module from the above code. If u require any info, u can msg again.

And one more thing, don't forget to have the call to the function module 'SERIAL_LISTE_POST_AU' amd commit work if the return code is 0. This is also mandatory.

  • Note: Please don't forget to reward points if the message is helpful.

0 Kudos

The SERNR_ADD_TO_LS and SERIAL_LISTE_POST_LS appear to be working in that the serial numbers are being popped into the delivery however it appears that the delivery is being locked for as long as the application is running. Did you experience this? In my application I build a internal tables of deliveries and serial numbers to be update and then call these FM's to update the serial numbers as you have shown and then I write a simple list output to show error messages and so forth and for as long the list output is shown in the GUI the delivery is being locked for editing, like the FM is not let go until the application is exited. Any ideas?

former_member186078
Active Participant
0 Kudos

Hi Joseph,

Any update on the function modules and the method I suggested. I am also very much eager to know whether these are working for Delivery also or not?

0 Kudos

I'm looking at SERNR_ADD_TO_ls and SERIAL_LISTE_POST_LS as these appear to be for the delivery note as opposed to _AU which is for the SD document.

On the FM call for the post FM you don't need to pass anything?

0 Kudos

Hi jospeh,

You're on good way while using FM SERNR_ADD_TO_LS and SERIAL_LISTE_POST_LS .

In the second function module you don't need to pass anything.

Don't forget to make a commit work to avoid database error during synchronisation.

Unfortunatly i think it's impossible to post GI at the same time , i work on this subject for 3 weeks and the system is not able to do the both think at the same time due to BATCH SPLIT possibility . Do you find any solution for this ?

For IDOC processing, we call WS_DELIVERY_UPDATE FM twice times, 1 for update serial number, 1 for updating GI but in VL02N it's impossible to do it.

Let me know if you find a solution.

Best regards.

Bertrand

0 Kudos

Hi Joseph

I need to do the same process

Creation of delivery, picking and post goods issue, which include serial numbers as well.

Can you tell me which fm u called for these processes please because nothing is working for me!

Thanks

Anjali

0 Kudos

Hi sia,

I found the solution to update serial number in delivery when posting goods movement.

You have to implement 2 BADI for this.

First, implement BADI based on LE_SHP_DELIVERY_PROC, in this badi, implement methods SAVE_DOCUMENT_PREPARE and SAVE_AND_PUBLISH_DOCUMENT.

The last method is necessary for set serial number without posting goods movement .

In method SAVE_DOCUMENT_PREPARE you must update fields ANZSN for each item of the delivery . Bellow the code i wrote for this .

<i>* IT_DELIV is an attribute of the object

  • and its type is LEDLV_OUTP_DBDATA-LIPS .

  • IT_SERNOS is an attribute of the object and type is

  • LEDLV_OUTP_DBDATA-SERNO

IF if_tcode = 'VL02N'.

it_deliv = temp_xlips.

LOOP AT It_deliv assigning <deliv>.

<deliv>-anzsn = <deliv>-lfimg.

endloop.

  • Search all serial number set for this delivery

CALL FUNCTION 'LE_SHP_DLVOUTP_SERNR_SELECT'

EXPORTING

it_deliv_item = it_deliv

IMPORTING

et_sernos = it_sernos

EXCEPTIONS

records_not_found = 1

records_not_requested = 2

OTHERS = 3.

LOOP AT ct_xlikp ASSIGNING <likp> .

LOOP AT ct_xlips ASSIGNING <lips>

WHERE vbeln = <likp>-vbeln.

  • In my case serial number is link with Batch Number

  • So i check that Batch is set , if not i don't update

CHECK NOT <lips>-charg IS INITIAL.

CLEAR w_count.

  • Count how many serail number are set for the iteM

LOOP AT it_sernos TRANSPORTING NO FIELDS

WHERE vbeln = <lips>-vbeln

AND posnr = <lips>-posnr.

ADD 1 TO w_count.

ENDLOOP.

  • If current number of serial number set for the item

  • is not equal to the count then update .

CHECK <lips>-anzsn NE w_count.

<lips>-anzsn = w_count.

ENDLOOP.

ENDLOOP.

ENDIF.</i>

Then implement BADI based on LE_SHP_GOODSMOVEMENT. You only have one method available.

Find bellow the code i wrote for creating serial number, update delivery and make PGI right .

<i>*

  • In my case as i already said, serial number are

  • dependant of Batch number

  • Search for all delivery using the same batch number to

  • get the last serial number .

select * from lips

appending corresponding fields of table it_lips

for all entries in xlips

where charg = xlips-charg

and serail = xlips-serail

and matnr = xlips-matnr

and charg ne space.

  • Search for all serial number link with thoses delivery

loop at it_lips assigning <lips> .

append <lips> to it_deliv_item.

endloop.

call function 'LE_SHP_DLVOUTP_SERNR_SELECT'

exporting

it_deliv_item = it_deliv_item

importing

et_sernos = et_sernos

exceptions

records_not_found = 1

records_not_requested = 2

others = 3.

loop at xlips assigning <xlips>.

case <xlips>-charg .

when space.

  • No Batch for my item so Error message .

message e065(vl) with <xlips>-posnr.

  • The number of partial deliveries & has already been reached

when others.

  • check that some serial number are missing for the item

clear : w_cpt , loc_sernr .

free it_serial.

loop at et_sernos transporting no fields

where vbeln = <xlips>-vbeln

and posnr = <xlips>-posnr .

add 1 to w_cpt.

endloop.

check w_cpt < <xlips>-lfimg.

  • At least one serial number is missing .

w_dotimes = <xlips>-lfimg - w_cpt.

loc_sernr-charg = <xlips>-charg.

  • Search for the last serial number

loop at it_lips assigning <lips>

where charg = <xlips>-charg

and matnr = <xlips>-matnr.

loop at et_sernos assigning <sernos>

where vbeln = <lips>-vbeln

and posnr = <lips>-posnr.

use_sernr = <sernos>-sernr.

check use_sernr-cpt > loc_sernr-cpt.

loc_sernr = use_sernr.

endloop.

endloop.

  • creation of the new serial number .

do w_dotimes times.

add 1 to loc_sernr-cpt.

append initial line to it_serial

assigning <serial>.

<serial>-sernr = loc_sernr.

enddo.

check not it_serial[] is initial.

w_qty = <xlips>-lfimg.

  • update delivery with all new serial number

call function 'SERNR_ADD_TO_LS'

exporting

profile = <xlips>-serail

material = <xlips>-matnr

quantity = w_qty

j_vorgang = 'PMS8'

document = <xlips>-vbeln

item = <xlips>-posnr

debitor = is_likp-kunnr

vbtyp = is_likp-vbtyp

bwart = '601'

importing

anzsn = <xlips>-anzsn

tables

sernos = it_serial

exceptions

konfigurations_error = 1

serialnumber_errors = 2

serialnumber_warnings = 3

no_profile_operation = 4

others = 5.

check sy-subrc eq 0.

call function 'SERIAL_LISTE_POST_LS'.

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = 'X'.

endcase.

  • UPDATE of methods parameter to set the number of

  • serial number correct , if this part is not done then

  • you will get error message in the posting but the

  • delivery is update correctly.

loop at ct_ximseg assigning <mseg>

where vbeln = <xlips>-vbeln

and posnr = <xlips>-posnr.

<mseg>-anzsn = <xlips>-anzsn .

endloop.

endloop.

modify lips from table xlips.

commit work and wait.</i>

Hope this will help you.

Don't forget to rewards if this solve your trouble.

Best regards.

Bertrand.

0 Kudos

Bertrand,

in my case I wont have to search for serial numbers,the serial numbers will be already be given, do i still have to implement the BADIs?

and to create delivery,picking and post gooods issue should i use the fm BAPI_DELIVERYPROCESSING_EXEC or smthing else?

anjali

Hello,

The two function modules update tables SER01 with the delivery-id (in field SER01-LEIF_NO) in which record you find DER01-OBKNR. Using that OBKNR in table OBJK-OBKNR will return OBJK-SERNR.

So far so good. The field LIPS-ANZSN is not a serial number but the number of serial numbers of course. This does not appear to be updated by the FMs listed.

Your solution will work except that you are updating LIPS directly which is a major no-no. Do you know of any other means to update that field?

Some days later......

Ive found a FM that will solve the ANZSN problem : 'L_SER_SAVE_ANZSN_IN_DELIVERY'. It will post the nubmer of serial numbers in to LIPS-ANZSN. The delivery document needs to have been posted for this FM to work so you need to pick an enhancement after document save. For VL01(N) that will be program SAPMV50A, Include id : FV50XF0B_BELEG_SICHERN.

If the 'SERNR_ADD_TO_LS' and 'SERIAL_LISTE_POST_LS' worked then you will find an entry in table SER01. The document number will be in SER01-LIEF_NR. That same record will give you SER01-OBKNR.

SER01-OBKNR is the key field for table OBJK-OBKNR. That record will give you OBJK-SERNR.

Hope this helps.

Edited by: Philip Jones on May 4, 2011 12:07 PM

Former Member
0 Kudos

Hi all,

I am using SERNR_ADD_TO_AU to update serial number to sales order. This function call is followed by call to SERIAL_POST_UPDATE_AU. Serial number does get created in sales order. But the problem is it wipes out the stock information in the serial master. This creates a problem when we have to post goods issue using that serial number in the corresponding delivery document.

Has anyone run into similar problem? I would appreciate any suggestions.

Thanks again,

Ramesh

0 Kudos

We are using the DELVRY03 idoc with SHPCON message to accomplish what you are trying to do. The serial numbers are sent in on the E1EDL11 segments, and we are setting the E1EDK18-QUALF value to PGI.

Hope this helps.

Terri

0 Kudos

am calling FM SERNR_ADD_TO_ls and SERIAL_LISTE_POST_LS in sequence .

But it does not update the delivery with the serial numbers.

Sample code is below.

wa_sernos-sernr = p_sernr .

APPEND wa_sernos TO t_sernos.

CALL FUNCTION 'SERNR_ADD_TO_LS'

EXPORTING

profile = 'S004'

material = '80023UN01'

quantity = '0'

document = '0080835864'

item = '000010'

debitor = '10031801'

vbtyp = 'J'

serial_commit = serial_commit

TABLES

sernos = t_sernos .

IF sy-subrc <> 0.

CALL FUNCTION 'SERIAL_LISTE_POST_LS' .

COMMIT WORK.

ENDIF.

Is there something more that needs to be done??

Edited by: Ketan Nandrajog on Jul 1, 2008 4:47 PM

Former Member
0 Kudos

HI,

I am on 46C, and I am using WS_DELIVERY_UPDATE to creat an HU and pack the delivery. I seem to have the HU creation and packing working, however I cannot get this FM to update the serial numbers. I think I may be populating the wrong serial structures?? Not sure... Any help would be VERY much appreaciated.

Thanks

Trisha