Monday, 23 June 2008

Padding eText files with blank lines

MikeM asked:
"How to pad an eText template with blank lines so the text file entries end up on the correct position on the stationary?
e.g. There are 25 lines available on the stationary for invoices but only 5 invoices to be paid on this payment - what steps should be taken to insert 20 blank lines after the 5 invoice lines?"



The solution that I use is to add an additional dummy Extend tag for each required blank line to the Payments Disbursement file. These are created under the 'OutboundPayment' parent.

You can add new tags to the Payments file by calling PL/SQL package 'IBY_FD_EXTRACT_EXT_PUB'. See previous blog post: http://kwoodrow.blogspot.com/2008/06/part-1-adding-new-fields-to-r12.html


After adding the new tags, the resulting XML file should look something like:
(Note - in this case, there are 3 blank lines added to the file)

XML_File


Then, in the eText template, under the 'OutboundPayment' level, create a new record to add these blank lines to the file:
(Note - this is highlighted in yellow)

Template


Finally, test the template using the BIP Template Viewer:

Template


Anyone got a different solution?

5 comments:

Linda said...

Hi Kevin,
Thanks a lot for sharing the info. It is very useful esp for newbie in ETEXT like me. I would like to ask one question, How do i padding etext template with blank line if the number of invoices is a variable? Let say, if i have 10 invoices and 15 invoices to be printed on first and second page respectively so each page output will be fitted nicely on every page. Any solution is very much appreciated. TIA.
Regards,
Linda

Mikem said...

Hi Kevin
Just to follow up on this - I've develoed a full solution using your suggestions.
The following detail may help Linda as well.
In the package IBY_FD_EXTRACT_PUB update the function Get_Pmt_Ext_Agg() to generate the required number of blank lines by first
selecting the count of the payable documents in IBY_DOCS_PAYABLE_ALL for that
payment.
In my case I need to accomodate a total of 21 lines so:-
FUNCTION Get_Pmt_Ext_Agg(p_payment_id IN NUMBER)
RETURN XMLTYPE
IS
v_XML_VARI_STRING VARCHAR2(4000) :=null;
v_result XMLTYPE := null;
v_loop_count number;
BEGIN

-- Find the variable number of balnk lines to insert
SELECT 21 - COUNT(DP.DOCUMENT_PAYABLE_ID)
INTO V_LOOP_COUNT
FROM IBY_DOCS_PAYABLE_ALL DP
WHERE DP.PAYMENT_ID = P_PAYMENT_ID;

-- Build the variable number of blank lines
for I in 1..v_loop_count
loop
IF I = 1
THEN
select XMLElement("Extend",XMLElement("Blank_Line",' '))
into v_result
from dual;
ELSE
select XMLConcat(v_result,XMLElement("Extend",XMLElement("Blank_Line",' ')))
into v_result
from dual;
END IF;
end loop;

-- Build the 15 numbered blank lines
for J in 1..15
loop
select XMLConcat(v_result,
XMLElement("ExtendC",XMLElement("Blank_LineC",' '),
XMLElement("Blank_Line_Count",J )))
into v_result
from dual;
end loop;
RETURN v_result;

END Get_Pmt_Ext_Agg;
The fifteen numbered lines are used oadding a fixed number or lines in different places down the page - 2 at the top - then the address - then 5 blanks etc. - just using the required number in each spot.

Not the pretiest solution - but it works!

Thanks again

Mike

Kevin Woodrow said...

Thanks Mike. Nice solution!

I'll make sure I forward it on to Linda.

Kevin

Bhaumik said...

Kevin,

I appriciate yr solution but i have one question for you.
How can i add one summary line in Oracle Payment's positive pay file.
I mean to say i have 5 lines in positive pay file and at the end of the last record i want to add summary then how can i add it??

Please let me know as i am stuck here.

Thanks in advance.

Bhaumik Bhatt

Mallik said...

Hi Kevin,
I am also in same boat as Bhatt. How can i add one File header and summary (Trailer) line in Oracle Payment's positive pay file.
I mean to say i have 5 lines in positive pay file and at the end of the last record i want to print summary line(total amount, record count) then how can i add it??

TIA
Mallik