SAP - How To Upload Serial Number

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7
At a glance
Powered by AI
The discussion outlines how to use a BADI implementation to automatically assign serial numbers during delivery creation in VL01N. The BADI LE_SHP_DELIVERY_PROC can be used, and the method SAVE_AND_PUBLISH_BEFORE_OUTPUT can contain logic to fetch serial numbers.

Serial numbers can be automatically assigned in VL01N by implementing a BADI and adding logic in the method SAVE_AND_PUBLISH_BEFORE_OUTPUT to fetch serial numbers using a number range, add them to the list using SERNR_ADD_TO_LS, and update the serial number field.

The BADI that can be used for this purpose is LE_SHP_DELIVERY_PROC.

How to automatically assign the serial...

studentof abap 83 posts since Nov 22, 2011


How to automatically assign the serial numbers in VL01N Feb 3, 2012 9:03 AM
When creating a delivery in VL01N for a material that is serial number managed,how can i have the system
automatically assign the serial numbers for the relevant quantity instead of having the user select the serial
numbers manually.
I am reading of an enhancement IQSM0001 for Automatic serial number assignment,can it solve the problem,
Can some one help how to use it?
thnx

nabheet madan 5,706 posts since Oct 1, 2009


Re: How to automatically assign the serial numbers in VL01N Feb 3, 2012 9:17 AM
Yes it will..Create a project for this enhancement in CMOD and put a break point in zinclude. In debugging
chnage the serial number it will be reflected. than you can code accoriding to your own needs.
Nabheet

studentof abap 83 posts since Nov 22, 2011


Re: How to automatically assign the serial numbers in VL01N Feb 3, 2012 9:23 AM
Hi Nabeet can you provide more details on how to create this,am new in this?

nabheet madan 5,706 posts since Oct 1, 2009


Re: How to automatically assign the serial numbers in VL01N Feb 3, 2012 9:25 AM
Please search on SDN for how to implement a customer exit. You will find many articles for the same.
Headstart is CMOD
Nabheet

studentof abap 83 posts since Nov 22, 2011


Re: How to automatically assign the serial numbers in VL01N Feb 3, 2012 9:29 AM
thanx for the direction am on it

studentof abap 83 posts since Nov 22, 2011


Re: How to automatically assign the serial numbers in VL01N Feb 3, 2012 11:57 AM

Generated by Jive on 2015-06-26+02:00


1

How to automatically assign the serial...

Hi my version of netweaver is 7.0 netweaver ,on reading about customer exit (cmod) http://wiki.sdn.sap.com/
wiki/display/ABAP/CustomerExits%28CMOD%29 IItis indicated that this concept is obsolete for netweaver
7.0 and is replaced by the classic and new BAdIs, and SAP does not create any more customer exit.I was
wondering if still applicable to use the enhancement.IQSM0001 in my version of 7.0 because I can see in
se84 it exist ?
Edited by: JackAbaper on Feb 3, 2012 11:53 AM
Edited by: JackAbaper on Feb 3, 2012 11:55 AM

studentof abap 83 posts since Nov 22, 2011


Re: How to automatically assign the serial numbers in VL01N Feb 3, 2012 12:48 PM
Hi Nabheet,
Thank you so much for your direction but am still stuck in how to code this in include.Do you have a sample
code that can demonstrate this.thank you

Naveen Vajja 120 posts since Sep 11, 2010


Re: How to automatically assign the serial numbers in VL01N Feb 5, 2012 8:05 AM
Hi,
What you can do is implement BADI
In that implementation in the method 'SAVE_AND_PUBLISH_BEFORE_OUTPUT'
">>> Use number range EQUIP_NR to get current values
call function 'SERNR_ADD_TO_LS' passing required values.
if SERIAL_COMMIT = 'X'.
PERFORM SERIAL_LISTE_POST_LS in SAPLIPW1.
endif,

Make sure you validate the processing using ABAP stack and T-Code check....I made a blunder not checking
those...

studentof abap 83 posts since Nov 22, 2011


Re: How to automatically assign the serial numbers in VL01N Feb 5, 2012 8:30 AM
Hi,
Thanks for the code logic.

Generated by Jive on 2015-06-26+02:00


2

How to automatically assign the serial...

What is the name of the BADi to be implemented for this case?


and how to validate the processing using ABAP stack and T-Code check , please provide the procedure to
check this?thank you
rgd
JA

Naveen Vajja 120 posts since Sep 11, 2010


Re: How to automatically assign the serial numbers in VL01N Feb 5, 2012 11:33 AM
Hi,
Thanks for the code logic.

Jobless guy....happy to help


What is the name of the BADi to be implemented for this case?

Simplest way to find a BADI.


Goto SE24->CL_EXITHANDLER->method GET_INSTANCE...place a break point after
GET_CLASS_NAME_BY_REFERENCE
Now execute VL01N.
When you press 'SAVE' you get CLASS name which gives you BADI name
SHP_DELIVERY_PROC i guess...sorry dont have SAP access.
and how to validate the processing using ABAP stack and T-Code check , please provide
the procedure to check this?

actually forget the stack and just check for Tcode


if sy-tcode = 'VL01X'
endif.
That should do...

studentof abap 83 posts since Nov 22, 2011


Re: How to automatically assign the serial numbers in VL01N Feb 5, 2012 12:31 PM
So far your answer seems to be the best in answering this question ,I will try it out and update you soon
Thank you again.
regds
JA

Generated by Jive on 2015-06-26+02:00


3

How to automatically assign the serial...

studentof abap 83 posts since Nov 22, 2011


Re: How to automatically assign the serial numbers in VL01N Feb 6, 2012 5:47 PM
Please help
I managed to find the BADI NAME :SHP_DELIVERY_PROC and method SAVE AND
PUBLISH_BEFORE_OUTPUT.Please in detail how do I implement statement :">>> Use number range
EQUIP_NR to get current values
Could you please detail on this?
What values should be passed on call function 'SERNR_ADD_TO_LS' ?Can you detail on this too please?
Please help Abapers?
Edited by: JackAbaper on Feb 6, 2012 5:42 PM

Naveen Vajja 120 posts since Sep 11, 2010


Re: How to automatically assign the serial numbers in VL01N Feb 7, 2012 3:41 AM
Hi ,
The BADI IS appropriate and so is the method.
These need to be used to use the existing Serial number range
CALL FUNCTION 'NUMBER_RANGE_ENQUEUE' ">>>> Enqueue to ensure that this is not parallely processed.

Loop this for for the lines in lips


CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR
= '01'
Now dequeue
CALL FUNCTION 'NUMBER_RANGE_DEQUEUE' ">>>> Dequeue process
EXPORTING
OBJECT
Now the main function
CALL FUNCTION 'SERNR_ADD_TO_LS'
EXPORTING
PROFILE
= WA_XLIPS-SERAIL
Then
IF SERIAL_COMMIT = 'X'.
">>>>If serial numbers and Object numbers are generated
and viola my friend...we are done

PERFORM SERIAL_L

sai vignesh sudarsan 4 posts since Jan 28, 2015


Re: How to automatically assign the serial numbers in VL01N Jun 12, 2015 11:16 PM
Hi Naveen Vajja,

Thanks a ton for your valuable piece of information :-)

Generated by Jive on 2015-06-26+02:00


4

How to automatically assign the serial...

I got a requirement to update the serial numbers during outbound delivery creation in VL01N.
the information that u have provided had assisted me in accomplishing the goal :-)
I have used the BADI: LE_SHP_DELIVERY_PROC and implemented an enhancement for the METHOD:
SAVE AND PUBLISH_BEFORE_OUTPUT.
Step - 1: used the logic provided to me to fetch the serial numbers.
Step - 2: used the FM: SERNR_ADD_TO_LS
Step - 3: used the below code to update
IF SERIAL_COMMIT = 'X'.
">>>>If serial numbers and Object numbers are generated
PERFORM SERIAL_LISTE_POST_LS IN PROGRAM SAPLIPW1.
ENDIF.

Thank you once again. :-)

Regards,
Sai Vignesh.

studentof abap 83 posts since Nov 22, 2011


Re: How to automatically assign the serial numbers in VL01N Feb 7, 2012 1:28 PM
Hi,
I have implemented your code as follows in the method but not complete:My now question is the loops and the
data declarations for this.
Could you also provide me with the data declarations and loops used for this?
for e.g for WA_XLIPS,WA_XLIKP,LV_ANZAHL
I have tried to make it_sernum getting from table LIPS but not sure with my statement.Please see.
Thank you
Appreciated.
METHOD if_ex_le_shp_delivery_proc~save_and_publish_before_output.
CALL FUNCTION 'NUMBER_RANGE_ENQUEUE'
EXPORTING
object
= 'EQUIP_NR'
EXCEPTIONS
foreign_lock = 1
object_not_found = 2
system_failure = 3
OTHERS
= 4.

Generated by Jive on 2015-06-26+02:00


5

How to automatically assign the serial...

DATA: it_sernum TYPE STANDARD TABLE OF lips,


wa_sernum TYPE lips.
LOOP AT it_sernum INTO wa_sernum.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr
= '01'
object
= 'EQUIP_NR'
quantity
= '1'
SUBOBJECT
=''
TOYEAR
= '0000'
ignore_buffer
IMPORTING

= 'X'

number
= wa_sernum-sernr
QUANTITY
=
RETURNCODE
=
EXCEPTIONS
interval_not_found
=1
number_range_not_intern
=2
object_not_found
=3
quantity_is_0
=4
quantity_is_not_1
=5
interval_overflow
=6
buffer_overflow
=7
OTHERS
=8
endloop.
CALL FUNCTION 'NUMBER_RANGE_DEQUEUE'
EXPORTING
object
= 'EQUIP_NR'
EXCEPTIONS
OBJECT_NOT_FOUND
=1
OTHERS
=2
endloop.
CALL FUNCTION 'SERNR_ADD_TO_LS'
EXPORTING
PROFILE
= WA_XLIPS-SERAIL
MATERIAL
= WA_XLIPS-MATNR
QUANTITY
= LV_ANZAHL ">>>>Type cast this from LFIMG

Generated by Jive on 2015-06-26+02:00


6

How to automatically assign the serial...

DOCUMENT
= WA_XLIPS-VBELN
ITEM
= WA_XLIPS-POSNR
DEBITOR
= WA_XLIKP-KUNNR
VBTYP
= ' ' "WA_XLIPS-VGTYP
BWART
= WA_XLIPS-BWART
SNBWG
= 'XXXX' ">>>>Serial number profuile of the material
M_WERK
= WA_XLIPS-WERKS
IMPORTING
ANZSN
= WA_XLIPS-ANZSN
SERIAL_COMMIT
= SERIAL_COMMIT
TABLES
SERNOS
= IT_SERNUM
EXCEPTIONS ">>>>Please use all exceptions
endmethod.

Naveen Vajja 120 posts since Sep 11, 2010


Re: How to automatically assign the serial numbers in VL01N Feb 7, 2012 3:04 PM
They would be very simple my friend...hope this will help you from next time on...
Could you also provide me with the data declarations and loops used for this?
for e.g for WA_XLIPS,WA_XLIKP,LV_ANZAHL

Goto SE37->'SERNR_ADD_TO_LS->deduce from the data declaration of the parameters


But for now
data wa_xlips type lipsvb. ">>>> Please verify in your system againt the parameters of your BADI data wa_xlikp type likpvb.
data it_sernum type e1rmsno. ">>>>This contains a list of all your serial numbers
for the loop part
loop at it_xlips into wa_xlips. ">>>>loop runs for each and every item ">>>>do your enqueue dequeue....populate it_sernum f
*Another important thing is find another method of the same badi implementation and populate lips-anzsn from
the exporting parameter of this function module.
Its a little pain coz of the complications,but sometimes a little research on your end might just eliminate your
hassles.But for now glad to help

Generated by Jive on 2015-06-26+02:00


7

You might also like