Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Upload Serial Numbers via Excel File - MIGO (Goods Receipt)

$
0
0

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:

 

Screen 1.jpg

 

2. Set the attributes of this new button as shown in below screenshot:

 

Set the function code as "MIGO_OK_SER_UPLOAD"

 

Screen 2.jpg

 

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:

 

Screen 3.jpg

 

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:

 

Screen 4.JPG

 

 

5. Modify the program LMIGODS3 by implementing the method "serial_upload"

Please check the below codes to be entered: (These are sample codes...)

 

 

method serial_upload.
*   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.

    clear: lv_rc,
             ls_file.


    refresh: lt_goserial[],
                 lt_file[].


*   Open dialog box for obtaining file name
    call method cl_gui_frontend_services=>file_open_dialog
      changing
        file_table              = lt_file
        rc                         = lv_rc
      exceptions
        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.
      exit.
    endif.
*   Read the file name
    clear lv_filename.
    read table lt_file into ls_file index 1.
    if sy-subrc eq 0.
      lv_filename = ls_file-filename.
    else.
      exit.
    endif.


*   Upload the serial numbers from a text tab delimited file
    refresh: lt_upload_serial[].
    call function 'GUI_UPLOAD'
         exporting
              filename                 = lv_filename
              filetype                   = 'ASC'
         tables
              data_tab                = lt_upload_serial
         exceptions
              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.
      exit.
    endif.
*  Fill the serial number data into the internal table LT_GOSERIAL
    clear ls_upload_serial.
    loop at lt_upload_serial into ls_upload_serial.
      ls_goserial-serialno = ls_upload_serial-serialno.
      append ls_goserial to lt_goserial.
      clear: ls_goserial,
             ls_upload_serial.
    endloop.
*   Merge the serial numbers uploaded thorugh flat file with those
*   already existing and display the consolidated data
    call method serial_join.

  endmethod.

 

6. This completes the various changes required.

Now, for testing purpose create a text tab delimited file as shown below:

 

Screen 5.JPG

 

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.


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>