<?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 how to do this code in elegant way in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-this-code-in-elegant-way/m-p/2496863#M563963</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hallow&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there is better way to do that becouse I this is part (I have many )of the table I have to send?&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;&amp;lt;b&amp;gt;PERFORM write_2_server TABLES hire_emp_tab.&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES entrance_tab.&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES integration_tab.&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES duty_tab .&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES type_emp_tab.&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES job_part_tab .&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES free_days_tab.&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES status_tab.&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES bank_detailes_tab.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;FORM write_2_server TABLES p_tab_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;wa&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" MOVE 'D:_pa_test_mmsk_pa1.txt' TO adress.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET adress IN TEXT MODE&lt;/P&gt;&lt;P&gt;ENCODING DEFAULT FOR OUTPUT.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;no_file = ' '.&lt;/P&gt;&lt;P&gt;LOOP AT p_tab_data ASSIGNING &amp;lt;wa&amp;gt;.&lt;/P&gt;&lt;P&gt;TRANSFER &amp;lt;wa&amp;gt; TO adress.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;CLOSE DATASET adress.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;no_file = 'X'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jul 2007 16:02:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-10T16:02:45Z</dc:date>
    <item>
      <title>how to do this code in elegant way</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-this-code-in-elegant-way/m-p/2496863#M563963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hallow&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there is better way to do that becouse I this is part (I have many )of the table I have to send?&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;&amp;lt;b&amp;gt;PERFORM write_2_server TABLES hire_emp_tab.&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES entrance_tab.&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES integration_tab.&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES duty_tab .&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES type_emp_tab.&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES job_part_tab .&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES free_days_tab.&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES status_tab.&lt;/P&gt;&lt;P&gt;PERFORM write_2_server TABLES bank_detailes_tab.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;FORM write_2_server TABLES p_tab_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;wa&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" MOVE 'D:_pa_test_mmsk_pa1.txt' TO adress.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET adress IN TEXT MODE&lt;/P&gt;&lt;P&gt;ENCODING DEFAULT FOR OUTPUT.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;no_file = ' '.&lt;/P&gt;&lt;P&gt;LOOP AT p_tab_data ASSIGNING &amp;lt;wa&amp;gt;.&lt;/P&gt;&lt;P&gt;TRANSFER &amp;lt;wa&amp;gt; TO adress.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;CLOSE DATASET adress.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;no_file = 'X'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 16:02:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-this-code-in-elegant-way/m-p/2496863#M563963</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-10T16:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to do this code in elegant way</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-this-code-in-elegant-way/m-p/2496864#M563964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is definitly one option, I would probably go with that, if not within the OO context, but similarly I would use class/method if I was within the OO context.  Another option, which I would not recommend, is to use a macro, problem with that is, you can't debug it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 16:08:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-this-code-in-elegant-way/m-p/2496864#M563964</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-07-10T16:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to do this code in elegant way</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-this-code-in-elegant-way/m-p/2496865#M563965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This is definitely good because your program is modularised..Let it remain as it is..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Cmehra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 16:22:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-this-code-in-elegant-way/m-p/2496865#M563965</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-10T16:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to do this code in elegant way</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-this-code-in-elegant-way/m-p/2496866#M563966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can also do it in this way also...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;DATA:  BEGIN OF name_of_tables OCCURS 0,&lt;/P&gt;&lt;P&gt;              tabname(30) TYPE c,&lt;/P&gt;&lt;P&gt;           END OF name_of_tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INITIALIZATION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  APPEND 'HIRE_EMP_TAB' TO name_of_tables.&lt;/P&gt;&lt;P&gt;  APPEND 'ENTRANCE_TAB' TO name_of_tables.&lt;/P&gt;&lt;P&gt;  APPEND 'INTEGRATION_TAB' TO name_of_tables.&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;  APPEND 'HIRE_EMP_TAB' TO hire_emp_tab.&lt;/P&gt;&lt;P&gt;  APPEND 'ENTRANCE_TAB' TO entrance_tab.&lt;/P&gt;&lt;P&gt;  APPEND 'INTEGRATION_TAB' TO integration_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PERFORM write_2_server TABLES name_of_tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM write_2_server TABLES p_tab_data STRUCTURE name_of_tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  FIELD-SYMBOLS: &amp;lt;tab&amp;gt; TYPE table,&lt;/P&gt;&lt;P&gt;                &amp;lt;wa&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: l_tabname(30) TYPE c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DELETE DATASET address.&lt;/P&gt;&lt;P&gt;  OPEN DATASET address FOR OUTPUT IN TEXT MODE ENCODING DEFAULT .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CHECK sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT p_tab_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CONCATENATE p_tab_data-tabname '[]' INTO l_tabname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ASSIGN (l_tabname) TO &amp;lt;tab&amp;gt;.&lt;/P&gt;&lt;P&gt;    ASSIGN (p_tab_data-tabname) TO &amp;lt;wa&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    w_count = w_count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT &amp;lt;tab&amp;gt; INTO &amp;lt;wa&amp;gt;.&lt;/P&gt;&lt;P&gt;      TRANSFER &amp;lt;wa&amp;gt; TO address.&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;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLOSE DATASET address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CHECK sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;  WRITE:/ 'Done'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    "write_2_server&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Coding is reduced... performance will be almost same ..&lt;/P&gt;&lt;P&gt;Reward points if useful..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Prax&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 17:26:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-this-code-in-elegant-way/m-p/2496866#M563966</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-10T17:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to do this code in elegant way</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-this-code-in-elegant-way/m-p/2496867#M563967</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;Your code seems to be good, I believe you can have some little problem while you transfer the data to the file (if you're using only one file):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET adress IN TEXT MODE should overwrite the file, so the result should be you'll transfer the data of the last table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U should use the option FOR APPENDING or u open the file just one time or transfer all table in a big table and the transfer it to the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe the easier solution should be open the file just one time:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PERFORM write_2_server: TABLES hire_emp_tab USING '1',
                              TABLES entrance_tab  USING SPACE,
                              TABLES integration_ta USING SPACE,
                              TABLES duty_tab USING SPACE,
                              TABLES type_emp_tab USING SPACE,
                              TABLES job_part_tab USING SPACE, 
                              TABLES free_days_tab USING SPACE,
                              TABLES status_tab USING SPACE, 
                              TABLES bank_detailes_tab USING '2'.

FORM write_2_server TABLES p_tab_data
                                USING   ACTION.

FIELD-SYMBOLS: &amp;lt;wa&amp;gt; TYPE ANY.

" MOVE 'D:_pa_test_mmsk_pa1.txt' TO adress.


IF ACTION = '1'.
 OPEN DATASET adress IN TEXT MODE ENCODING DEFAULT FOR OUTPUT.
 IF sy-subrc = 0.
   no_file = ' '.
 ELSE.
   no_file = 'X'.
 ENDIF.
ENDIF.

IF NO_FILE = SPACE.
  LOOP AT p_tab_data ASSIGNING &amp;lt;wa&amp;gt;.
     TRANSFER &amp;lt;wa&amp;gt; TO adress.
  ENDLOOP.
ENDIF.

IF ACTION = '2' AND NO_FILE = SPACE.
  CLOSE DATASET adress.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 17:42:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-this-code-in-elegant-way/m-p/2496867#M563967</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-10T17:42:16Z</dc:date>
    </item>
  </channel>
</rss>

