Monday, May 18, 2015

In XML Report Date format zero's are missing (How to get zero values in XML Report)


By using this Below tag in RTF Template we will disply the zero starting and ending dates and number valued tags.


Here Tag is Creation_date.

Normally if the value for this tag is 03-JAN-2010,when you run the XML report by using Excel output the value will come like 3-jan-10.

by using below one overriding tag we will get expected output like 03-JAN-2010.

<fo:bidi-override direction="ltr" unicode-bidi="bidi-override"><?CREATION_DATE?></fo:bidi-override>

Friday, May 15, 2015

How to attach RTF Layout to the Concurrent Program From Back End:


Using submit_request will only submits the program and will not attach any layout or print option.
Code below will help to set XML publisher template/layout along with print option.

NOTE: Add_layout and Add_printer procedures are optional in calling submit_request. Use only if you need to set them.

Layout is submitted to a concurrent request using below procedure

fnd_request.add_layout (
                    template_appl_name   => 'Template Application',
                    template_code        => 'Template Code',
                    template_language    => 'en', --Use language from template definition
                    template_territory   => 'US', --Use territory from template definition
                    output_format        => 'PDF' --Use output format from template definition
                     );


Setting printer while submitting concurrent program

fnd_submit.set_print_options (printer      => lc_printer_name
                                   ,style        => 'PDF Publisher'
                                   ,copies       => 1
                                   );

fnd_request.add_printer (
                    printer => printer_name,
                    copies  => 1);



DECLARE
   lc_boolean        BOOLEAN;
   ln_request_id     NUMBER;
   lc_printer_name   VARCHAR2 (100);
   lc_boolean1       BOOLEAN;
   lc_boolean2       BOOLEAN;
BEGIN

      -- Initialize Apps
      fnd_global.apps_initialize (>USER_ID<
                                 ,>RESP_ID<
                                 ,>RESP_APPL_ID<
                                 );
   -- Set printer options
   lc_boolean :=
      fnd_submit.set_print_options (printer      => lc_printer_name
                                   ,style        => 'PDF Publisher'
                                   ,copies       => 1
                                   );
   --Add printer
   lc_boolean1 :=
                fnd_request.add_printer (printer      => lc_printer_name
                                         ,copies       => 1);
  --Set Layout
  lc_boolean2 :=
               fnd_request.add_layout (
                            template_appl_name   => 'Template Application',
                            template_code        => 'Template Code',
                            template_language    => 'en', --Use language from template definition
                            template_territory   => 'US', --Use territory from template definition
                            output_format        => 'PDF' --Use output format from template definition
                                    );
   ln_request_id :=
      fnd_request.submit_request ('FND',                -- application
                                  'COCN_PGM_SHORT_NAME',-- program short name
                                  '',                   -- description
                                  '',                   -- start time
                                  FALSE,                -- sub request
                                  'Argument1',          -- argument1
                                  'Argument2',          -- argument2
                                  'N',                  -- argument3
                                  NULL,                 -- argument4
                                  NULL,                 -- argument5
                                  'Argument6',          -- argument6
                                  CHR (0)               -- represents end of arguments
                                 );
   COMMIT;

   IF ln_request_id = 0
   THEN
      dbms.output.put_line ('Concurrent request failed to submit');
   END IF;
END;

Coma Delimiter sub string Program example for Reports



DECLARE
L_STRING VARCHAR2(400):='1,12,123,1234,12345,0,12';
begin
IF L_STRING IS NOT NULL THEN

SELECT LENGTH(L_STRING) into l_length FROM DUAL;

select substr(L_STRING,2,l_length-2) into L_STRING from dual;
srw.message(4,'P_SOURCE_LIN :'||L_STRING);

select (length(L_STRING) - length(replace(L_STRING, ',')))  INTO L_COUNT from dual;
srw.message(5,'l_count :'||l_count);
L_COUNT:=L_COUNT+1;
srw.message(6,'l_count :'||l_count);
FOR i IN 1..L_COUNT
loop

srw.message(8,'i  :'||i);
l_source:=null;
l_f:=0;
l_last:=0;
l_fir:=0;
l_sec:=0;
l_ccc:=0;
l_order_number:=0;
l_line_number:=0;

SELECT INSTR(L_STRING,',', 1,i) into l_f FROM DUAL;
srw.message(9,'l_f  :'||l_f);
if i=1 and l_f =0 then
select L_STRING into l_source FROM DUAL;
elsif i=1 then
SELECT substr(L_STRING, 1,l_f-1) into l_source FROM DUAL;
srw.message(10,'l_source  :'||l_source);

elsif i=L_COUNT and i<>1 then
SELECT INSTR(L_STRING, ',', 1,i-1) into l_last FROM DUAL;
select substr(L_STRING,l_last+1) into l_source FROM DUAL;
else
SELECT INSTR(L_STRING, ',', 1,i-1) into l_fir FROM DUAL;
SELECT INSTR(L_STRING, ',',1, i) into l_sec FROM DUAL;

SELECT substr(L_STRING, l_fir+1,l_sec-l_fir-1) into l_source FROM DUAL;
end if;
srw.message(7,'l_chr :'||l_source);


srw.message(12,'l_ccc :'||l_ccc);
end if;

end loop;

END IF;
END;

Concurrent Request Status Codes and Meaning Of Status Code's


Concurrent Request Status Codes and Meaning Of Status Code's:

Use below query to cancel all scheduled concurrent programs.
===================================================
UPDATE fnd_concurrent_requests
SET phase_code = 'C', status_code = 'X'
WHERE status_code IN ('Q','I')
AND requested_start_date > SYSDATE
AND hold_flag = 'N';

COMMIT;

=====================================================
TO cancel all running concurrent programs.

UPDATE fnd_concurrent_requests
SET phase_code = 'C', status_code = 'X'
WHERE status_code IN ('R','I');
Commit;

=====================================================

Concurrent Request Phase Codes:-

SELECT LOOKUP_CODE, MEANING
  FROM FND_LOOKUP_VALUES
 WHERE LOOKUP_TYPE = 'CP_PHASE_CODE' AND LANGUAGE = 'US'
       AND ENABLED_FLAG = 'Y';

To Cancel Specific request:
=====================================================

update fnd_concurrent_requests
set status_code='D', phase_code='C'
where request_id=:request_id;

LOOKUP_CODE MEANING
C             Completed
I               Inactive
P             Pending
R             Running

Concurrent Request Status Codes:-

SELECT LOOKUP_CODE, MEANING
  FROM FND_LOOKUP_VALUES
 WHERE LOOKUP_TYPE = 'CP_STATUS_CODE' AND LANGUAGE = 'US'
       AND ENABLED_FLAG = 'Y';


LOOKUP_CODE
MEANING
R
Normal
I
Normal
Z
Waiting
D
Cancelled
U
Disabled
E
Error
M
No Manager
C
Normal
H
On Hold
W
Paused
B
Resuming
P
Scheduled
Q
Standby
S
Suspended
X
Terminated
T
Terminating
A
Waiting
G
Warning


Normally a concurrent request proceeds through three, possibly four, life cycle stages or phases,

Phase Code
Meaning with Description
Pending
Request is waiting to be run
Running
Request is running
Completed
Request has finished
Inactive               
Request cannot be run
                                               
                               
Within each phase, a request's condition or status may change. Below appears a listing of each phase and the various states that a concurrent request can go through.

The status and the description of each meaning given below:
PENDING
Normal
Request is waiting for the next available manager.
Standby
Program to run request is incompatible with other program(s) currently running.
Scheduled
Request is scheduled to start at a future time or date.
Waiting
A child request is waiting for its Parent request to mark it ready to run. For example, a report in a report set that runs sequentially must wait for a prior report to complete.



RUNNING
Normal
Request is running normally.
Paused
Parent request pauses for all its child requests to complete. For example, a report set pauses for all reports in the set to complete.
Resuming
All requests submitted by the same parent request have completed running. The Parent request is waiting to be restarted.
Terminating
Running request is terminated, by selecting Terminate in the Status field of   the Request Details zone.

COMPLETED
Normal
Request completes normally.
Error
Request failed to complete successfully.
Warning
Request completes with warnings. For example, a report is generated successfully but fails to print.
Cancelled
Pending or Inactive request is cancelled, by selecting Cancel in the Status field of the Request Details zone.
Terminated
Running request is terminated, by selecting Terminate in the Status field of   the Request Details zone.

INACTIVE
Disabled
Program to run request is not enabled. Contact your system administrator.
On Hold
Pending request is placed on hold, by selecting Hold in the Status field of the Request Details zone.
No Manager
No manager is defined to run the request. Check with your system administrator.