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

Function Module to update Serial Numbers in Delivery

Former Member
0 Likes
9,515

Hello there,

I am attempting to update serial numbers in an outbound delivery using function module SERNR_ADD_TO_LS followed by a perform of serial_liste_post_ls IN PROGRAM saplipw1. However I am struggle with error messages of inconsistancies in status management of the serial numbers. I have verified that the serial numbers I'm using are valid and available. Has anyone had any experience with this FM or others to post serial numbers into an outbound delivery?

Many thanks!

Hello there,

I am attempting to update serial numbers in an outbound delivery using function module SERNR_ADD_TO_LS followed by a perform of serial_liste_post_ls IN PROGRAM saplipw1. However I am struggle with error messages of inconsistancies in status management of the serial numbers. I have verified that the serial numbers I'm using are valid and available. Has anyone had any experience with this FM or others to post serial numbers into an outbound delivery?

Many thanks!

11 REPLIES 11
Read only

Former Member
0 Likes
5,191

I saw your other post in the other similar topic.

Can you check the settings of serial number creation in IMG?

We are presently using BDC to update serial numbers into Delivery in 46C.

Thanks...

How exactly are you trying to update the delivery? Are you using the FM in the custom program?

What is the system status of the serial numbers you are trying to update?

Message was edited by: B P

Read only

0 Likes
5,191

B P -

What I am doing is taking the serial numbers from the DELVRY03 IDoc which is being supplied by a decentralized WMS system for outbound delivery pick/pack. The IDOC process code for WHSCON message DELS process code does not update serial numbers. I'm passing the serial numbers to this FM and running a BDC to post goods issue (PGI) the delivery, when I capture the error messages of the PGI BDC I get errors like 'Exactly 2 serial numbers are required for the asset 00010'. I check the delivery and the serial numbers are there however I have hit the green check mark on the serial dialogue and the I can PGI the delivery. I thought maybe the asynchronous update might be lagging from the FM so I put a 2 minute sleep route between the serial FM and the PGI BDC.

Read only

0 Likes
5,191

So the FM is working and your are able to update the serial numbers, but you dont like a 2 minute delay?..

Why dont you use COMMIT WORK and WAIT. I think 2 min is a very long delay.

Rgds,

Bhavani

Read only

0 Likes
5,191

Bhavani

Not really.. allow me to elaborate some..

The FM's SERNR_ADD_TO_LS and the corresponding call of serial_liste_post_ls in program saplipw1 does populate serial numbers into outbound deliveries that are picked and packed (via a DELVRY03 IDoc interface) however when my PGI BDC runs I receive errors that the serial numbers still need to be entered. If I manually go into the delivery via VL02N, highlight the line, the select Extras/Serial Numbers I see my serial numbers, however I need to hit the green checkmark then I'm able to PGI the delivery. So answer it's working partially, the serial numbers are entered however they don't seem to be properly posted or updated in the delivery. I put a commit work statement in the application at the end of each delivery update and I instituted a 2 minute wait in the application to allow for all asynchronous updates to happen before running my PGI BDC. I hope this explains a bit more.

Read only

0 Likes
5,191

The most probable reason for that dialog box coming up is that, the delivery item does not get updated in FM and corresponding call of SERIAL_LISTE_POST_LS. The field LIPS-ANZSN is not updated, therefore you get the message that "Serial Numbers are not present". if you do MODIFY LIPS with count of serial numbers in field ANZSN, you should be able PGI w/o any problem.

Do you know that we can make serial number entry optional at delivery item level in IMG? If there is no purpose of having those serial numbers, you can as well do away with it. We are planning to do this in our system.

Since you are packing the delivery, HU must also contain the serial numbers. If you need serial numbers further down(like invoice), you can get them from HU instead of delivery.

Hope this helps.

Rgds,

Bhavani.

Read only

0 Likes
5,191

That is very helpful and turns out to be true, the delivery is updated with the serial numbers however LIPS is not. I have started to write a routine to correct this.

On another note in my application I'm noticing that the when I call FM serial_liste_post_ls IN PROGRAM saplipw1 that the internal tables being passed that were built in the FM SERNR_ADD_TO_LS contain serial data from all deliveries and consequently I'm getting errors.

My program loops at the delivery then the item and for each item I call the FM SERNR_ADD_TO_LS and then I call the serial_liste_post_ls IN PROGRAM saplipw1 once all lines have been passed and the first delivery updates fine. However the subsequent delivery receives an error of " Inconsitancy in status management for serial ". I have confirmed that the serials are good and when I go into debug I see the first delivery goes fine and then I noticed on the FM call of serial_liste_post_ls IN PROGRAM saplipw1 that the internal tables contains data from that delivery and the previous one.

Below is psuedo code replicating how I call the FM's

loop at i_likp.

loop at i_lips

where vbeln = i_likp-vbeln.

CALL FUNCTION 'SERNR_ADD_TO_LS'

EXPORTING

profile = 'Z002'

material = i_lips-matnr

quantity = i_lips-anzahl

j_vorgang = 'PMS3'

document = i_likp-vbeln

item = i_lips-posnr

debitor = i_likp-kunnr

vbtyp = i_lips-vgtyp

bwart = '601'

IMPORTING

anzsn = anzsn

zeilen_id = l_zeile

serial_commit = serial_commit

TABLES

sernos = sernr

EXCEPTIONS

konfigurations_error = 1

serialnumber_errors = 2

serialnumber_warnings = 3

no_profile_operation = 4

OTHERS = 5.

endloop.

PERFORM serial_liste_post_ls IN PROGRAM saplipw1.

COMMIT WORK.

endloop.

Any help is very much appreciated!!!

Read only

0 Likes
5,191

HI Joseph,

Could you please tell me how did you write the routine to update the table LIPS for field ANZSN.

I am also Facing same issue.

did you directly used modify/update command on tale LIPS or used some other Fm or BAP?

Thanks

YG

Read only

Former Member
0 Likes
5,191

Try the following:

SORT lt_serials BY rfpos.

CALL FUNCTION 'WS_DELIVERY_UPDATE'

EXPORTING

vbkok_wa = lwa_vbkok

delivery = i_vbeln

commit = 'X'

it_sernr_update = lt_serials

IMPORTING

ef_error_sernr_update = l_sernr_update

EXCEPTIONS

OTHERS = 99.

Ensure you do the sort before calling the function module.

hith

Sunil Achyut

Read only

0 Likes
5,191

Sunil,

I looked at this FM in our system (46C) and can not find the importing parameter it_sernr_update (see below). Is this FM sample from a later version of SAP then 46C.

IMPORTING

VALUE(VBKOK_WA) LIKE VBKOK STRUCTURE VBKOK

VALUE(SYNCHRON) LIKE RVSEL-XFELD DEFAULT ' '

VALUE(NO_MESSAGES_UPDATE) LIKE RVSEL-XFELD DEFAULT SPACE

VALUE(COMMIT) LIKE RVSEL-XFELD DEFAULT SPACE

VALUE(DELIVERY) LIKE LIKP-VBELN

VALUE(UPDATE_PICKING) LIKE RVSEL-XFELD DEFAULT SPACE

VALUE(NICHT_SPERREN) LIKE RVSEL-NO_SP DEFAULT ' '

VALUE(IF_CONFIRM_CENTRAL) LIKE RVSEL-XFELD DEFAULT SPACE

VALUE(IF_WMPP) LIKE RVSEL-XFELD DEFAULT SPACE

VALUE(IF_GET_DELIVERY_BUFFERED) TYPE RVSEL-XFELD DEFAULT SPACE

VALUE(IF_NO_GENERIC_SYSTEM_SERVICE) LIKE RVSEL-XFELD DEFAULT SPACE

VALUE(IF_DATABASE_UPDATE) TYPE LESHP_DATABASE_UPDATE DEFAULT '1'

VALUE(IF_NO_INIT) TYPE XFELD DEFAULT SPACE

VALUE(IF_NO_READ) TYPE XFELD DEFAULT SPACE

VALUE(IF_ERROR_MESSAGES_SEND_0) TYPE XFELD DEFAULT 'X'

Read only

Former Member
0 Likes
5,191

Hi,

Below is the function module which u can used to update the serial numbers for each delivery line item.

FORM serial_no_update TABLES p_it_returns STRUCTURE ztpi_dlvreturn.

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'

EXPORTING

header_data = it_header_data (delivery number alone is sufficient)

header_control = it_header_control (delivery number alone is sufficient)

delivery = v_delivery (delivery number alone is sufficient)

  • TECHN_CONTROL =

TABLES

  • HEADER_PARTNER =

  • HEADER_PARTNER_ADDR =

  • HEADER_DEADLINES =

  • ITEM_DATA =

  • ITEM_CONTROL =

item_serial_no = it_item_serial_no

  • SUPPLIER_CONS_DATA =

  • EXTENSION1 =

  • EXTENSION2 =

return = it_return

  • TOKENREFERENCE =

.

READ TABLE it_return WITH KEY type = 'E'.

IF sy-subrc NE 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

endif.

Read only

surykumar158
Explorer
0 Likes
5,191

Hello all,

You can use this parameter to update serial numbers

FM- WS_DELIVERY_UPDATE

Importing parameters

VBKOK_WA- VBELN

COMMIT-X

IF_DATABASE_UPDATE-1

IF_ERROR_MESSAGES_SEND_0-X

IT_SERNR_UPDATE- RFBEL(delivery number),RFPOS(item),SERNR

IF_LATE_DELIVERY_UPD-X

Thanks,

surya