<?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: open data and close dataset in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513576#M845088</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; Use  the below statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET :  open application server file in OUTPUT, INPUT(read) &amp;amp; APPEND modes.&lt;/P&gt;&lt;P&gt;READ DATASET :  Read records from file when it is opened in read mode (INPUT MODE).&lt;/P&gt;&lt;P&gt;TRANSFER :  write data to the file when opened in Output &amp;amp; Append mode.&lt;/P&gt;&lt;P&gt;CLOSE DATASET :  Close the application server file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Mar 2008 05:41:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-07T05:41:34Z</dc:date>
    <item>
      <title>open data and close dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513573#M845085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;code required for  how to upload to application server and download it from application server using open dataset and closedataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2008 05:36:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513573#M845085</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-07T05:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: open data and close dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513574#M845086</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;DATA FNAME(60) VALUE 'myfile'.---Application server file name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: TEXT1(4) VALUE '1234    ',&lt;/P&gt;&lt;P&gt;      TEXT2(8) VALUE '12345678',&lt;/P&gt;&lt;P&gt;      TEXT3(2),&lt;/P&gt;&lt;P&gt;      LENG TYPE I.&lt;/P&gt;&lt;P&gt;For writing&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE.&lt;/P&gt;&lt;P&gt;   TRANSFER: TEXT1 TO FNAME,&lt;/P&gt;&lt;P&gt;             TEXT2 TO FNAME.&lt;/P&gt;&lt;P&gt;CLOSE DATASET FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Reading &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR INPUT IN TEXT MODE.&lt;/P&gt;&lt;P&gt;   DO 2 TIMES.&lt;/P&gt;&lt;P&gt;      READ DATASET FNAME INTO TEXT3 LENGTH LENG.&lt;/P&gt;&lt;P&gt;      WRITE: / TEXT3, LENG.&lt;/P&gt;&lt;P&gt;   ENDDO.&lt;/P&gt;&lt;P&gt;CLOSE DATASET FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get the application server file goto tcdoe &lt;STRONG&gt;AL11&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2008 05:40:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513574#M845086</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-07T05:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: open data and close dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513575#M845087</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; You can use this code for downloading file to application server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form download_file_appl_server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  open dataset p_dlf2 for output&lt;/P&gt;&lt;P&gt;          in text mode encoding default .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;    message:i005 with text-415 text-407.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at i_final into wa_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    transfer wa_final to p_dlf2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  close dataset p_dlf2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    " OPENDATA_CLOSE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where  p_dlf2 is the application server file path.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will Help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shibin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Shibin on Mar 7, 2008 6:42 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2008 05:41:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513575#M845087</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-07T05:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: open data and close dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513576#M845088</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; Use  the below statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET :  open application server file in OUTPUT, INPUT(read) &amp;amp; APPEND modes.&lt;/P&gt;&lt;P&gt;READ DATASET :  Read records from file when it is opened in read mode (INPUT MODE).&lt;/P&gt;&lt;P&gt;TRANSFER :  write data to the file when opened in Output &amp;amp; Append mode.&lt;/P&gt;&lt;P&gt;CLOSE DATASET :  Close the application server file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2008 05:41:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513576#M845088</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-07T05:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: open data and close dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513577#M845089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;

* Audit file read from  application server
FORM check_phys_file  USING  p_file TYPE any.

  DATA: l_str(300) TYPE c.
  CLEAR l_str.

  OPEN DATASET p_file IN TEXT MODE FOR INPUT ENCODING DEFAULT.

  READ DATASET p_file INTO l_str.

  CLOSE DATASET p_file.

ENDFORM.                    " check_phys_file



* Audit file download in application server
    OPEN DATASET p_ofile_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

    IF sy-subrc = 0.
      CLEAR: wa_local.

      LOOP AT p_local_table INTO wa_local.
        TRANSFER wa_local TO p_ofile_file.
        CLEAR: wa_local.
      ENDLOOP.

      CLOSE DATASET p_ofile_file.
    ELSE.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2008 05:42:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513577#M845089</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-07T05:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: open data and close dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513578#M845090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls check this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXCEL to INTERNAL table and then to APPLICATION SEVER &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 ZSD_EXCEL_INT_APP&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 ZSD_EXCEL_INT_APP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameter: file_nm type localfile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of it_tab1,&lt;/P&gt;&lt;P&gt;f1(20),&lt;/P&gt;&lt;P&gt;f2(40),&lt;/P&gt;&lt;P&gt;f3(20),&lt;/P&gt;&lt;P&gt;end of it_tab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : it_tab type table of ALSMEX_TABLINE with header line,&lt;/P&gt;&lt;P&gt;file type rlgrap-filename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : it_tab2 type it_tab1 occurs 1,&lt;/P&gt;&lt;P&gt;wa_tab2 type it_tab1,&lt;/P&gt;&lt;P&gt;w_message(100) TYPE c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at selection-screen on value-request for file_nm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'KD_GET_FILENAME_ON_F4'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROGRAM_NAME = SYST-REPID &lt;/P&gt;&lt;P&gt;DYNPRO_NUMBER = SYST-DYNNR &lt;/P&gt;&lt;P&gt;FIELD_NAME = ' ' &lt;/P&gt;&lt;P&gt;STATIC = 'X'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MASK = ' ' &lt;/P&gt;&lt;P&gt;CHANGING&lt;/P&gt;&lt;P&gt;file_name = file_nm&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;MASK_TOO_LONG = 1&lt;/P&gt;&lt;P&gt;OTHERS = 2&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;ENDIF.&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;refresh it_tab2[].clear wa_tab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;file = file_nm.&lt;/P&gt;&lt;P&gt;&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 = file&lt;/P&gt;&lt;P&gt;i_begin_col = '1'&lt;/P&gt;&lt;P&gt;i_begin_row = '1'&lt;/P&gt;&lt;P&gt;i_end_col = '10'&lt;/P&gt;&lt;P&gt;i_end_row = '35'&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;intern = it_tab&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;.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case it_tab-col.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when '002'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_tab2-f1 = it_tab-value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when '004'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_tab2-f2 = it_tab-value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when '008'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_tab2-f3 = it_tab-value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at end of row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append wa_tab2 to it_tab2.&lt;/P&gt;&lt;P&gt;clear wa_tab2.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : p_file TYPE rlgrap-filename value 'TEST3.txt'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.&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;&lt;/P&gt;&lt;P&gt;Display error messages if any. &lt;/P&gt;&lt;P&gt;IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;MESSAGE e001(zsd_mes).&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*---Data is downloaded to the application server file path&lt;/P&gt;&lt;P&gt;LOOP AT it_tab2 INTO wa_tab2.&lt;/P&gt;&lt;P&gt;TRANSFER wa_tab2 TO p_file.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--Close the Application server file (Mandatory).&lt;/P&gt;&lt;P&gt;CLOSE DATASET p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_tab2 into wa_tab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2008 05:47:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513578#M845090</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-07T05:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: open data and close dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513579#M845091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello bharath,&lt;/P&gt;&lt;P&gt;Check out this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

EPORT Z_CRM_REP_SCORE100 no standard page heading message-id zmsgap.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;     Type Declaration
*&amp;amp;---------------------------------------------------------------------*
Types: Begin of t_file,
       BPEXT type BU_BPEXT,               "External Number of Business Partner
       NAME_FIRST type BU_NAMEP_F,        "First Name
       NAME_LAST type BU_NAMEP_L,         "Last Name
       CITY1 type AD_CITY1,               "City
       COUNTRY type AD_COMCTRY,           "Country
       TEL_NUMBER type AD_TLNMBR1,        "Telephone Number
       End of t_file.

Types: Begin of t_but000,                "External Number of Business Partner
       PARTNER type BU_PARTNER,
       BPEXT type BU_BPEXT,
       NAME_FIRST type BU_NAMEP_F,       "First Name
       NAME_LAST type BU_NAMEP_L,        "Last Name
       PERSNUMBER type AD_PERSNUM,       "Person Number
       ADDRCOMM type BU_ADDRCOMM,        "Address Number
       end of t_but000.

Types: Begin of t_adr2,
       ADDRNUMBER type AD_ADDRNUM,       "Address Number
       PERSNUMBER type AD_PERSNUM,       "Person Number
       COUNTRY type AD_COMCTRY,          "Country
       TEL_NUMBER type AD_TLNMBR,        "Telephone Number
       End of t_adr2.

Types: Begin of t_adrc,
       ADDRNUMBER type AD_ADDRNUM,       "Address Number
       CITY1 type AD_CITY1,              "City
       End of t_adrc.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Internal tables and Work Areas Declaration
*&amp;amp;---------------------------------------------------------------------*

Data: it_file type standard table of t_file,
      wa_file type t_file,

      it_sapdata type standard table of t_file,
      wa_sapdata type t_file,

      it_output type standard table of t_file,
      wa_output type t_file,

      it_but000 type standard table of t_but000,
      wa_but000 type t_but000,

      it_adr2 type standard table of t_adr2,
      wa_adr2 type t_adr2,

      it_adrc type standard table of t_adrc,
      wa_adrc type t_adrc.


*Variable Declaration for file path
Data:gv_path type SAPB-SAPPFAD value 'C:\FILE.TXT',
     gv_path1 type string value 'file1.txt'.

*Variable Declaration for index.
Data: gv_tabix type sy-tabix.

*Variable Declaration for Line selection.
Data: v_fieldname type BUT000-BPEXT,
       v_fieldvalue type BU_BPEXT.


*Calling subroutine to create flat file in application server.
Perform f_file_to_server.

*Calling subroutine to fetch values from flat file into an internal table.
Perform f_dataset.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Event Start-of-Selection.
*&amp;amp;---------------------------------------------------------------------*
Start-of-Selection.

*Calling subroutine to fetch values from table BUT000 into an internal table.
  Perform f_select_but000.

*Calling subroutine to fetch values from table ADR2 into an internal table.
  Perform f_select_adr2.

*Calling subroutine to fetch values from table ADRC into an internal table.
  Perform f_select_adrc.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Event End-of-Selection.
*&amp;amp;---------------------------------------------------------------------*
End-of-Selection.

*Calling subroutine to fill an internal table with SAP data.
  Perform f_fill_sapdata.

*Calling subroutine to compare the values between I_SAPDATA and I_FILE.
  Perform f_compare.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Event At Line Selection.
*&amp;amp;---------------------------------------------------------------------*
At Line-Selection.

*Checking for list index.
  Case sy-lsind.
*When list index is 1.
    When '1'.
*Get the value of external number and apss it to the field value..
      Get Cursor Field v_fieldname value v_fieldvalue.
*Passing field value to field name.
      wa_sapdata-BPEXT = v_fieldvalue.
      If v_fieldname = 'WA_SAPDATA-BPEXT'.
*Taking only that value whose External Number exist in the internal table IT_BUT000.
        Read Table it_but000 into wa_but000 with key BPEXT = v_fieldvalue binary search.
*Checking if value exist.
        If sy-subrc eq 0.
*If it exists then call BP transaction to change the values for that particualr BP according to Aries data.
          Set Parameter id 'BPA' FIELD WA_BUT000-partner.
          Call Transaction 'BP' and skip first screen..
        Endif.                                                        "End of Sy-subrc check.
      Endif.
    Endcase.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  f_file_to_server
*&amp;amp;---------------------------------------------------------------------*
*       This module is used to create flat file in application server
*       by using function module ARCHIVFILE_CLIENT_TO_SERVER .
*----------------------------------------------------------------------*
FORM f_file_to_server .

*Calling function module to create flat file in application server.
  CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
    EXPORTING
      PATH       = GV_PATH
      TARGETPATH = 'FILE1.TXT '
    EXCEPTIONS
      ERROR_FILE = 1
      OTHERS     = 2.
*checking if file is created successfully
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
*If file is not created then display a message.
    Message E009.

  ENDIF.                 "End of Sy-subrc check.

ENDFORM.                    " f_file_to_server


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  f_dataset
*&amp;amp;---------------------------------------------------------------------*
*       This module is used to fetch values from flat file,stored in
*       application server, into an internal table it_file.
*----------------------------------------------------------------------*
FORM f_dataset .

*Opening file from application server.
  Open dataset gv_path1 for input in text mode encoding default.
*Reading the file.
  While sy-subrc eq 0.
    Read dataset gv_path1 into wa_file.
    Append wa_file to it_file.
    Clear wa_file.
  Endwhile.
*closing the file in application server.
  Close dataset gv_path1.

ENDFORM.                    " f_dataset


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  f_select_but000
*&amp;amp;---------------------------------------------------------------------*
*       This module is used to select values from table BUT000 into an
*       internal table i_but000.
*----------------------------------------------------------------------*
FORM f_select_but000 .

*Selecting values from table BUT000.
  Select PARTNER
         BPEXT
         NAME_FIRST
         NAME_LAST
         PERSNUMBER
         ADDRCOMM
         From but000 into table it_but000
         where TYPE = '1'
         and BPEXT ne ''
         and ADDRCOMM ne ''.

*Checking if values are fetched in the internal table.
  If sy-subrc eq 0.
    sort it_but000 by BPEXT PERSNUMBER .
  Endif.                           " End of Sy-subrc check.

ENDFORM.                    " f_select_but000


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  f_select_adr2
*&amp;amp;---------------------------------------------------------------------*
*       This module is used to select values from table ADR2 into an
*       internal table i_adr2 corresponding to the values in i_but000.
*----------------------------------------------------------------------*
FORM f_select_adr2 .

*Checking if internal table i_but000 is not empty.
  If not it_but000[] is initial.

*Selecting values from table ADR2.
    Select ADDRNUMBER
           PERSNUMBER
           COUNTRY
           TEL_NUMBER
           into table it_adr2
           from adr2
           for all entries in it_but000
           where PERSNUMBER = it_but000-PERSNUMBER.

*Checking if values are fetched in the internal table.
    If sy-subrc eq 0.
      sort it_adr2 by ADDRNUMBER.         " End of Sy-subrc check.
    Endif.

  Endif.                                  "End of internal table check.

ENDFORM.                    " f_select_adr2

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  f_select_adrc
*&amp;amp;---------------------------------------------------------------------*
*      This module is used to select values from table ADRC into an
*      internal table i_adrc on the basis of values in i_adr2.
*----------------------------------------------------------------------*
FORM f_select_adrc .

*Checking if internal table i_but000 is not empty.
  If not it_adr2[] is initial.

*Selecting values from table ADRC.
    Select ADDRNUMBER
           CITY1
           from adrc
           into table it_adrc
           for all entries in it_adr2
           where ADDRNUMBER = it_adr2-ADDRNUMBER.

*Checking if values are fetched in the internal table.
    If sy-subrc eq 0.
      sort it_adrc by ADDRNUMBER.         " End of Sy-subrc check.
    Endif.

  Endif.                                  "End of internal table check.




ENDFORM.                    " f_select_adrc


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  f_fill_sapdata
*&amp;amp;---------------------------------------------------------------------*
*       This module is used to fill values in internal table i_sapdata
*       with the values selected from BUT000,ADRC and ADR2.
*----------------------------------------------------------------------*
FORM f_fill_sapdata .

*Checking if internal table it_but000 is not empty.
  If not it_but000[] is initial.

    Loop at it_but000 into wa_but000.
*Filling the values of internal table IT_BUT000 into workarea of IT_SAPDATA.
      wa_sapdata-BPEXT = wa_but000-BPEXT.
      wa_sapdata-NAME_FIRST = wa_but000-NAME_FIRST.
      wa_sapdata-NAME_LAST = wa_but000-NAME_LAST.

*Taking only those values whose Person Number exist in the internal table IT_ADR2.
      Read  table it_adr2 into wa_adr2 with key PERSNUMBER = wa_but000-PERSNUMBER Binary Search.
*If value exists then populate those values in work area of IT_SAPDATA.
      If sy-subrc eq 0.
        wa_sapdata-COUNTRY = wa_adr2-COUNTRY.
        wa_sapdata-TEL_NUMBER  = wa_adr2-TEL_NUMBER .
*Taking only those values whose Address Number exist in the internal table I_ADRC.
        Read table it_adrc into wa_adrc with key ADDRNUMBER = wa_adr2-ADDRNUMBER Binary Search.
*If value exists then populate that value in work area of I_SAPDATA.
        If sy-subrc eq 0.
          wa_sapdata-CITY1 = wa_adrc-CITY1.
        Endif.                              "End of Sy-subrc Check.
      Endif.                                "End of Sy-subrc Check.
*Inserting workarea of sapdata into its internal table.
      Append wa_sapdata to it_sapdata.
*Clearing all workareas.
      Clear: wa_adrc,wa_adr2,wa_sapdata.
    Endloop.
  Endif.                                      "End of internal table check.
*Clearing workarea.
  Clear wa_but000.

ENDFORM.                    " f_fill_sapdata


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  f_compare
*&amp;amp;---------------------------------------------------------------------*
*       This module is used to compare values between the Aries data
*       and SAP data and display those values which are different.
*----------------------------------------------------------------------*
FORM f_compare .

*Checking if internal table it_sapdata is not empty.
  If not it_sapdata[] is initial.

    Loop at it_sapdata into wa_sapdata.

*Taking only those values whose External Number exist in the internal table IT_FILE.
      Read table it_file into wa_file with key BPEXT = wa_sapdata-BPEXT.

*Comparing the workareas of two internal tables
      If wa_sapdata ne wa_file.

*Checking if values of work area donot match then write the header.
        Write: / sy-uline(120).
        Format color 1.
        Write: /1 'External Number' Centered.
        Format Hotspot on.
        Write: 17 wa_sapdata-BPEXT.
        Format Hotspot off.
        Write: 47 sy-vline,
           48 'Aries data' Centered,
           80 sy-vline,
           81 'SAP data' Centered,
           120 sy-vline.
        WRITE: / sy-uline(120).

*Checking if first name in the aries data and SAP data does not match.
        If wa_sapdata-NAME_FIRST ne wa_file-NAME_FIRST.
*If it doesnt match then display it using subroutine.
          Perform f_write using 'First Name' wa_file-NAME_FIRST  wa_sapdata-NAME_FIRST.
        Endif.                                                                              " End of Sy-subrc check.

*Checking if last name in the aries data and SAP data does not match.
        If wa_sapdata-NAME_LAST ne wa_file-NAME_LAST.
*If it doesnt match then display it using subroutine.
          Perform f_write using 'Last Name' wa_file-NAME_LAST  wa_sapdata-NAME_LAST.
        Endif.                                                                              " End of Sy-subrc check.

*Checking if city in the aries data and SAP data does not match.
        If wa_sapdata-CITY1 ne wa_file-CITY1.
*If it doesnt match then display it using subroutine.
          Perform f_write using 'City' wa_file-CITY1  wa_sapdata-CITY1.
        Endif.                                                                             " End of Sy-subrc check.

*Checking if country in the aries data and SAP data does not match.
        If wa_sapdata-COUNTRY ne wa_file-COUNTRY.
*If it doesnt match then display it using subroutine.
          Perform f_write using 'Country' wa_file-COUNTRY  wa_sapdata-COUNTRY.
        Endif.                                                                             " End of Sy-subrc check.

*Checking if phone number in the aries data and SAP data does not match.
        If wa_sapdata-TEL_NUMBER ne wa_file-TEL_NUMBER.
*If it doesnt match then display it using subroutine.
          Perform f_write using 'Phone Number' wa_file-TEL_NUMBER  wa_sapdata-TEL_NUMBER.
        Endif.                                                                            " End of Sy-subrc check.

      Endif.                                                                               "End of Equality check.
    Endloop.
*Clearing workareas.
    Clear: wa_sapdata, wa_file.
  Endif.                                                                                "End of internal table check.




ENDFORM.                    " f_compare

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  f_write
*&amp;amp;---------------------------------------------------------------------*
*       This module is used to display the field names which has been
*       changed in SAP from Aries data.
*----------------------------------------------------------------------*
*      --&amp;gt;P_field_name   text
*      --&amp;gt;P_Aries_data   text
*      --&amp;gt;P_SAP_data     text
*----------------------------------------------------------------------*
FORM f_write  USING    VALUE(P_field_name)
                       VALUE(P_Aries_data)
                       VALUE(P_SAP_data).

  Format color 2.
  Write : /1 P_field_name,
          47 sy-vline.
  Format color off.
  Write: 48 P_Aries_data,
         80 sy-vline,
         81 P_SAP_data,
         120 sy-vline.
  WRITE: / sy-uline(120).

ENDFORM.                    " f_write

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward points if helpful.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Aditi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2008 06:27:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-data-and-close-dataset/m-p/3513579#M845091</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-07T06:27:15Z</dc:date>
    </item>
  </channel>
</rss>

