cancel
Showing results for 
Search instead for 
Did you mean: 

Print translated SAP SCRIPT depending on WERKS

enrico_andreoli
Participant
0 Kudos

Hi All,

I've translated a SAP SCRIPT (production order - CO02/CO03) from Italian to Serbian using SE76.

I need to print in IT (italian) or in SH (serbian) depending on the WERKS of the production order (1100 -> IT, 2000 -> SH). I can't use system language 'cause users may log on in IT, SH or EN depending on what they prefers.

I read in other discussions about the FM OPEN_FORM; at the moment i have this setup:

call function 'OPEN_FORM'

     exporting

       device   = 'PRINTER'

       dialog   = space

       form     = print_co-forml

       language = print_co-spras

       options  = print_opts

     exceptions

       canceled = 01

       device   = 02

       form     = 03

       options  = 04

       unclosed = 05.

   call function 'START_FORM'

     exporting

       startpage = startpage.


How can I do this?

Accepted Solutions (1)

Accepted Solutions (1)

former_member1161170
Participant
0 Kudos

I can't uderstand: do you change the language parameter and it doesn't work?

Is this the problem?

Once I remember I did it and it worked.

(but I don't remember where, i'll try to looking for it)

enrico_andreoli
Participant
0 Kudos

No, I don't know how to change it. At the moment print is controlled by system language:

log in in Italian --> print italian

log in in english --> print in english

log in in serbian --> print in serbian

Print language may change depending on the production order werks (2000, serbian - 1100 italian).

former_member1161170
Participant
0 Kudos

Do you mean this?

DATA: f_langu TYPE SY-LANGU.

[...]

IF f_werks = '2000'.

     f_langu = 'SR'.

ELSEIF f_werks = '1100'. " or simplest "ELSE"

     f_langu = 'IT'.

ENDIF.

call function 'OPEN_FORM'

     exporting

       device   = 'PRINTER'

       dialog   = space

       form     = print_co-forml

       language = f_langu

       options  = print_opts

     exceptions

       canceled = 01

       device   = 02

       form     = 03

       options  = 04

       unclosed = 05.

   call function 'START_FORM'

     exporting

  startpage = startpage.

Message was edited by: Massimiliano Beghini I did a mistake with the "else" option.

enrico_andreoli
Participant
0 Kudos

I saw that language at the moment is taken from table PRINT_CO (filed SPRAS) but it a Char 1 so I can't use IT, EN or SH (serbian). I saw that IT is converted in I, English in E..so..maybe SH is S? I don't know why but the OPEN_FORM language parameter is long only 1 char, so I have to discover how SH is translated in "1 char syntax". Any idea?

former_member1161170
Participant
0 Kudos

The parameter type which you can use is must be the same of the function parameter.

If you look into the OPEN_FORM you can see the type SY-LANGU for the parameter language.

Try to look inside by SE37 at the first tag: you can see all the parameters types.

By SE37 try to push the F8 button (or by menu: "test function module"). You'll get the input fields about all the parameters: the language fields is 2 characters long.

I don't know about serbian language value (SH? SR?), but if you log in in serbian and test the function by SE37, you can see the default value in the language field.

Or, if you prefer, you can put a brekpoint in you report on the "CALL 'OPEN_FORM'" so during the execution you can see the real value used (always logging in in serbian).

enrico_andreoli
Participant
0 Kudos

Thanks Massimiliano,

I solved my problem declaring a new variable:

DATA: v_lang LIKE print_co-spras.

Then, just before the open form, I made a CASE:

CASE afpod_p-pwerk.       "check the WERK field of AFPO

         WHEN '1100'.

           v_lang = 'I'.           "1100 = italian

         WHEN '2000'.

           v_lang = 'd'.          "2000 = serbian

         WHEN OTHERS.

           v_lang = 'I'.           "others value = italian

       ENDCASE.


Then, in the CALL FUNCTION I canged the old language = print_co-spras with the new co-spras.


I found the transcoding of all the languages in table T002.

Answers (0)