Application Development 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: 

Writing file on Application Server

Former Member
0 Kudos

Hi All,

We have a requirement to write a file on App server. The width of each of the records is around 350 characters. Using Transfer command I am able to write only 255 characters in a row. I tried using 'LENGTH 350 ' addition. Still everything beyond 255 char is getting chopped off. Any idea how to overcome this ? Is this a limitation of the server or any authorisation problem ?

Just as an addl info, the server is Unix based.

Thanks & regards

Amit

9 REPLIES 9

Former Member
0 Kudos

Hi

No! You can see only the first 255 char, but that doesn't mean you can't write a file with a record longer 255 char.

So I think the problem is only how you're seeing your file after downloading it.

Max

Message was edited by: max bianchi

0 Kudos

Max is right. You can prove it by uploading it back into a program in look at the last 100 bytes of the internal table.

Rob

Former Member
0 Kudos

I think there might be a bug the way you are using dataset.

please if possible , can you paste the code.

thanks

surjit

Former Member
0 Kudos

Hi Amit,

The limit for the application server is 1032 bytes.

Though the data is written to the server it is not visible.Hence, split the data into lengths of 255 and then write the file to application server, if you want them all to appear on the application server.

Best Regards,

Anjali

0 Kudos

Hi All,

Thanks for your replies. I tried copying the file on Presentation server. Still it is coming in truncated form only. I can not split the data into packets of 255 characters as the rows are individual records.

For those who might be able to help looking at the code, I am attaching the code as well.

Constants: lc_filename(100) TYPE c

VALUE '/usr/sap/tmp/EXTRACT_<SY_DAT>_<SY_U>.csv'.

  • Open dataset to upload file on application server

OPEN DATASET lc_filename FOR APPENDING IN TEXT MODE ENCODING DEFAULT.

  • If file doesnt get opened, raise status message

IF sy-subrc IS NOT INITIAL.

MESSAGE s361(zumt_gen) WITH lc_opened.

  • Output file could not be opened

STOP.

ELSE.

  • Loop through the resultant table

LOOP AT git_result INTO wa_result.

  • Type conversion

lv_zwfakt = wa_result-zwfakt.

lv_asset_stat_code = wa_result-asset_stat_code.

  • Concatenate each line of resultant table using comma seperators

CONCATENATE

wa_result-partner

lc_comma

wa_result-zz_qq

lc_comma

wa_result-zz_sp_qq

lc_comma

lv_asset_stat_code

lc_comma

wa_result-serge

..........

..........

lc_comma

wa_result-string1

lc_comma

wa_result-postcode

lc_comma

wa_result-pltxt

lc_comma

wa_result-name1

lc_comma

wa_result-str_suppl2

lc_comma

wa_result-house_num1

lc_comma

wa_result-street

lc_comma

wa_result-str_suppl3

lc_comma

wa_result-city1

lc_comma

wa_result-post_code1

INTO

wa_csv-lv_csv.

  • Write data into file

TRANSFER wa_csv-lv_csv TO lc_filename LENGTH 350.

  • Clear work areas

CLEAR: wa_csv, wa_result.

ENDLOOP.

  • Close dataset

CLOSE DATASET lc_filename.

  • if error in closing, raise status message

IF sy-subrc IS NOT INITIAL.

MESSAGE s361(zt_gen) WITH lc_closed.

  • Output file could not be opened

STOP.

ENDIF.

  • Status Message: File created

IF sy-subrc IS INITIAL.

MESSAGE s371(zt_gen) WITH lc_filename.

ENDIF.

ENDIF.

Many Thanks

Amit

0 Kudos

Hi

check the string is loaded into wa_csv-lv_csv.

Are you sure it is loaded well?

Max

Message was edited by: max bianchi

Former Member
0 Kudos

Hi Amit,

What is the data type and length of your field wa_csv-lv_csv ??

Cheers.

0 Kudos

Hi Sanjay / Max,

The data type of wa_csv-lv_csv is string. Also I checked the value in it at runtime. There it is coming correctly ( all 350-odd characters ).

Regards

Amit

0 Kudos

Hello Amit,

Can we see so many chars (350) while debugging...I dont know.

Amit...just give a try to this idea once to make sure everything is well.

Try uploading the data in that string variable into an internal table with a field of length 350 and load that table in to file on the presentation server using gui_upload.

Check the file and if it contains all chars then ok.

Code a write statement showing contents of wa_csv-lv_csv on the list.

Just trial and error. If it work with presentation server then there should be some limitations with the files on app server which I am not aware of.

Thanks,