<?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: Bdc in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521865#M570915</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the FM : ALSM_EXCEL_TO_INTERNAL_TABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the sample code below, with a single field in excel file. like wise you can use it with all your fields in Excel.&lt;/P&gt;&lt;P&gt;If you find any difficulty in implementing it do let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
parameters       : p_ifname type rlgrap-filename.
data : it_data type table of alsmex_tabline initial size 0,
       is_data type alsmex_tabline.

* Flatfile internal table.
types : begin of ty_tab,
          zuonr type bsid-zuonr,
        end of ty_tab.

data : it_tab type table of ty_tab initial size 0,
       is_tab type ty_tab.

* If Input file name is not initial.
  if not p_ifname is initial.
* Upload EXCEL data into internal table
    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.
  endif.

* Append EXCEL Data into a internal table
  loop at it_data into is_data.
    at new row.
      clear is_tab.
    endat.
    if is_data-col = '001'.
      move is_data-value to is_tab-zuonr.
    endif.
    at end of row.
      append is_tab to it_tab.
    endat.
    clear : is_data.
  endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&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, 18 Jul 2007 03:43:37 GMT</pubDate>
    <dc:creator>gopi_narendra</dc:creator>
    <dc:date>2007-07-18T03:43:37Z</dc:date>
    <item>
      <title>Bdc</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521864#M570914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i want to upload the vendor details from an excel file to sap  using bdc.&lt;/P&gt;&lt;P&gt;i have taken four fileds &lt;/P&gt;&lt;P&gt;LIFNR&lt;/P&gt;&lt;P&gt;BURKS&lt;/P&gt;&lt;P&gt;EKORG&lt;/P&gt;&lt;P&gt;KTOKK&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PLS help how to upload this from an excel file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2007 03:41:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521864#M570914</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-18T03:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Bdc</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521865#M570915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the FM : ALSM_EXCEL_TO_INTERNAL_TABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the sample code below, with a single field in excel file. like wise you can use it with all your fields in Excel.&lt;/P&gt;&lt;P&gt;If you find any difficulty in implementing it do let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
parameters       : p_ifname type rlgrap-filename.
data : it_data type table of alsmex_tabline initial size 0,
       is_data type alsmex_tabline.

* Flatfile internal table.
types : begin of ty_tab,
          zuonr type bsid-zuonr,
        end of ty_tab.

data : it_tab type table of ty_tab initial size 0,
       is_tab type ty_tab.

* If Input file name is not initial.
  if not p_ifname is initial.
* Upload EXCEL data into internal table
    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.
  endif.

* Append EXCEL Data into a internal table
  loop at it_data into is_data.
    at new row.
      clear is_tab.
    endat.
    if is_data-col = '001'.
      move is_data-value to is_tab-zuonr.
    endif.
    at end of row.
      append is_tab to it_tab.
    endat.
    clear : is_data.
  endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&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, 18 Jul 2007 03:43:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521865#M570915</guid>
      <dc:creator>gopi_narendra</dc:creator>
      <dc:date>2007-07-18T03:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: Bdc</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521866#M570916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks gopi can u please tel me a sample program for this.&lt;/P&gt;&lt;P&gt;or any referal blogs to see..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2007 03:45:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521866#M570916</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-18T03:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: Bdc</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521867#M570917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Dinesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the sample code for uploading data through excel.&lt;/P&gt;&lt;P&gt;Just change the fields it will work.&lt;/P&gt;&lt;P&gt;If you still have problem. do get bk. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  UPLOAD_EXCEL                                                *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;*&amp;amp; Upload and excel file into an internal table using the following    *&lt;/P&gt;&lt;P&gt;*&amp;amp; function module: ALSM_EXCEL_TO_INTERNAL_TABLE                       *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  UPLOAD_EXCEL no standard page heading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Data Declaration&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------" /&gt;&lt;P&gt;data: itab like alsmex_tabline occurs 0 with header line.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Has the following format:&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            Row number   | Colum Number   |   Value&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            ---------------------------------------&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     i.e.     1                 1             Name1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;              2                 1             Joe&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: Begin of t_record,&lt;/P&gt;&lt;P&gt;    name1 like itab-value,&lt;/P&gt;&lt;P&gt;    name2 like itab-value,&lt;/P&gt;&lt;P&gt;    age   like itab-value,&lt;/P&gt;&lt;P&gt;    End of t_record.&lt;/P&gt;&lt;P&gt;DATA: it_record type standard table of t_record initial size 0,&lt;/P&gt;&lt;P&gt;      wa_record type t_record.&lt;/P&gt;&lt;P&gt;DATA: gd_currentrow type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Selection Screen Declaration&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------" /&gt;&lt;P&gt;PARAMETER p_infile like rlgrap-filename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;*START OF SELECTION&lt;/P&gt;&lt;P&gt; call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'&lt;/P&gt;&lt;P&gt;       exporting&lt;/P&gt;&lt;P&gt;            filename                = p_infile&lt;/P&gt;&lt;P&gt;            i_begin_col             = '1'&lt;/P&gt;&lt;P&gt;            i_begin_row             = '2'  "Do not require headings&lt;/P&gt;&lt;P&gt;            i_end_col               = '14'&lt;/P&gt;&lt;P&gt;            i_end_row               = '31'&lt;/P&gt;&lt;P&gt;       tables&lt;/P&gt;&lt;P&gt;            intern                  = itab&lt;/P&gt;&lt;P&gt;       exceptions&lt;/P&gt;&lt;P&gt;            inconsistent_parameters = 1&lt;/P&gt;&lt;P&gt;            upload_ole              = 2&lt;/P&gt;&lt;P&gt;            others                  = 3.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message e010(zz) with text-001. "Problem uploading Excel Spreadsheet&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sort table by rows and colums&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  sort itab by row col.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get first row retrieved&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  read table itab index 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Set first row retrieved to current row&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  gd_currentrow = itab-row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at itab.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Reset values for next row&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    if itab-row ne gd_currentrow.&lt;/P&gt;&lt;P&gt;      append wa_record to it_record.&lt;/P&gt;&lt;P&gt;      clear wa_record.&lt;/P&gt;&lt;P&gt;      gd_currentrow = itab-row.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    case itab-col.&lt;/P&gt;&lt;P&gt;      when '0001'.                              "First name&lt;/P&gt;&lt;P&gt;        wa_record-name1 = itab-value.&lt;/P&gt;&lt;P&gt;      when '0002'.                              "Surname&lt;/P&gt;&lt;P&gt;        wa_record-name2 = itab-value.&lt;/P&gt;&lt;P&gt;      when '0003'.                              "Age&lt;/P&gt;&lt;P&gt;        wa_record-age   = itab-value.&lt;/P&gt;&lt;P&gt;    endcase.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;  append wa_record to it_record.&lt;/P&gt;&lt;P&gt;*!! Excel data is now contained within the internal table IT_RECORD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display report data for illustration purposes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  loop at it_record into wa_record.&lt;/P&gt;&lt;P&gt;    write:/     sy-vline,&lt;/P&gt;&lt;P&gt;           (10) wa_record-name1, sy-vline,&lt;/P&gt;&lt;P&gt;           (10) wa_record-name2, sy-vline,&lt;/P&gt;&lt;P&gt;           (10) wa_record-age, sy-vline.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful,&lt;/P&gt;&lt;P&gt;Aleem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2007 03:47:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521867#M570917</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-18T03:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: Bdc</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521868#M570918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. upload the input file to a internal table in your program using "GUI_UPLOAD".&lt;/P&gt;&lt;P&gt;2. record the vendor master transaction in SHDB , passing the parameters you want to pass.&lt;/P&gt;&lt;P&gt;3. Generate the program from the recording in SHDB. There is a option of generating the program from the recording.&lt;/P&gt;&lt;P&gt;4. In the program there parameters what you want to pass will be hardcoded. Replace them with the fields of the workarea of the table which you have populated from the input file.&lt;/P&gt;&lt;P&gt;5.Place the generated program inside the loop of the internal table.&lt;/P&gt;&lt;P&gt;6. Save the program and activate and execute.&lt;/P&gt;&lt;P&gt;7. In selection screen chose call transaction or session method and execute.&lt;/P&gt;&lt;P&gt;8. If you choose session method then a session will be create in SM35. you have to execute the session to upload the vendor informations. If you use call transaction then the venvor message will be autometically uploaded when you execute.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2007 03:49:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521868#M570918</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-18T03:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Bdc</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521869#M570919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use, FM--&amp;gt; ALSM_EXCEL_TO_INTERNAL_TABLE or&lt;/P&gt;&lt;P&gt;                GUI_UPLOAD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For more info read the documentation, from SE37.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sairam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2007 04:09:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521869#M570919</guid>
      <dc:creator>former_member196280</dc:creator>
      <dc:date>2007-07-18T04:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: Bdc</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521870#M570920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try this also...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TABLES : LFA1,LFB1,LFM1.

DATA : BEGIN OF ITAB OCCURS 0,
       LIFNR LIKE LFA1-LIFNR,
       BUKRS LIKE LFB1-BUKRS,
       EKORG LIKE LFM1-EKORG,
       KTOKK LIKE LFA1-KTOKK,
       END OF ITAB.

DATA : ITAB1(4096) TYPE C OCCURS 0.
PARAMETERS : P_FNAME LIKE RLGRAP-FILENAME.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.

CALL FUNCTION 'F4_FILENAME'
 EXPORTING
   PROGRAM_NAME        = SYST-CPROG
   DYNPRO_NUMBER       = SYST-DYNNR
*   FIELD_NAME          = ' '
 IMPORTING
   FILE_NAME           = P_FNAME
          .

START-OF-SELECTION.

          CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
            EXPORTING
*             I_FIELD_SEPERATOR          =
*             I_LINE_HEADER              =
              i_tab_raw_data             = ITAB1
              i_filename                 = P_FNAME
            tables
              i_tab_converted_data       = ITAB
*           EXCEPTIONS
*             CONVERSION_FAILED          = 1
*             OTHERS                     = 2
                    .
          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.

LOOP AT ITAB.
* do processing
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;shiba dutta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2007 04:22:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/2521870#M570920</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-18T04:22:52Z</dc:date>
    </item>
  </channel>
</rss>

