2013 Aug 02 1:10 PM
Hi Experts,
I am working on a simple program. i need to download the internal table data to UNIX server.
now thing is that i am able to download that data in UNIX server, but the client now wants the data in
alignment like below screen.
0-1614976-1 | |05 |Resistor 100K 2% 1-8W |
0-1614979-1 | |05 |Resistor 10R 2% 1-8W CF |
0-1614981-1 | |05 |Resistor 110R 2% 1-8W |
0-1622161-1 | |05 |Resistor 150K 2% 1-8W |
0-1622163-1 | |05 |Resistor 15K 2% 1-8W |
Please help on that matter.
Thanks in Advance.
Regards
Rakesh
2013 Aug 02 1:33 PM
Hi Rakesh,
Use the following lines:
data: lv_str type string.
loop at itab into wa.
concatenate wa-field1 wa-field2 .... wa-fieldn into lv_str separated by '|'.
transfer lv_str into <filename>.
if sy-subrc <> 0.
"Display error message
endif.
clear: lv_str.
endloop.
Thanks & Regards,
T. Prasanna Kumar
2013 Aug 02 1:33 PM
Hi Rakesh,
Use the following lines:
data: lv_str type string.
loop at itab into wa.
concatenate wa-field1 wa-field2 .... wa-fieldn into lv_str separated by '|'.
transfer lv_str into <filename>.
if sy-subrc <> 0.
"Display error message
endif.
clear: lv_str.
endloop.
Thanks & Regards,
T. Prasanna Kumar
2013 Aug 02 2:03 PM
Hi Prasanna Kumar,
Thanks for your interest in my issue. I think you are not getting my error.
Look at my source code. It is just like as you have given above.
suppose amaterial has length of character = 10
then 18-10 =8 will be the no of blank space i need in the application server downloaded data.
suppose amaterial has length of character = 16
then 18-16 =2 will be the no of blank space i need in the application server downloaded data.
this frocess will for all column in the data report output.
Please check my below source code and advice me for the same.
TYPES :BEGIN OF ty_file,
file(1500) TYPE c,
END OF ty_file.
DATA : wa_demo TYPE ty_file,
it_demo TYPE STANDARD TABLE OF ty_file.
loop at it_fimara into wa_fimara.
concatenate wa_fimara-matnr wa_fimara-raube wa_fimara-mstae wa_fimara-maktx into wa_demo separated by '|'.
append wa_demo to it_demo.
ENDLOOP.
zmmlv_file = dire_mara.
OPEN DATASET zmmlv_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
CHECK sy-subrc = 0.
loop at it_demo into wa_demo.
TRANSFER wa_demo TO zmmlv_file.
ENDLOOP.
CLOSE DATASET zmmlv_file.
2013 Aug 03 3:09 AM
Hi Rakesh,
Use RESPECTING BLANKS addition in CONCATENATE statement and the data type of the result should be in string.
Now the blank spaces will not be avoided.
Refer this URL: http://help.sap.com/abapdocu_702/en/abapconcatenate.htm
I am also giving a suggestion for your code. You actually don't need the internal table IT_DEMO.
Code:
data: lv_str type string.
zmmlv_file = dire_mara.
OPEN DATASET zmmlv_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
CHECK sy-subrc = 0.
loop at it_fimara into wa_fimara.
concatenate wa_fimara-matnr wa_fimara-raube wa_fimara-mstae wa_fimara-maktx into lv_str separated by '|'.
TRANSFER lv_str TO zmmlv_file.
CLEAR: lv_str, wa_fimara.
ENDLOOP.
CLOSE DATASET zmmlv_file.
Hope, this helps.
Thanks & Regards,
T. Prasanna Kumar
2013 Aug 05 2:31 PM
2013 Aug 06 4:19 AM