2007年11月21日 星期三

Note for WSH_DELIVERY_DETAILS.RELEASED_STATUS

WSH_DELIVERY_DETAILS.RELEASED_STATUS的意義:

B Backordered Line failed to be allocated in Inventory

C Shipped Line has been shipped

D Cancelled Line is Cancelled

I Interfaced Line has been shipped and interfaced to Order Management and Inventory

N Not Ready to Release Line is not ready to be released

R Ready to Release Line is ready to be released

S Released to Warehouse Line has been released to Inventory for processing

X Not Applicable Line is not applicable for Pick Release

Y Staged/Pick Confirmed Line has been picked and staged by Inventory

2007年7月26日 星期四

Bursting Engine Implementation

其實這部份在一個月前就已經完成測試了
不過現在才有空寫上來

基本上
Tim的Blog提供的例子與架構已經很清楚了
但是習慣上會照著做一個不同的報表來用看看...
在做的過程中
才會知道有那些是重要的...要克服的問題..
否則看別人的Code...一切都是那麼理所當然...自己做看看才知道..即使只是模仿

我的測試分兩部份
第一部份是不管Data怎麼出來的部份...假設已有xml了
然後搭配JSP與Control file
看看有沒有什麼問題

如果第一部份沒問題
那麼第二部份的測試...就是把它完整地implement出來
從rdf開始..含report trigger..並掛到Server上跑
讓它完全如Tim的例子一樣運作完美...

(註:由於我用的是XMLP 5.6.2
所以要自己寫JCP..聽說5.6.3就不用了...)

第一部份:
* Control file : burst.xml 放到/tmp/下
* Data file : emp.xml 放到/tmp/下
* Rtf Template : test.rtf 放到/tmp/下
* JCP: BurstingTest.java compile後掛上Server..
主要在JCP中就會依Control file與Data去抓Template並做Bursting
因此測試時跑JCP就好

這邊卡住的問題有
1. JCP Compile問題
一開始抓下來的Java檔...居然在Compile時就有問題...
經過確認..
發現程式中用OADocumentProcessor是有問題的
http://forums.oracle.com/forums/thread.jspa?messageID=1843531
要使用DocumentProcessor

所以import的部份多加了
import oracle.apps.xdo.batch.DocumentProcessor;

程式中的這一段
lfile.writeln("Starting burst ...",1);
OADocumentProcessor dp = new OADocumentProcessor("/tmp/burst.xml","/tmp/emp.xml","/tmp");
lfile.writeln("Bursting initiated ... ",1);

也改為
file.writeln("Starting burst ...",1);
DocumentProcessor dp = new DocumentProcessor("/tmp/burst.xml","/tmp/emp.xml","/tmp");
lfile.writeln("Bursting initiated ... ",1);

2. Data file的問題
我的emp.xml中
用到幾個會有問題的tag...我用了EMP、EMPLOYEE、NAEM這類的....
結果在5.6.2中...不管我資料有幾筆...都只是Burst出第一筆...
這裡卡了很久
後來才知道可能是Bug
改了Tag後...就沒有問題了
http://forums.oracle.com/forums/message.jspa?messageID=1904432#1904432

這邊兩個問題都要感謝Ashish的協助

第二部份:
* Control file : burst.xml 放到/tmp/下
* Report file : BURSTDEMO.rdf 放到Server上
* Rtf Template : test.rtf 放到/tmp/下
* JCP: XMLPReportBurst.java compile後掛上Server..
主要是跑掛上Server的Report: BURSTDEMO..它產生的output就是XML格式
而由於它的After Report Trigger會去Call JCP
因此...JCP會抓得到它XML的output..加上Control file與template
一氣呵成完成後半部的Bursting動作

這部份與第一部份的差異
就在於怎麼去找到rdf的xml output
主要問題在
1. JCP怎麼寫
這邊沒有太大的麻煩..
Tim的例子本身就有這個功能..
只要傳入request id當參數就好...
甚至還能回過頭去改Request畫面上的Request Name...

2. RDF的After Report怎麼把自己的Request id當參數傳給JCP
這裡卡了一陣子
因為~~自己都還沒跑出去..要怎麼知道自己的Request id??
可以看這邊
http://zhxiangxie.blogspot.com/2007/06/how-to-get-this-request-id.html

而完成第一部份測試
加上克服第二部份的問題後
RDF到Bursting的路就走出來了

應該可以用來取代之前用JavaMail與iText寫的那一段功能...

2007年7月6日 星期五

Tax Code changed after booking order -- Trouble Shooting

http://forums.oracle.com/forums/thread.jspa?messageID=1938213�

業務人員操作時碰到問題
當Customer A的Bill to預設TAX CODE為TAX0
打單時會預帶出TAX0
而某些時候因需求改為TAX5
存檔時都很正常
但Book後卻自動變為TAX0
當沒注意時
就會造成訂單的錯誤

這個問題透過Ketter Ohnes與Daniel Borgstrom的協助
發現Note 359606.1有建議的解決方式
(看來不是bug..而是需要額外設定的東西...詳細請看Note 359606.1)

修改$ONT_TOP/patch/115/sql/OEXEDEPB.pls的程式似乎沒有用
但直接修改 oe_dependencies_extn 這個package
則可以解決這個問題

CREATE OR REPLACE
PACKAGE BODY oe_dependencies_extn AS
/* $Header: OEXEDEPB.pls 115.5 2003/12/03 22:42:58 nlakshma ship $ */

-- Global constant holding the package name

G_PKG_NAME CONSTANT VARCHAR2(30):='OE_Dependencies_Extn';


PROCEDURE Load_Entity_Attributes
( p_entity_code IN VARCHAR2
, x_extn_dep_tbl OUT NOCOPY Dep_Tbl_Type)

IS
l_index NUMBER;
--
l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
--
BEGIN

null;
--==========================================================================
/*
* Please refer to : http://forums.oracle.com/forums/thread.jspa?messageID=1938213
* Ask and Trace by Zhxiang.. @20070706
*/
l_index := 1;

x_extn_dep_tbl(l_index).source_attribute := OE_LINE_UTIL.G_TAX_DATE;
x_extn_dep_tbl(l_index).dependent_attribute := OE_LINE_UTIL.G_TAX;
x_extn_dep_tbl(l_index).enabled_flag := 'N';
l_index := l_index + 1;
--==========================================================================

/*
-- In order to start using the package:
-- 1)Increase the version number in the header line to a high value
-- => Header: OEXEDEPB.pls 115.1000. This would prevent patches
-- from over-writing this package in the future.
-- 2)Included are some examples on how to enable/disable dependencies
-- Please use these guidelines to edit dependencies as per your
-- defaulting rules. Please note that:
-- i) List of attributes is restricted to those in the earlier
-- comments in this file.
-- ii) Source attribute and dependent attribute should belong
-- to the same entity!
-- This API does not support dependencies across entities i.e.
-- changing an attribute on order header will not result in
-- a change to attributes on order line.
-- 3)Uncomment this code and compile.

oe_debug_pub.add('Enter OE_Dependencies_Extn.LOAD_ENTITY_ATTRIBUTES', 1);

-- Initializing index value for pl/sql table. Ensure that the index
-- value is incremented after setting each dependency record.
l_index := 1;

-- Dependencies for Order Header Entity
IF p_entity_code = OE_GLOBALS.G_ENTITY_HEADER THEN

null;

-- Sample Code for Disabling dependency of Invoice To on Ship To
-- x_extn_dep_tbl(l_index).source_attribute := OE_HEADER_UTIL.G_SHIP_TO_ORG;
-- x_extn_dep_tbl(l_index).dependent_attribute := OE_HEADER_UTIL.G_INVOICE_TO_ORG;
-- x_extn_dep_tbl(l_index).enabled_flag := 'N';
-- l_index := l_index + 1;

-- Dependencies for Order Line Entity
ELSIF p_entity_code = OE_GLOBALS.G_ENTITY_LINE THEN

null;

-- Sample Code for Disabling dependency of Invoice To on Ship To
-- x_extn_dep_tbl(l_index).source_attribute := OE_LINE_UTIL.G_SHIP_TO_ORG;
-- x_extn_dep_tbl(l_index).dependent_attribute := OE_LINE_UTIL.G_INVOICE_TO_ORG;
-- x_extn_dep_tbl(l_index).enabled_flag := 'N';
-- l_index := l_index + 1;

-- Sample Code for adding dependency of Source Type on Item
-- x_extn_dep_tbl(l_index).source_attribute := OE_LINE_UTIL.G_INVENTORY_ITEM;
-- x_extn_dep_tbl(l_index).dependent_attribute := OE_LINE_UTIL.G_SOURCE_TYPE;
-- x_extn_dep_tbl(l_index).enabled_flag := 'Y';
-- l_index := l_index + 1;

END IF;

oe_debug_pub.add('Exit OE_Dependencies_Extn.LOAD_ENTITY_ATTRIBUTES', 1);
*/

EXCEPTION
WHEN OTHERS THEN
IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
THEN
OE_MSG_PUB.Add_Exc_Msg
( G_PKG_NAME
, 'Load_Entity_Attributes'
);
END IF;
RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
END Load_Entity_Attributes;

END OE_Dependencies_Extn;
/

2007年7月5日 星期四

Turning Rows into Columns

http://forums.oracle.com/forums/message.jspa?messageID=1921986#1921986

在這邊的討論
算是XMLP的進階應用...

然而感謝Anil Passi 的網站
介紹以xsl變數宣告模擬for loop的方式
才能應用到這的問題上

TEXT001{NO_IN_A_ROW}
TEXT002{INNER_GROUP}

---------------------------------------------------------------
| Attribute | Emp TEXT003{F} TEXT004{1} TEXT005{E} |
---------------------------------------------------------------
| Name | Emp TEXT003{F} TEXT006{Name} TEXT005{E} |
---------------------------------------------------------------
| Department | Emp TEXT003{F} TEXT007{DEPT} TEXT005{E} |
---------------------------------------------------------------
| Salary | Emp TEXT003{F} TEXT008{1000} TEXT005{E} |
---------------------------------------------------------------

TEXT005{E}


where TEXT004,TEXT005,TEXT006,TEXT007,TEXT008 are the same as the original document,
and

TEXT001: <xsl:variable name="no_in_a_row" select="number(5)"/>
TEXT002: <xsl:variable xdofo:ctx="incontext" name="inner_group" select=".//ROW"/>
<?for-each:$inner_group?><?if:(position()-1) mod $no_in_a_row=0?><xsl:variable name="first_rec" xdofo:ctx="incontext" select="position()"/>
TEXT003: <?for-each@cell:$inner_group[position()>=$first_rec and position() <$first_rec+$no_in_a_row]?>

2007年6月20日 星期三

Function with DML and Commit

之前寫到一個需求
需要動態產生一組Sequence..
且Sequence不只是流水號
而是有前置字元的流水號
例如CF0703001(XXYYMMSSS)這樣的型態

當用Function來產生這個流水號時
同時要在Table中記錄已用到那一個號碼
這樣的話
Function中就會有Update的DML語法...
在Compile時會發生ORA-01655的Error
表示function不應包括DML的SQL

然而...可以透過PRAGMA AUTONOMOUS_TRANSACTION的宣告
避開此Error
如下

CREATE OR REPLACE
FUNCTION tw_get_cks_seq
( i_seq_type IN varchar2)
RETURN varchar2 IS
PRAGMA AUTONOMOUS_TRANSACTION;
--associated obj: tw_cks_sequence
o_seq_no varchar2(20);
v_check varchar2(20);
BEGIN
select seq_last
into v_check
from tw_cks_sequence
where seq_type=i_seq_type;

if substr(v_check,3,4)=to_char(sysdate,'YYMM') then
--use next
select i_seq_type||to_char(sysdate,'YYMM')||trim(to_char(seq_cur+1,seq_length))
into o_seq_no
from tw_cks_sequence
where seq_type=i_seq_type;


update tw_cks_sequence
set seq_cur=seq_cur+1,
seq_last=o_seq_no,
last_updated_date=sysdate
where seq_type=i_seq_type;

COMMIT;

else
--use 1
select i_seq_type||to_char(sysdate,'YYMM')||trim(to_char(1,seq_length))
into o_seq_no
from tw_cks_sequence
where seq_type=i_seq_type;

update tw_cks_sequence
set seq_cur=1,
seq_last=o_seq_no,
last_updated_date=sysdate
where seq_type=i_seq_type;

COMMIT;
end if;

RETURN o_seq_no ;
EXCEPTION
WHEN others THEN
return SQLCODE||':'||SQLERRM ;
END;
/

How to get THIS request id

在implement XMLP Bursting Engine時
會有一個動作
是將RDF報表產生的XML丟到JCP上面
這一個動做會有一個需求
就是在RDF中的After Report Trigger..
將本身的request id拋到JCP上當參數
那麼必須知道...該怎麼抓取...目前這個Concurrent Program的Request id

據說在Application Developer的User Guide中有詳細的說明
做法有點Tricky...
1. 宣告Number型態的User Parameter : P_CONC_REQUEST_ID
2. 在Before Report Trigger中.. : srw.user_exit( 'FND SRWINIT' )
3. 在After Report Trigger中 : srw.user_exit( 'FND SRWEXIT' )
4. 這樣就可以抓到目前的 request id 於 P_CONC_REQUEST_ID 參數中

在Oracle Forum中我也有記著..
http://forums.oracle.com/forums/message.jspa?messageID=1899700#1899700

2007年6月11日 星期一

Awaiting Invoice Interface-On Hold -- Trouble Shooting

version 11.5.10.2

當Bill to的訂單被Hold
透過流程做完Release後
Line的Status有時會停在Awaiting Invoice Interface-On Hold

而並沒有資料拋到AR interface..

根據Metalink Doc: Note:398867.1
指出可以跑
Workflow Background Process
而Timeout要設為Yes..
這樣這支程式會將eligibe的部份再抓入重新進入流程
(就我的經驗...偶而會成功...偶而還是卡在這個狀態中)

不過..也可以找到這個line(在OM上)
直接按滑鼠右鍵
執行Progress Order的指令
就會往下一個流程推了...

無論如何
碰到這樣的狀況
兩個方法都試一下應該就可以了...