david7
12th May 2009, 09:40
Hi,
I have been reading some threads that is related to the report's language. I think I have a different problem:
I am trying to print a PO to a device I created. How can my script know the language of the printed report?
I have noticed that PO reports can be printed in different languages depending on the PO itself or maybe the BP.
I have checked the language$ variable and it is always "2" even if the report langauge is 3.
Any ideas?
- D7
bdittmar
12th May 2009, 10:21
Hi,
I have been reading some threads that is related to the report's language. I think I have a different problem:
I am trying to print a PO to a device I created. How can my script know the language of the printed report?
I have noticed that PO reports can be printed in different languages depending on the PO itself or maybe the BP.
I have checked the language$ variable and it is always "2" even if the report langauge is 3.
Any ideas?
- D7
Hello,
Use:
brp.open.language()
--------------------------------------------------------------------------------
Syntax
long brp.open.language( string rep_name(16), string lang, string device(14), long mode )
Description
This is the same as brp.open() in most respects, except that it includes a language argument. This enables you to specify a language for the report other than the default user language.
Return values
>0 an ID for the activated report
0 report could not be activated
-1 spooler could not be opened
Context
Bshell function.
Regards
david7
12th May 2009, 10:30
Bernd,
brp.open.language prints a report. The report is already printed. my code works as a device and from there, after the report has been printed, I need to get the language of that report.
- D7
MilindV
12th May 2009, 11:07
Hi
May be, this will solve your problem.
Predefined variables (Report)
lattr.language$ R The language code of the report.
Thanks & Regards
MilindV
david7
12th May 2009, 11:13
Sorry,
I forgot to mention that I have tried that too and it is not declared in the script! I get a compilation error.
- D7
wiggum
12th May 2009, 12:27
I think the only way to get the language which was used for the report is to insert lattr.language$ into a layout of the report (before.report) so that you can read this in your script.
david7
12th May 2009, 12:44
Thanks for the reply but, there are many reports in our system. I do not want to customize them all.
Is there a way to know the report's language from the device script without editing the report?
- D7
bdittmar
12th May 2009, 14:02
Thanks for the reply but, there are many reports in our system. I do not want to customize them all.
Is there a way to know the report's language from the device script without editing the report?
- D7
Hello,
maybe this will help,
reportname with language is stored in prog.name$
e.g. tisfc0408012003 for language = 3
Regards
david7
12th May 2009, 15:30
Thanks but, the predefined varibale "prog.name$" shows the name of the device script that I am writing and no the report that was printed to the device.
- D7
george7a
14th May 2009, 09:48
If we are talking about a standard session (not customized) then there should be a logic behind choosing the language. If you can dig up the logic, you will have the language. For example, If you are printing a Purchase order, there is a field there that specifies the Language. In other cases it might pick up the BP Language...
- George
günther
14th May 2009, 16:47
Thanks but, the predefined varibale "prog.name$" shows the name of the device script that I am writing and no the report that was printed to the device.
- D7
In that case, you could try get.var(parent, "language$", my.lang) to retrieve language of the parent into your local variable my.lang. (You could even climb up the ladder with get.var(parent, "parent", parent.parent) and so on.)
Hope you don't get confused!
Günther
david7
18th May 2009, 08:19
In that case, you could try get.var(parent, "language$", my.lang) to retrieve language of the parent into your local variable my.lang. (You could even climb up the ladder with get.var(parent, "parent", parent.parent) and so on.)
Hope you don't get confused!
Günther
Thanks Gunther, but that did not work. Since the session I am printing from is in English and the select device (the parent & the grand parent). So "language$" has always returns the same result which is the language of the current user and not the language of the report.
As a workaround, I have edited some reports and put in them "lattr.language$".
- D7
günther
18th May 2009, 09:41
Oops, sorry. But I think there is still a chance:
1. In reports, the predefined variable prog.name$ contains the full name of the report starting with "r" and ending with the reports language, e.g. "2" (=english).
2. So If we are able to retrieve that prog.name$ the rest would be easy, right?
=> Could you try get.var(parent, "prog.name$", full.report.name) to retrieve it?
Günther
david7
18th May 2009, 09:48
The parent of my script is "ttstpsplclose", so, this is what will be in prog.name$.
When my process starts, the report process (r...) will be finished already. So I can not get anything from it. Every get.var will direct me to the "ttstpsplclose" and I am not sure that that process does know the language of the report.
The parent of "ttstpsplclose" (my script's grand parent) will be finished (dead) by the time my script starts.
Any other ideas?
günther
18th May 2009, 10:04
You're absolutely right; the printer driver gets started during/after ttstpclose.
Maybe a "heuristical" approach could help: The first argument of the printer driver (argv$(1)) contains the name of the spool file. So at least you could open it, read the first lines (eg. 10) and check if you find "Page:" (then it seems to be English), "Seite:" (then it seem to be German). Not perfect, but who cares?
Günther
david7
18th May 2009, 10:32
I am doning something similar right now. since not all reports have the same layouts, I am editing them first as I wrote before.
If there is a generic way to get the report language it will be much easier.
- D7
Hitesh Shah
19th May 2009, 08:24
If u set the report language in the resport script either through free$ or procesinfo$ , u can access the same in device script . free$ is bshell instance variable and unique and no need to import / export .
david7
19th May 2009, 09:13
Thanks for the reply,
As I said earlier I am looking for a solution that won't customize all the reports.
Also as I mentioned the report process will end before my script starts.
Han Brinkman
19th May 2009, 09:30
Am I correct if I assume that you would like to know in your PROGRAM script what the report language will be?
Perhaps you can explain us why you need it, what are you trying to solve?
Regards,
Han
david7
19th May 2009, 09:35
I will try to make it easy and give you a simple example.
I am archiving the report via this script that I wrote as a device. I want to have a directory for every language. For example the german reports should be in "Z:\GER" and the english ones should be in "Z:\ENG".
As I said this is only part of the script. It does other things (that also depends on the language) to the report before archiving.
I hope this explains it better.
- D7
Hitesh Shah
19th May 2009, 10:21
U may check last printed report for the user in ttaad320 (or maybe with spool.id variable if accessible) . The language in ttaad320 probably is the report language . I could not test due to lack of other language reports .
david7
19th May 2009, 10:30
I have checked that already, and the language field is always empty! other fields are good.
david7
5th August 2009, 17:27
Does anyone know why is the language field in the device queue table (ttaad320.clan) is always empty?
Is there a switch somewhere that will log this variable too?
Marioth
5th August 2009, 18:13
I looked in our system and it is always filled, so I think it has to do with the set up, but at the moment I don't know yet where to set it, but I will search for it or maybe somebody else has a clue.
Regards,
Mario
david7
5th August 2009, 18:24
Thanks for your reply,
Is it the language of the user who printed? or the language of the printed report?
Marioth
5th August 2009, 19:00
If I am correct it is the language of the report and not the user.
Cheers,
Mario