注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

Memory extender

Beautiful Day..

 
 
 

日志

 
 

验证及生成GL CODE COMBINATION组合  

2011-01-12 16:50:58|  分类: EBS |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

实现验证GL CODE COMBINATION组合,如果不存在,则自动生成,可以使用

BEGIN
  IF fnd_flex_keyval.validate_segs(operation        => 'CREATE_COMBINATION',
                                   appl_short_name  => 'SQLGL',
                                   key_flex_code    => 'GL#',
                                   structure_number => x_coa_id, --- Pass your chart of accounts id
                                   concat_segments  => x_acc_comb, --- Pass your account combination string you want to create
                                   validation_date  => x_eff_date --- effective date by which you want the combination to be validated
                                   ) THEN
    l_ccid := fnd_flex_keyval.combination_id();
  ELSE
    errmsg          := fnd_flex_keyval.error_message();
    x_return_status := g_status_error;
  END IF;
END;

-----------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------

There are 2 flexfield APIs which you can use to either validation the existing given code_combination_id (ccid) or to validate and create a new code combination (Account).

1. fnd_flex_keyval.VALIDATE_SEGS - To validate and if required can create Account code combination.
  /* ------------------------------------------------------------------------ */
  /*        VALIDATE_SEGS:            */
  /*  Finds combination from given segment values.          */
  /*  Segments are passed in as a concatenated string in increasing     */
  /*  order of segment_number (display order).          */
  /*  Operation is one of:                */
  /*    'FIND_COMBINATION' - Combination must already exist.          */
  /*    'CREATE_COMBINATION' - Combination is created if doesn't exist.   */
  /*        'CREATE_COMB_NO_AT' - same as create_combination but does not     */
  /*                              use an autonomous transaction.              */
  /*    'CHECK_COMBINATION' - Checks if combination valid, doesn't create.*/
  /*    'DEFAULT_COMBINATION' - Returns minimal default combination.      */
  /*    'CHECK_SEGMENTS' - Validates segments individually.       */
  /*                      */
  /*  If validation date is NULL checks all cross-validation rules.     */
  /*  Returns TRUE if combination valid, or FALSE and sets error message  */
  /*  on server if invalid.                 */
  /*                      */
  /*  The defaulted arguments listed after combination_id are all         */
  /*  optional.  Use the default values if you do not want any special    */
  /*  functionality.  Defaulted argument descriptions:        */
  /*  -  user_id, resp_id, and resp_appl_id identify the user and         */
  /*     responsibility.  They default to the values from FND_GLOBAL      */
  /*     which are set by the navigator form if this database session     */
  /*     underlies a form on the client or by the concurrent manager if   */
  /*     this package is in a database session started through the        */
  /*     concurrent manager.                */
  /*  -  Values_or_ids indicates whether input segments are values ('V')  */
  /*     hidden ids ('I').  If values are input the function expects one  */
  /*     value for every displayed segment, whereas if ids are input the  */
  /*     function expects one id for each enabled segment whether or not  */
  /*     the segment is displayed.              */
  /*  -  displayable is used to specify which segments are displayed.     */
  /*     This argument allows the user to not display segments that would */
  /*     otherwise be displayed based on the flexfield definition.        */
  /*  -  data_set specifies the effective flexfield structure number to   */
  /*     use when selecting or inserting into the combinations table.     */
  /*  -  vrule can be used to impose additional validation constraints    */
  /*     based on flexfield qualifier values.           */
  /*  -  where_clause limits existing combinations based on a user-       */
  /*     specified SQL where clause expression.  Only use with dinsert    */
  /*     FALSE.                 */
  /*  -  get_columns specifies additional columns from the combinations   */
  /*     table that are to be retrieved when a combination is found.      */
  /*  -  allow_nulls and allow_orphans are only checked if the operation  */
  /*     is 'CHECK_SEGMENTS'.  In this case, if allow_nulls is TRUE then  */
  /*     required segments that are null will be considered valid.  If    */
  /*     allow_orphans is TRUE, then all possible dependent segment       */
  /*     values be valid if the parent segment is null.       */
  /* ------------------------------------------------------------------------ */
  FUNCTION validate_segs(operation             IN VARCHAR2,
                         appl_short_name       IN VARCHAR2,
                         key_flex_code         IN VARCHAR2,
                         structure_number      IN NUMBER,
                         concat_segments       IN VARCHAR2,
                         values_or_ids         IN VARCHAR2 DEFAULT 'V',
                         validation_date       IN DATE DEFAULT SYSDATE,
                         displayable           IN VARCHAR2 DEFAULT 'ALL',
                         data_set              IN NUMBER DEFAULT NULL,
                         vrule                 IN VARCHAR2 DEFAULT NULL,
                         where_clause          IN VARCHAR2 DEFAULT NULL,
                         get_columns           IN VARCHAR2 DEFAULT NULL,
                         allow_nulls           IN BOOLEAN DEFAULT FALSE,
                         allow_orphans         IN BOOLEAN DEFAULT FALSE,
                         resp_appl_id          IN NUMBER DEFAULT NULL,
                         resp_id               IN NUMBER DEFAULT NULL,
                         user_id               IN NUMBER DEFAULT NULL,
                         select_comb_from_view IN VARCHAR2 DEFAULT NULL,
                         no_combmsg            IN VARCHAR2 DEFAULT NULL,
                         where_clause_msg      IN VARCHAR2 DEFAULT NULL)
    RETURN BOOLEAN;

 

Here Operation can be :
'FIND_COMBINATION' - Combination must already exist.
'CREATE_COMBINATION' - Combination is created if doesn't exist.
'CREATE_COMB_NO_AT' - same as create_combination but does not use an autonomous transaction.
'CHECK_COMBINATION' - Checks if combination valid, doesn't create.
'DEFAULT_COMBINATION' - Returns minimal default combination.
'CHECK_SEGMENTS' - Validates segments individually.

For example:

fnd_flex_keyval.validate_segs(
operation => 'CREATE_COMBINATION',
appl_short_name => 'SQLGL',
key_flex_code => 'GL#',
structure_number => x_coa_id, --- Pass your chart of accounts id
concat_segments => x_acc_comb, --- Pass your account combination string you want to create
validation_date => x_eff_date) --- effective date by which you want the combination to be validated

If the above function returns FALSE then use fnd_flex_keyval.error_message() to get the exact FND FLEXFIELD error message to work on.

Another very important function - fnd_flex_keyval.combination_id() returns the ccid of the newly created code combination by the above API.

 


Second API - fnd_flex_keyval.validate_ccid

  /* ------------------------------------------------------------------------ */
  /*        VALIDATE_CCID:            */
  /*  Looks up flexfield combination by its combination id.       */
  /*  Returns TRUE if combination found, otherwise returns FALSE      */
  /*  and sets error on the server.  Checks value security rules,       */
  /*  but violations do not invalidate the combination.       */
  /*  The defaulted arguments listed after combination_id are all         */
  /*  optional.  Use the default values if you do not want any special    */
  /*  functionality.  Defaulted argument descriptions:        */
  /*  -  user_id, resp_id, and resp_appl_id identify the user and         */
  /*     responsibility.  They default to the values from FND_GLOBAL      */
  /*     which are set by the navigator form if this database session     */
  /*     underlies a form on the client or by the concurrent manager if   */
  /*     this package is in a database session started through the        */
  /*     concurrent manager.  These parameters are used to determine if   */
  /*     values are secured.  Combinations with secrued values can still  */
  /*     be looked up using this function without returning an error,     */
  /*     but this function will note if any segments violate security.    */
  /*     Use is_secured to check if security violated.                */
  /*  -  displayable is used to specify which segments are displayed.     */
  /*     This argument allows the user to not display segments that would */
  /*     otherwise be displayed based on the flexfield definition.        */
  /*     Only the displayed segments are returned.          */
  /*  -  data_set specifies the effective flexfield structure number to   */
  /*     use when selecting or inserting into the combinations table.     */
  /*  -  vrule can be used to impose additional validation constraints    */
  /*     based on flexfield qualifier values.           */
  /*  -  Get_columns specifies additional columns from the combinations   */
  /*     table that are to be retrieved when a combination is found.      */
  /*  -  security determines whether or not to check value security.      */
  /*     IGNORE  - ignores value security altogether.         */
  /*     CHECK   - checks security, but violation is not an error.      */
  /*     ENFORCE - Stop validating and return error ifs security violated.*/
  /* ------------------------------------------------------------------------ */

  FUNCTION validate_ccid(appl_short_name       IN VARCHAR2,
                         key_flex_code         IN VARCHAR2,
                         structure_number      IN NUMBER,
                         combination_id        IN NUMBER,
                         displayable           IN VARCHAR2 DEFAULT 'ALL',
                         data_set              IN NUMBER DEFAULT NULL,
                         vrule                 IN VARCHAR2 DEFAULT NULL,
                         security              IN VARCHAR2 DEFAULT 'IGNORE',
                         get_columns           IN VARCHAR2 DEFAULT NULL,
                         resp_appl_id          IN NUMBER DEFAULT NULL,
                         resp_id               IN NUMBER DEFAULT NULL,
                         user_id               IN NUMBER DEFAULT NULL,
                         select_comb_from_view IN VARCHAR2 DEFAULT NULL)
    RETURN BOOLEAN;

Looks up flexfield combination by its combination id. Returns TRUE if combination found.

Possible values for security parameter are :
IGNORE - ignores value security altogether.
CHECK - checks security, but violation is not an error.
ENFORCE - Stop validating and return error ifs security violated

For example:

fnd_flex_keyval.validate_ccid(
appl_short_name => 'SQLGL',
key_flex_code => 'GL#',
structure_number => x_coa_id,
combination_id => x_ccid,
security => 'ENFORCE')


  评论这张
 
阅读(1748)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017