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: 

Serial Number prompt in VL01n

Former Member
0 Kudos

Hi,

Would you please assist on this issue; your help is highly appreciated.

I am trying to save serial number into a new delivery (VL01n) and I wonder if there is a way (through configuration) to prompt that serial number value assigned trough serialization, directly into VL01n, in Extra-> Serial Number; or if not is there another way to do this?

Thanks,

Ligia

1 ACCEPTED SOLUTION

sridhar_k1
Active Contributor
0 Kudos

You can try making the serial number mandatory in the serial number profile - serialializing procedure config (Tx: OIS2). set SerUsage field to 3.

Regards

Sridhar

17 REPLIES 17

Former Member
0 Kudos

Ligia,

Why not take the delivery created, and adapt your code for a delivery change tx (VL02N), and update the serial numbers there, via the ok code (PSER_T). Since serial number profiles are dependant upon the material number, I would think this would be your best choice.

Good luck!

Terry

sridhar_k1
Active Contributor
0 Kudos

You can try making the serial number mandatory in the serial number profile - serialializing procedure config (Tx: OIS2). set SerUsage field to 3.

Regards

Sridhar

0 Kudos

Thanks guys!

I checked and the configuration was set to mandatory.

I am now searching for a User Exit which would pre-populate the serial numbers when creating deliveries in VL01N. The requirement is to pre-populate fields RIPW0-SERNR in Screen 200/program SAPLIPW1 (which is part of transaction VL01N).

I appreciate any ideas!

Thanks,

Ligia

0 Kudos

CAn you tell the source of these serial numbers? Are you picking them up from a goods movement document of 601/603 movement types? There should already be a copy control for this type of functionality.

Check the transaction VOFM.

You can avoid this copy control by setting the flag in user exit IQSM0002.

-B.P

0 Kudos

Thanks for your prompt reply!

I am an abap-er- sorry what should I look for in vofm?

I looked at various exit like:EXIT_SAPLIPW1_002. I am getting my data from EQBS and EQUI and I was looking for an exit which would pre-populate the fields I mentioned and not to have to select them with the search help in VL01N.

txs -Ligia

0 Kudos

Hi ligia,

You can use a BADI for populated serial number in VL01N but you can do it only at save document because before user can modify data and it's very difficult to modify by program serial number.

Implement BADI name LE_SHP_DELIVERY_PROC and in method SAVE_DOCUMENT_PREPARE / SAVE_AND_PUBLISH_DOCUMENT you can set your code to set serial number.

If you want i can send you an sample of code i made for this .

Best regards.

Bertrand

0 Kudos

Hi Bertrand,

Your solution seems extremely interesting. It would be good to see the example of your code.

Thanks a lot,

Ligia

0 Kudos

Hi ligia,

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 = 'VL01N' OR

if_tcode = 'VL10C'.

FREE : it_sernos , it_deliv , it_equi.

temp_xlips = ct_xlips .

CHECK NOT temp_xlips[] IS INITIAL.

it_deliv = temp_xlips.

  • Search serial number already set

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.

  • Search the link between equipement and material of the

  • delivery

  • Table ZSEDBS_EQUI is a specific view between EQBS and

  • EQUI.

SELECT * FROM zsdeqbs_equi

APPENDING CORRESPONDING FIELDS OF TABLE it_equi

FOR ALL ENTRIES IN temp_xlips

WHERE kdauf = temp_xlips-vgbel

AND kdpos = temp_xlips-vgpos.

LOOP AT ct_xlikp ASSIGNING <likp> .

LOOP AT ct_xlips ASSIGNING <lips>

WHERE vbeln = <likp>-vbeln.

CLEAR w_count.

  • Count serial number already set

LOOP AT it_sernos TRANSPORTING NO FIELDS

WHERE posnr = <lips>-posnr.

ADD 1 TO w_count.

ENDLOOP.

  • At least one serial number missing

CHECK w_count < <lips>-lfimg.

<lips>-anzsn = <lips>-lfimg .

  • Retrieve the link material - equipement

LOOP AT it_equi ASSIGNING <equi>

WHERE kdauf = <lips>-vgbel

AND kdpos = <lips>-vgpos.

EXIT.

ENDLOOP.

CHECK sy-subrc NE 0.

  • no equipement retrieve => Error.

CLEAR <lips>-anzsn .

MESSAGE e262(io) WITH <lips>-matnr.

  • Serial number obligatory material & cannot be updated

ENDLOOP.

ENDLOOP.

</i>

Now the code I wrote in the method SAVE_AND_PUBLISH_DOCUMENT

<i>

DATA : it_lips TYPE HASHED TABLE OF lips

WITH UNIQUE KEY vbeln posnr ,

it_serial TYPE STANDARD TABLE OF e1rmsno ,

it_deliv_item TYPE ledlv_outp_dbdata-lips ,

et_sernos TYPE ledlv_outp_dbdata-serno,

w_qty TYPE risa0-anzahl ,

w_anzsn TYPE lips-anzsn ,

temp_xlips TYPE shp_lips_t.

.

FIELD-SYMBOLS : <lips> TYPE lipsvb ,

<local_lips> TYPE lips ,

<likp> TYPE likpvb ,

<equi> TYPE zsdeqbs_equi ,

<serial> TYPE e1rmsno .

CHECK if_tcode = 'VL01N' OR if_tcode = 'VL10C'.

temp_xlips = it_xlips.

CHECK NOT temp_xlips[] IS INITIAL.

  • Search for others delivery already created for this

  • order to avoid setting the same serial number.

SELECT * FROM lips

APPENDING CORRESPONDING FIELDS OF TABLE it_lips

FOR ALL ENTRIES IN temp_xlips

WHERE vgbel = temp_xlips-vgbel.

LOOP AT it_lips ASSIGNING <local_lips>.

APPEND <local_lips> TO it_deliv_item.

ENDLOOP.

  • This function give you all serial number already define for deliveries.

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 it_xlikp ASSIGNING <likp> .

LOOP AT temp_xlips ASSIGNING <lips>

WHERE vbeln = <likp>-vbeln.

CLEAR w_count.

  • Count how many serial number already set.

LOOP AT it_sernos TRANSPORTING NO FIELDS

WHERE posnr = <lips>-posnr.

ADD 1 TO w_count.

ENDLOOP.

CHECK w_count < <lips>-lfimg.

  • At least one serial number is missing.

FREE it_serial.

  • Search equipement link to material .

LOOP AT it_equi ASSIGNING <equi>

WHERE kdauf = <lips>-vgbel

AND kdpos = <lips>-vgpos.

READ TABLE it_sernos TRANSPORTING NO FIELDS

WITH KEY sernr = <equi>-sernr.

CHECK sy-subrc NE 0.

  • Serial number not already used in this delivery

READ TABLE et_sernos TRANSPORTING NO FIELDS

WITH KEY sernr = <equi>-sernr.

CHECK sy-subrc NE 0.

  • Serial number not already used in others delivery

ADD 1 TO w_count.

APPEND INITIAL LINE TO it_serial

ASSIGNING <serial>.

<serial>-sernr = <equi>-sernr.

CHECK w_count >= <lips>-lfimg.

  • All serial number are set

EXIT.

ENDLOOP.

CHECK NOT it_serial[] IS INITIAL.

w_qty = <lips>-lfimg.

  • Update of the delivery with all new serial number

CALL FUNCTION 'SERNR_ADD_TO_LS'

EXPORTING

profile = <lips>-serail

material = <lips>-matnr

quantity = w_qty

document = <lips>-vbeln

item = <lips>-posnr

debitor = <likp>-kunnr

vbtyp = <likp>-vbtyp

IMPORTING

anzsn = w_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'.

COMMIT WORK AND WAIT.

ENDLOOP.

ENDLOOP.</i>

Hope this help you .

If you want to set the serial number while posting goods movement , you have to implement an others badi and modify the one i describe here. Let me know if you need information .

Best regards.

Bertrand.

0 Kudos

Thank you Bertrand for your prompt reply.

I will look into it and let you know about the fix.

Thanks and kind regards,

Ligia

0 Kudos

Hi Bertrand,

Thanks again for your help! I implemented my code as you sugested, but when I try to debugg the BADI, when creating new delivery (VL01N), the debugg will not stop at the methods I implemented and I am not sure why. It looks like they are not triggered on VL01N.

Thank you.

Ligia

0 Kudos

Hi ligia,

For BADI implementation you have to activate the method but also the all BADI like you do with customer enhancement ( CMOD ) .

If you don't do the both activation you can't debug and your code is not done.

Bertrand

0 Kudos

Hi Bertrand,

I accorded you maximum points. Thanks a lot!!!

I implemented the code and passed the data between the two methods via Export/import to/from Memory.

Great stuff!

Best regards,

Ligia

0 Kudos

Hello Bertrand,

I found your coding which help me to save much time in a similar development.

Thank you very much.

Franck

0 Kudos

Hi Bertrand,

I implemented your sugestion but I get an error when assigning serial numbers to multipple items delivery; I get the error:" "Delivery note assignment" is not allowed (EQU 10044153)" for example. It works only for first delivery item, but the SERNR do not get assigned to the rest of items. (with VL10A)

Also, I tried using this solution for a partial return delivery creation but the SERNR do not get assigned.

Thanks a lot and regards!

Ligia

0 Kudos

Hi Lidia,

The problems doesn't comes from the code you implement but seams to come from the equipment linked with the serail number .

Have you update the number of serial number in LIPS for your items ?

I implement my code and it's works for delivery created thru VL10 transaction with several items ( including batch split ) .

Can you check with functionnal consultant who works on Equipment if everything is ok ?

Best regards.

0 Kudos

Thanks very much Bertrand for your answer!

Yes, I did update the number of serial numbers in LIPS for every item. We implemented another solution now- but I really wanted your solution to work- I find it more user frienly and elegant.

I noticed that the error message: "Delivery note assignment" is not allowed (EQU 10044153' because of the system status (I0186) of the second item in delivery changes during processing to an 'active' value.

Thanks again,

Ligia

Message was edited by:

Ligia Ion

0 Kudos

Hi Lidia,

Nice if you find a way to solve your problem but it's strange that items change of status during the process of the badi . I don't get this error and there's about 300 deliverires creted per days and about 500 delivery modified a days .

Best regards