<?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 Program in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997783#M75627</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried using the LSMW tool?  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Oct 2005 18:38:38 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2005-10-05T18:38:38Z</dc:date>
    <item>
      <title>BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997780#M75624</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 create material master using bdc session method. The data has to be transferred from csv file to sap system. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please tell me how to achieve this and how to split the fields by commas while uploading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please provide me the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;sriram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2005 18:22:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997780#M75624</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-05T18:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997781#M75625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sriram, why don't u use the Batch input program RMDATIND to achieve the same purpose.. See the documentation for this program and it contains how the input structure must be provide..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2005 18:38:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997781#M75625</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-05T18:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997782#M75626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sriram,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the SPLIT command.&lt;/P&gt;&lt;P&gt;Load your file data into a TEXT variable.&lt;/P&gt;&lt;P&gt;SPLIT variable into workarea at ','.&lt;/P&gt;&lt;P&gt;workarea is structure of type of the internal table which you are going to upload the data from the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I am not sure why you are using BDC instead of a BAPI method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2005 18:38:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997782#M75626</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-05T18:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997783#M75627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried using the LSMW tool?  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2005 18:38:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997783#M75627</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-10-05T18:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997784#M75628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to use only BDCs session method for this purpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you provide me the code it will be very useful for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;sriram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2005 18:40:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997784#M75628</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-05T18:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997785#M75629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a skeleton program for upload from a comma delimted text file.  It expects material number and material group.  This was used to update material groups at one time.  I have removed the BDC code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0002.

type-pools: icon, slis.

types: begin of tdata,
        rec(150) type c,
       end of tdata,

       begin of tmtgp,
        matnr type mara-matnr
        matkl type mara-matkl,
       end of tmtgp,

       begin of tmess,
        stats(4) type c,
        matnr type mara-matnr,
        matkl type mara-matkl,
       end of tmess.

data: idata type table of tdata with header line.
data: imtgp type table of tmtgp with header line.
data: imess type table of tmess with header line.
data: it023 type table of t023 with header line.

data: fieldcat type slis_t_fieldcat_alv.

data: mode(1) type c value 'N'.
data: messtab type table of bdcmsgcoll with header line.
data: bdcdata type table of bdcdata with header line.

selection-screen begin of block b1 with frame title text-001.
parameters: p_file type localfile default 'C:Material Groups.txt'.
selection-screen end of block b1.

at selection-screen on value-request for p_file.

  call function 'KD_GET_FILENAME_ON_F4'
       exporting
            static    = 'X'
       changing
            file_name = p_file.

start-of-selection.

  perform upload_data.
  perform update_via_bdc.
  perform call_alv.

************************************************************************
* Upload_Data
************************************************************************
form upload_data.

  data: filename type string.

  clear idata. refresh idata.
  filename = p_file.

  call function 'GUI_UPLOAD'
       exporting
            filename        = filename
            filetype        = 'ASC'
       tables
            data_tab        = idata
       exceptions
            file_open_error = 1
            file_read_error = 2
            no_authority    = 6
            others          = 17.

  check sy-subrc = 0.

  loop at idata.
    clear imtgp.
    split idata at ',' into imtgp-matnr imtgp-matkl.
    append imtgp.
  endloop.

endform.
************************************************************************
*      Form  update_table_via_bdc
************************************************************************
form update_table_via_bdc.

  clear imess. refresh imess.

  loop at imtgp.

* BDC Code goes here

    call transaction 'MM02' using bdcdata mode mode
                                  update 'S'
                                  messages into messtab.
    if sy-subrc = 0.
      move-corresponding imtgp to imess.
      write icon_green_light as icon to imess-stats.
      imess-message = 'Transaction Completed Successfully'.
      append imess.
    else.
      move-corresponding imtgp to imess.
      write icon_red_light as icon to imess-stats.
      read table messtab index 1.
      if sy-subrc = 0.
        perform bdc_message using imess-message.
      else.
        imess-message = 'Transaction Failed'.
      endif.
      append imess.
    endif.

    clear bdcdata. refresh bdcdata.
    clear messtab. refresh messtab.

  endloop.

endform.

************************************************************************
*      Form  BDC_DYNPRO
************************************************************************
form bdc_dynpro using  program dynpro.

  clear bdcdata.
  bdcdata-program = program.
  bdcdata-dynpro = dynpro.
  bdcdata-dynbegin = 'X'.
  append bdcdata.

endform.

************************************************************************
*      Form  BDC_FIELD
************************************************************************
form bdc_field using fnam fval.

  clear bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = fval.
  append bdcdata.

endform.

************************************************************************
*  BDC_MESSAGE
************************************************************************
form bdc_message using message.

  clear message.

* Move parameters into message text.
  call function 'MESSAGE_PREPARE'
       exporting
            language = sy-langu
            msg_id   = messtab-msgid
            msg_no   = messtab-msgnr
            msg_var1 = messtab-msgv1(50)
            msg_var2 = messtab-msgv2(50)
            msg_var3 = messtab-msgv3(50)
            msg_var4 = messtab-msgv4(50)
       importing
            msg_text = message.

endform.

************************************************************************
*      Form  call_alv
************************************************************************
form call_alv.

* Call ABAP List Viewer (ALV)
  perform build_field_catalog.
  call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            it_fieldcat  = fieldcat
            i_grid_title = 'Transaction Messages'
       tables
            t_outtab     = imess.

endform.

************************************************************************
* BUILD_FIELD_CATALOG
************************************************************************
form build_field_catalog.

  data: tmp_fc type slis_t_fieldcat_alv with header line.

  clear: fieldcat. refresh: fieldcat.

  clear tmp_fc.
  tmp_fc-reptext_ddic = ' '.
  tmp_fc-fieldname    = 'STATS'.
  tmp_fc-tabname      = 'IMESS'.
  tmp_fc-outputlen    = '5'.
  tmp_fc-icon         = 'X'.
  append tmp_fc to fieldcat.

  clear tmp_fc.
  tmp_fc-reptext_ddic = 'Material Number'.
  tmp_fc-fieldname    = 'MATNR'.
  tmp_fc-tabname      = 'IMESS'.
  tmp_fc-outputlen    = '12'.
  append tmp_fc to fieldcat.

  clear tmp_fc.
  tmp_fc-reptext_ddic = 'Material Group'.
  tmp_fc-fieldname    = 'MATKL'.
  tmp_fc-tabname      = 'IMESS'.
  tmp_fc-outputlen    = '12'.
  append tmp_fc to fieldcat.


  clear tmp_fc.
  tmp_fc-reptext_ddic = 'Message'.
  tmp_fc-fieldname    = 'MESSAGE'.
  tmp_fc-tabname      = 'IMESS'.
  tmp_fc-outputlen    = '200'.
  append tmp_fc to fieldcat.

endform.

&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;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2005 18:59:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997785#M75629</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-10-05T18:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997786#M75630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please make sure to award points for helpful answers.  Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2005 19:00:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997786#M75630</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-10-05T19:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997787#M75631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sriram,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do a recording using SHDB transaction and you will get an idea over the screens used in this process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the file is an .csv file then you can convert it into a comma delimited test file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the data in the csv file is in legacy format or in SAP format. If not use may have to develop a conversion program to do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-tx1.&lt;/P&gt;&lt;P&gt;PARAMETERS : p_input  LIKE filename-fileextern OBLIGATORY,  " Input File&lt;/P&gt;&lt;P&gt;             p_error  LIKE filename-fileextern OBLIGATORY. " Output File&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK bl1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specify the comma delimited text file name on the screen then upload that data into an internal table.&lt;/P&gt;&lt;P&gt;perform bdc_open_group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT i_leg.  "internal table which you have to use&lt;/P&gt;&lt;P&gt;*-- First screen&lt;/P&gt;&lt;P&gt;      CLEAR w_insert_line.&lt;/P&gt;&lt;P&gt;      PERFORM bdc_dynpro      USING 'SAPMM06E'    '0100'.&lt;/P&gt;&lt;P&gt;      PERFORM bdc_field       USING 'BDC_CURSOR'  'RM06E-BSART'.&lt;/P&gt;&lt;P&gt;      PERFORM bdc_field       USING 'BDC_OKCODE'  '/00'.&lt;/P&gt;&lt;P&gt;      PERFORM bdc_field       USING 'EKKO-LIFNR'  i_sap-lifnr.&lt;/P&gt;&lt;P&gt;      PERFORM bdc_field       USING 'RM06E-BSART' c_yb.&lt;/P&gt;&lt;P&gt;      PERFORM bdc_field       USING 'EKKO-EKORG'  p_ekorg.&lt;/P&gt;&lt;P&gt;      PERFORM bdc_field       USING 'EKKO-EKGRP'  i_sap-ekgrp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;etc----&lt;/P&gt;&lt;HR originaltext="----------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call transaction xxxx .....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform bdc_close_group.&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;      Form  OPEN_GROUP&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;&lt;/P&gt;&lt;P&gt;FORM open_group.&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'BDC_OPEN_GROUP'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            client = sy-mandt&lt;/P&gt;&lt;P&gt;            group  = p_sess&lt;/P&gt;&lt;P&gt;            user   = p_uname&lt;/P&gt;&lt;P&gt;            keep   = 'X'.&lt;/P&gt;&lt;P&gt;ENDFORM.                    " OPEN_GROUP&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;      Form  BDC_DYNPRO&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;FORM bdc_dynpro USING  program  dynpro.&lt;/P&gt;&lt;P&gt;  CLEAR bdcdata.&lt;/P&gt;&lt;P&gt;  bdcdata-program  = program.&lt;/P&gt;&lt;P&gt;  bdcdata-dynpro   = dynpro.&lt;/P&gt;&lt;P&gt;  bdcdata-dynbegin = w_flg.&lt;/P&gt;&lt;P&gt;  APPEND bdcdata.&lt;/P&gt;&lt;P&gt;  CLEAR bdcdata.&lt;/P&gt;&lt;P&gt;ENDFORM.                               " BDC_DYNPRO&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;      Form  BDC_FIELD&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;FORM bdc_field USING fnam fval.&lt;/P&gt;&lt;P&gt;  CLEAR bdcdata.&lt;/P&gt;&lt;P&gt;  bdcdata-fnam = fnam.&lt;/P&gt;&lt;P&gt;  bdcdata-fval = fval.&lt;/P&gt;&lt;P&gt;  APPEND bdcdata.&lt;/P&gt;&lt;P&gt;  CLEAR bdcdata.&lt;/P&gt;&lt;P&gt;ENDFORM.                               " BDC_FIELD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2005 20:19:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997787#M75631</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-05T20:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997788#M75632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please award points for helpful answers and close if answered completely,  Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2005 16:34:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-program/m-p/997788#M75632</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-10-19T16:34:12Z</dc:date>
    </item>
  </channel>
</rss>

