Upload Serial Numbers via Excel File – MIGO (Goods Receipt)
We had a requirement wherien users requested a functionality to upload serial numbers via Excel File while performing MIGO transaction. Currently there is a limit wherein only 6 serial numbers can be entered at a time. If we are receipting 5000 quantities at a time (with no scanners in warehouse)…..this is a huge time consuming process.
Our initial approach was to provide various alternatives to attain the business requirement including uploading serial numbers from a reference document.
However…after careful analysis it was agreed to provide this functionality to business users.
NOTE: Please note that this is an SAP modification, which was implemented after lots of analysis. This document is not intended for anyone to copy this functionality without analysis.
Steps to provide this functionality are as follows:
1. Modify the screen 360 of program SAPLMIGO by introducing a new button as shown in below screenshot:
2. Set the attributes of this new button as shown in below screenshot:
Set the function code as “MIGO_OK_SER_UPLOAD”
3. Modify the program LMIGODS1 by introducing a new method namely “serial_upload” in class “lcl_migo_detail_serial_numbers”
Below is how the source code should be:
4. Modify the program LMIGODS2 by calling the newly created method “serial_upload” in method “lif_migo_frame~okcode_handler”
Function code should be the one which was entered for the newly created button. Please see the below screenshot:
5. Modify the program LMIGODS3 by implementing the method “serial_upload”
Please check the below codes to be entered: (These are sample codes…)
* Local Data Declaration
types: begin of ty_serial_upload,
serialno type gernr,
end of ty_serial_upload.
data: ls_goserial type lcl_migo_kernel=>ty_s_goserial,
lt_upload_serial type standard table of ty_serial_upload,
ls_upload_serial type ty_serial_upload,
lt_file type filetable,
ls_file type file_table,
lv_filename type string,
lv_rc type i.
* Open dialog box for obtaining file name
call method cl_gui_frontend_services=>file_open_dialog
file_table = lt_file
rc = lv_rc
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
others = 4.
* If the dialog box cannot be opened then exit.
if sy-subrc ne 0.
* Read the file name
read table lt_file into ls_file index 1.
if sy-subrc eq 0.
lv_filename = ls_file-filename.
* Upload the serial numbers from a text tab delimited file
call function ‘GUI_UPLOAD’
filename = lv_filename
filetype = ‘ASC’
data_tab = lt_upload_serial
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
if sy-subrc <> 0.
* Fill the serial number data into the internal table LT_GOSERIAL
loop at lt_upload_serial into ls_upload_serial.
ls_goserial-serialno = ls_upload_serial-serialno.
append ls_goserial to lt_goserial.
* Merge the serial numbers uploaded thorugh flat file with those
* already existing and display the consolidated data
call method serial_join.
6. This completes the various changes required.
Now, for testing purpose create a text tab delimited file as shown below:
7. Try to perform MIGO for a purchase order containing serial number managed material and for uploading serial numbers click on the newly created button and upload the above attached file. All of the serial numbers would be uploaded.
This modification was made using SAP Note 688602 as reference.
Again, please note that this was a modification that was performed in 4.6c system as a workaround for a missing functionality.