cancel
Showing results for 
Search instead for 
Did you mean: 

Chinese Characters Printing as Boxes in SAPscript

Former Member
0 Kudos

Issue...why would a Chinese standard text print fine using the "INCLUDE" method, but output as boxes when that same Chinese standard text is retrieved successfully using the "PERFORM" method?

Summary...I am currently experiencing problems printing Chinese characters on a custom SAP Script form. This does not appear to be an issue with printer setup or font selection, as I am able to get the Chinese characters to appear depending on the method I use. The problem occurs when I execute a "PERFORM" within the SAP script to retrieve the Chinese standard text, the results are displayed as boxes. If I "INCLUDE" the standard text directly within the SAP script, the Chinese standard text prints without issue. I have executed the SAP script in debug mode and the Chinese text is being retrieved from the "PERFORM" statement as expected, but just does not display correctly as it does by using the "INCLUDE" approach. I'm trying to understand why the two approaches would not both work in the same manner. We are on a UNICODE system.

Though we may be able to use the "INCLUDE" method in a majority of places, we are interested in using the function "ADDRESS_INTO_PRINTFORM" for printing addresses. This would require passing values back to the SAP script line by line.

Below is a simplified version of the two methods...

(PRINTS CHINESE CHARACTERS AS EXPECTED)

INCLUDE 'ZADDRESS_LINE1' OBJECT 'TEXT' ID 'ST' LANGUAGE &NAST-SPRAS& PARAGRAPH IG

(RESULTS IN BOXES BEING PRINTED)

PERFROM GET_TEXT IN PROGRAM ZGET_CHINESE_TEXT

USING &NAST-SPRAS&

CHANGING &ADDRESS_LINE1&

ENDPERFORM.

&ADDRESS_LINE1&

(&ADDRESS_LINE1& contains Chinese characters as expected when debugging SAP script)

FORM GET_TEXT TABLE PT_IN STRUCTURE ITCSY

PT_OUT STRUCTURE ITCSY

...

...USE FUNCTION 'READ_TEXT' TO RETRIEVE CHINESE TEXT FROM ZADDRESS_LINE1 STANDARD TEXT (works as expected)

...

read table pt_out index 1.

move ADDRESS_LINE1 to pt_out-value.

modify pt_out index 1.

(PT_OUT table is populated with chinese text as expected)

ENDFORM.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Problem solved...Form language was being pulled from the vendor. The vendor we originally were using for our test PO was set-up for English and this was causing the EN version of the form to be called. Once the vendor was changed to a "ZH" vendor, the "ZH" version of the form was called and all Chinese characters are displaying as expected, regardless of using the "INCLUDE" or "PERFORM" method.

Thanks for all the assistance.

Former Member
0 Kudos

HI,

Can you please Tell be in which language you are printing the Text "NAST-SPRAS" should be Chineese Lang.

Former Member
0 Kudos

Language for form is 'ZH'.

To clarify the original post, the standard text is being retrieved correctly for both methods. By this I mean that during debugging of the SAP script I can see the Chinese text as expected for both methods. However, during print preview only the "INCLUDE" method displays correctly. I have both methods included in my current script for the same standard text and the "INCLUDE" displays fine, but not the "PERFORM" method.

Does the "CHANGING" parameter which is populated by the "PERFORM" need to be defined in a particular way? Might there an issue with the TDSYMVALUE type that is used for storing the values retrieved from the "PERFORM"?

Sandra_Rossi
Active Contributor
0 Kudos

Is it possible that the INCLUDE adds in the OTF a CP command corresponding to the language, while there is no possibility with any other code?

Below added by: Sandra Rossi on Feb 10, 2010 5:55 PM

This may interest you: Note 887455 - Incorrect characters in PDF documents on UNICODE systems

Former Member
0 Kudos

It does appear that a CP command is inserted in the OTF log for both methods. If the text uses the "INCLUDE" method a "CP 410200001" preceeds the text. If the text uses the "PERFORM" method, a "CP 41020000E" preceeds the text. I'm assuming the last digit pertains to the language key (1 = Chinese, E = English). It does appear that the English version of the form is being called in this instance possible causing the "CP 41020000E" command to be used when NOT using the "INCLUDE" method.

I created a copy of the form with the "ZH" language key. Any ideas how I persuade it to call the Chinese version of the form? I'm just making a guess that that form language key is contolling which CP command to use.

Sandra_Rossi
Active Contributor
0 Kudos

Nice findings, thx.

You may pass the language using LANGUAGE parameter in OPEN_FORM function module.

I found in subroutine CONV_SET_LANG_ENV of program RSTXCPDF (I assume it's called during PDF conversion, but I can't be sure) that when the language (9th character of CP OTF command) is English, SAP uses internally code page 1133 (its text mentions "pure iso-8859-1"), but if it is set to Chinese, it uses code page 4102 (Unicode). Again, this is an assumption.

I couldn't find any documentation about that, but I guess it probably exists.