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

Character Problem For SmartForms to Pdf .

Former Member
0 Likes
2,590

Hi Experts ;

my problem about smartforms . I have a custumer list. I use smartform for output. Customer list of smartform ok . Have any problem . But I convert this output to PDF . Some Characters are overlapping . My main language Türkçe(Turkish) . Characters is incorrect for struct of laguage .( smartform output has no problem but pdf output have problem )

My Code :

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.

PARAMETER: p_date LIKE sy-datum.

PARAMETER: p_rea TYPE char255.

SELECTION-SCREEN: END OF BLOCK b1.

DATA: ws_ucomm LIKE sy-ucomm.

DATA: gt_intab TYPE ZSMRT_DNM_T WITH HEADER LINE.

INITIALIZATION.

SET PF-STATUS 'GUI'.

PERFORM get_data.

AT SELECTION-SCREEN.

ws_ucomm = sy-ucomm.

CASE ws_ucomm.

WHEN '&PDF'.

PERFORM f1000_download_form.

EXIT.

WHEN '&BACK'.

LEAVE TO SCREEN 0.

EXIT.

WHEN '&EXIT'.

SET SCREEN 0.

EXIT.

WHEN '&canc'.

SET SCREEN 0.

LEAVE TO SCREEN 0.

ENDCASE.

*----


*

  • f1000_download_form

*----


*

FORM f1000_download_form.

DATA: form_name TYPE rs38l_fnam.

DATA: wa_ctrlop TYPE ssfctrlop,

wa_outopt TYPE ssfcompop.

DATA: t_otfdata TYPE ssfcrescl,

t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.

DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.

DATA: w_filesize TYPE i.

DATA: w_bin_filesize TYPE i.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZDNMSMRT'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

fm_name = form_name

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.

wa_ctrlop-getotf = 'X'.

wa_ctrlop-no_dialog = 'X'.

wa_ctrlop-DEVICE = 'I9SWIN'.

wa_outopt-tdnoprev = 'X'.

CALL FUNCTION form_name

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

control_parameters = wa_ctrlop

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

output_options = wa_outopt

user_settings = 'X'

mydate = p_date

reason = p_rea

ADRNR = '23713'

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

job_output_info = t_otfdata

  • JOB_OUTPUT_OPTIONS =

TABLES

RTAB = gt_intab[]

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

t_otf[] = t_otfdata-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 150 "132

  • ARCHIVE_INDEX = ' '

IMPORTING

bin_filesize = w_bin_filesize

TABLES

otf = t_otf

lines = t_pdf_tab

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

OTHERS = 4

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

bin_filesize = w_bin_filesize

  • CODEPAGE = ' '

filename = 'c: est.PDF'

filetype = 'BIN'

  • MODE = ' '

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • COL_SELECT = ' '

  • COL_SELECTMASK = ' '

  • NO_AUTH_CHECK = ' '

IMPORTING

filelength = w_filesize

TABLES

data_tab = t_pdf_tab

  • FIELDNAMES =

EXCEPTIONS

file_open_error = 1

file_write_error = 2

invalid_filesize = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

OTHERS = 10

.

IF sy-subrc <> 0.

MESSAGE i003(z00) WITH 'File not downloaded succesfully'.

ELSE.

MESSAGE i003(z00) WITH 'File Test.pdf downloaded succesfully '

'under C drive'.

ENDIF.

ENDFORM. " F1000_DOWNLOAD_FORM

*&----


*

*& Form GET_DATA

*&----


*

FORM GET_DATA .

SELECT kunnr belnr gjahr from bsid

INTO CORRESPONDING FIELDS OF TABLE gt_intab

WHERE bukrs = '4000' and gjahr = '2007'.

LOOP AT gt_intab.

SELECT SINGLE name1 from kna1

INTO (gt_intab-name1)

WHERE kunnr = gt_intab-kunnr.

MODIFY gt_intab INDEX sy-tabix.

ENDLOOP.

SORT gt_intab by kunnr.

ENDFORM. " GET_DATA

Regards .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,438
8 REPLIES 8
Read only

Former Member
0 Likes
1,438

Hi,

I remember facing similar problem while dealing with Serbian Characters long time ago.

Unfortunately i can not recollect the solution that we have implemented.

All i remember is, we managed to find a OSS note describing the problem and the problem was rectified as per the instructions in the OSS Note.

Try to search the OSS notes if you can find any similar ones and Good Luck.

Kind Regards

Eswar

Read only

Former Member
0 Likes
1,438

Try following logic:

DATA: lt_data TYPE TABLE OF tline,

lt_data1 TYPE TABLE OF tline,

lt_objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.

  • Convert OTF to PDF

REFRESH: lt_data.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_filesize = l_binfilesize

TABLES

otf = la_jobout-otfdata[]

lines = lt_data[]

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • Error during conversion from OTF to PDF.

ELSE.

  • Creation of the document attachment

REFRESH: lt_data1.

CALL FUNCTION 'TABLE_COMPRESS' "#EC *

TABLES

in = lt_data[]

out = lt_data1[]

EXCEPTIONS

compress_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • Error during compress operation of the data

ELSE.

REFRESH: lt_objbin.

CALL FUNCTION 'TABLE_DECOMPRESS' "#EC *

TABLES

in = lt_data1[]

out = lt_objbin[]

EXCEPTIONS

compress_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • Error during decompress operation of the data.

ENDIF.

ENDIF.

ENDIF.

Pass table lt_objbin[] to WS_DOWNLOAD function module. It should work.

Thanks

Amol Lohade

Read only

Former Member
0 Likes
1,438

hi

you can have a look at this documentation

http://help.sap.com/saphelp_nw04/helpdata/en/27/67443cc0063415e10000000a11405a/frameset.htm

hope this helps

regards

Aakash Banga

Read only

Former Member
0 Likes
1,438

thanks answers .

Firstly Eswar Rao Boddi

I can not find any note in SNOTE .

Secondly Amol Lohade

I add your code in my report You add this function when 'CONVERT_OTF' function dont work . But 'CONVERT_OTF' function work and I have any change in my output

REFRESH: lt_objbin.

CALL FUNCTION 'TABLE_DECOMPRESS' "#EC *

TABLES

in = lt_data1[]

out = lt_objbin[]

EXCEPTIONS

compress_error = 1

OTHERS = 2.

IF sy-subrc eq 0.

"Error during decompress operation of the data.

ENDIF.

aakash banga thank for answer read this link

Edited by: Turgut ÇILGI on Dec 29, 2008 10:28 AM

Read only

Former Member
0 Likes
1,439
Read only

Former Member
0 Likes
1,438

I hope this answers aren't solved.

Read only

Former Member
0 Likes
1,438

My Problem solved. I Must add this code. problem solved this part.

Thanks aakash banga

*Transfer the 132-long strings to 255-long strings

LOOP AT tline.

TRANSLATE tline USING ' ~'.

CONCATENATE gd_buffer tline INTO gd_buffer.

ENDLOOP.

TRANSLATE gd_buffer USING '~ '.

DO.

it_attach = gd_buffer.

APPEND it_attach.

SHIFT gd_buffer LEFT BY 255 PLACES.

IF gd_buffer IS INITIAL.

EXIT.

ENDIF.

ENDDO.

Read only

Former Member
0 Likes
1,438

hi,

check the patch level for EA-HR probably u have to update latest patch level for EA-HR. we had a similar problem and now it is solved.