Tuesday 10 January 2012

xml publiesher


RTF Template- PageBreak


Insert definite space in RTF template
Use below syntax in Tag to insert space before or after in your template. As point increases, space also get increased.
(xsl:attribute name='space-before')100pt(/xsl:attribute)
(xsl:attribute name='space-after')100pt(/xsl:attribute)


Inserting pagebreak
1) Below is the simple syntax to add pagebreak
(?split-by-page-break:?)

2) We can also use below syntax for before and after
(xsl:attribute name="break-before")page(/xsl:attribute)
(xsl:attribute name="break-after")page(/xsl:attribute)
3) Conditional pagebreak, use below syntax. Here we are inserting page-break if value of variable no_of_lines_per_page is equal to total records in loop inner_group. Variable is always referred by $ in XSL
(xsl:if xdofo:ctx="inblock" test="$no_of_lines_per_page=count($inner_group)")(xsl:attribute name="break-before")page(/xsl:attribute) (/xsl:if)
Note: Replace symbol '(' with '<' and ')' with '>' in all above xml/xsl syntax

RTF Template- Signature Printing


Fixed Signature
If you have fixed logo or signature to print in RTF template, then perform below steps
1) Copy file in .gif format to $OA_MEDIA path at Application Server
2) Insert picture in RTF template and add below text in Web Tab
url:{'${OA_MEDIA}/MAB_NEW.gif'}

Dynamic Signature
If you want to print signature based on Tag value in RTF template, then perform below steps
1) Copy file in .gif format to $OA_MEDIA path at Application Server
2) File name must be same as Tag value. For example, if tag value is Amit, then your file name should be Amit.gif
3) Finally, Insert picture in RTF template and add below text in Web Tab
url:{concat('$[OA_MEDIA]/',.//PO_NUMBER)}

RTF Template- Variables

Define Constant Variable
This variable remains constant for entire file
(xsl:variable name="no_of_lines_per_page" select="number(15)"/)

Assigning Group/Repeating Frame to Variable
(xsl:variable xdofo:ctx="incontext" name="inner_group" select=".//DocumentPayable"/)
Here DocumentPayable is a Group which is assigned to variable inner_group. So we can loop through this variable as below
(?for-each:$inner_group?)
Here you can also get total records in a group anytime using count($inner_group)

Incrementing Variable in Loop
Declare variable before loop and increment it inside loop as below
(?xdoxslt:set_variable($_XDOCTX, ‘counter’, 0)?)
(?for-each:G_LINES?)
(?xdoxslt:set_variable($_XDOCTX, ‘counter’, xdoxslt:get_variable($_XDOCTX, ‘counter’) + 1)?)
(?xdoxslt:get_variable($_XDOCTX, ‘counter’)?)
(?end for-each?)

However, this variable is not referenced using $ symbol

Printing Variable Value
The "xsl:value-of" element can be used to select the value of an XML element and add it to the output

(xsl:value-of select=”$var1”/)

Note: Replace symbol '(' with '<' and ')' with '>' for starting and ending Tags above

XML File Creation Thru PL/SQL

CREATE OR REPLACE PROCEDURE gl_inter_company_trans
(retcode OUT VARCHAR2,
errbuf OUT VARCHAR2,
p_period VARCHAR2,
p_operating_unit VARCHAR2,
p_status1 VARCHAR2)
IS

CURSOR gl_detail
(p_status IN VARCHAR2,
p_period VARCHAR2,
p_operating_unit VARCHAR2)
IS
SELECT receiver, sender, transaction_number, period, entered_date,
description, note, amount, NAME, attribute10, status, gl_date,
sendor_gl_transfer, receiver_gl_transfer, CONTEXT
FROM (SELECT rsub.NAME receiver, ssub.NAME sender,
gl_.transaction_number, gl_.sender_period_name period,
gl_.entered_date, gl_.description, gl_.note,
( NVL (gl_.sender_running_total_dr, 0)
- NVL (gl_.sender_running_total_cr, 0)
) amount,
REPLACE (typ.NAME, '&', '') NAME, gl_.attribute10,
DECODE (gl_.status, 'R', 'Review', 'Approved') status,
gl_.gl_date,
DECODE (gl_.sender_transfer_flag, 'Y', 'Yes', 'No') sendor_gl_transfer,
DECODE (gl_.receiver_transfer_flag, 'Y', 'Yes', 'No') receiver_gl_transfer,
gl_.CONTEXT
FROM gl.gl_iea_transactions gl_,
gl.gl_iea_transaction_types typ,
gl.gl_iea_subsidiaries ssub,
gl.gl_iea_subsidiaries rsub
WHERE typ.transaction_type_id = gl_.transaction_type_id
AND ssub.subsidiary_id = gl_.sending_subsidiary_id
AND rsub.subsidiary_id = gl_.receiving_subsidiary_id
AND gl_.status = 'R'
AND gl_.status = NVL (p_status, gl_.status)
AND gl_.sender_period_name = NVL (p_period, gl_.sender_period_name)
AND ( ssub.NAME = NVL (p_operating_unit, ssub.NAME)
OR rsub.NAME = NVL (p_operating_unit, rsub.NAME)));

p_status VARCHAR2 (100);
v_transaction_num_prev VARCHAR2 (50) := '00000';
v_transaction_num_curr VARCHAR2 (50) := '11111';

BEGIN

BEGIN
IF p_status1 = 'Approved'
THEN
p_status := 'A';
ELSIF p_status1 = 'Review'
THEN
p_status := 'R';
ELSIF p_status1 = 'ALL'
THEN
p_status := NULL;
END IF;
END;

fnd_file.put_line (fnd_file.output, '(?xml version="1.0" encoding="UTF-8"?)');
fnd_file.put_line (fnd_file.output, '(Pending_Transac)'); -- Main Tag
fnd_file.put_line (fnd_file.output, '(PERIOD)' || p_period || '');
fnd_file.put_line (fnd_file.output, '(OPERATING_UNIT)' || p_operating_unit || '(/OPERATING_UNIT)');
fnd_file.put_line (fnd_file.output, '(STATUS)' || p_status1 || '(/STATUS)');

FOR rec_gl_detail IN gl_detail (p_status, p_period, p_operating_unit)
LOOP
v_transaction_num_curr := rec_gl_detail.transaction_number;
IF p_operating_unit IS NOT NULL
THEN
fnd_file.put_line (fnd_file.output, '(G_GL_DETAIL)'); -- Masters tag
fnd_file.put_line (fnd_file.output, '(STATUS)' || rec_gl_detail.status || '(/STATUS)');
fnd_file.put_line (fnd_file.output, '(TRANSACTION_NUMBER)' || rec_gl_detail.transaction_number
'(/TRANSACTION_NUMBER)
');
fnd_file.put_line (fnd_file.output, '(ENTERED_DATE)' || rec_gl_detail.entered_date ||
'(/ENTERED_DATE)
');
fnd_file.put_line (fnd_file.output, '(GL_DATE)' || rec_gl_detail.gl_date || '(/GL_DATE)');
fnd_file.put_line (fnd_file.output, '(PERIOD)' || rec_gl_detail.period || '(/PERIOD)');
fnd_file.put_line (fnd_file.output, '(NAME)' || rec_gl_detail.NAME || '(/NAME)');
fnd_file.put_line (fnd_file.output, '(SENDER)'  || rec_gl_detail.sender || '(/SENDER)');
fnd_file.put_line (fnd_file.output, '(SENDOR_GL_TRANSFER)' || rec_gl_detail.sendor_gl_transfer ||
'(/SENDOR_GL_TRANSFER)
');
fnd_file.put_line (fnd_file.output, '(RECEIVER)' || rec_gl_detail.receiver || '(/RECEIVER)');
fnd_file.put_line (fnd_file.output, '(RECEIVER_GL_TRANSFER)' || rec_gl_detail.receiver_gl_transfer ||
'(/RECEIVER_GL_TRANSFER)
');
fnd_file.put_line (fnd_file.output, '(AMOUNT)' || rec_gl_detail.amount || '(/AMOUNT)');
fnd_file.put_line (fnd_file.output, '(DESCRIPTION)' || rec_gl_detail.description || '(/DESCRIPTION)');
fnd_file.put_line (fnd_file.output, '(NOTE)' || rec_gl_detail.note || '(/NOTE)');
fnd_file.put_line (fnd_file.output, '(ATTRIBUTE10)' || rec_gl_detail.attribute10 || '(/ATTRIBUTE10)');
fnd_file.put_line (fnd_file.output, '(CONTEXT)' || rec_gl_detail.CONTEXT || '(/CONTEXT)');
fnd_file.put_line (fnd_file.output, '(/G_GL_DETAIL)
');

ELSIF p_operating_unit IS NULL
THEN

IF ( ( v_transaction_num_curr <> v_transaction_num_prev
AND rec_gl_detail.status = 'Approved')
OR rec_gl_detail.status = 'Review')
THEN
fnd_file.put_line (fnd_file.output, '(G_GL_DETAIL)'); -- Masters tag
fnd_file.put_line (fnd_file.output, '(STATUS)' || rec_gl_detail.status || '(/STATUS)');
fnd_file.put_line (fnd_file.output, '(TRANSACTION_NUMBER)' || rec_gl_detail.transaction_number ||
'(/TRANSACTION_NUMBER)');
fnd_file.put_line (fnd_file.output, '(ENTERED_DATE)' || rec_gl_detail.entered_date ||
'(/ENTERED_DATE)');
fnd_file.put_line (fnd_file.output, '(GL_DATE)' || rec_gl_detail.gl_date || '(/GL_DATE)');
fnd_file.put_line (fnd_file.output, '(PERIOD)' || rec_gl_detail.period || '(/PERIOD)');
fnd_file.put_line (fnd_file.output, '(NAME)' || rec_gl_detail.NAME || '(/NAME)');
fnd_file.put_line (fnd_file.output, '(SENDER)' || rec_gl_detail.sender || '(/SENDER)');
fnd_file.put_line (fnd_file.output, '(SENDOR_GL_TRANSFER)' || rec_gl_detail.sendor_gl_transfer ||
'(/SENDOR_GL_TRANSFER)');
fnd_file.put_line (fnd_file.output, '(RECEIVER)' || rec_gl_detail.receiver || '(/RECEIVER)');
fnd_file.put_line (fnd_file.output, '(RECEIVER_GL_TRANSFER)' || rec_gl_detail.receiver_gl_transfer ||
'(/RECEIVER_GL_TRANSFER)');
fnd_file.put_line (fnd_file.output, '(AMOUNT)' || rec_gl_detail.amount || '(/AMOUNT)');
fnd_file.put_line (fnd_file.output, '(DESCRIPTION)' || rec_gl_detail.description || '(/DESCRIPTION)');
fnd_file.put_line (fnd_file.output, '(NOTE)' || rec_gl_detail.note || '(/NOTE)');
fnd_file.put_line (fnd_file.output, '(ATTRIBUTE10)' || rec_gl_detail.attribute10 || '(/ATTRIBUTE10)');
fnd_file.put_line (fnd_file.output, '(CONTEXT)' || rec_gl_detail.CONTEXT || '(/CONTEXT)');
fnd_file.put_line (fnd_file.output, '(/G_GL_DETAIL)');
END IF;

v_transaction_num_prev := v_transaction_num_curr;

END IF;
END LOOP;

fnd_file.put_line (fnd_file.output, '(/Pending_Transac)
'); -- End Main Tag

EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.LOG, 'Entered into Exception');
END gl_inter_company_trans;

Note: Replace symbol '(' with '<' and ')' with '>' in all above xml Tags

How to find OPP log file?

To investigate on XML issues or other publishing problems, often the OPP logfile is needed.
OPP stands for Output Post Processor. Below are the steps to find log file

1. Login to the application as SYSADMIN

2. Responsibility: System Administrator

3. Function: Concurrent --> Manager --> Administration

4. Select the Output Post Processor

5. Click on the Processes button

6. Select the Concurrent Process which was active during the time that the request ran

7. Click on the Manager Log button to open the Output Post Processor log file

RTF Template- PageBreak


Insert definite space in RTF template
Use below syntax in Tag to insert space before or after in your template. As point increases, space also get increased.
(xsl:attribute name='space-before')100pt(/xsl:attribute)
(xsl:attribute name='space-after')100pt(/xsl:attribute)


Inserting pagebreak
1) Below is the simple syntax to add pagebreak
(?split-by-page-break:?)

2) We can also use below syntax for before and after
(xsl:attribute name="break-before")page(/xsl:attribute)
(xsl:attribute name="break-after")page(/xsl:attribute)
3) Conditional pagebreak, use below syntax. Here we are inserting page-break if value of variable no_of_lines_per_page is equal to total records in loop inner_group. Variable is always referred by $ in XSL
(xsl:if xdofo:ctx="inblock" test="$no_of_lines_per_page=count($inner_group)")(xsl:attribute name="break-before")page(/xsl:attribute) (/xsl:if)
Note: Replace symbol '(' with '<' and ')' with '>' in all above xml/xsl syntax

RTF Template- IF Conditions

You can use IF condition directly or using xdofx in RTF Template. Below are few examples
(?xdofx:if LENGTH(/XXBRPRPOP/LIST_G_INIT_INFO/G_INIT_INFO/LIST_G_HEADERS/G_HEADERS/POH_CUSTOMER)=0 THEN 'DELIVER TO:'POD_REQUESTOR_NAME'('POD_QUANTITY_ORDERED')' END IF?)


(?xdofx:if LENGTH(/XXBRPRPOP/LIST_G_INIT_INFO/G_INIT_INFO/LIST_G_HEADERS/G_HEADERS/POH_CUSTOMER) !=0 AND(/XXBRPRPOP/LIST_G_INIT_INFO/G_INIT_INFO/LIST_G_HEADERS/G_HEADERS/POH_CUSTOMER)!=POD_REQUESTOR_NAME THEN 'DELIVER TO:'POD_REQUESTOR_NAME'('POD_QUANTITY_ORDERED')' END IF?)


(?if:string-length(/XXBRPRPOP/LIST_G_INIT_INFO/G_INIT_INFO/LIST_G_HEADERS/G_HEADERS/LIST_G_CANCEL_RELEASE/CANCEL_RELEASE_DATE)!=0?)


(?xdofx:if AMOUNT > 1000 then ’Higher’
else
if AMOUNT < 1000 then ’Lower’
else
’Equal’
end if?>

RTF Template- Word Features

Q. How to repeat table header on each page?
Ans: Right click on first row of table header and Go to table properties and click on Row Tab. Here check the second option checkbox- Repeat as header row at the top of each page. For rest of the rows uncheck this checkbox and check first option- Allow row to break across pages

Q. How to insert tag in header/footer portion of RTF template?
Ans. Usually we are not allowed to insert tag in header/footer. But we can insert text of the tag directly in header/footer, it indirectly work as a tag in template. Eg: (?CountryName?)
Q. Not able to print tag value even after opening the loop?
Ans. Sometimes we are not able to print tag value even after properly opening and closing the loop. In such case, provide complete path for tag in form field help text.
Eg: (?/OutboundPaymentInstruction/OutboundPayment/Payee/SupplierNumber?)
Q. How to remove line border between records of a table?
Ans. To manage line border between records of a table in loop, use outside border option inFormatting Menu of Word. If it still doesnt work, then create a table in excel by formatting cells and paste it in RTF template.

Note: Replace symbol '(' with '<' and ')' with '>' in all above xml/xsl syntax

No comments:

Post a Comment