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: 

How to upload pdf format from smart form output into content server.

Former Member
0 Kudos

Hi,

I know that configuration of content server is done by Basis team and i will be getting a path in al11.So,now I am able to create a smart form layout and able to convert the smart form output into pdf by calling the FM 'Convert OTF'.

This FM converts the smart form output into pdf format.i know that using open datset the pdf file can be uploaded into appliaction server but i think open datset will not work for content server.

then i want to know how to upload this pdf file generated into content server.

Can any body please tell me.

34 REPLIES 34

former_member182915
Active Contributor
0 Kudos

1)  Convert Smartform to PDF format
2)  To download the PDF to application server  use the below code

data: ap_server_path(100) value '/usr/sap/xfr/FIS/testpdf',  

open dataset ap_server_path for output in binary mode.

loop at it_lines.

transfer it_lines-field to ap_server_path.

endloop.

close dataset ap_server_path.

clear   it_lines.

refresh it_lines.

0 Kudos

i know how to upload file in application server.But my problem is how to upload the pdf file in content server.

Juwin
Active Contributor
0 Kudos

There are function modules to archive a file. You will have to use them to load the file to content server.

Check thread: https://scn.sap.com/thread/1625794

Thanks,

Juwin

Former Member
0 Kudos

Hi juwin,

Can we directly upload the pdf file from our programe into content server or first we have to upload the pdf file into application server then into content server.Please explain

Juwin
Active Contributor
0 Kudos

You can directly upload the file to content server. No need to write it on application server.

Thanks,

Juwin

Former Member
0 Kudos

You could also use "Archive Link" concept also store the output pdf automatically via output type configuration into the content server. No programming needed. Not even you have to convert the SAPSCRIPT/SMARTFORM  to PDF ( Document classes controls it ). Check with your basis team.

The advantage of Archive link is that incase your content server changes ( e.g to Documentum/File net / DMS ) in future just the content repository settings has to be changed and it will work.

Do a google on..

R

0 Kudos

Hi Rudra,

Thanks for your reply,

can you plaese tell me how without converting the samrtform output into pdf format.It is stored in content server.Please provide some links for upload pdf files in application server.

Juwin
Active Contributor
0 Kudos

There is a whole set of content server configuration that can be activated and the appropriate document types can be assigned to achieve this (generally Basis activity).

Once all the setup is done, all you need to do from program is to pass the archival parameters, while calling smartform function module (archive_index &  archive_parameters). It will do the rest.

Thanks,

Juwin

0 Kudos

Hi Sushant,

In addition to what Juwin has said, the output type also has to link the Document type in Storage System tab in Output Type configuration.

Search in Internet and you get lot of information. Most of the settings are done via SPRO->SAP Netweaver->Application Server->Basis Services->Archive Link->Basic Customizing..

A good way to start may be to have a look at the following link..

ArchiveLink - SAP Library

As you can see it falls under Basis and your Basis colleague should be able to help you that. You can keep your finger crossed.

R

0 Kudos

Hi Juwin,

I wanto know how the path will be given for uploading the file from samrtform,and like below you are telling to pass the values. In archive_parameters and archive_index, what values need to be passed.Is the content server path will be configured and visible through al11.Please provide some example and also the tcode for seeing the content server.i also want to know only by passing these two parameters, will the smartform output converted into pdf format and uploaded in content server.Please reply..

CALL FUNCTION lv_fmodule(FM name of smart from)
EXPORTING
   archive_parameters
    archive_index 

Juwin
Active Contributor
0 Kudos

Content server configuration will take care of the folder path.

Once you have the output type configured to archive, you don't have to worry about what are the values to be passed. When the output is triggered by the standard program, it pre-fills the required values into  toa_dara &  arc_params. You just need to pass these parameters into archive_index &  archive_parameters respectively.

Yes, these parameters and the content server configuration are the only required settings to convert Smartform output to PDF and store in content server.

Thanks,

Juwin

0 Kudos

Hi Juwin,

right now the conetent server is craeted and i am able to see it through tcode csadmin.The content server is not visible through al11.And about the archive link do we have to call soem fms to do that.i am craeting a zprogram for calling smartform.Can you please provide the steps what i have to do or what basis team has to do.I am still confused.Please provide some links or data.

Reagrds,

Sushant

Juwin
Active Contributor
0 Kudos

How is the Zprogram called? Is it through an output type?

Thanks,

Juwin

0 Kudos

i am calling the smartform though the below fm which is written in a z program.please can you provide me what to do.you can mail me in my id skddas12@gmail.com.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

 
EXPORTING

    formname          
= l_form_name

 
IMPORTING

    fm_name           
= l_fmodule

 
EXCEPTIONS

    no_form           
= 1

    no_function_module
= 2

   
OTHERS             = 3.
IF sy-subrc <> 0.

 
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

 
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


* Calling the SMARTFORM using the function module retrieved above

ls_cparam
-no_dialog = lc_error. "'X'.

ls_cparam
-preview   = space. " Suppressing the dialog box

ls_cparam
-getotf    = lc_error. "'X'.    " for print preview
* * Printer name to be used is provided in the export parameter
* * OUTPUT_OPTIONS

ls_outoptions
-tddest = lc_output. "'LP01'.

CALL FUNCTION lv_fmodule

 
EXPORTING

    control_parameters
= ls_cparam

    output_options    
= ls_outoptions

 
IMPORTING

    job_output_info   
= ls_otf_from_fm

Juwin
Active Contributor
0 Kudos

Please don't share personal information on the forum. Moderators may block you.

My reply will depend on your answer to the question:

How is the Zprogram called? Is it through an output type?

Thanks,

Juwin

0 Kudos

i didnot get what you mean by output type.I am preaparing the smartform then calling it though this fm SSF_FUNCTION_MODULE_NAME by passing the smart form name and function module gereated.when i preview the smart form it asks for output device.Yes i think by output type.

Juwin
Active Contributor
0 Kudos

No, I didn't mean output device. Please check this: https://help.sap.com/saphelp_46c/helpdata/en/c8/19884743b111d1896f0000e8322d00/frameset.htm.

Thanks,

Juwin

0 Kudos

No, the program is not called by the output type.

0 Kudos

Hi juwin,

i am creating a smart form which is called by normal program (workflow).So there is no output type configuration done through nace transaction.Could you please tell me how to upload the file n content server.

Juwin
Active Contributor
0 Kudos

Thanks Sushant for the response.

Generally these documents are loaded and attached to a business object. And whenever a person opens the business object, will be able to open the GOS toolbar and access the document from content server.

If not related to a business object, then you should be able use the function modules mentioned in my earlier post and upload the file to content server. Can you please try it once and let me know where you get stuck?

http://scn.sap.com/message/16086735#16086735

Thanks,

Juwin

0 Kudos

Hi Juwin,

I used the transaction to see the content server OAC0.the storage type is HTTP content server.Does this storage type needs to be SAP System Database and will be given a physical path in application server (eg: /usr/sap/home/..) .Does the  Category should be defined for content repository.Please answer above question.

As i found one fm in the sdn with same question as answere .So here what will be the path and where to get storage category and how to get these fields:

ls_doc-documenttype

ls_doc-documentnumber

ls_doc-documentversion

ls_doc-documentpart

      lt_files-storage_cat = 'ZDMS_AOP'.

      lt_files-checked_in = 'X'.

      lt_files-filename = wa_final-file1.

      lt_files-pathname = v_path.

      APPEND lt_files.

 

**----------------------------------------------------------------------

** Change document

**----------------------------------------------------------------------

 

      CALL FUNCTION 'CVAPI_DOC_CHECKIN'

           EXPORTING

                pf_dokar    = ls_doc-documenttype

                pf_doknr    = ls_doc-documentnumber

                pf_dokvr    = ls_doc-documentversion

                pf_doktl    = ls_doc-documentpart

           IMPORTING

                psx_message = ls_return

           TABLES

                pt_files_x  = lt_files.

Juwin
Active Contributor
0 Kudos

This is the screenshot from our system:

Repository setup:

Example Program to upload PDF to content server and get URL:

report z1 no standard page heading.

data:lv_docid    type char100,

     lv_absurl   type char1024,

     ls_comp     type scms_comp,

     lt_comp     like standard table of ls_comp,

     lt_data     type standard table of tline,

     lv_len      type i,

     lv_fm       type rs38l_fnam,

     ls_control  type ssfctrlop,

     ls_options  type ssfcompop,

     ls_sfoutput type ssfcrescl,

     lt_docs     type standard table of docs.

*Call smartform and convert to PDF data

*Get smartform function module name

call function 'SSF_FUNCTION_MODULE_NAME'

  exporting

    formname = 'ZTEC_TEST_BACK_SM'

  importing

    fm_name  = lv_fm.

ls_control-device = 'PRINTER'.

ls_options-tdnewid = ls_options-tdnoprev = ls_options-tdnoprint = ls_options-tdnoarch = ls_control-getotf = ls_control-no_dialog = abap_true.

ls_options-tddest = 'LOCL'.

*Call smartform

call function lv_fm

  exporting

    control_parameters = ls_control

    output_options     = ls_options

    user_settings      = abap_false

  importing

    job_output_info    = ls_sfoutput.

*Convert PDF from OTF

call function 'CONVERT_OTF_2_PDF'

  importing

    bin_filesize   = lv_len

  tables

    otf            = ls_sfoutput-otfdata

    doctab_archive = lt_docs

    lines          = lt_data.

ls_comp-name     = 'file.pdf'.

ls_comp-mimetype = 'application/pdf'.

ls_comp-fsize    =  lv_len.

ls_comp-compid   = 'data'.

append ls_comp to lt_comp.

*Upload data to content server

call function 'SCMS_HTTP_CREATE_TABLE'

  exporting

    crep_id       = 'ZI'

  importing

    doc_id_out    = lv_docid

  tables

    comps         = lt_comp

    data          = lt_data.

*Get the absolute URL

call function 'SCMS_URL_GENERATE'

  exporting

    command      = 'get'

    contrep      = 'ZI'

    docid        = lv_docid

  importing

    absolute_uri = lv_absurl.

*Output the URL

write:/ lv_absurl.

Now, paste this URL on a browser and you should be able to see the uploaded document

0 Kudos

Hi sushant,

thanks a lot for the code,its displaying the url but when i am opening it in browser its shwoing internet explorer cannot display the webapage.Please tell how to see whether the file is uploaded or not and why this error is coming.

Juwin
Active Contributor
0 Kudos

Can you please check

1. if the PDF file was correctly generated, may be download to desktop and see if you can open the file?

2. check the PDF file size before upload

3. make sure that you are not missing any characters while copy-pasting the url

4. check the contents of the repository by using the following URL:

http://servername:port/ContentServer/ContentServer.dll?adminContRep&operation=docIdList&contRep=ZREPOSITORY


Replace the text in red, with the values from your server.

Thanks,

Juwin

0 Kudos

When i am running the above link its showing this error: I replace the name with my repository name: ZI

http://servername:port/ContentServer/ContentServer.dll?adminContRep&operation=docIdList&contRep=ZI

when i replace the server name with my server name and port with my port no .it shows internet explorer cannot display the webpage.do i need to check some cinfiguration in host file.

Juwin
Active Contributor
0 Kudos

Please change server name and port number also on the link, as per your content server config.

If it still doesn't work, make sure your can at least archive some document through standard method. May be the content server is setup incorrectly.

Thanks

0 Kudos

yes i change the server name and port no and run the url it shows error 'internet explorer cannot display webpage.'

When i run your code and when i debug i i saw the document id is craeted but i didnt find any document in repository with that id

Do i have to do some cofiguration in my system or in the host file to run the files in the content server by the url.

Here in your code

ls_comp-name     = 'file.pdf'.

ls_comp-mimetype = 'application/pdf'.

ls_comp-fsize    =  lv_len.

ls_comp-compid   = 'data'.

append ls_comp to lt_comp.

What is this field mimetype = 'application/pdf'

and compid 'data'.where to get this values?

and what do you mean by archive some document through standard method.

Do i need to craete some documents through cvo1n tcode.

Juwin
Active Contributor
0 Kudos

mimetype = 'application/pdf'

compid  = 'data'


Please hardcode these values.


When you go into a document (order/invoice/FI document etc), through GOS toolbar, you can choose "Store business document" option to upload a document to the content server. Just make sure that the document is configured to be stored in your content server.



Thanks,

Juwin

0 Kudos

Hi Juwin,

Do i need to do some settings in the host fiel of the c drive.

Also do you know how to craete kix code in smartform.Kix code like bar code is used to hold dutch postal adress.

Regards,

Santosh

Juwin
Active Contributor
0 Kudos

Can you try accessing the link from someone else's machine? If still not successful, please check with Basis to make sure that server name and port number are correct.

For Kix code:

Can you please check out this blog?

Or else, you can simply install the KIX code font through SE73 and then just use that in your smartform character format.

Reference: KIX-code: informatie en downloaden | PostNL

Thanks,

Juwin

0 Kudos

Hi Juwin,

I downloaded the font and install it in system through se73 tcode.Then craeted a smarts styles and used that font in character format.And then i craeted a text in smartform and when i wrote this

<bc>&vg_kixcode</>.It showing error 'Do you want to delete all invalid formats'.When i activate the smartform.And when i am running the smartform the field is blank.

Also i tried craeting a bar code and use this font in that,still same erroer is coming.

can you tell me where is the problem.

Juwin
Active Contributor
0 Kudos

Invalid format issue means <bc> isn't defined in your smartstyle. Can you please verify the smartstyle assigned to the window and if <bc> tag is correct?

Thanks,

Juwin

0 Kudos

Hi Juwin,

Thanks for your help.The smartform is being uploaded into content server but the formatting of the smartform i.e font and bold are not visible in the content server.Can you please tell me.

Regards,

Santosh

Juwin
Active Contributor
0 Kudos

It may be because of the printer device type that you used to generate the PDF file. Not all printer device types support all kinds of fonts. Try to use another printer device type and see if the problem persists.

Thanks,

Juwin