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

XSTRING to PDF

Former Member
0 Likes
5,634

Hi,

I'm using FM CONVERT_OTF to convert the OTF Data out of a smartform to XSTRING format.

Any idea about how to convert the XSTRING obtained to PDF? I tried the cl_http_response method, but it doesn't work. I'm on 4.6C, and the OO Methods work only on 4.7.

Any pointers would be helpful.

Are there any parameters in the smartform which will help me achieve this?

Regards,

Vijay

15 REPLIES 15
Read only

Former Member
0 Likes
3,435

Hi,

Is there any purpose for converting the OTF format to XSTRING?

As you can directly convert OTF to PDF using CONVERT_OTF_2_PDF function module.

Read only

Former Member
0 Likes
3,435

Hi Vijay,

I agree with Lavanya. Why do you need to convert to XSTRING.? Can you specify it clearly...?

Regards,

SP.

Read only

0 Likes
3,435

Ya there's a reason. The XSTRING format is going to be further used by Enterprise Portal EP. The EP can't convert OTF Format to PDF through browser. So the XSTRING is required, which is further passed onto the portal XSTRING conversion function, and then it should be converted to PDF. So can anybody shed some light on this? Has anybody converted XSTRINGs successfully to PDFs.

To be more specific, the problem occurs only when there are tables and templates, and any sort of figures, other than plain text in the smartform. Otherwise plain text alone gets converted properly to PDFs through XSTRINGs. Is it that XSTRINGs can't handle graphics like tables and tempaltes?

Regards,

Vijay

Message was edited by: vijay srikanth

Message was edited by: vijay srikanth

Read only

venkat_o
Active Contributor
0 Likes
3,435
Read only

Former Member
0 Likes
3,435

Hi Venkat,

That is just Smartform SAP Help.

Regards,

Vijay

Message was edited by: vijay srikanth

Read only

0 Likes
3,435

Ok i dont have 4.6C to check that out.

(your reference of cl_http_response class makes me think you may be in atleast 4.7)

anyhow since you have the xstring (PDF page) , do you want to save it as a pdf file in your local system?

if yes use gui_download to download the same.

here are the steps.

first convert the xstring to a binary table by calling FM

SCMS_XSTRING_TO_BINARY

(for the binary tab parameter the itab declaration should be as follows.

data: begin of int_tab1 occurs 0,

int_txt(300) type x,

end of int_tab1.

)

now use gui_download with file type 'BIN' filename with extension .pdf

and pass the table returned from SCMS_XSTRING_TO_BINARY.

Regards

Raja

Read only

Former Member
0 Likes
3,435

Hi DuraiRaj,

Unfortunately I'm not in 4.7. I'm in 4.6C this FM doesn't exist here.

Regards,

Vijay

Read only

Former Member
0 Likes
3,435

Hi Vijay,

Check this SMARTFORM to PDF

http://www.sap4.com/wiki/index.php/Genera_PDF_a_partir_de_Smartforms

also check this BLOG

/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp

Regards

vijay

Read only

0 Likes
3,435

as i said i dont have access to 4.6 c system, so you have to find a replacement for this fm SCMS_XSTRING_TO_BINARY.

this is to convert the xstring to a internal table formta.

Regards

Raja

Read only

Former Member
0 Likes
3,435

Is the XSTRING format same as XSFFORMAT - an output of the smartform.

Regards,

Vijay

Message was edited by: vijay srikanth

Read only

Former Member
0 Likes
3,435

To be more specific, the problem occurs only when there are tables and templates, and any sort of figures, other than plain text in the smartform. Otherwise plain text alone gets converted properly to PDFs through XSTRINGs. Is it that XSTRINGs can't handle graphics like tables and tempaltes

Regards,

Vijay

Message was edited by: vijay srikanth

Read only

athavanraja
Active Contributor
0 Likes
3,435

are you sure its XSTRING. to my knowledge 4.6c dosent have data type XSTRING

Regards

Raja

Read only

0 Likes
3,435

It has XSTRING is a predefined data type in 4.6C.

Read only

Former Member
0 Likes
3,435

Use the below Code, this will help you to convert into pdf as a spool


CALL FUNCTION 'ADS_SR_OPEN'

       EXPORTING

         copies           = 1

         dest              = 'ZPDI'

         doctype         = 'ADSP'

       IMPORTING

         handle           = l_handle

         spoolid          = l_spoolid

         partname       = l_partname

       EXCEPTIONS

         device_missing   = 1

         no_such_device   = 2

         operation_failed = 3

         wrong_doctype    = 4

         wrong_devicetype = 5

         OTHERS           = 6.

     IF sy-subrc = 0.

       CALL FUNCTION 'ADS_GET_PATH'

         IMPORTING

           ads_path = l_globaldir.

       CONCATENATE l_globaldir '/' l_partname '.pdf'

              INTO l_filename.

       OPEN DATASET l_filename FOR OUTPUT IN BINARY MODE.

        "Pass the XSTRING value here.

       TRANSFER l_xstring TO l_filename.

       CLOSE DATASET l_filename.

       l_filesize = xstrlen( l_xstring ).

       CALL FUNCTION 'ADS_SR_CONFIRM'

         EXPORTING

           handle   = l_handle

           partname = l_partname

           size     = l_filesize

           no_pdf   = ' '

         EXCEPTIONS

           OTHERS   = 1.

       IF sy-subrc NE 0.

         RETURN.

       ENDIF.

* Close the spool request

       CALL FUNCTION 'ADS_SR_CLOSE'

         EXPORTING

           handle = l_handle

         EXCEPTIONS

           OTHERS = 1.



Thanks,

Jegadeesh

Read only

Former Member
0 Likes
3,435