顯示具有 JDEdwards 標籤的文章。 顯示所有文章
顯示具有 JDEdwards 標籤的文章。 顯示所有文章

2013年11月12日 星期二

JDE Base64 Encode Function

Data Structure 很簡單
2 個 URL(DD) 就搞定了
1 個 Input, 1 個 Output

VA evt_Table_Conversion_URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
BF szOutputString = ""
VA evt_Count_Char_INT01 = 3
VA evt_Count_BinNo6_INT01 = 4
VA evt_Length_BinNo8_INT01 = 8
VA evt_Length_BinNo6_INT01 = 6
VA evt_Input_Temporary_URL = [BF szInputString]
VA evt_Length_Input_INT01 = length([VA evt_Input_Temporary_URL])
//
While VA evt_Length_Input_INT01 is greater than <Zero>
   VA evt_Index_Char_INT01 = 1
   VA evt_BinNo_Length24_DSSP = ""
   While VA evt_Index_Char_INT01 is less than or equal to VA evt_Count_Char_INT01
         And VA evt_Length_Input_INT01 is greater than <Zero>
      // 取出 1 個字元 (重複 3 次)
      VA evt_Char_FromInput_EV01 = substr([VA evt_Input_Temporary_URL],0,1)
      VA evt_Input_Temporary_URL = substr([VA evt_Input_Temporary_URL],1,
            [VA evt_Length_Input_INT01])
      VA evt_Length_Input_INT01 = length([VA evt_Input_Temporary_URL])
      //
      // 將取出的字元轉為 ASCII
      // (Character to Math Numeric, Convert : B0000049)
      // 為什麼使用 B0000049 ? 因為我找不到可以直接將字轉為 ASCII 的 BF
      // B0000049 是以'0'為起始, 所以要加上 48 轉為 ASCII (ASCII 表中'0'的 10 進位為 48)
      Character to Math Numeric, Convert
      VA evt_Char_FromInput_EV01 -> BF cCharacter
      VA evt_ASCIINo_FromChar_MATH01 <- BF mnMathNumeric
      VA evt_ASCIINo_FromChar_MATH01 = [VA evt_ASCIINo_FromChar_MATH01]+48
      //
      // 將 ASCII 轉為 2 進位 (Binary), 並補齊 8 bits (左側補'0')
      // (Convert From Deciaml Number To Binary Number : B46R0210)
      Convert From Deciaml Number To Binary Number
      VA evt_ASCIINo_FromChar_MATH01 -> BF mnDecimalNumber
      VA evt_BinNo_Length8_A801 <- BF szBinaryNumber
      VA evt_BinNo_Length8_A801 = lpad([VA evt_BinNo_Length8_A801],"0",
            [VA evt_Length_BinNo8_INT01])
      //
      // 將 binary 數字整理為 3 Bytes (24 bits)
      VA evt_BinNo_Length24_DSSP = concat([VA evt_BinNo_Length24_DSSP],
            [VA evt_BinNo_Length8_A801])
      //
      VA evt_Index_Char_INT01 = [VA evt_Index_Char_INT01]+1
   End While
   //
   VA evt_Index_BinNo6_INT01 = 1
   While VA evt_Index_BinNo6_INT01 is less than or equal to VA evt_Count_BinNo6_INT01
      // 取出 6 bits binary 數字 (重複 4 次)
      VA evt_BinNo_Length6_CFSTR8 = substr([VA evt_BinNo_Length24_DSSP],0,
            [VA evt_Length_BinNo6_INT01])
      VA evt_BinNo_Length24_DSSP = substr([VA evt_BinNo_Length24_DSSP],
            [VA evt_Length_BinNo6_INT01],24)
      //
      If VA evt_BinNo_Length6_CFSTR8 is not equal to <Blank>
            And VA evt_BinNo_Length6_CFSTR8 is not equal to <Null>
         // 將取出的 6 bits binary 數字轉回 10 進位數字
         // (Convert From Binary Number To Decimal Number : B46R0210)
         // 透過字元對照表取出對應加密字元
         VA evt_BinNo_Length6_CFSTR8 = rpad([VA evt_BinNo_Length6_CFSTR8],"0",
               [VA evt_Length_BinNo6_INT01])
         Convert From Binary Number To Decimal Number
         VA evt_Index_ConvertTable_MATH01 <- BF mnDecimalNumber
         VA evt_BinNo_Length6_CFSTR8 -> BF szBinaryNumber
         BF szOutputString = concat([BF szOutputString],
               substr([VA evt_Table_Conversion_URL],[VA evt_Index_ConvertTable_MATH01],1))
      Else
         // 取不到 6 bits binary 數字時, 直接回傳 '=' 字元
         BF szOutputString = concat([BF szOutputString],'=')
      End If
      //
      VA evt_Index_BinNo6_INT01 = [VA evt_Index_BinNo6_INT01]+1
   End While
End While


當中遇到的陷阱是:B46R0210 有 Bug
真是有點懶得再寫 Decode...

此 function 只適用於單位元組 (single byte)處理
所以無法處理中文
但可以先將中文轉為 Url Encoding 的格式, 再進行 Base64 Encode
這樣 Decode 後的字串還是能被網頁識別為中文

(Url Encoding 轉換 : w3schools.com)

2013年11月8日 星期五

JDE Parameterized URL

JDE Parameterized URL 一定要透過 Data Structure 傳遞參數
FormDSTmpl 傳遞 FI 編號
FormDSData 傳遞 FI 內容值
ex. P550001 有 3 個 FI
  1 KCOO
  2 DOCO
  3 DCTO
 今天只查 DOCO = 13000001 的資料
 => FormDSTmpl=|1|2|3|&FormDSData=||13000001||

完整模式 :
http://[ServerIP]:[ServerPort]/jde/HostedE1Servlet?OID=[ApplicationID]_[FormID]_[Version]&FormDSTmpl=[FI編號]&FormDSData=[FI內容值]
完整 URL :
http://192.168.1.153:82/jde/HostedE1Servlet?OID=P550001_W550001A&FormDSTmpl=|1|2|3|&FormDSData=||13000001||
 
環境要求 :
Tool Release : 8.96 - Service Pack E1 and Above
Application Release : 8.9 and Above
 
參考資料 :
 

2013年10月13日 星期日

JDE Business Function 令人無法想像的限制

最近撰寫 JDE 9.0 Business Function 遇到一個問題:

在 BF 中 Fetch Single 某個 Table
結果 SV File_IO_Status 一直 return CO Error
但是我確定該 Table 有符合的資料存在
相同的條件將 Fetch Single 寫在 P 程式中, 也一切正常 (CO Success)

最後才發現:
在 BF 使用 Fetch Single
一定要依序使用 Index Column

Ex. 
Table 有一組 Index, 依序為 : KCOO, DOCO, DCTO, LNID
在 BF 裡使用這組 Index 進行 Fetch Single, 可以有下列用法:
1. KCOO
2. KCOO + DOCO
3. KCOO + DOCO + DCTO
4. KCOO + DOCO + DCTO + LNID

但是, 如果你用 KCOO + DCTO, 就是死!

JDE 9.0 Grid 相關 System Function 測試

記錄最近測試 Grid 相關的 System Function 結果
以下皆為使用 Fat Client Windows Form 測試

// 無效, 不論 Row 怎麼傳, Grid Row 都不會變成 Selected
Change Row Selection(Grid[in], Row[in], Select State[in])

// 有效, Row 會回傳 Selected 的 Grid Row 筆數
Get Selected Grid Row Count(Grid, Row)

// 有效, Row 會回傳第 1 個 Selected 的 Grid Row Number
// Multiple Select Grid 也只會回傳第 1 個 Selected 的 Grid Row Number
Get Selected Grid Row Number(Grid, Row)

// 無效, 不論 Start Row 怎麼傳, Row 永遠回傳 0
Get Next Selected Row(Grid[in], Start Row[in], Row[out])


2013年9月17日 星期二

JDE Split 應用

記錄一下 JDE 如何應用 Split 截字串的方法
// 設定來源字串(DD: UKEMES), 以逗號分隔
VA evt_SourceString = "1,3,5,7,9,13,23,32,47,50,123"
// 取得來源字串長度(DD: MATH01)
VA evt_LengthOfString = length([VA evt_SourceString])
// 迴圈執行直到來源字串長度為 0
While VA evt_LengthOfString is greater than <zero>
   // 取得逗號在來源字串中的位置 (DD: MATH01, BF: B7500150 StartingPosition = 0)
   Finds a char position in a string
   If VA evt_IndexOfComma is greater than or equal to <zero>
      // 如果來源字串中有逗號
      // 將逗號前的子字串傳給Message Section的變數
      RV Variable 000001 = substr([VA evt_SourceString],0,[VA evt_IndexOfComma])
      // 將來源字串第一個逗號及之前的子字串去除
      VA evt_SourceString = substr([VA evt_SourceString],([VA evt_IndexOfComma]+1),[VA evt_LengthOfString])
   Else
      // 如果來源字串中沒有逗號
      // 將來源字串傳給Message Section的變數
      RV Variable 000001 = VA evt_SourceString
      // 將來源字串清空
      VA evt_SourceString = ""
   End If
   // 到Message Section 顯示截出來的字串
   Do Custom Section(RS Message)
   // 取得來源字串長度
   VA evt_LengthOfString = length([VA evt_SourceString])
End While

以下為 Message Section 的輸出

2013年7月18日 星期四

JDE 程式開發新發現

將自己新發現的一些東東記錄於此
測試環境: JDE 9.0

1)
R程式各Section中, 每種Level-Break條件只能建立1個Level-Break Footer, 如果超過 1個, 僅有其中 1個Level-Break Footer能正常顯示
(Level-Break條件意指: Level-Break的欄位組合; 推測Level-Break Header相同)

2)
Business View可以 Join 5個 tables

3)
R程式的Vocabulary Override存在F98760

2013年7月17日 星期三

JDE R程式呼叫 X00022 取號失敗

今天 Copy 一支 R 程式出來修改
結果在執行時發現 X00022 居然沒有取到號
才發現到問題在 R 程式的屬性(Update Report / No Update Report)
如果設定為 No Update Report, 所有Insert/Update/Delete動作都會失效

Copy 出來的 R 程式預設是 No Update Report


如果在 Copy 沒修改, R 程式就是 No Update Report (Read Only)


此時就只能下 SQL Update R 程式屬性
   --版本9.0
   --OMIT : 0=Update Report / 1=No Update Report
   UPDATE OL900.F9860 SET SIOMIT = '0' WHERE SIOBNM = 'RXXXXXXX';


2013年3月31日 星期日

JDE 程式相關的標準工具程式

在這邊記錄一下

Object IDDescription
P98306設定Process Option的Vocabulary Overrides
R98306列印各程式版本的Process Option內容值
P93081設定User/Group/Object的編碼(Encoding)

JDE Vocabulary Overrides Locked

之前遇到一個無法 Check-Out P程式的情況
原因是因為 P程式的 Vocabulary Overrides 被 lock 住

此時 F9861 裡應該會有一筆這支 P程式的資料
(F9861.STCE = 5 : In Use by Vocabulary Overrides)
將這筆資料 delete 後
就可以正常 Check-Out

2013年3月25日 星期一

JDE DREAM Writer 版本與目前存在的不符

最近在 JDE 9.0 遇到P程式發生"DREAM Writer 版本與目前存在的不符"問題
(This Dream Writer Version does not currently exist)
發現是P程式(A)又呼叫P程式(B),而且是以P程式(A)的版本呼叫P程式(B)
所以P程式(B)也要建立一個和P程式(A)同名的版本,才能運作正常

在這邊記錄一下
Parent appChild appDescription
P0411P75T003P0411呼叫P75T004產生GUI/VAT時
P4314P75T003P0411呼叫P4314進行Voucher Match時
P75T0411P75T003P75T0411執行Row>GUI/VAT Entry

2012年9月27日 星期四

JDE 顯示 Grid 的 Attachment 迴紋針

記錄一下如何顯示 Attachment 的迴紋針圖示(Paper Clip Icon)
一般來說, 如果 Grid Row 有 Attachment
要點一下上方的 Click to search for Attachments 鈕, 才會顯示迴紋針

其實在 Grid Record is Fetched event 中增加下列程式
就可以在 Find 出資料時, 連帶將有 Attachment 的 Row 的迴紋針顯示出來

2012年9月11日 星期二

JDE BC 值無故改變

今天在查一個R程式沒有將資料顯示出來的問題

R程式的大略架構是:
  Main Section 裡又有一個Sub-Section Join

Main Section 有抓到資料
也確定 Sub-Section Join 的 Business View 裡也有對應的資料
可是卻只印出 Main Section
Sub-Section Join 就是無法顯示

查了很久才找到問題所在
原來在 Main Section 中有一個 LNID 的 Business View Column(RV)
可是這個 RV 的 Display 被改成只顯示整數(Display Length=4, Display Decimals=0)

在 Main Section 顯示之前 BC Line Number 一直等於 1.01
等到 Main Section 顯示出來時
因為 Display 的設定, 將 BC Line Number 改變成 1
所以當 Main Section 將 BC 值拋入 Sub-Section Join 比對資料時
Sub-Section Join 中找不到任何 Line Number = 1 的資料
所以就無法顯示了

※原來 Business View Column 的改變, 會影響到背後的 BC 值