<?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: Sample code for CS01 using BDC recording in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-cs01-using-bdc-recording/m-p/4469428#M1058804</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;       I want the flat file records to be displayed vertically under one Alternative BOM .&lt;/P&gt;&lt;P&gt;Now wen i execute, the records r replaced one by one with one Alternative BOM .I dont know how to overcome with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report ZBOM1&lt;/P&gt;&lt;P&gt;       no standard page heading line-size 255.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*include bdcrecx1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF bdc OCCURS 0,&lt;/P&gt;&lt;P&gt;       matnr(18),&lt;/P&gt;&lt;P&gt;       werks(4),&lt;/P&gt;&lt;P&gt;       stlan(1),&lt;/P&gt;&lt;P&gt;      END OF BDC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF BDC1 OCCURS 0,&lt;/P&gt;&lt;P&gt;       posnr(4),&lt;/P&gt;&lt;P&gt;       idnrk(18),&lt;/P&gt;&lt;P&gt;       MENGE(18),&lt;/P&gt;&lt;P&gt;       MEINS(3),&lt;/P&gt;&lt;P&gt;       postp(1),&lt;/P&gt;&lt;P&gt;      END OF bdc1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF BDCDATA OCCURS 0,&lt;/P&gt;&lt;P&gt;         matnr(18),&lt;/P&gt;&lt;P&gt;         werks(4),&lt;/P&gt;&lt;P&gt;         stlan(1),&lt;/P&gt;&lt;P&gt;         posnr(4),&lt;/P&gt;&lt;P&gt;         idnrk(18),&lt;/P&gt;&lt;P&gt;         MENGE(18),&lt;/P&gt;&lt;P&gt;         MEINS(3),&lt;/P&gt;&lt;P&gt;         postp(1),&lt;/P&gt;&lt;P&gt;      END OF BDCDATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data  ibdcdata type standard table of bdcdata WITH  header line.&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;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    FILENAME                      = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'&lt;/P&gt;&lt;P&gt;   FILETYPE                       = 'ASC'&lt;/P&gt;&lt;P&gt;   HAS_FIELD_SEPARATOR            = ','&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  HEADER_LENGTH                 = 0&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  READ_BY_LINE                  = 'X'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  DAT_MODE                      = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  CODEPAGE                      = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  IGNORE_CERR                   = ABAP_TRUE&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  REPLACEMENT                   = '#'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  CHECK_BOM                     = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  VIRUS_SCAN_PROFILE            =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  NO_AUTH_CHECK                 = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILELENGTH                     =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  HEADER                         =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    DATA_TAB                      = BDCDATA&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILE_OPEN_ERROR               = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILE_READ_ERROR               = 2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  NO_BATCH                      = 3&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  GUI_REFUSE_FILETRANSFER       = 4&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  INVALID_TYPE                  = 5&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  NO_AUTHORITY                  = 6&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  UNKNOWN_ERROR                 = 7&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  BAD_DATA_FORMAT               = 8&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  HEADER_NOT_ALLOWED            = 9&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  SEPARATOR_NOT_ALLOWED         = 10&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  HEADER_TOO_LONG               = 11&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  UNKNOWN_DP_ERROR              = 12&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  ACCESS_DENIED                 = 13&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  DP_OUT_OF_MEMORY              = 14&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  DISK_FULL                     = 15&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  DP_TIMEOUT                    = 16&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  OTHERS                        = 17&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*perform open_group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at bdcdata.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move: bdcdata-matnr to bdc-matnr,&lt;/P&gt;&lt;P&gt;     bdcdata-werks to bdc-werks,&lt;/P&gt;&lt;P&gt;     bdcdata-stlan to bdc-stlan.&lt;/P&gt;&lt;P&gt;append bdc.&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;perform bdc_dynpro      using 'SAPLCSDI' '0100'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_CURSOR'&lt;/P&gt;&lt;P&gt;                              'RC29N-STLAN'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_OKCODE'&lt;/P&gt;&lt;P&gt;                              '/00'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29N-MATNR'&lt;/P&gt;&lt;P&gt;                              'SOFTDRINKS'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29N-WERKS'&lt;/P&gt;&lt;P&gt;                              'WIND'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29N-STLAN'&lt;/P&gt;&lt;P&gt;                              '1'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29N-DATUV'&lt;/P&gt;&lt;P&gt;                              '16.09.2008'.&lt;/P&gt;&lt;P&gt;perform bdc_dynpro      using 'SAPLCSDI' '0110'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_OKCODE'&lt;/P&gt;&lt;P&gt;                              '/00'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29K-BMENG'&lt;/P&gt;&lt;P&gt;                              '1'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29K-STLST'&lt;/P&gt;&lt;P&gt;                              '1'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_CURSOR'&lt;/P&gt;&lt;P&gt;                              'RC29K-EXSTL'.&lt;/P&gt;&lt;P&gt;perform bdc_dynpro      using 'SAPLCSDI' '0111'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_CURSOR'&lt;/P&gt;&lt;P&gt;                              'RC29K-LABOR'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_OKCODE'&lt;/P&gt;&lt;P&gt;                              '/00'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:field(11),&lt;/P&gt;&lt;P&gt;     indx(3),&lt;/P&gt;&lt;P&gt;     final(17).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at bdcdata where matnr eq bdc-matnr and&lt;/P&gt;&lt;P&gt;                      werks eq bdc-werks and&lt;/P&gt;&lt;P&gt;                      stlan eq bdc-stlan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform bdc_dynpro      using 'SAPLCSDI' '0140'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_CURSOR'&lt;/P&gt;&lt;P&gt;                              'RC29P-POSTP(01)'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_OKCODE'&lt;/P&gt;&lt;P&gt;                              '=FCBU'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-IDNRK(001)'&lt;/P&gt;&lt;P&gt;                              BDCDATA-IDNRK.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-MENGE(001)'&lt;/P&gt;&lt;P&gt;                              BDCDATA-MENGE.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-MEINS(001)'&lt;/P&gt;&lt;P&gt;                              BDCDATA-MEINS.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-POSTP(001)'&lt;/P&gt;&lt;P&gt;                              BDCDATA-POSTP.&lt;/P&gt;&lt;P&gt;perform bdc_dynpro      using 'SAPLCSDI' '0130'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_OKCODE'&lt;/P&gt;&lt;P&gt;                              '/00'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_CURSOR'&lt;/P&gt;&lt;P&gt;                              'RC29P-POSNR'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-POSNR'&lt;/P&gt;&lt;P&gt;                               BDCDATA-POSNR.            "'0010'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-IDNRK'&lt;/P&gt;&lt;P&gt;                              BDCDATA-IDNRK.             "'15'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-MENGE'&lt;/P&gt;&lt;P&gt;                              BDCDATA-MENGE.             "'1'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-MEINS'&lt;/P&gt;&lt;P&gt;                              BDCDATA-MEINS.             "'ml'.&lt;/P&gt;&lt;P&gt;perform bdc_dynpro      using 'SAPLCSDI' '0131'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_OKCODE'&lt;/P&gt;&lt;P&gt;                              '/00'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_CURSOR'&lt;/P&gt;&lt;P&gt;                              'RC29P-POTX1'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-SANKA'&lt;/P&gt;&lt;P&gt;                              'X'.&lt;/P&gt;&lt;P&gt;*perform bdc_transaction using 'CS01'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*perform close_group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL TRANSACTION 'CS01' USING IBDCDATA MODE 'A' UPDATE 'S'.&lt;/P&gt;&lt;P&gt;REFRESH IBDCDATA.&lt;/P&gt;&lt;P&gt;clear ibdcdata.&lt;/P&gt;&lt;P&gt;endloop.&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;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       Start new screen                                              *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&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 iBDCDATA.&lt;/P&gt;&lt;P&gt;  iBDCDATA-PROGRAM  = PROGRAM.&lt;/P&gt;&lt;P&gt;  iBDCDATA-DYNPRO   = DYNPRO.&lt;/P&gt;&lt;P&gt;  iBDCDATA-DYNBEGIN = 'X'.&lt;/P&gt;&lt;P&gt;  APPEND ibDCDATA .&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       Insert field                                                  *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; IF FVAL &amp;lt;&amp;gt; NODATA.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLEAR iBDCDATA.&lt;/P&gt;&lt;P&gt;    iBDCDATA-FNAM = FNAM.&lt;/P&gt;&lt;P&gt;    iBDCDATA-FVAL = FVAL.&lt;/P&gt;&lt;P&gt;    APPEND iBDCDATA .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; ENDIF.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Sep 2008 06:31:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-19T06:31:26Z</dc:date>
    <item>
      <title>Sample code for CS01 using BDC recording</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-cs01-using-bdc-recording/m-p/4469426#M1058802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    Can anybody give me sample code for CS01 using BDC recording.&lt;/P&gt;&lt;P&gt;I m working on it,but i had errors.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Sep 2008 05:39:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-cs01-using-bdc-recording/m-p/4469426#M1058802</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-19T05:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Sample code for CS01 using BDC recording</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-cs01-using-bdc-recording/m-p/4469427#M1058803</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;Please put ur codes here..the errors will be rectified. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vishwa.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Sep 2008 06:14:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-cs01-using-bdc-recording/m-p/4469427#M1058803</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-19T06:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sample code for CS01 using BDC recording</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-cs01-using-bdc-recording/m-p/4469428#M1058804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;       I want the flat file records to be displayed vertically under one Alternative BOM .&lt;/P&gt;&lt;P&gt;Now wen i execute, the records r replaced one by one with one Alternative BOM .I dont know how to overcome with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report ZBOM1&lt;/P&gt;&lt;P&gt;       no standard page heading line-size 255.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*include bdcrecx1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF bdc OCCURS 0,&lt;/P&gt;&lt;P&gt;       matnr(18),&lt;/P&gt;&lt;P&gt;       werks(4),&lt;/P&gt;&lt;P&gt;       stlan(1),&lt;/P&gt;&lt;P&gt;      END OF BDC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF BDC1 OCCURS 0,&lt;/P&gt;&lt;P&gt;       posnr(4),&lt;/P&gt;&lt;P&gt;       idnrk(18),&lt;/P&gt;&lt;P&gt;       MENGE(18),&lt;/P&gt;&lt;P&gt;       MEINS(3),&lt;/P&gt;&lt;P&gt;       postp(1),&lt;/P&gt;&lt;P&gt;      END OF bdc1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF BDCDATA OCCURS 0,&lt;/P&gt;&lt;P&gt;         matnr(18),&lt;/P&gt;&lt;P&gt;         werks(4),&lt;/P&gt;&lt;P&gt;         stlan(1),&lt;/P&gt;&lt;P&gt;         posnr(4),&lt;/P&gt;&lt;P&gt;         idnrk(18),&lt;/P&gt;&lt;P&gt;         MENGE(18),&lt;/P&gt;&lt;P&gt;         MEINS(3),&lt;/P&gt;&lt;P&gt;         postp(1),&lt;/P&gt;&lt;P&gt;      END OF BDCDATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data  ibdcdata type standard table of bdcdata WITH  header line.&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;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    FILENAME                      = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'&lt;/P&gt;&lt;P&gt;   FILETYPE                       = 'ASC'&lt;/P&gt;&lt;P&gt;   HAS_FIELD_SEPARATOR            = ','&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  HEADER_LENGTH                 = 0&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  READ_BY_LINE                  = 'X'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  DAT_MODE                      = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  CODEPAGE                      = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  IGNORE_CERR                   = ABAP_TRUE&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  REPLACEMENT                   = '#'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  CHECK_BOM                     = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  VIRUS_SCAN_PROFILE            =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  NO_AUTH_CHECK                 = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILELENGTH                     =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  HEADER                         =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    DATA_TAB                      = BDCDATA&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILE_OPEN_ERROR               = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILE_READ_ERROR               = 2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  NO_BATCH                      = 3&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  GUI_REFUSE_FILETRANSFER       = 4&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  INVALID_TYPE                  = 5&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  NO_AUTHORITY                  = 6&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  UNKNOWN_ERROR                 = 7&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  BAD_DATA_FORMAT               = 8&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  HEADER_NOT_ALLOWED            = 9&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  SEPARATOR_NOT_ALLOWED         = 10&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  HEADER_TOO_LONG               = 11&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  UNKNOWN_DP_ERROR              = 12&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  ACCESS_DENIED                 = 13&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  DP_OUT_OF_MEMORY              = 14&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  DISK_FULL                     = 15&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  DP_TIMEOUT                    = 16&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  OTHERS                        = 17&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*perform open_group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at bdcdata.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move: bdcdata-matnr to bdc-matnr,&lt;/P&gt;&lt;P&gt;     bdcdata-werks to bdc-werks,&lt;/P&gt;&lt;P&gt;     bdcdata-stlan to bdc-stlan.&lt;/P&gt;&lt;P&gt;append bdc.&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;perform bdc_dynpro      using 'SAPLCSDI' '0100'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_CURSOR'&lt;/P&gt;&lt;P&gt;                              'RC29N-STLAN'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_OKCODE'&lt;/P&gt;&lt;P&gt;                              '/00'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29N-MATNR'&lt;/P&gt;&lt;P&gt;                              'SOFTDRINKS'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29N-WERKS'&lt;/P&gt;&lt;P&gt;                              'WIND'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29N-STLAN'&lt;/P&gt;&lt;P&gt;                              '1'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29N-DATUV'&lt;/P&gt;&lt;P&gt;                              '16.09.2008'.&lt;/P&gt;&lt;P&gt;perform bdc_dynpro      using 'SAPLCSDI' '0110'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_OKCODE'&lt;/P&gt;&lt;P&gt;                              '/00'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29K-BMENG'&lt;/P&gt;&lt;P&gt;                              '1'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29K-STLST'&lt;/P&gt;&lt;P&gt;                              '1'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_CURSOR'&lt;/P&gt;&lt;P&gt;                              'RC29K-EXSTL'.&lt;/P&gt;&lt;P&gt;perform bdc_dynpro      using 'SAPLCSDI' '0111'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_CURSOR'&lt;/P&gt;&lt;P&gt;                              'RC29K-LABOR'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_OKCODE'&lt;/P&gt;&lt;P&gt;                              '/00'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:field(11),&lt;/P&gt;&lt;P&gt;     indx(3),&lt;/P&gt;&lt;P&gt;     final(17).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at bdcdata where matnr eq bdc-matnr and&lt;/P&gt;&lt;P&gt;                      werks eq bdc-werks and&lt;/P&gt;&lt;P&gt;                      stlan eq bdc-stlan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform bdc_dynpro      using 'SAPLCSDI' '0140'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_CURSOR'&lt;/P&gt;&lt;P&gt;                              'RC29P-POSTP(01)'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_OKCODE'&lt;/P&gt;&lt;P&gt;                              '=FCBU'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-IDNRK(001)'&lt;/P&gt;&lt;P&gt;                              BDCDATA-IDNRK.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-MENGE(001)'&lt;/P&gt;&lt;P&gt;                              BDCDATA-MENGE.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-MEINS(001)'&lt;/P&gt;&lt;P&gt;                              BDCDATA-MEINS.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-POSTP(001)'&lt;/P&gt;&lt;P&gt;                              BDCDATA-POSTP.&lt;/P&gt;&lt;P&gt;perform bdc_dynpro      using 'SAPLCSDI' '0130'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_OKCODE'&lt;/P&gt;&lt;P&gt;                              '/00'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_CURSOR'&lt;/P&gt;&lt;P&gt;                              'RC29P-POSNR'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-POSNR'&lt;/P&gt;&lt;P&gt;                               BDCDATA-POSNR.            "'0010'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-IDNRK'&lt;/P&gt;&lt;P&gt;                              BDCDATA-IDNRK.             "'15'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-MENGE'&lt;/P&gt;&lt;P&gt;                              BDCDATA-MENGE.             "'1'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-MEINS'&lt;/P&gt;&lt;P&gt;                              BDCDATA-MEINS.             "'ml'.&lt;/P&gt;&lt;P&gt;perform bdc_dynpro      using 'SAPLCSDI' '0131'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_OKCODE'&lt;/P&gt;&lt;P&gt;                              '/00'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'BDC_CURSOR'&lt;/P&gt;&lt;P&gt;                              'RC29P-POTX1'.&lt;/P&gt;&lt;P&gt;perform bdc_field       using 'RC29P-SANKA'&lt;/P&gt;&lt;P&gt;                              'X'.&lt;/P&gt;&lt;P&gt;*perform bdc_transaction using 'CS01'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*perform close_group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL TRANSACTION 'CS01' USING IBDCDATA MODE 'A' UPDATE 'S'.&lt;/P&gt;&lt;P&gt;REFRESH IBDCDATA.&lt;/P&gt;&lt;P&gt;clear ibdcdata.&lt;/P&gt;&lt;P&gt;endloop.&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;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       Start new screen                                              *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&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 iBDCDATA.&lt;/P&gt;&lt;P&gt;  iBDCDATA-PROGRAM  = PROGRAM.&lt;/P&gt;&lt;P&gt;  iBDCDATA-DYNPRO   = DYNPRO.&lt;/P&gt;&lt;P&gt;  iBDCDATA-DYNBEGIN = 'X'.&lt;/P&gt;&lt;P&gt;  APPEND ibDCDATA .&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       Insert field                                                  *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; IF FVAL &amp;lt;&amp;gt; NODATA.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLEAR iBDCDATA.&lt;/P&gt;&lt;P&gt;    iBDCDATA-FNAM = FNAM.&lt;/P&gt;&lt;P&gt;    iBDCDATA-FVAL = FVAL.&lt;/P&gt;&lt;P&gt;    APPEND iBDCDATA .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; ENDIF.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Sep 2008 06:31:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-cs01-using-bdc-recording/m-p/4469428#M1058804</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-19T06:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Sample code for CS01 using BDC recording</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-cs01-using-bdc-recording/m-p/4469429#M1058805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hii&lt;/P&gt;&lt;P&gt;diwakar., please check this code for PO. I think the table BDCdata should not be used the way ur using it... just check this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ZZPO_BDC no standard page heading line-size 255.


tables: zzpo_staging.
DATA  id type string..
DATA: fnam(20) type c,
       matnr type bstmg.
data: quan(13) type c,
      netpr(15) type c,
      qty(13) type c,
      gp(15) type c.
DATA  idx type string.
data: i_bdcdata like bdcdata occurs 1 with header line,
      i_msg like bdcmsgcoll occurs 1 with header line.
DATA  W_STR type string.
DATA: IT_STAGING TYPE STANDARD TABLE OF ZZPO_STAGING WITH HEADER LINE,
      ti_staging type standard table of zzpo_staging with header line,
      KT_STAGING TYPE STANDARD TABLE OF ZZPO_STAGING WITH HEADER LINE.




*
*CALL FUNCTION 'BDC_OPEN_GROUP'
* EXPORTING
*   CLIENT                    = SY-MANDT
*   DEST                      = 'zzpo'
*   GROUP                     =  'zzpo'
**   HOLDDATE                  = FILLER8
*   KEEP                      = 'X'
*   USER                      =  sy-uname
**   RECORD                    = FILLER1
**   PROG                      = SY-CPROG
**   DCPFM                     = '%'
**   DATFM                     = '%'
** IMPORTING
**   QID                       =
** EXCEPTIONS
**   CLIENT_INVALID            = 1
**   DESTINATION_INVALID       = 2
**   GROUP_INVALID             = 3
**   GROUP_IS_LOCKED           = 4
**   HOLDDATE_INVALID          = 5
**   INTERNAL_ERROR            = 6
**   QUEUE_ERROR               = 7
**   RUNNING                   = 8
**   SYSTEM_LOCK_ERROR         = 9
**   USER_INVALID              = 10
**   OTHERS                    = 11
*          .
*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.

start-of-selection.
*perform open_group.

  SELECT * FROM ZZPO_STAGING INTO TABLE IT_STAGING.
  select * from zzpo_staging into table ti_staging.
  SELECT * fROM ZZPO_STAGING INTO TABLE KT_sTAGING.

    delete adjacent duplicates from it_staging comparing vendor docdate.


  loop at IT_STAGING.


    perform bdc_dynpro      using 'SAPMM06E' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EKKO-EKGRP'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'EKKO-LIFNR'
                                   IT_STAGING-vendor.
    perform bdc_field       using 'RM06E-BSART'
                                  'NB'.
    perform bdc_field       using 'RM06E-BEDAT'
                                   IT_STAGING-docdate.
    perform bdc_field       using 'EKKO-EKORG'
                                   IT_STAGING-purorg.
    perform bdc_field       using 'EKKO-EKGRP'
                                   IT_STAGING-purgrp.
    perform bdc_field       using 'RM06E-LPEIN'
                                  'T'.

*  endloop.

    perform bdc_dynpro      using 'SAPMM06E' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RM06E-EPSTP(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=DETA'.
    perform bdc_dynpro      using 'SAPMM06E' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EKPO-WERKS(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.

    move 1 to id.
*
    loop at TI_STAGING WHERE VENDOR = IT_STAGING-VENDOR AND DOCDATE = IT_STAGING-DOCDATE.

      concatenate 'RM06E-EPSTP(0' id ')' into fnam.
      perform bdc_field       using fnam TI_STAGING-itmcategory.

      concatenate 'EKPO-KNTTP(0' id ')' into fnam.
      perform bdc_field       using fnam TI_STAGING-accassignment.

      concatenate 'EKPO-EMATN(0' id ')' into fnam.
      perform bdc_field       using fnam TI_STAGING-material.

      concatenate 'EKPO-TXZ01(0' id ')' into fnam.
      perform bdc_field       using fnam TI_STAGING-shortxt.

      quan = ti_staging-poqty.
      concatenate 'EKPO-MENGE(0' id ')' into fnam.
      perform bdc_field       using fnam quan.

      concatenate 'RM06E-EEIND(0' id ')' into fnam.
      perform bdc_field       using fnam TI_STAGING-deliverydate.

      netpr = ti_staging-netpr.

      concatenate 'EKPO-NETPR(0' id ')' into fnam.
      perform bdc_field       using fnam netpr.

      concatenate 'EKPO-MATKL(0' id ')' into fnam.
      perform bdc_field       using fnam TI_STAGING-mategroup.

      concatenate 'EKPO-WERKS(0' id ')' into fnam.
      perform bdc_field       using fnam TI_STAGING-plant.

      ID = ID + 1.
*
    ENDLOOP.
*
*    perform bdc_dynpro      using 'SAPMM06E' '0111'.
*    perform bdc_field       using 'BDC_CURSOR'
*                                  'EKPO-MENGE'.
*    perform bdc_field       using 'BDC_OKCODE'
*                                  '/00'.
*perform bdc_field       using 'EKPO-KNTTP'
*                              'N'.
*perform bdc_field       using 'EKPO-TXZ01'
*                              'Office Supplies'.
*perform bdc_field       using 'EKPO-MENGE'
*                              '2'.
*    perform bdc_field       using 'EKPO-SPINF'
*                                  'B'.
*    perform bdc_field       using 'EKPO-BPUMN'
*                                  '1'.
*    perform bdc_field       using 'EKPO-BPUMZ'
*                                  '1'.
*    perform bdc_field       using 'EKPO-PRSDR'
*                                  'X'.
*perform bdc_field       using 'RM06E-EEIND'
*                              '06/24/2008'.
*perform bdc_field       using 'RM06E-LPEIN'
*                              'D'.
*    perform bdc_field       using 'EKPO-WEPOS'
*                                  'X'.
*    perform bdc_field       using 'EKPO-REPOS'
*                                  'X'.
    loop at TI_STAGING where vendor = it_staging-vendor and docdate = it_staging-docdate.

      perform bdc_dynpro      using 'SAPMM06E' '0511'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=ENTE'.


      perform bdc_field       using 'EKKN-SAKTO'
                                     TI_STAGING-glaccount.
      perform bdc_field       using 'BDC_CURSOR'
                                    'DKACB-FMORE'.
      perform bdc_field       using 'DKACB-FMORE'
                                    'X'.

      perform bdc_dynpro      using 'SAPLKACB' '0002'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'COBL-VORNR'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=ENTE'.
      perform bdc_field       using 'COBL-NPLNR'
                                     TI_STAGING-networkid.
      perform bdc_field       using 'COBL-VORNR'
                                     TI_STAGING-activity.






*    perform bdc_dynpro      using 'SAPMM06E' '0120'.
*    perform bdc_field       using 'BDC_CURSOR'
*                                  'RM06E-EPSTP(02)'.
*    perform bdc_field       using 'BDC_OKCODE'
*                                  '=DETA'.
*    perform bdc_field       using 'RM06E-EBELP'
*                                  '10'.
*
*    perform bdc_dynpro      using 'SAPMM06E' '0120'.
*    perform bdc_field       using 'BDC_CURSOR'
*                                  'EKPO-WERKS(02)'.
*    perform bdc_field       using 'BDC_OKCODE'
*                                  '/00'.
*    perform bdc_field       using 'RM06E-EBELP'
*                                  '10'.
*perform bdc_field       using 'RM06E-EPSTP(02)'
*                              'd'.
*perform bdc_field       using 'EKPO-KNTTP(02)'
*                              'n'.
*perform bdc_field       using 'EKPO-TXZ01(02)'
*                              'adage artwork'.
*perform bdc_field       using 'EKPO-MENGE(02)'
*                              '                1'.
*perform bdc_field       using 'RM06E-EEIND(02)'
*                              '06242008'.
*perform bdc_field       using 'EKPO-MATKL(02)'
*                              'm1'.
*perform bdc_field       using 'EKPO-WERKS(02)'
*                              'a001'.
*    perform bdc_field       using 'BDC_OKCODE'
*                                  '/00'.
*
*
      perform bdc_dynpro      using 'SAPMM06E' '0111'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'EKPO-MENGE'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
*    perform bdc_field       using 'EKPO-MATKL'
*                                  'M1'.
*    perform bdc_field       using 'EKPO-TXZ01'
*                                   wa_jtab-j4.
*    perform bdc_field       using 'EKPO-PRSDR'
*                                  'X'.
*    perform bdc_field       using 'RM06E-EEIND'
*                                   wa_jtab-j6.
*
*
      perform bdc_field       using 'RM06E-LPEIN'
                                    'D'.
      perform bdc_field       using 'EKPO-WEPOS'
                                    'X'.
      perform bdc_field       using 'EKPO-UEBTK'
                                    'X'.
      perform bdc_field       using 'EKPO-WEBRE'
                                    'X'.

      perform bdc_field       using 'BDC_OKCODE'
                                   '/00'.
      perform bdc_field       using 'BDC_OKCODE'
                                     '=ENTE'.



      move 1 to idx.



      perform bdc_dynpro      using 'SAPLMLSP' '0200'.

      perform bdc_field       using 'BDC_OKCODE'
                                   '/00'.
      perform bdc_field       using 'BDC_OKCODE'
                                     '=ENTE'.



      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.

      perform bdc_field       using 'RM11P-HEADTEXT'
                                      'adage'.
      perform bdc_field       using  'BDC_CURSOR' 'ESLL-TBTWR(01)'.
      perform bdc_field       using 'RM11P-NEW_ROW'
                                     '10'.


*      concatenate 'ESLL-KTEXT1(0' idx ')' into fnaml.
*      perform bdc_field       using fnaml wa_ktab-k1.
*
*      concatenate 'ESLL-MENGE(0' idx ')' into fnaml.
*      perform bdc_field       using fnaml wa_ktab-k2.
*
*      concatenate 'ESLL-MEINS(0' idx ')' into fnaml.
*      perform bdc_field       using fnaml wa_ktab-k3.
*
*      concatenate 'ESLL-TBTWR(0' idx ')' into fnaml.
*      perform bdc_field       using fnaml wa_ktab-k4.

*
*      IDX = IDX + 1.

*      loop at KT_STAGING where vendor = it_staging-vendor and docdate = it_staging-docdate and itmcategory is not initial.
        IF TI_STAGING-ITMCATEGORY IS NOT INITIAL.
        qty = ti_staging-serqty.
        gp  = ti_staging-sergrossprice.

        perform bdc_field       using 'ESLL-KTEXT1(01)' TI_STAGING-sertext.
        perform bdc_field       using 'ESLL-MENGE(01)'  qty.
        perform bdc_field       using 'ESLL-MEINS(01)'  TI_STAGING-seruom.
        perform bdc_field      using 'ESLL-TBTWR(01)'   gp.


*    endloop.

*    move 1 to cnt.
*
*    loop at KT_STAGING WHERE VENDOR = IT_STAGING-VENDOR AND DOCDATE = IT_STAGING-DOCDATE and itmcategory is not initial.

        perform bdc_dynpro      using 'SAPLMLSK' '0200'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'RM11K-VORNR(01)'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using 'VRTKZ1'
                                      'X'.


*      concatenate 'ESKN-SAKTO(0' IDX ')' into fnamk.
*      perform bdc_field       using fnam wa_ktab-k5.
*
*      concatenate 'ESKN-NPLNR(0' IDX ')' into fnamk.
*      perform bdc_field       using fnam wa_ktab-k6.
*
*      concatenate 'RM11K-VORNR(0' IDX ')' into fnamk.
*      perform bdc_field       using fnam wa_ktab-k7.

*      cnt = cnt + 1.

        PERFORM BDC_FIELD USING 'ESKN-SAKTO(01)' TI_STAGING-serglaccount.
        PERFORM BDC_FIELD USING 'ESKN-NPLNR(01)' TI_STAGING-sernetwork.
        PERFORM BDC_FIELD USING 'RM11K-VORNR(01)' TI_STAGING-seractivity.


*      endloop.


      perform bdc_dynpro      using 'SAPLKACB' '0002'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'COBL-NPLNR'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=ENTE'.
      perform bdc_field       using 'COBL-NPLNR'
                                     kt_STAGING-sernetwork.
      perform bdc_field       using 'COBL-VORNR'
                                     kt_STAGING-seractivity.

      perform bdc_dynpro      using 'SAPLMLSK' '0200'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'ESLL-INTROW'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'VRTKZ1'
                                    'X'.




    perform bdc_dynpro      using 'SAPMM06E' '0200'.
    perform bdc_field       using 'BDC_CURSOR'
                              'RM06E-EBELP'.
    perform bdc_field       using 'BDC_OKCODE'
                              '=BACK'.
    perform bdc_dynpro      using 'SAPLMLSP' '0200'.
    perform bdc_field       using 'BDC_OKCODE'
                                     '=SAV'.
  ELSE.
    perform bdc_dynpro      using 'SAPMM06E' '0100'.
    perform bdc_field       using 'BDC_OKCODE'
                                     '=SAV'.
  ENDIF.


 endloop.








*perform bdc_field       using 'RM11P-HEADTEXT'
*                              'adage artwork'.
*    perform bdc_field       using 'BDC_CURSOR'
*                                  'ESLL-KTEXT1(01)'.
*perform bdc_field       using 'RM11P-NEW_ROW'
*                              '10'.
*perform bdc_transaction using 'ME21'.

CALL TRANSACTION 'ME21' USING I_BDCDATA MODE 'A' messages into i_msg.

*clear: kt_staging,ti_staging,it_staging,i_bdcdata.

  endloop.


*
*    CALL FUNCTION 'BDC_INSERT'
*     EXPORTING
*       TCODE                  = 'ME21'
**    POST_LOCAL             = NOVBLOCAL
**    PRINTING               = NOPRINT
**    SIMUBATCH              = ' '
**    CTUPARAMS              = ' '
*      TABLES
*        DYNPROTAB              = I_BDCDATA
**  EXCEPTIONS
**    INTERNAL_ERROR         = 1
**    NOT_OPEN               = 2
**    QUEUE_ERROR            = 3
**    TCODE_INVALID          = 4
**    PRINTING_INVALID       = 5
**    POSTING_INVALID        = 6
**    OTHERS                 = 7
*              .
*    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.


*-------------------------------------------------------------------------------------------*
*Using Call Transaction Statement Call the transaction in back ground mode/fore ground mode
*-------------------------------------------------------------------------------------------*

*
  LOOP AT I_MSG.

    CALL FUNCTION 'FORMAT_MESSAGE'
     EXPORTING
       ID              = I_MSG-MSGID
       LANG            = SY-LANGU
       NO              = I_MSG-MSGNR
       V1              = I_MSG-MSGV1
       V2              = I_MSG-MSGV2
       V3              = I_MSG-MSGV3
       V4              = I_MSG-MSGV4
     IMPORTING
       MSG             = W_STR
*  EXCEPTIONS
*    NOT_FOUND       = 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.

    WRITE:/ i_msg-msgnr,w_str.




  endloop.




*
*  CALL FUNCTION 'BDC_CLOSE_GROUP'.
*** EXCEPTIONS
***   NOT_OPEN          = 1
***   QUEUE_ERROR       = 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.
**
**

*perform close_group.

*----------------------------------------------------------------------*
*        Start new screen                                              *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
  CLEAR I_BDCDATA.
  I_BDCDATA-PROGRAM  = PROGRAM.
  I_BDCDATA-DYNPRO   = DYNPRO.
  I_BDCDATA-DYNBEGIN = 'X'.
  APPEND I_BDCDATA.
ENDFORM.                    "BDC_DYNPRO

*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
*  IF FVAL &amp;lt;&amp;gt; SPACE.
  CLEAR I_BDCDATA.
  I_BDCDATA-FNAM = FNAM.
  I_BDCDATA-FVAL = FVAL.
  APPEND I_BDCDATA.
*  ENDIF.
ENDFORM.                    "BDC_FIELD&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Sep 2008 06:38:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-cs01-using-bdc-recording/m-p/4469429#M1058805</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-19T06:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Sample code for CS01 using BDC recording</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-cs01-using-bdc-recording/m-p/4469430#M1058806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vishwa,&lt;/P&gt;&lt;P&gt;        i m checking with ur code.It s very useful to me.&lt;/P&gt;&lt;P&gt;Once i got clear i come back to u.&lt;/P&gt;&lt;P&gt;Thanks .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Sep 2008 10:06:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-cs01-using-bdc-recording/m-p/4469430#M1058806</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-19T10:06:48Z</dc:date>
    </item>
  </channel>
</rss>

