Register Login

Writing Files On Application Server AL11

Updated May 18, 2018

Hi all,

I am writing file onto application server AL11.

constants : c_tab type x value '09'.

concatenate w_matnr
w_werks
w_date
w_name2
into lv_data separated by c_tab.

When I checked in AL11, I am getting # symbol between each field.
When I download it to .xls file I am getting the entire record in single column of Excel file.

How to get matnr, werks, date and name in each column of Excel file.
Please help.

Thanks


Comments

  • 22 Aug 2013 6:39 am Sushma
    Hi,

    Are you specifying that your file is tab delimited when you are opening it
    in Excel?
  • 22 Aug 2013 6:39 am Sushma
    Hi,

    Try using constant CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB in stead of your own defined constant.

    How are you opening the file? Do you specify the proper code page, byte order mark?
  • 22 Aug 2013 6:39 am amit butola
    Hi,

    I have used
    constants : c_tab type x value '09'.
    In AL11, I am using Download push button on application toolbar.

    Where do we specify tab delimiter? Could you explain in detail?

    Thanks
  • 22 Aug 2013 6:39 am Sushma
    Hi,
    Replace c_tab with CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

    Furthermore, check how the OPEN DATASET statement has been specified. Check the documentation of the statement to read up on options for opening datasets on application server.
  • 22 Aug 2013 6:40 am Sushma
    Hopefully when you downloaded the file, you didn't specify an Excel file
    extension. That way when you open Excel and select your file Excel will
    recognise that you are opening a non-Excel file and you will get a popup
    window "Text Import Wizard" where you specify in Step 1 that your file is
    Delimited. Click Next >, then in Step 2 you choose Tab from the list of
    Delimiters. Either go on to Step 3 or Finish. Your file will open with
    each field in its own column.
  • 22 Aug 2013 6:40 am amit butola
    Hi,

    I am developing this in 4.0B version and no OOPs concept.
    I am opening the file using OPEN DATASET P_FILE FOR OUTPUT.

    Please advise.

    Thanks
  • 22 Aug 2013 6:43 am Sushma
    Maybe as a tip for next time you put a question on this forum, provide us with this important piece of information.
  • 22 Aug 2013 12:45 pm Sushma
    Change the file type to .csv and then try to open it open it. Tell us what
    happens...
  • 23 Aug 2013 6:49 am amit butola
    Hi,

    Thank you all for your replies. Now I am getting the data separated by tab delimiter with each value in each column.

    Thanks
  • 23 Aug 2013 6:49 am Sushma
    The open data set statement has an encoding default or other option for output in text mode or binary mode etc. You should be able to see your line
    The encoding controls the end-of-line which varies from unix to windows etc.

    Then when you open the file since it will be txt mode You will import into excel and will have to use the character that you have used for delimitting.
    Try hard coded ',' for the field separator. The output mode being text it is best to use .txt extension or none.

    Then you should see the file as you want in columns in excel.
    Most of the time you should find 1001 successful code excerpts on the net.
    Good luck.

×