on 08-12-2011 3:58 PM
Hello,
I have an include text in the smartform for the position footer text: texname is invoicenumber+position, object is VBBP and id is ZR02 (our footer text id). Language is empty.
Standard language of the smartform is German.
The position in the invoice has only a German text. When I printout the smartform in English it outputs the German text (beauce English is not available).
I read about, that this i because system checks if prefered language (English output) is available, if not than in logon language and if also not the original form language is taken. So the system finds the German text and puts it on the smartform.
I don't want that handling so I implemented a little bit of code:
clear: GV_TEXT_AVAILABLE.
select single * from STXH
into ls_stxh
where
TDNAME = G_TEXT_KEY " invoice + position
AND TDOBJECT = 'VBBP'
AND TDID = 'ZR02'
AND TDSPRAS = IS_NAST-SPRAS.
if sy-subrc = 0.
gv_text_available = 'X'.
endif.
And the Include text got the condition gv_text_available IS 'X'.
So now it works and only the English text is printed (if available). But this is a bit messy to put this code befor all include-texts if I want a strict handling for texts.
Also tried to put IS_NAST-SPRAS in the language of the include text - but then also the standard logic is taken and the German text is found.
So what can I do?
Deleted...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Seems that is only possible make sure that only the desired language (wich is flexible) is printed with this code::
DATA: ls_stxh type STXH.
clear: GV_TEXT_AVAILABLE.
select single * from STXH
into ls_stxh
where
TDNAME = IS_BIL_INVOICE-HD_GEN-BIL_NUMBER
AND TDOBJECT = 'VBBK'
AND TDID = 'ZR01' "Kopf Header
AND TDSPRAS = IS_NAST-SPRAS.
if sy-subrc = 0.
gv_text_available = 'X'.
endif.
And in the include text check gv_text_available = 'X'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Denise,
You could hard code SPRAS value to meet your requirement:
clear: GV_TEXT_AVAILABLE.
select single * from STXH
into ls_stxh
where
TDNAME = G_TEXT_KEY " invoice + position
AND TDOBJECT = 'VBBP'
AND TDID = 'ZR02'
AND TDSPRAS = 'E'. " IS_NAST-SPRAS
if sy-subrc = 0.
gv_text_available = 'X'.
endif.
So the sy-subrc will not be equal to 0 if record not found and value in gv_text_available will be initial .
Hope this helps.
BR
Dep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello DeepakNandikanti,
thanks for your response, I don't want to hardcode the SPRAS-Value because sometimes we output it also in German (depending on NAST-language). My code works for my requirement.
The problem is with the Include text, if i don't have this code, the standard logic from first searches for the English text, if it doesn't find, then comes the logic with logon language or language of form (smart form standard - read it in a book). Then it finds the German text an puts in out (even if I wanted to print it in English).
So without my code, SAP tries to find the include text in another language - and this is what I didn't want - so I made my code. But I thought - there is maybe a simpler solution
Hi,
Did you try with STANDARD TEXT's ?
Give a try with below:
Example:
v_text1 is concatenated value of EKPO-EBELN and EKPO-EBELP.
So Text Name : &v_text1&
Text Object: EKPO
Text ID: F01
No error if no text exists: ticked
The above No error if no text exists: ticked will print if value available in logon language or gives space if value not found. If unchecked( un tick) gives a runtime error.
BR
Dep
Edited by: DeepakNandikanti on Aug 12, 2011 5:39 PM
Hello,
I checked, we have same situation in our purchase order.
Textid is F02 or F03. Object EKPO, purchase order and position concatenated for textname.
Ticked no error if text is not available.
Maintained only german text, logged on as german, orignial form language is german, print it out in English, smartform puts out the german text.
Unticking "no error if text doesn't exist" for a runtime error is not a good idea, because, if I don't have English text, I don't want to output it - but also not the German text. So I made my coding.
Here a example of our order confirmation:
German text is printed, but we print in English.
http://img4web.com/view/68KH9V
Edited by: Denise Nepraunig on Aug 12, 2011 6:08 PM
Hello, I don't use it because sometimes we output our printforms in German, Englisch, Polish, Czech and so on, so we keep it flexible - and we got the desired print language with the IS_NAST-SPRAS. So I don't set fixed languages.
What I was wondering, if i can supress the standard logic, that SAP has when text is not available in desired language (which the smartform gets by the printout-language), to stop it for searching for another language (logon language, original form language).
So I didn't find the standard solution, wrote my code to check if it is available in the desired language (IS_NAST-SPRAS), set a flag - and check this flag in the include text. This works fine, looks like I have to add this coding to every text, to be sure to only output desired language.
Hi
But the variable has to be the NAST-SPRAS of course, you don't fixe any language
That means you need to use:
&CONTROL_PARAMETERS-LANGU&
or if NAST is a parameter of your smartforms
&NAST-SPRAS&
The smartform shoudn't check a text in logon lanaguage, if CONTROL_PARAMETERS-LANGU is filled, and that should be filled just before calling smartform:
CONTROL_PARAMETERS-LANGU = NAST-SPRAS.
The language to be used are set in fm SSFRT_SET_LANGUAGES:
If you see this function module you can see the language will be used in smartforms are:
- CONTROL_PARAMETERS-LANGU (if it is empty, SY-LANGU will be used)
- Master Language (The language used to create the smartform)
That mean the smartform will try to print the text in message language, if the text doesn't exit, the smartform will try to print the text in master language.
Now if you need to print a document in English, but the text is in German, the text will be written in german because it's the master language, but it's very strange a document, has to be printed in English, has some text in German.
That mean the problem is the document has some text in an another language, not in language message
So if you want to skip the standard behavior, you can only check if the text exist in the master language and avoid to print it
Max
Max
Edited by: max bianchi on Aug 12, 2011 6:32 PM
Yes that's true Checked it with fixed parameter EN - doesn't work. Thanks for you help!
So my code is maybe a good solution.
Resolved FIXED with code
-
So I post the text from the smartforms book if anyone is interested:
+
5.5.1 Language for Form Output
When you output a form, the node names are no longer pertinent; only the
contents of the text nodes and their language-septic information are relevant.
The language for this output can come from different sources:
In many cases, the main program defines the output language. A corresponding
parameter is available for this purpose in the form interface (possibly even
with replacement languages; see Section 9.7).
If a text element is not available in the specified language or one of its
replacement languages, or if no language was specified, output control uses the
cur- rent logon language instead.
If a text element does not have an entry in this language either, the
original form language is used.
The system uses an internal language vector, in which priorities are assigned
to each available language in the system. If a text is not available in the
highest-priority language, the system automatically searches for the language
with the next-highest priority. The same language vector procedure is also used
for text nodes that are used to include text modules. Therefore, make sure that
the text modules you use are also available in the required language(s).
You can only assign the output language as a custom node attribute for include
texts. If no language is specified, the language vector is processed as usual,
which means the specification from the interface has the highest priority.
+
Edited by: Denise Nepraunig on Aug 12, 2011 6:34 PM
Hallo max,
thanks for your detailed answer. This is just what I thougt about "language dermination".
The document is maybe strange, but we are a German speaking company - use the system in german, standard language of our smartforms is German, maintained material master texts in German and "somtimes" English, made a sales document for a intern rollout in USA, picked a material with only German text, printed the document out and wondered why it printed the German version when English text doesn't exist
But now I now in detail why and how to handle this SAP-logic. Thanks all!
Hi
I understand you, but I believe the language to be used depends on the business and not technical issue.
That means the language depends on agreement with partner where the print has to be sent.
I know it's not possible to create prints in all languages but only in the main ones, but if it decides a print has to be in English for a certain partner, all texts should be in English too,
That means the text should be corrected in the document, not in the smartform.
But this is my opinion of course
Max
Fyi:
For standard text, if you don't want the other languages to be used, the following can be done:
global variable:
GS_DEF_LANG | TYPE | SSFRLANG |
Before the include text, add following code:
"remove default language because smartform uses this
"for the standard text, but we only want to use the language we set
FIELD-SYMBOLS <s_def_lang> TYPE ssfrlang.
ASSIGN ('%LANGUAGES') TO <s_def_lang>.
gs_def_lang = <s_def_lang>.
CLEAR <s_def_lang>.
After include text, add following code:
"set back default language
FIELD-SYMBOLS <s_def_lang> TYPE ssfrlang.
ASSIGN ('%LANGUAGES') TO <s_def_lang>.
<s_def_lang> = gs_def_lang .
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.