Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Alignment in application servre data

Former Member
0 Likes
809

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
747

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

5 REPLIES 5
Read only

Former Member
0 Likes
748

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

Read only

0 Likes
747

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.

Read only

0 Likes
747

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

Read only

0 Likes
747

Thanks Prasanna. My program is working now.

Read only

0 Likes
747

Welcome.

Thanks & Regards,

T. Prasanna Kumar