Thursday, May 24, 2007

Fake It - masquerade one BIP concurrent program as another for testing purposes

Had a query from a friend about why their XML / BI Publisher template and underlying XML wasn't working.

I wanted to do a quick check on my system to see if I was seeing the same problem.

I don't know where/how the XML was generated from so I "borrowed" an existing concurrent programs output file (XML) and template definition in order to test. Stealing the existing concurrent requests identity also means I didn't have to setup a new data definition, template, concurrent program etc...

So how?

I had previously (for other BIP work) done the following:

  • Setup a AR Statement Data Definition and Template
  • Run the AR Statement Generation Program, XML file produced - say concurrent request id 112233
  • Run an XML Report Publisher concurrent request report for the Statement - say concurrent request id 112244

I now had the following files to use/test:

  • /tmp/virtuate.xml - my friend's XML output
  • /tmp/virtuate.rtf - my friend's template

Okay, so now to faking it:

1. In Unix as the applmgr user, replace the xml output from statements with the masquerading xml:

cd $APPLCSF/$APPLOUT
mv o112233.out o112233.out.stmt
cp /tmp/virtuate.xml o112233.out

2. Upload virtuate.rtf over top of the AR Statement template

3. Login to Oracle eBusiness Suite, Copy your Request 112244, and submit.

The output is now your friends template applied to your friends XML data source using your instance.

Unfortunately for my friend, things were working perfectly for me but not for him...

19 comments:

  1. Gareth
    Nice blog. I have been a frequent reader.

    Just curious as to why you would'nt just use Template Builder tool to test the template and xml instead of this "slipping in your friends template" since the test was to see if the template and xml are working in unison well.

    Subraya Mallya
    http://blog.foyopa.com

    ReplyDelete
  2. Hi Subraya,
    The graphs present in my friends BIP Template weren't being displayed in the RTF / PDF output on his system, but were working fine for me. So template builder was fine, but runtime under eBusiness Suite wasn't. It turned out that the X Server (vncserver, Xvfb or similar) on his server wasn't running and so the graphs weren't being generated or rendered.

    ReplyDelete
  3. You said:
    >Setup a AR Statement Data
    > Definition and Template.

    After setting this up. Is any method to Delete the template with Data defintion?

    Thank you.

    ReplyDelete
  4. Hi,
    Good question - can't see the solution to delete template or data definition (or change Code). Any got any ideas?
    Gareth

    ReplyDelete
  5. Hi Gareth,
    I have issue in the AR Print Statement Report
    (N)Receivables.HyC_USA_AR.Print: Statement
    This Statement has contains two set of Programs as like parent and child which runs once the statement printed.
    Parent Conc. Request : Print Statement(ARXSGPO) - Executable Output Type : RDF
    Child Conc. Request : "Statement Generator Program(ARXSGP)" - Executable Output Type
    :Spawned

    I have set the output type as XML and given the exact short name of Parent Program in the
    XML Publisher Data Defination Code and also template(RTF) attached in the XML Publisher Template, I have tried this same for the child conc. program too. But it shows the output only in XML Format. I can say that Mapping the short name with the XML Publisher is not working for this Print Statement Report.

    welcoming your advice!...

    Regards
    Prabu

    ReplyDelete
  6. Hi Prabu,

    Run the "XML Report Publisher" concurrent request and specify the Report Request (Request ID) of the Print Statements program (the XML output you mention).

    For reference:
    http://forums.oracle.com/forums/thread.jspa?threadID=597509&tstart=-1

    Regards,
    Gareth

    ReplyDelete
  7. Hi again Prabu,
    Automated solution for applying layout or calling XML Report Publisher for Statements (and Dunning Letters) can be achieved by customization see:
    this forum

    Regards,
    Gareth

    ReplyDelete
  8. Hi Gareth,

    I have got this error when i run the same fnd_submit.request code in the ARXSGPO(Print Statement ) -after report trigger.
    error 707
    unsupported construct or internal error[2601]

    Following code in the after report trigger

    function AfterReport return boolean is
    v_set_layout_option boolean;
    v_conc_request_id number;
    v_printer_name varchar2(100);
    v_printer boolean;
    begin
    v_set_layout_option := fnd_request.add_layout('RECEIVABLES','ARXSGPO','en','US','PDF');
    begin
    select printer_name
    into v_printer_name
    from fnd_concurrent_programs
    where CONCURRENT_PROGRAM_NAME = 'ARXSGPO';
    exception
    when others then
    null;
    end;

    if v_printer_name is not null then
    v_printer := fnd_request.set_print_options(v_printer_name,
    null,
    1, -- no of copies
    TRUE,
    'N');
    end if;
    -- CALLING THE CHILD REPORT USING FND_REQUEST
    v_conc_request_id := FND_REQUEST.SUBMIT_REQUEST( application => 'Receivables',
    program => 'ARXSGPO',
    description => null,
    start_time => TO_CHAR(SYSDATE, 'DD-MON-YY HH:MI:SS'),
    sub_request => FALSE
    );
    commit;
    SRW.USER_EXIT('FND SRWEXIT');
    return (TRUE);
    end;


    welcoming your advice
    Prabu

    ReplyDelete
  9. Hi Prabu,

    Oracle Reports PL/SQL isn't 100% like serverside PL/SQL. Make sure you put all 100 parameters to fnd_request.submit_request (null for all the parameters you are not using).
    See:
    this forum post
    Gareth

    ReplyDelete
  10. Hi Garneth,

    Yes i have included all the parameters for the Fnd_request.submit_request and the coding is not showing any error now in the after report trigger- ARXSGPO(Print Statement ).But after the Statement Generator Program completed,the calling child program XML Report Publisher is not running automatically in the request,so i am not able to view the output.

    Here the coding which i have included in the after report trigger
    function AfterReport return boolean is
    v_set_layout_option boolean;
    v_conc_request_id number;
    v_printer_name varchar2(100);
    v_printer boolean;
    begin
    v_set_layout_option := fnd_request.add_layout('AR','Print Statement Temp','en','US','PDF');
    begin
    select printer_name
    into v_printer_name
    from fnd_concurrent_programs
    where CONCURRENT_PROGRAM_NAME = 'ARXSGPO';

    exception
    when others then
    null;
    end;
    if v_printer_name is not null then
    v_printer := fnd_request.set_print_options(v_printer_name,
    null,
    1, -- no of copies
    TRUE,
    'N');
    end if;

    -- CALLING THE CHILD REPORT USING FND_REQUEST
    v_conc_request_id := FND_REQUEST.SUBMIT_REQUEST(application => 'XDO' -- Application Short name
    , program => 'XDOREPPB'--Concurrent Program Application Short Name
    ,description => null,
    start_time => TO_CHAR(SYSDATE, 'DD-MON-YY HH:MI:SS'),
    sub_request => FALSE
    ,argument1 => NULL,
    argument2 => NULL,
    argument3 => NULL,
    argument4 => NULL,
    argument5 => NULL,
    argument6 => NULL,
    argument7 => NULL,
    argument8 => NULL,
    argument9 => NULL,
    argument10 => NULL,
    argument11 => NULL,
    argument12 => NULL,
    argument13 => NULL,
    argument14 => NULL,
    argument15 => NULL,
    argument16 => NULL,
    argument17 => NULL,
    argument18 => NULL,
    argument19 => NULL,
    argument20 => NULL,
    argument21 => NULL,
    argument22 => NULL,
    argument23 => NULL,
    argument24 => NULL,
    argument25 => NULL,
    argument26 => NULL,
    argument27 => NULL,
    argument28 => NULL,
    argument29 => NULL,
    argument30 => NULL,
    argument31 => NULL,
    argument32 => NULL,
    argument33 => NULL,
    argument34 => NULL,
    argument35 => NULL,
    argument36 => NULL,
    argument37 => NULL,
    argument38 => NULL,
    argument39 => NULL,
    argument40 => NULL,
    argument41 => NULL,
    argument42 => NULL,
    argument43 => NULL,
    argument44 => NULL,
    argument45 => NULL,
    argument46 => NULL,
    argument47 => NULL,
    argument48 => NULL,
    argument49 => NULL,
    argument50 => NULL,
    argument51 => NULL,
    argument52 => NULL,
    argument53 => NULL,
    argument54 => NULL,
    argument55 => NULL,
    argument56 => NULL,
    argument57 => NULL,
    argument58 => NULL,
    argument59 => NULL,
    argument60 => NULL,
    argument61 => NULL,
    argument62 => NULL,
    argument63 => NULL,
    argument64 => NULL,
    argument65 => NULL,
    argument66 => NULL,
    argument67 => NULL,
    argument68 => NULL,
    argument69 => NULL,
    argument70 => NULL,
    argument71 => NULL,
    argument72 => NULL,
    argument73 => NULL,
    argument74 => NULL,
    argument75 => NULL,
    argument76 => NULL,
    argument77 => NULL,
    argument78 => NULL,
    argument79 => NULL,
    argument80 => NULL,
    argument81 => NULL,
    argument82 => NULL,
    argument83 => NULL,
    argument84 => NULL,
    argument85 => NULL,
    argument86 => NULL,
    argument87 => NULL,
    argument88 => NULL,
    argument89 => NULL,
    argument90 => NULL,
    argument91 => NULL,
    argument92 => NULL,
    argument93 => NULL,
    argument94 => NULL,
    argument95 => NULL,
    argument96 => NULL,
    argument97 => NULL,
    argument98 => NULL,
    argument99 => NULL,
    argument100 => NULL);
    commit;
    SRW.USER_EXIT('FND SRWEXIT');
    return (TRUE);
    end;

    please advice me where exactly i am doing wrong.

    regards
    prabu

    ReplyDelete
  11. Hi Prabu,

    Take a look at this post for a solution to your Statements XML Publisher output problem.
    Easy 1 Step Statements

    Gareth

    ReplyDelete
  12. Hi Gareth,

    I have requirement to develop xml reports using pdf template.

    what are the pre-request to start the development in pdf template?.
    And also if u have any best posted formus for developing template in pdf please give your advice

    with regards
    prabu

    ReplyDelete
  13. Hi Gareth,
    I found your posts very valuable, I have one question.
    How can I print output of a conc prog to TWO diffrent printers automatically.

    Print options would have only one printer defaulting automaticaly, second printer needs to be added manually.

    Thanks
    Manu

    ReplyDelete
  14. Hi Manu,
    Haven't worked through a solution, but if you need it to be automated perhaps a request set might help with a Reprint job after the first?
    Otherwise you might want to try a Forms Personalization?
    Gareth

    ReplyDelete
  15. Hi, I am a beginner in XML publisher. I tried creating MS Word template with charts (pie chart and bar Chart). In preview, the charts are displayed perfectly but when I try to register as a concurrent program, all the elements (tables, chart specification etc.,) are displayed EXCEPTthe charts which are NOT displayed in the output. Tried many options, but in vain.

    ReplyDelete
  16. Hi Sangeeth,

    No graphs is due to no X Server. Make sure you have an X Server running on your EBS Concurrent Processing Server. You can see what the concurrent manager thinks the X Server is by running concurrent request "Prints environment variables" from System Administrator responsibility and specify variable "DISPLAY".

    Regards,
    Gareth

    ReplyDelete
  17. Hi Gareth,
    Thanks for your reply. I am able to find the X server as you mentioned in your reply. Is there anyways to point this to another server?
    Kindly let me know the details.
    Thanks...

    ReplyDelete
  18. Hi Sangeeth,

    Update the config xml file $CONTEXT_FILE and run autoconfig, then restart processes.

    Regards,
    Gareth

    ReplyDelete
  19. Hi,
    Previously I was facing this problam, but now it got fixed. My Program sucessfully generating the PDF output of statement report.

    Requirment: Need "Statement Generation Program" output in PDF.

    Solution: You have to do below staps.
    ------------------------------
    1. make a PL/SQL Package:-

    create or replace package XXV8_XMLP_PKG AUTHID CURRENT_USER AS
    function submit_request_xmlp(p_code in varchar2, p_request_id in number)
    return number;
    end XXV8_XMLP_PKG;


    create or replace package body XXV8_XMLP_PKG AS
    function submit_request_xmlp(p_code in varchar2, p_request_id in number)
    return number is
    l_req_id number := 0;
    begin
    if p_code = 'ARXSGPO' then
    l_req_id := FND_REQUEST.SUBMIT_REQUEST('XDO',
    'XDOREPPB',
    NULL,
    NULL,
    FALSE,
    'N',
    p_request_id,
    222, -- Receivables
    'ARXSGPO', -- Statement Generate
    'en-US', -- English
    'N',
    'RTF',
    'PDF');
    end if;
    return l_req_id;
    end submit_request_xmlp;

    end XXV8_XMLP_PKG;
    ------------------------------
    2. Add the below code in "ARXSGPO" report (after report trigger).

    declare
    v_req_id number := 0;
    begin
    v_req_id := xxv8_xmlp_pkg.submit_request_xmlp('ARXSGPO',:p_conc_request_id);
    if v_req_id > 0 then
    srw.message(20002, 'Submitted request_id ' || v_req_id);
    commit;
    else
    srw.message(20002, 'Failed to submit request');
    end if;
    end;
    ------------------------------
    3. Create the TEMPLATE and Data Definition in BI Publisher.

    Code: ARXSGPO
    Template: ARXSGP
    Data Definition: ARXSGP
    Upload 'UTF-8'en-us'CLE_F_ARCUSBALSL.rtf'
    (If u dont have this .rtf then U can download it from 'http://vis1213.solutionbeacon.net' and upload the same on your system).
    ------------------------------
    Run your Statement Generation program.

    Rgds,
    Sanjeev Kumar

    ReplyDelete