<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Excel file upload issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/excel-file-upload-issue/m-p/747404#M35865</link>
    <description>&lt;P&gt;Either use standard tool (like mentionned FM) or OLE2 or a tool such as Abap2XLS (*)&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;But you could first map data to a table without format (text fields) and then map yourself those field values to the final internal table (with TRY/CATCH/ENDTRY) in some loop on records and then on subfields.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;(*) &lt;A href="https://blogs.sap.com/?p=62676"&gt;abap2xlsx – Generate your professional Excel spreadsheet from ABAP&lt;/A&gt;, &lt;A href="http://www.abap2xlsx.org/"&gt;abap2xlsx by ivanfemia&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Nov 2018 07:48:19 GMT</pubDate>
    <dc:creator>RaymondGiuseppi</dc:creator>
    <dc:date>2018-11-19T07:48:19Z</dc:date>
    <item>
      <title>Excel file upload issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/excel-file-upload-issue/m-p/747403#M35864</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;My objective is for upload of data through excel into SAP by using a simple ABAP report. But in case of any format issue in any of the record of input, the next records are not getting processed.&lt;/P&gt;
  &lt;P&gt;For e.g. if I have 100 records in excel and 40th record is having some format issue, then only 39 records are being converted to internal table and remaining are not being processed.&lt;/P&gt;
  &lt;P&gt;Can anyone tell me that how to skip that record with format error and process next records after that since I have already used ALSM_EXCEL_TO_INTERNAL_TABLE, TEXT_CONVERT_XLS_TO_SAP&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 07:07:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/excel-file-upload-issue/m-p/747403#M35864</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-11-19T07:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Excel file upload issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/excel-file-upload-issue/m-p/747404#M35865</link>
      <description>&lt;P&gt;Either use standard tool (like mentionned FM) or OLE2 or a tool such as Abap2XLS (*)&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;But you could first map data to a table without format (text fields) and then map yourself those field values to the final internal table (with TRY/CATCH/ENDTRY) in some loop on records and then on subfields.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;(*) &lt;A href="https://blogs.sap.com/?p=62676"&gt;abap2xlsx – Generate your professional Excel spreadsheet from ABAP&lt;/A&gt;, &lt;A href="http://www.abap2xlsx.org/"&gt;abap2xlsx by ivanfemia&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 07:48:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/excel-file-upload-issue/m-p/747404#M35865</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2018-11-19T07:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Excel file upload issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/excel-file-upload-issue/m-p/747405#M35866</link>
      <description>&lt;P&gt;HI &lt;A href="https://answers.sap.com/users/455759/swaraj1265-1.html"&gt;Swaraj Kumar Mishra&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Can you check the below code where it converts Excel to Internal table using class based approach. Maybe in this those bugs might not come.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*Read the Excel Data

    cl_gui_frontend_services=&amp;gt;gui_upload(

      EXPORTING

        filename                = iv_file_name    " Name of file

        filetype                = 'BIN'

      IMPORTING

        filelength              = DATA(lv_length)

      CHANGING

        data_tab                = lt_data    " Transfer table for file contents

      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

        not_supported_by_gui    = 17

        error_no_gui            = 18

        OTHERS                  = 19

    ).

    IF sy-subrc &amp;lt;&amp;gt; 0.

      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO DATA(lv_dummy).

* Add Message

      append_message(

        CHANGING

          ct_messages = et_messages    " Return parameter table

      ).

      RETURN.

    ENDIF.

* Show provgress indicator

    cl_progress_indicator=&amp;gt;progress_indicate(

      EXPORTING

        i_text               = 'Loading the excel data....'

        i_processed          = 50

        i_total              = 100

        i_output_immediately = abap_true ).



* Convert it to xstring

    CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'

      EXPORTING

        input_length = lv_length

      IMPORTING

        buffer       = lv_content

      TABLES

        binary_tab   = lt_data

      EXCEPTIONS

        failed       = 1

        OTHERS       = 2.

    IF sy-subrc NE 0.

* Add Message

      append_message(

        CHANGING

          ct_messages = et_messages    " Return parameter table

      ).

      RETURN.

    ENDIF.



* User Excel functions to read the worksheet

    TRY.

        DATA(lr_excel) = NEW cl_fdt_xl_spreadsheet( document_name = iv_file_name xdocument = lv_content ).

        IF lr_excel IS BOUND.

          lr_excel-&amp;gt;if_fdt_doc_spreadsheet~get_worksheet_names( IMPORTING worksheet_names = DATA(lt_worksheets) ).

        ENDIF.

      CATCH cx_root.

* Add Message

        MESSAGE ID 'ZMSG_EGA_CA' TYPE 'E' NUMBER 008 WITH 'Error while reading the Excel' INTO lv_dummy.

        append_message(

          CHANGING

            ct_messages = et_messages    " Return parameter table

        ).

        RETURN.

    ENDTRY.



    mt_excel_read_data = ct_excel_read_data.

    LOOP AT lt_worksheets REFERENCE INTO DATA(lo_worksheets).



      CHECK line_exists( mt_excel_read_data[ name = lo_worksheets-&amp;gt;* ] ).



      DATA(lr_worksheet_itab) = lr_excel-&amp;gt;if_fdt_doc_spreadsheet~get_itab_from_worksheet( lo_worksheets-&amp;gt;* ).

      ASSIGN lr_worksheet_itab-&amp;gt;* TO &amp;lt;ft_excel_data&amp;gt;.



      DATA(lo_data) = mt_excel_read_data[ name = lo_worksheets-&amp;gt;* ]-data.

      ASSIGN lo_data-&amp;gt;* TO &amp;lt;ft_conv_data&amp;gt;.



      IF &amp;lt;ft_excel_data&amp;gt; IS ASSIGNED AND &amp;lt;ft_conv_data&amp;gt; IS ASSIGNED.

        LOOP AT &amp;lt;ft_excel_data&amp;gt; ASSIGNING &amp;lt;fs_excel_data&amp;gt;.

          IF sy-tabix = 1. " First line is header

            CONTINUE.

          ENDIF.

*   Initialize flag
" Your output table below
          APPEND INITIAL LINE TO &amp;lt;ft_conv_data&amp;gt; ASSIGNING &amp;lt;fs_conv_data&amp;gt;.

          DATA(lv_flag) = abap_true.

          WHILE lv_flag = abap_true.

            DATA(lv_index) = sy-index.

*     Read columnwise entries

            ASSIGN COMPONENT lv_index OF STRUCTURE &amp;lt;fs_excel_data&amp;gt; TO &amp;lt;fs_comp_excel&amp;gt;.

            IF &amp;lt;fs_comp_excel&amp;gt; IS NOT ASSIGNED.

              lv_flag = abap_false.

*       Exit the loop when a row ends

              EXIT.

            ELSE.

              ASSIGN COMPONENT lv_index OF STRUCTURE &amp;lt;fs_conv_data&amp;gt; TO &amp;lt;fs_comp_target&amp;gt;.

              &amp;lt;fs_comp_target&amp;gt; = &amp;lt;fs_comp_excel&amp;gt;.

            ENDIF.

*     Unassign field symbol

            UNASSIGN &amp;lt;fs_comp_excel&amp;gt;.

          ENDWHILE.

        ENDLOOP.

      ELSE.

        "Record error

      ENDIF.

    ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Mahesh&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 08:32:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/excel-file-upload-issue/m-p/747405#M35866</guid>
      <dc:creator>maheshpalavalli</dc:creator>
      <dc:date>2018-11-19T08:32:32Z</dc:date>
    </item>
  </channel>
</rss>

