<?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/3587952#M863873</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Basic Form of the OPEN DATASET Statement &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To open a file on the application server, use the OPEN statement as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET &amp;lt;dsn&amp;gt; Additions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement opens the file &amp;lt;dsn&amp;gt;. If you do not specify any additions for the mode, the file is opened in binary mode for reading. SY-SUBRC returns 0 if the system opens the file. Otherwise, SY-SUBRC is set to 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You enter the filename &amp;lt;dsn&amp;gt; either as a literal or as a field containing the actual name of the file. If you do not specify a path, the system opens the file in the directory in which the R/3 System is running on the application server. To open a file, the user under which the R/3 System is running must have the requisite authorizations at operating system level. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filenames are platform-specific. You must therefore use file- and pathnames that conform to the rules of the operating system under which your R/3 System is running. However, you can also use logical filenames to ensure that your programs are not operating system-specific. For further information, refer to Using Platform-Independent Filenames.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA FNAME(60).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FNAME = '/tmp/myfile'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET 'myfile'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example works as long as your R/3 System is running under UNIX. The program opens the file "myfile" in the directory in which the R/3 System is running, and also opens the file "myfile" in directory "/tmp". However, you would have to change the filename for other operating systems. For example, for OpenVMS, you could write the following: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FNAME = 'TMPmyfile.BIN'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET 'myfile.BIN'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Opening a File for Write Access &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To open a file for writing, use the FOR OUTPUT addition to the OPEN DATASET statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET &amp;lt;dsn&amp;gt; FOR OUTPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the file does not already exist, it is created automatically. If it does already exist, but is closed, its contents are overwritten. If the file exists and is already open (for read or write access, or for appending), the position is reset to the beginning of the file. If the system can open the file &amp;lt;dsn&amp;gt; successfully, SY-SUBRC is set to 0. If not, it is set to 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: MESS(60),&lt;/P&gt;&lt;P&gt;FNAME(10) VALUE '/tmp'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT MESSAGE MESS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC 0.&lt;/P&gt;&lt;P&gt;WRITE: 'SY-SUBRC:', SY-SUBRC,&lt;/P&gt;&lt;P&gt;/ 'System Message:', MESS.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the R/3 System is ruining under UNIX, the output looks like this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The system cannot open the file, since the name you specified is that of a directory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following program shows how the system sets the position when you open a file for writing. However, it is better programming style to close files that are already open before you reopen them for a different operation (for further information about closing files, refer to Closing a File).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA FNAME(60) VALUE 'myfile'.&lt;/P&gt;&lt;P&gt;DATA NUM TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO 10 TIMES.&lt;/P&gt;&lt;P&gt;NUM = NUM + 1.&lt;/P&gt;&lt;P&gt;TRANSFER NUM TO FNAME.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM INPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NUM = 0.&lt;/P&gt;&lt;P&gt;DO 5 TIMES.&lt;/P&gt;&lt;P&gt;NUM = NUM + 10.&lt;/P&gt;&lt;P&gt;TRANSFER NUM TO FNAME.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt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;40&lt;/P&gt;&lt;P&gt;50&lt;/P&gt;&lt;P&gt;6&lt;/P&gt;&lt;P&gt;7&lt;/P&gt;&lt;P&gt;8&lt;/P&gt;&lt;P&gt;9&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;20&lt;/P&gt;&lt;P&gt;40&lt;/P&gt;&lt;P&gt;60&lt;/P&gt;&lt;P&gt;80&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example performs the following steps using the file "myfile":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is opened for writing &lt;/P&gt;&lt;P&gt;It is filled with 10 integers (for information about the TRANSFER statement, refer to Writing Data to Files) &lt;/P&gt;&lt;P&gt;It is then opened for reading. The position is reset accordingly to the beginning of the file. &lt;/P&gt;&lt;P&gt;It is read into the field NUM. For information about the READ DATASET statement, refer to Reading Data from Files. The values of NUM are displayed on the screen. &lt;/P&gt;&lt;P&gt;It is reopened for writing The position is reset to the beginning of the file. &lt;/P&gt;&lt;P&gt;It is filled with five integers, which overwrite the previous contents of the file. &lt;/P&gt;&lt;P&gt;It is then reopened for reading. The position is reset to the beginning of the file. &lt;/P&gt;&lt;P&gt;The file is read into the field NUM. The values of NUM are displayed on the screen. &lt;/P&gt;&lt;P&gt;It is closed (for information about the CLOSE DATASET statement, refer to Closing a File). &lt;/P&gt;&lt;P&gt;It is then reopened for writing. The system deletes the existing contents of the file. &lt;/P&gt;&lt;P&gt;It is filled with 5 integers. &lt;/P&gt;&lt;P&gt;It is then opened for reading. The position is reset to the beginning of the file. &lt;/P&gt;&lt;P&gt;The file is read into the field NUM. The values of NUM are displayed on the screen. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Closing a File &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To close a file on the application server, use the close statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLOSE DATASET &amp;lt;dsn&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement closes the file &amp;lt;dsn&amp;gt;. The naming convention is described in the section Opening a File.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You only need to close a file if you want to delete its contents the next time you open it for write access. For further information and an example, refer to Opening a File for Write Access.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, to avoid errors, and to make your programs easier to read, you should always close a file before the next OPEN DATASET statement. The CLOSE statement divides your program into logical blocks, and makes them easier to maintain. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA FNAME(60) VALUE 'myfile'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT.&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;CLOSE FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR INPUT.&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;CLOSE FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR INPUT AT POSITION &amp;lt;pos&amp;gt;.&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;CLOSE FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The CLOSE statement is not obligatory in this example, but it does improve the layout of the program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Mar 2008 07:14:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-17T07:14:20Z</dc:date>
    <item>
      <title>BDC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3587951#M863872</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;&lt;/P&gt;&lt;P&gt;FORM OPEN_DATASET USING P_DATASET.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what is the meaning of this!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nutan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 07:12:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3587951#M863872</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T07:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: BDC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3587952#M863873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Basic Form of the OPEN DATASET Statement &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To open a file on the application server, use the OPEN statement as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET &amp;lt;dsn&amp;gt; Additions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement opens the file &amp;lt;dsn&amp;gt;. If you do not specify any additions for the mode, the file is opened in binary mode for reading. SY-SUBRC returns 0 if the system opens the file. Otherwise, SY-SUBRC is set to 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You enter the filename &amp;lt;dsn&amp;gt; either as a literal or as a field containing the actual name of the file. If you do not specify a path, the system opens the file in the directory in which the R/3 System is running on the application server. To open a file, the user under which the R/3 System is running must have the requisite authorizations at operating system level. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filenames are platform-specific. You must therefore use file- and pathnames that conform to the rules of the operating system under which your R/3 System is running. However, you can also use logical filenames to ensure that your programs are not operating system-specific. For further information, refer to Using Platform-Independent Filenames.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA FNAME(60).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FNAME = '/tmp/myfile'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET 'myfile'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example works as long as your R/3 System is running under UNIX. The program opens the file "myfile" in the directory in which the R/3 System is running, and also opens the file "myfile" in directory "/tmp". However, you would have to change the filename for other operating systems. For example, for OpenVMS, you could write the following: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FNAME = 'TMPmyfile.BIN'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET 'myfile.BIN'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Opening a File for Write Access &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To open a file for writing, use the FOR OUTPUT addition to the OPEN DATASET statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET &amp;lt;dsn&amp;gt; FOR OUTPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the file does not already exist, it is created automatically. If it does already exist, but is closed, its contents are overwritten. If the file exists and is already open (for read or write access, or for appending), the position is reset to the beginning of the file. If the system can open the file &amp;lt;dsn&amp;gt; successfully, SY-SUBRC is set to 0. If not, it is set to 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: MESS(60),&lt;/P&gt;&lt;P&gt;FNAME(10) VALUE '/tmp'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT MESSAGE MESS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC 0.&lt;/P&gt;&lt;P&gt;WRITE: 'SY-SUBRC:', SY-SUBRC,&lt;/P&gt;&lt;P&gt;/ 'System Message:', MESS.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the R/3 System is ruining under UNIX, the output looks like this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The system cannot open the file, since the name you specified is that of a directory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following program shows how the system sets the position when you open a file for writing. However, it is better programming style to close files that are already open before you reopen them for a different operation (for further information about closing files, refer to Closing a File).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA FNAME(60) VALUE 'myfile'.&lt;/P&gt;&lt;P&gt;DATA NUM TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT.&lt;/P&gt;&lt;P&g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lt;P&gt;WRITE / NUM.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output appears as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;6&lt;/P&gt;&lt;P&gt;7&lt;/P&gt;&lt;P&gt;8&lt;/P&gt;&lt;P&gt;9&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;20&lt;/P&gt;&lt;P&gt;30&lt;/P&gt;&lt;P&gt;40&lt;/P&gt;&lt;P&gt;50&lt;/P&gt;&lt;P&gt;6&lt;/P&gt;&lt;P&gt;7&lt;/P&gt;&lt;P&gt;8&lt;/P&gt;&lt;P&gt;9&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;20&lt;/P&gt;&lt;P&gt;40&lt;/P&gt;&lt;P&gt;60&lt;/P&gt;&lt;P&gt;80&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example performs the following steps using the file "myfile":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is opened for writing &lt;/P&gt;&lt;P&gt;It is filled with 10 integers (for information about the TRANSFER statement, refer to Writing Data to Files) &lt;/P&gt;&lt;P&gt;It is then opened for reading. The position is reset accordingly to the beginning of the file. &lt;/P&gt;&lt;P&gt;It is read into the field NUM. For information about the READ DATASET statement, refer to Reading Data from Files. The values of NUM are displayed on the screen. &lt;/P&gt;&lt;P&gt;It is reopened for writing The position is reset to the beginning of the file. &lt;/P&gt;&lt;P&gt;It is filled with five integers, which overwrite the previous contents of the file. &lt;/P&gt;&lt;P&gt;It is then reopened for reading. The position is reset to the beginning of the file. &lt;/P&gt;&lt;P&gt;The file is read into the field NUM. The values of NUM are displayed on the screen. &lt;/P&gt;&lt;P&gt;It is closed (for information about the CLOSE DATASET statement, refer to Closing a File). &lt;/P&gt;&lt;P&gt;It is then reopened for writing. The system deletes the existing contents of the file. &lt;/P&gt;&lt;P&gt;It is filled with 5 integers. &lt;/P&gt;&lt;P&gt;It is then opened for reading. The position is reset to the beginning of the file. &lt;/P&gt;&lt;P&gt;The file is read into the field NUM. The values of NUM are displayed on the screen. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Closing a File &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To close a file on the application server, use the close statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLOSE DATASET &amp;lt;dsn&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement closes the file &amp;lt;dsn&amp;gt;. The naming convention is described in the section Opening a File.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You only need to close a file if you want to delete its contents the next time you open it for write access. For further information and an example, refer to Opening a File for Write Access.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, to avoid errors, and to make your programs easier to read, you should always close a file before the next OPEN DATASET statement. The CLOSE statement divides your program into logical blocks, and makes them easier to maintain. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA FNAME(60) VALUE 'myfile'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT.&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;CLOSE FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR INPUT.&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;CLOSE FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR INPUT AT POSITION &amp;lt;pos&amp;gt;.&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;CLOSE FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The CLOSE statement is not obligatory in this example, but it does improve the layout of the program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 07:14:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3587952#M863873</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T07:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: BDC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3587953#M863874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you generate the BDC (Batch Data Communication options define the processing mode for a batch input session) program with SHDB, you can remove a lot of unwanted fields by copying this customize abap include program.  It allows you to execute the BDC program immediately without filling up those SAP generate fields.  To run background, just run it as a background job. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if useful&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;  open dataset                                                       * &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 OPEN_DATASET USING P_DATASET. &lt;/P&gt;&lt;P&gt;  OPEN DATASET P_DATASET IN TEXT MODE. &lt;/P&gt;&lt;P&gt;  IF SY-SUBRC &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;P&gt;    WRITE: / TEXT-E00, SY-SUBRC. &lt;/P&gt;&lt;P&gt;    STOP. &lt;/P&gt;&lt;P&gt;  ENDIF. &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;  close dataset                                                      * &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 CLOSE_DATASET USING P_DATASET. &lt;/P&gt;&lt;P&gt;  CLOSE DATASET P_DATASET. &lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 07:15:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3587953#M863874</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T07:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: BDC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3587954#M863875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Eg1:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Report ZTESTPROGRAMFORDOWNLOAD&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report ztestprogramfordownload.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables:zupload.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:it_pa0002(200).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of ty_pa0002 ,&lt;/P&gt;&lt;P&gt;pernr like pa0002-pernr,&lt;/P&gt;&lt;P&gt;begda like pa0002-begda,&lt;/P&gt;&lt;P&gt;endda like pa0002-endda,&lt;/P&gt;&lt;P&gt;vorna like pa0002-vorna,&lt;/P&gt;&lt;P&gt;nachn like pa0002-nachn,&lt;/P&gt;&lt;P&gt;end of ty_pa0002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of it_error occurs 0 ,&lt;/P&gt;&lt;P&gt;pernr like pa0000-pernr,&lt;/P&gt;&lt;P&gt;end of it_error .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:it_final type standard table of ty_pa0002 with header line.&lt;/P&gt;&lt;P&gt;data:it_temp type standard table of ty_pa0002 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters:p_file like rlgrap-filename default 'F:\usr\sap\EC6\DVEBMGS00\work\entiraledu1'.&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;open dataset p_file for input in text mode encoding default.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read dataset p_file into it_pa0002.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it_final-pernr = it_pa0002+0(8).&lt;/P&gt;&lt;P&gt;it_final-begda = it_pa0002+18(8).&lt;/P&gt;&lt;P&gt;it_final-endda = it_pa0002+36(8).&lt;/P&gt;&lt;P&gt;it_final-vorna = it_pa0002+54(40).&lt;/P&gt;&lt;P&gt;it_final-nachn = it_pa0002+104(40).&lt;/P&gt;&lt;P&gt;append it_final.&lt;/P&gt;&lt;P&gt;clear it_final.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not it_final[] is initial.&lt;/P&gt;&lt;P&gt;sort it_final by pernr begda descending.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from it_final comparing pernr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;begda&lt;/P&gt;&lt;P&gt;endda&lt;/P&gt;&lt;P&gt;vorna&lt;/P&gt;&lt;P&gt;nachn&lt;/P&gt;&lt;P&gt;from pa0002&lt;/P&gt;&lt;P&gt;into table it_temp&lt;/P&gt;&lt;P&gt;for all entries in it_final&lt;/P&gt;&lt;P&gt;where pernr = it_final-pernr.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_temp.&lt;/P&gt;&lt;P&gt;zupload-pernr = it_temp-pernr.&lt;/P&gt;&lt;P&gt;zupload-begda = it_temp-begda.&lt;/P&gt;&lt;P&gt;zupload-endda = it_temp-endda.&lt;/P&gt;&lt;P&gt;zupload-vorna = it_temp-vorna.&lt;/P&gt;&lt;P&gt;zupload-nachn = it_temp-nachn.&lt;/P&gt;&lt;P&gt;insert zupload.&lt;/P&gt;&lt;P&gt;clear it_temp.&lt;/P&gt;&lt;P&gt;clear zupload.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;close dataset p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 07:15:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3587954#M863875</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T07:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: BDC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3587955#M863876</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;*FORM open_dataset USING p_dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;OPEN DATASET p_dataset&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;FOR INPUT IN TEXT MODE&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;ENCODING DEFAULT.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WRITE: / text-e00, sy-subrc.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;STOP.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    &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;&lt;/P&gt;&lt;P&gt;*ENDFORM. "OPEN_DATASET&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Means that you are creatign a subroutine which will open the data set by means of using the data set parameter you give.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&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;Dhruv Shah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 07:19:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3587955#M863876</guid>
      <dc:creator>dhruv_shah3</dc:creator>
      <dc:date>2008-03-17T07:19:40Z</dc:date>
    </item>
  </channel>
</rss>

