Friday, July 29, 2016

WF_NOTE in workflow

select count(*) into L_attr_cnt
from wf_notification_attributes
where notification_id =  wf_engine.context_nid
and name = 'WF_NOTE'  ;                              
                   
    if  L_attr_cnt = 0 then    
        wf_notification.ADDATTR( wf_engine.context_nid,'WF_NOTE');
    end if;                                              
     l_comment := wf_notification.getattrtext(wf_engine.context_nid,'WF_NOTE');
     wf_notification.SetAttrText(wf_engine.context_nid, 'WF_NOTE', l_comment);

Raise Exception in Workflow Procedure

EXCEPTION  WHEN OTHERS THEN
    Wf_Core.Context('XX_PKG', 'xx_apprs', itemtype, itemkey);
    raise;

Add Attribute Programatically to Workflow

select count(name)  into l_attr_cnt
                    from wf_item_attribute_values where item_key = itemkey
                    and name like to_char('xx attr name')
                    and item_type = 'GLBATCH';
if l_attr_cnt = 0 then    
        apps.WF_ENGINE.AddItemAttr( itemtype =>  itemtype,
                                    itemkey =>  itemkey,
                                    aname =>  to_char('xx attr name'),
                                      text_value=> 'Guru',                -- If want to create attribute Text Type
                                      number_value=> null,                -- If want to create attribute Number Type
                                      date_value=> null);                 -- If want to create attribute Date Type
                                     
 end if;
apps.wf_engine.setitemattrtext (itemtype =>  itemtype,
                                itemkey  =>  itemkey,
                                aname    =>  to_char('xx attr name'),
                                avalue   =>  'Guru' )

Custom.pll compilation script

In R12:


cd $AU_TOP/Resource


frmcmp_batch module=CUSTOM.pll userid=apps/<pwd> output_file=CUSTOM.plx module_type=LIBRARY batch=yes compile_all=special

WF_LOAD Script

WFLOAD apps/<pwd> 0 Y DOWNLOAD APINVAPR.wft APINVAPR 


WFLOAD apps/<pwd> 0 Y UPLOAD APINVAPR.wft

Fnd_Load Scripts


Oracle Forms Personalization:
FNDLOAD APPS/<pwd> 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct XX_FORM_PERS.ldt FND_FORM_CUSTOM_RULES function_name=AP_APXINWKB_BATCHES

FNDLOAD apps/<pwd> 0 Y UPLOAD $FND_TOP/patch/115/import/affrmcus.lct XX_FORM_PERS.ldt
Request Group:
FNDLOAD apps/<pwd> O Y DOWNLOAD $FND_TOP/patch/115/import/afcpreqg.lct XX_GL_INQUIRY_REQ_GRP.ldt REQUEST_GROUP REQUEST_GROUP_NAME="Resp_grp_name" APPLICATION_SHORT_NAME="XX"

FNDLOAD apps/$apps_pwd O Y UPLOAD $FND_TOP/patch/115/import/afcpreqg.lct XX_GL_INQUIRY_REQ_GRP.ldt
Concurrent Program:
FNDLOAD apps/<pwd> O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct XX_CP.ldt PROGRAM APPLICATION_SHORT_NAME="XX" CONCURRENT_PROGRAM_NAME="XX"

FNDLOAD apps/$apps_pwd O Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct XX_CP.ldt PROGRAM APPLICATION_SHORT_NAME="XX" CONCURRENT_PROGRAM_NAME="XX" CUSTOM_MODE=FORCE
RTF Template:
select * from xdo_lobs where lob_code = :l_lob_code and file_name like 'XX.rtf' and xdo_file_type = 'RTF'
java oracle.apps.xdo.oa.util.XDOLoader DOWNLOAD -DB_USERNAME apps -DB_PASSWORD <pwd> -JDBC_CONNECTION '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxxx.xxx.xxx)(PORT=xxxx))(CONNECT_DATA=(SERVICE_NAME=xxxx)))' -LOB_TYPE TEMPLATE_SOURCE -LOB_CODE <lob Code> -APPS_SHORT_NAME XX -LANGUAGE en -TERRITORY 00 -lct_FILE $XDO_TOP/patch/115/import/xdotmpl.lct -LOG_FILE $LOG_FILE_NAME

java oracle.apps.xdo.oa.util.XDOLoader UPLOAD \
    -DB_USERNAME APPS \
    -DB_PASSWORD $apps_pwd \
    -JDBC_CONNECTION $jdbc \
    -APPS_SHORT_NAME XX \
    -LOB_TYPE TEMPLATE_SOURCE \
    -LOB_CODE <lob code> \
    -LANGUAGE en \
    -TERRITORY US \
    -XDO_FILE_TYPE RTF \
    -FILE_NAME XX.rtf \
    -CUSTOM_MODE FORCE



Request Set:
Request Set:
FNDLOAD apps/<pwd> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct Test_FNDRS_RS.ldt REQ_SET REQUEST_SET_NAME="FNDRSSUB1054"

FNDLOAD apps/$apps_pwd O Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct Test_FNDRS_RS.ldt UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

Request Set Link:
FNDLOAD apps/<pwd> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct Test_FNDRS_LINK.ldt REQ_SET_LINKS REQUEST_SET_NAME="FNDRSSUB1054"

FNDLOAD apps/$apps_pwd 0 Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct Test_FNDRS_LINK.ldt UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE
Alert:
FNDLOAD apps/$apps_pwd 0 Y DOWNLOAD $ALR_TOP/patch/115/import/alr.lct XX_ALERT.ldt ALR_ALERTS APPLICATION_SHORT_NAME=XX ALERT_NAME="XX - Alert Name"

FNDLOAD apps/$apps_pwd 0 Y UPLOAD $ALR_TOP/patch/115/import/alr.lct XX_ALERT.ldt CUSTOM_MODE=FORCE 

For Web ADI:
Integrator:
FNDLOAD apps/<pwd> 0 Y DOWNLOAD $BNE_TOP/patch/115/import/bneintegrator.lct XX_LDT_FILE_INTG.ldt BNE_INTEGRATORS INTEGRATOR_ASN=XX INTEGRATOR_CODE=<integrator Code>

FNDLOAD apps/$apps_pwd  0 Y UPLOAD  $BNE_TOP/patch/115/import/bneint.lct XX_LDT_FILE_INTG.ldt
Download Layout: 
FNDLOAD apps/<pwd> 0 Y DOWNLOAD $BNE_TOP/patch/115/import/bnelay.lct XX_LDT_FILE_LAYOUT.ldt BNE_LAYOUTS LAYOUT_ASN=XX LAYOUT_CODE=<Layout Name>

FNDLOAD $apps_user/$apps_pwd  0 Y UPLOAD  $BNE_TOP/patch/115/import/bnelay.lct XX_LDT_FILE_LAYOUT.ldt
Download Contents:  
FNDLOAD apps/<pwd> 0 Y DOWNLOAD $BNE_TOP/patch/115/import/bnecont.lct XXOMG_CONTENT.ldt BNE_CONTENTS CONTENT_ASN=XX CONTENT_CODE=<Content code>

FNDLOAD $apps_user/$apps_pwd  0 Y UPLOAD  $BNE_TOP/patch/115/import/bnecont.lct XXOMG_CONTENT.ldt

Download mappings:
FNDLOAD apps/<pwd> 0 Y DOWNLOAD $BNE_TOP/patch/115/import/bnemap.lct XX_LDT_FILE_MAP.ldt BNE_MAPPINGS MAPPING_ASN=XX MAPPING_CODE=MAP_KEY1

FNDLOAD $apps_user/$apps_pwd  0 Y UPLOAD  $BNE_TOP/patch/115/import/bnemap.lct XX_LDT_FILE_MAP.ldt
Lookup:
FNDLOAD apps/<pwd> O Y DOWNLOAD $FND_TOP/patch/115/import/aflvmlu.lct XX_INDICATOR_LK.ldt FND_LOOKUP_TYPE APPLICATION_SHORT_NAME=XX LOOKUP_TYPE=XX_INDICATOR_LK

FNDLOAD $apps_user/$apps_pwd O Y UPLOAD $FND_TOP/patch/115/import/aflvmlu.lct XX_INDICATOR_LK.ldt UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE
Function:
FNDLOAD apps/<pwd> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct XX_LDT_FILE_ADI.ldt FUNCTION FUNCTION_NAME=XX_LDT_FILE_ADI 
FNDLOAD $apps_user/$apps_pwd 0 Y UPLOAD $FND_TOP/patch/115/import/afsload.lct XX_LDT_FILE_ADI.ldt

Menu:
FNDLOAD apps/<pwd> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct XX_LDT_FILE_MENU.ldt MENU MENU_NAME=XX_OBI_SALES_UPLOAD

FNDLOAD $apps_user/$apps_pwd 0 Y UPLOAD $FND_TOP/patch/115/import/afsload.lct XX_LDT_FILE_MENU.ldt
Responsibility:
FNDLOAD apps/<pwd> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afscursp.lct XX_LDT_FILE_RESP.ldt FND_RESPONSIBILITY RESP_KEY=XX_OBI_SALES_UPLOAD

FNDLOAD $apps_user/$apps_pwd 0 Y UPLOAD $FND_TOP/patch/115/import/afscursp.lct  XX_LDT_FILE_RESP.ldt

FND_USER Scripts

Create User:

DECLARE
  v_user_name  VARCHAR2(30):=UPPER('TGSWAMY');
  v_password   VARCHAR2(30):='welcome12';
  v_session_id INTEGER     := USERENV('sessionid');
BEGIN
  fnd_user_pkg.createuser (
    x_user_name => v_user_name,
    x_owner => NULL,
    x_unencrypted_password => v_password,
    x_session_number => v_session_id,
    x_start_date => SYSDATE,
    x_end_date => NULL
  );
  COMMIT;
  DBMS_OUTPUT.put_line ('User: '||v_user_name||'Created Successfully');
EXCEPTION
  WHEN OTHERS THEN
    DBMS_OUTPUT.put_line ('Unable to create User due to'||SQLCODE||' '||SUBSTR(SQLERRM, 1, 100));
    ROLLBACK;
END;

Add Responsibility:

BEGIN
fnd_user_pkg.addresp ('TGSWAMY','SYSADMIN','SYSTEM_ADMINISTRATOR','STANDARD','Add Responsibility to USER using pl/sql',SYSDATE,SYSDATE + 100);
commit;
dbms_output.put_line('Responsibility Added Successfully');
exception WHEN others THEN
       dbms_output.put_line(' Responsibility is not added due to ' || SQLCODE || substr(SQLERRM, 1, 100));
       ROLLBACK;
END;

Reset Password for User:

DECLARE
      l_ret_val BOOLEAN;
      l_user_name   varchar2(50) := 'TGSWAMY';
      l_new_pwd     varchar2(20) := 'welcome123';
BEGIN
      l_ret_val := fnd_user_pkg.changepassword(username=> l_user_name,newpassword => l_new_pwd);
     IF l_ret_val
     THEN
        DBMS_OUTPUT.PUT_LINE('The password is successfully reset to '||  l_new_pwd);
        COMMIT;
     ELSE
        DBMS_OUTPUT.PUT_LINE('The password reset has failed');
     END IF;

END;

ValidateEntity() Method in in Entity Object (EOImpl) file in oaf

-- Method Already available in EOImpl file if you enable check button in EO wizard.

-- Method in EOImpl File
Protected void validateEntity()
{
super.validateEntity();
Double value = Double.parseDouble(getAmount().toString());
if(value > 0)
{
throw new OAException(“Amount Greater than Zero..”,OAException.WARNING);
}
}

Thursday, July 28, 2016

Set custom CSS (Colors) for specific fields in OAF

In Controller ProcessRequst Method():

OAMessageTextInputBean textBean = (OAMessageTextInputBean)oawebbean.findIndexedChildRecursive("Amount");
textBean.setAttributeValue(oracle.cabo.ui.UIConstants.STYLE_CLASS_ATTR, "xx_CSS_property_name");

Set two decimal to Number fields in OAF

In Controller ProcessRequest() method:

OAMessageTextInputBean Baseline_END_DATE7 = (OAMessageTextInputBean)oawebbean.findIndexedChildRecursive("xxAmount");
Baseline_END_DATE7.setAttributeValue(OAWebBeanConstants.CURRENCY_CODE,"USD" );

WF_NOTE in Workflow


select count(*) into L_attr_cnt from wf_notification_attributes where notification_id =  wf_engine.context_nid and name = 'WF_NOTE'  ;
if  L_attr_cnt = 0 then
wf_notification.ADDATTR( wf_engine.context_nid,'WF_NOTE');
end if;
l_sp_comment := wf_notification.getattrtext(wf_engine.context_nid,'WF_NOTE');
wf_notification.SetAttrText(wf_engine.context_nid, 'WF_NOTE', l_sp_comment);

-- Used to Show comments in Comment Column in workflow Notifications.

Dependent MessageChoice in OAF Table Region

Dependent Pick List VO query like:

select unique UOM_CODE lookup_code ,xx_code from xx.xx_tbl
where xx_code = :1

In Controller PR method:

    OAAdvancedTableBean  tableBean

      (OAAdvancedTableBean)oawebbean.findIndexedChildRecursive("ConstAreaDtlsTable");
        OAMessageChoiceBean k = (OAMessageChoiceBean)oawebbean.findIndexedChildRecursive("choiceList");
        k.setListVOBoundContainerColumn(0, tableBean,"DepColvalue1");
        k.setListVOBoundContainerColumn(1, tableBean,"DepColvalue2");
        k.setPickListCacheEnabled(false);                 

//  "DepColvalue1","DepColvalue2" are the Item ID in the page Structure and the choice list query execute based on these values for each row in Table Region Dynamically.
       

Some Examples for above:

OAMessageChoiceBean k1 = (OAMessageChoiceBean)oawebbean.findIndexedChildRecursive(“Applicable1″);
k1.setListVOBoundContainerColumn(0, tableBean2,”ProgramId1″);
k1.setListVOBoundContainerColumn(1, tableBean2,”ConstareaId”);
// k1.setListVOBoundContainerColumn(1, tableBean2,”SaleableareaId”);
k1.setPickListCacheEnabled(false);

OAMessageChoiceBean k3 = (OAMessageChoiceBean)oawebbean.findIndexedChildRecursive(“BudgetCodeFlexValue”);
k3.setListVOBoundContainerColumn(0, tableBean,”BudCodeFlex”);
k3.setPickListCacheEnabled(false);

OAMessageChoiceBean k4 = (OAMessageChoiceBean)oawebbean.findIndexedChildRecursive(“BudgetCodeFlexValue1″);
k4.setListVOBoundContainerColumn(0, tableBean2,”BudCodeFlex1”);
k4.setPickListCacheEnabled(false);

Capture LOV Event in OAF


— In CO ProcessformRequest Method:

if (pageContext.isLovEvent())
{
String lovInputSourceId = pageContext.getLovInputSourceId();
if(“xx_name”.equals(lovInputSourceId))
{
OAMessageLovInputBean lovBean=(OAMessageLovInputBean)webBean.findIndexedChildRecursive(lovInputSourceId);
if(lovBean != null)
{
String lovInput = (String) lovBean.getValue(pageContext);
System.out.println(“–lovInput –“+lovInput);
}
}