<?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: MB1B in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/mb1b/m-p/2432835#M543939</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The below code is to upload data from an excel flat file into SAP. My requirement consists of 5 fields.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* Data declarations to download data from excel
data : it_data type standard table of alsmex_tabline initial size 0,
       is_data type alsmex_tabline.
* Data declarations for downloaded data from excel in internal table for
* Floor Area
data : begin of it_tab occurs 0,
         bukrs like anla-bukrs,
         anln1 like anla-anln1,
         anln2 like anla-anln2,
         grufl like anla-grufl,
         leabg type sy-datum,
       end of it_tab.
selection-screen : begin of block b1 with frame title text-001.
parameters       : p_ifname type rlgrap-filename obligatory.
selection-screen : end of block b1.
* At Selection Screen for Input File Name
at selection-screen on value-request for p_ifname.

* Making F4 enale at selection scree for input file location
  call function 'F4_FILENAME'
       exporting
            program_name  = syst-cprog
            dynpro_number = syst-dynnr
       importing
            file_name     = p_ifname.

* Start of selection
start-of-selection.

* Upload data from Excel to internal table format
  call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
       exporting
            filename                = p_ifname
            i_begin_col             = 1
            i_begin_row             = 1
            i_end_col               = 256
            i_end_row               = 65356
       tables
            intern                  = it_data
       exceptions
            inconsistent_parameters = 1
            upload_ole              = 2
            others                  = 3.
  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.
  endif.

* Delete the heading if exists
  delete it_data where row = '001'.

* Append EXCEL Data into a internal table
  loop at it_data into is_data.
    at new row.
      clear it_tab.
    endat.
    if is_data-col = '001'.
      move is_data-value to it_tab-bukrs.
    endif.
    if is_data-col = '002'.
      move is_data-value to it_tab-anln1.
    endif.
    if is_data-col = '003'.
      move is_data-value to it_tab-anln2.
    endif.
    if is_data-col = '004'.
        move is_data-value to it_tab-grufl.
    endif.
    IF is_data-col = '005'.
      CALL FUNCTION 'CONVERSION_EXIT_IDATE_INPUT'
           EXPORTING
                input  = is_data-value
           IMPORTING
                output = it_tab-leabg.
    ENDIF.

    at end of row.
      append it_tab.
      clear it_tab.
    endat.
    clear : is_data.
  endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Jul 2007 02:07:40 GMT</pubDate>
    <dc:creator>gopi_narendra</dc:creator>
    <dc:date>2007-07-04T02:07:40Z</dc:date>
    <item>
      <title>MB1B</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mb1b/m-p/2432834#M543938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi friends....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could u plz tell me how can i upload datas from flat file to sap for the transaction MB1B....in this transaction docu date &amp;amp; posting dates are there so that i am asking hw can i take that dates in flat file...coud u explain me in details?????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 02:01:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mb1b/m-p/2432834#M543938</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-04T02:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: MB1B</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mb1b/m-p/2432835#M543939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The below code is to upload data from an excel flat file into SAP. My requirement consists of 5 fields.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* Data declarations to download data from excel
data : it_data type standard table of alsmex_tabline initial size 0,
       is_data type alsmex_tabline.
* Data declarations for downloaded data from excel in internal table for
* Floor Area
data : begin of it_tab occurs 0,
         bukrs like anla-bukrs,
         anln1 like anla-anln1,
         anln2 like anla-anln2,
         grufl like anla-grufl,
         leabg type sy-datum,
       end of it_tab.
selection-screen : begin of block b1 with frame title text-001.
parameters       : p_ifname type rlgrap-filename obligatory.
selection-screen : end of block b1.
* At Selection Screen for Input File Name
at selection-screen on value-request for p_ifname.

* Making F4 enale at selection scree for input file location
  call function 'F4_FILENAME'
       exporting
            program_name  = syst-cprog
            dynpro_number = syst-dynnr
       importing
            file_name     = p_ifname.

* Start of selection
start-of-selection.

* Upload data from Excel to internal table format
  call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
       exporting
            filename                = p_ifname
            i_begin_col             = 1
            i_begin_row             = 1
            i_end_col               = 256
            i_end_row               = 65356
       tables
            intern                  = it_data
       exceptions
            inconsistent_parameters = 1
            upload_ole              = 2
            others                  = 3.
  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.
  endif.

* Delete the heading if exists
  delete it_data where row = '001'.

* Append EXCEL Data into a internal table
  loop at it_data into is_data.
    at new row.
      clear it_tab.
    endat.
    if is_data-col = '001'.
      move is_data-value to it_tab-bukrs.
    endif.
    if is_data-col = '002'.
      move is_data-value to it_tab-anln1.
    endif.
    if is_data-col = '003'.
      move is_data-value to it_tab-anln2.
    endif.
    if is_data-col = '004'.
        move is_data-value to it_tab-grufl.
    endif.
    IF is_data-col = '005'.
      CALL FUNCTION 'CONVERSION_EXIT_IDATE_INPUT'
           EXPORTING
                input  = is_data-value
           IMPORTING
                output = it_tab-leabg.
    ENDIF.

    at end of row.
      append it_tab.
      clear it_tab.
    endat.
    clear : is_data.
  endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 02:07:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mb1b/m-p/2432835#M543939</guid>
      <dc:creator>gopi_narendra</dc:creator>
      <dc:date>2007-07-04T02:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: MB1B</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mb1b/m-p/2432836#M543940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In case the upload flat file is a TEXT File use the FM GUI_UPLOAD simply&lt;/P&gt;&lt;P&gt;Below is the code for that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Types declaration for TY_DATATAB
TYPES : BEGIN OF ty_datatab,
          matnr TYPE matnr,
          stawn TYPE stawn,
        END OF ty_datatab.

* Data declaration for TY_DATATAB
DATA : it_datatab TYPE STANDARD TABLE OF ty_datatab INITIAL SIZE 0,
       is_datatab TYPE ty_datatab.

* Selection Screen fields
parameters : P_FILE like RLGRAP-FILENAME obligatory. " Data Set Name

* At selection-screen on value-request
at selection-screen on value-request for P_FILE.

  call function 'F4_FILENAME'
    exporting
      PROGRAM_NAME  = SYST-CPROG
      DYNPRO_NUMBER = SYST-DYNNR
    importing
      FILE_NAME     = P_FILE.

    work-h_filename = p_file.

* Call function to upload data from flat file to internal table
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = work-h_filename
          filetype                = c_asc
          has_field_separator     = c_x
        IMPORTING
          filelength              = work-h_filelength
        TABLES
          data_tab                = it_datatab
        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 &amp;lt;&amp;gt; 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 02:15:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mb1b/m-p/2432836#M543940</guid>
      <dc:creator>gopi_narendra</dc:creator>
      <dc:date>2007-07-04T02:15:27Z</dc:date>
    </item>
  </channel>
</rss>

