Showing posts with label XML Publisher. Show all posts
Showing posts with label XML Publisher. Show all posts

Monday, 13 October 2014

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 in Formatting 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

RTF Template - IF Condition

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?>


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

RTF Template - Page Break

nsert definite space in RTF templateUse 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 SignatureIf 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 Variable

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 ValueThe "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 Creation Thru PLSQL

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;

Script to delete XML Templates

DECLARE
   p_template_code   xdo_templates_b.template_code%TYPE
                        := 'PRNT_XXX_YYY';
BEGIN
   DELETE FROM xdo_templates_b
         WHERE template_code = p_template_code;

   DELETE FROM xdo_templates_tl
         WHERE template_code = p_template_code;

   DELETE FROM xdo_lobs
         WHERE lob_code = p_template_code;

   COMMIT;
   DBMS_OUTPUT.put_line ('Total Rows Deleted ' || SQL%ROWCOUNT);
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Error ' || SQLERRM);
END;

Tuesday, 7 October 2014

XML Publisher Interview Questions and Answers

.     What are the XML publisher tables.
Ans>PER_GB_XDO_TEMPLATES
XDO_DS_DEFINITIONS_B
XDO_DS_DEFINITIONS_TL
XDO_DS_DEFINITIONS_VL
XDO_LOBS
XDO_TEMPLATES_B
XDO_TEMPLATES_TL
XDO_TEMPLATES_VL
XDO_TEMPLATE_FIELDS
XDO_TRANS_UNITS
XDO_TRANS_UNIT_PROPS
XDO_TRANS_UNIT_VALUES
2.     how to create report with out .rdf?
Ans> Using Data template…..see below link
3.     how to write a loop in rtf template design ?
Ans> <?for-each:G_invoice_no?>
     ……………………..<?end for each?>
4.     how to design  sub templates in rtf layout ?
Ans> using following tags..
                <?template:template_name?>
                      This is Last Page
                               <?end template?>
5.     how to call a header or footer ?
          Ans> using this tag <?call:header?> and <?call:footer?>
                We have to use header section and footer section of the page.

6.     How to break the page in specific condition ?
Ans>  <?split-by-page-break:?>
7.     How to use section break ?
Ans>  <?for-each@section:G_CUSTOMER(This is group name)?>
8.     How to create multi layouts in XMLP ?
        Ans>  using below conditions
              < ?choose:?>
               <?when:CF_CHOICE=’VENDOR’?>
            Your template….
               <?end when?>
                   <?when:CF_CHOICE=’INVOICE’?>
                Your template….
              <?end when?>
                           <?when:CF_CHOICE=’RECEIPT’?>
                              Your template….
                    <?end when?>
                                              <?end choose?>
9.     How to calculate the running total in XMLP?
Ans>           <?xdoxslt:set_variable($_XDOCTX, 'RTotVar', xdoxslt:get_variable($_XDOCTX, 'RTotVar') + ACCTD_AMT(This is                                                column name) )?><?xdoxslt:get_variable($_XDOCTX, 'RTotVar')?>
10.   How to submit a layout in the backend ?
       Ans>  we have to write a procedure for this using the below code
                              fnd_request.add_layout
                             (template_appl_name      => 'application name',
                              template_code           => 'your template code',
                              template_language       => 'En',
                              template_territory      => 'US',
                              output_format           => 'PDF'
                             );
11.   How to display the images in XMLP?
        Ans> url:{'http://image location'}
                 For example, enter:
                   url:{'http://www.oracle.com/images/ora_log.gif'}
                      url:{'${OA_MEDIA}/image name'}
12.   How to pass the page numbers in rtf layout?
Ans>  <REPORT>
<PAGESTART>200<\PAGESTART>
....
</REPORT>
Enter the following in your template:

<?initial-page-number:PAGESTART?>

13.How to display  last page is differently in XML Publisher Reports.

Ans> what you want to dispay the test anything write in last of page

last page header 

<?start@last-page-first:body?>    <?end body?>