Strings table in SQR
FAQ:
Ans)
Strings table is a application data table which stores the labels(PS_STRINGS_TBL)
.It is one of the common techniques many of the delivered programs employ to
take advantage of allocating labels without hard coding.
2) What is the use of strings table ?
Ans) It will store all the label
information which can be printed on the SQR report .
Ø
Report headings (like pay011,pay212,PeopleSoft, ABC Bank…)
Ø
Column names (Emplid, DeptId, Firstname,
Lastname….)
Ans) Go to the following navigation
Main Menu -> PeopleTools ->
Utilities -> Administration ->Strings Table
It contains following fields
PROGRAM_ID , STRING_ID , LABEL_ID ,
DEFAULT_LABEL, STR_LBL_TYPE, STRING_TEXT,
COL_WIDTH
Ans) To take advantage of strings table do the
following steps
> Incorporate the following SQC’S into your
program
SQRTRANS.SQC, GETRPLNG.SQC, PRCSLNG.SQC (Which will be called internally
in PRCSAPI.SQC No need to include if your program is getting run through
process scheduler i.e already included STDAPI.SQC)
> Inside this SQRTRANS.SQC we are having different procedures .Only the following can
be called out side of this sqc they are
>
Init_Report_Translation ($Report_ID,
$Report_Language)
> Get_Field_Information ($Report_ID, $Field_ID,
:$Field_Text, :#Field_Width)
> Append_Report_Translation ($Report_ID)
> Add_Report_Translation($Report_ID,
$Report_Language)
All the procedure parameters are equal to the fields in strings
table i.e
Strings Table Fields
|
Procedure parameters
|
PROGRAM_ID
|
$Report_ID
|
STRING_ID
|
:$Field_Text
|
STRING_TEXT
|
:$Field_Text
|
COL_WIDTH
|
:#Field_Width
|
$Report_Language Is coded as
$Language_Cd , Which
gets the data from GETRPLNG.SQC
It indicates the Language code ex : ENG
( for more info on this see GETRPTLNG.SQC, PRCSLNG.SQC)
Finally
the coding looks like the following way
Example :
Observe the following coding from one of the
delivered SQR (pay010.sqr)
begin-procedure Report-Translation
! Read from PAY010 and PAY1
program ids
do
Init_Report_Translation($ReportID,$language_cd)
do
Append_Report_Translation('PAY1')
do
Append_Report_Translation('HR')
do Get_Field_Information
('PAY010', 'REPORT_TITLE', $Pay010_ReportTitle, #dummy_width)
do Get_Field_Information
('PAY010', 'REG',
$Pay010_Reg,
#dummy_width)
do Get_Field_Information
('PAY010', 'OVR',
$Pay010_Ovr, #dummy_width)
do Get_Field_Information
('PAY010', 'OTH',
$Pay010_Oth,
#dummy_width)
do Get_Field_Information
('PAY010', 'EMP_NM',
$Pay010_Emp_Nm,
#dummy_width)
do Get_Field_Information
('PAY010', 'EMP_ID', $Pay010_Emp_Id, #dummy_width)
do Get_Field_Information
('PAY010', 'DEPT_ID',
$Pay010_Dept_Id,
#dummy_width)
do Get_Field_Information
('PAY010', 'PG_LN_ADL',
$Pay010_Pg_Ln_Adl,
#dummy_width)
do Get_Field_Information
('PAY010', 'HOURS', $Pay010_Hours, #dummy_width)
do Get_Field_Information
('PAY010', 'ERNS',
$Pay010_Erns,
#dummy_width)
do Get_Field_Information
('PAY010', 'TYPE',
$Pay010_Type,
#dummy_width)
do Get_Field_Information
('PAY010', 'NO_DATATXT',
$Pay010_No_DataTxt,
#dummy_width)
do Get_Field_Information
('PAY1', 'GR_TOT', $Pay1_Gr_Tot, #dummy_width)
do Get_Field_Information
('PAY1', 'CMP_TOT', $Pay1_Cmp_Tot, #dummy_width)
do Get_Field_Information
('PAY1', 'PAYPER_TOT', $Pay1_PayPer_Tot, #dummy_width)
do Get_Field_Information
('PAY1', 'PAYGRP_TOT', $Pay1_PayGrp_Tot, #dummy_width)
do Get_Field_Information
('HR', 'BUS_UNIT1', $HR_Bus_Unit1, #dummy_width)
do Get_Field_Information
('HR', 'BUS_UNIT2', $HR_Bus_Unit2, #dummy_width)
end-procedure
|
Here Report-Translation is initiated in GETRPLNG.SQC
, Inside this procedure we can see the using of Init_Report_Translation
, Append_Report_Translation , Get_Field_Information
do
Init_Report_Translation($ReportID,$language_cd) (Initiated in SSQRTRANS.SQC)
Here $ReportId is
written in the code like the following
move
'PAY010' to $ReportID
|
$language_cd ,
Finally gets the value of ENG
$language_cd is fetches language
dependent language information from PRCSLNG.SQC
If our SQR has to get values from more than 1 program id then need to supply the name of program id in the following procedure
If our SQR has to get values from more than 1 program id then need to supply the name of program id in the following procedure
do Append_Report_Translation('PAY1') (Initiated in SSQRTRANS.SQC)
Here PAY1 is $ReportID
do
Append_Report_Translation('HR')
(Initiated in SSQRTRANS.SQC)
Here HR is $ReportID
do Get_Field_Information
('PAY010', 'REPORT_TITLE', $Pay010_ReportTitle, #dummy_width) (Initiated
in SSQRTRANS.SQC)
It is the main procedure which fetches the data from
PS_STRINGS_TBL and stores in the $Field_Text. To know what exactly was stored
in the $Field_Text i.e in the $Pay010_ReportTitle use
the following sql
SELECT STRING_TEXT FROM
PS_STRINGS_TBL WHERE PROGRAM_ID = 'PAY010' AND STRING_ID ='REPORT_TITLE';
|
It is common for all
, where ever you find
GET_FIELD_INFORMATION
In the above SQL statement the result will be stored in $Pay010_ReportTitle and
it can be further used in PRINT statement to print the label the result is
Employees Not Processed in Current Payroll
|
Take an another Get_Field_Information procedure parameters
do
Get_Field_Information ('PAY010', 'OVR',
$Pay010_Ovr, #dummy_width)
Apply the same SQL statement listed above result will be
SELECT STRING_TEXT FROM
PS_STRINGS_TBL WHERE PROGRAM_ID = 'PAY010' AND STRING_ID ='OVR';
<- OVERTIME ->
|
Now $PAY010_REPORTTITLE , $PAY010_OVR will be hardcoded in a
print statement in the following way
move $Pay010_ReportTitle to
$ReportTitle
print $Pay010_Ovr (0,127)
|
These can be printed on SQR report in the label section .
Advantages :
Ø
No need to hard code label names in directly in
coding. If any kind of changes has to be done in the headings ,Directly can log-in to PIA can modify there
. Automatically same changes will appear in SQR report
Ø
This is one of the techniques almost all every
delivered program employs
No comments:
Post a Comment