2007 Jul 10 5:02 PM
Hallow
there is better way to do that becouse I this is part (I have many )of the table I have to send?
Regards
<b>PERFORM write_2_server TABLES hire_emp_tab.
PERFORM write_2_server TABLES entrance_tab.
PERFORM write_2_server TABLES integration_tab.
PERFORM write_2_server TABLES duty_tab .
PERFORM write_2_server TABLES type_emp_tab.
PERFORM write_2_server TABLES job_part_tab .
PERFORM write_2_server TABLES free_days_tab.
PERFORM write_2_server TABLES status_tab.
PERFORM write_2_server TABLES bank_detailes_tab.</b>
FORM write_2_server TABLES p_tab_data.
FIELD-SYMBOLS: <wa> TYPE ANY.
" MOVE 'D:_pa_test_mmsk_pa1.txt' TO adress.
OPEN DATASET adress IN TEXT MODE
ENCODING DEFAULT FOR OUTPUT.
IF sy-subrc = 0.
no_file = ' '.
LOOP AT p_tab_data ASSIGNING <wa>.
TRANSFER <wa> TO adress.
ENDLOOP.
CLOSE DATASET adress.
ELSE.
no_file = 'X'.
ENDIF.
2007 Jul 10 6:42 PM
Hi
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):
OPEN DATASET adress IN TEXT MODE should overwrite the file, so the result should be you'll transfer the data of the last table.
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.
I believe the easier solution should be open the file just one time:
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: <wa> 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 <wa>.
TRANSFER <wa> TO adress.
ENDLOOP.
ENDIF.
IF ACTION = '2' AND NO_FILE = SPACE.
CLOSE DATASET adress.
ENDIF.Max
Hallow
there is better way to do that becouse I this is part (I have many )of the table I have to send?
Regards
<b>PERFORM write_2_server TABLES hire_emp_tab.
PERFORM write_2_server TABLES entrance_tab.
PERFORM write_2_server TABLES integration_tab.
PERFORM write_2_server TABLES duty_tab .
PERFORM write_2_server TABLES type_emp_tab.
PERFORM write_2_server TABLES job_part_tab .
PERFORM write_2_server TABLES free_days_tab.
PERFORM write_2_server TABLES status_tab.
PERFORM write_2_server TABLES bank_detailes_tab.</b>
FORM write_2_server TABLES p_tab_data.
FIELD-SYMBOLS: <wa> TYPE ANY.
" MOVE 'D:_pa_test_mmsk_pa1.txt' TO adress.
OPEN DATASET adress IN TEXT MODE
ENCODING DEFAULT FOR OUTPUT.
IF sy-subrc = 0.
no_file = ' '.
LOOP AT p_tab_data ASSIGNING <wa>.
TRANSFER <wa> TO adress.
ENDLOOP.
CLOSE DATASET adress.
ELSE.
no_file = 'X'.
ENDIF.
2007 Jul 10 5:08 PM
2007 Jul 10 5:22 PM
Hi,
This is definitely good because your program is modularised..Let it remain as it is..
Rgds,
Cmehra
2007 Jul 10 6:26 PM
You can also do it in this way also...
<b>DATA: BEGIN OF name_of_tables OCCURS 0,
tabname(30) TYPE c,
END OF name_of_tables.
INITIALIZATION.
APPEND 'HIRE_EMP_TAB' TO name_of_tables.
APPEND 'ENTRANCE_TAB' TO name_of_tables.
APPEND 'INTEGRATION_TAB' TO name_of_tables.
START-OF-SELECTION.
APPEND 'HIRE_EMP_TAB' TO hire_emp_tab.
APPEND 'ENTRANCE_TAB' TO entrance_tab.
APPEND 'INTEGRATION_TAB' TO integration_tab.
PERFORM write_2_server TABLES name_of_tables.
FORM write_2_server TABLES p_tab_data STRUCTURE name_of_tables.
FIELD-SYMBOLS: <tab> TYPE table,
<wa> TYPE ANY.
DATA: l_tabname(30) TYPE c.
DELETE DATASET address.
OPEN DATASET address FOR OUTPUT IN TEXT MODE ENCODING DEFAULT .
CHECK sy-subrc EQ 0.
LOOP AT p_tab_data.
CONCATENATE p_tab_data-tabname '[]' INTO l_tabname.
ASSIGN (l_tabname) TO <tab>.
ASSIGN (p_tab_data-tabname) TO <wa>.
w_count = w_count + 1.
LOOP AT <tab> INTO <wa>.
TRANSFER <wa> TO address.
ENDLOOP.
ENDLOOP.
CLOSE DATASET address.
CHECK sy-subrc EQ 0.
WRITE:/ 'Done'.
ENDFORM. "write_2_server</b>
Coding is reduced... performance will be almost same ..
Reward points if useful..
regards
Prax
2007 Jul 10 6:42 PM
Hi
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):
OPEN DATASET adress IN TEXT MODE should overwrite the file, so the result should be you'll transfer the data of the last table.
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.
I believe the easier solution should be open the file just one time:
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: <wa> 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 <wa>.
TRANSFER <wa> TO adress.
ENDLOOP.
ENDIF.
IF ACTION = '2' AND NO_FILE = SPACE.
CLOSE DATASET adress.
ENDIF.Max
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |