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

PDF file write to application server

Former Member
0 Likes
2,258

Hi All,

I want to write PDF file to application server while downloading its writing but in this manner

%PDF-1.6#%####

108 0 obj#<</First 17/Length 108/Filter/FlateDecode/N 3/Type/ObjStm>>stream

xڲT0P04Q07W05#2,#ll##K#J*#R#C####Sbq#[^##GjNYjIfr##SN##kr~Jf#~xf#c^q&##Ҧ##agG#a####X###T##XR### ##b#

Please let me know where i am doing wrong.

Please see below my code .

(the scenario is when i download the pdf file i want to write the same file in to app server )


  call function fm_name
    exporting
      /1bcdwb/docparams  = fp_docparams "
      ls_header          = ls_waste
      lt_item            = gt_rkpf
      aufnr              = lv_aufnr
    importing
      /1bcdwb/formoutput = fp_formoutput
    exceptions
      usage_error        = 1
      system_error       = 2
      internal_error     = 3
      others             = 4.
 
 concatenate 'D:\temp\PROCESSORDER_' ls_waste-rsnum   '.PDF' into lv_file.
    pr_file = lv_file.
 
  open dataset pr_file for output in binary mode."text mode encoding  NON-UNICODE.
  if sy-subrc  0.
    exit.
  endif.
  transfer fp_formoutput-pdf  to pr_file.
  close dataset pr_file.
  clear :fp_formoutput-pdf,lv_file.

Please any one help me thanks,

Thanks,

Kumar

12 REPLIES 12
Read only

AlexanderOv
Product and Topic Expert
Product and Topic Expert
0 Likes
1,518

Hi,

can you explain what exactly the problem? Do you have the file on the application server after execution your program is complete? How do you manage to see the file with these symbols?

Read only

0 Likes
1,518

Thanks a lot for reply.

after writing my file i can see using AL11 transaction , why i want to see is after writer user want to change that data and he want to move that file into archive folder in server then i have to read right now they can't modify becz it is not in text mode it is like symbols they don't no where they want to modify.

please tell me what i have to do.

Read only

AlexanderOv
Product and Topic Expert
Product and Topic Expert
0 Likes
1,518

You need to try checking you file, if it is correct. If the file on server is not correct, you need to add catching exceptions (like CX_SY_FILE_OPEN, CX_SY_CODEPAGE_CONVERTER_INIT etc.).

Read only

0 Likes
1,518

Hi Alexander and Jose,

Thanks for quick reply , where i have to pass these exceptions right now i am passing to fm call function fm_name but in debug i can see sy-subrc = 0 and is there any other way to write file to server.

And one more thing i am wondering is i downloaed the file using cg3y from server it is showing correct data and in pdf format

but after upload why it is showing in correct format (not readable format) ,

can you please help me is there any other way i can write pdf file to application server

Thanks

Kumar

Read only

AlexanderOv
Product and Topic Expert
Product and Topic Expert
0 Likes
1,518

As said you won't see pdf via AL11.

Just a thought, try to write extension "pdf" in lower case.

Read only

former_member209703
Active Contributor
0 Likes
1,518

You can't tranfer the whole PDF data with just one transfer statement, instead you have to loop that table and transfer the data to the file until you reach the last row.


  open dataset pr_file for output in binary mode."text mode encoding  NON-UNICODE.
  if sy-subrc  0.
    exit.
  endif.
  loop at fp_formoutput-pdf  *****************
    transfer fp_formoutput-pdf  to pr_file. 
  endloop.
  close dataset pr_file.
  clear :fp_formoutput-pdf,lv_file.

Read only

0 Likes
1,518

Hi Jose ,

Thanks for reply, fp_formoutput-pdf is structure not a table from fm i am getting only one string not a table i changed to table and loop and transferd but the problem is same .

Please tell me what i have to do

Thanks

Kumar

Read only

0 Likes
1,518

Hi

I still don't know what is wrong, if the PDF file is created succesfully and you can see it in the AL11, I don't see where the problem is. Obviously you won't get to see the PDF file via AL11 to check whether the file is corrupted or not after creating it.

One thing you can do to check that out is using the standard FM ARCHIVEFILE_SERVER_TO_CLIENT. This way you can download the file you've just created to your PC and open it there, so you can check if the file in the server is OK.

Read only

0 Likes
1,518

Hi Jose,

i can't se this FM in my system ARCHIVEFILE_SERVER_TO_CLIENT (ECC 6)

Read only

0 Likes
1,518

Sorry

ARCHIVFILE_SERVER_TO_CLIENT

Read only

0 Likes
1,518

Solved

Read only

0 Likes
1,518

Hi,

I am also facing the same problem can you give me some idea how you solved.....

Regards,

Ramesh.