12 Replies Latest reply on Oct 27, 2010 5:57 AM by krishna vadlapatla

    How to populate custom table field value into standard DFF

    krishna vadlapatla
      Hi Gurus

      I am newbie to the OAF

      I have a requirement to populate the custom table field value into standard DFF. we enabled the DFF in ReqDistDFFOnAcct(po_req_distributions_all). On the requisition tab as soon as i click on the checkout button, the custom field value has to be shown in the requisition distributions DFF field along with the standard Columns like charge account, percent, qty and when we click on the next button, it has to hit the base table ie., po_req_distributions_all.
      the standard columns data is showing the screen. how to acheive this requirement programatically

      There is a EO for the req distributions table. please help me how to achevie this requirement.

      Any help woud be greatly appreciated.

      Thank You!
      Krishna
        • 1. Re: How to populate custom table field value into standard DFF
          Kurzweil4
          Krishna,

          If I understand you correctly, you want to automatically populate a DFF field?

          Check to see if the View Objects offer access to that column, and if they do, access the VO in an Application Module and set the value there. If the VO does not offer access to that column, see if the Entity Object does and get access to the EO and try to set the values of the columns that way.

          Kurz
          • 2. Re: How to populate custom table field value into standard DFF
            krishna vadlapatla
            Hi Kurz

            Thanks for your quick response. Your understanding is correct.

            The View object offers access to that Attribute field, following is the VO and there is also an EO for that VO. How do i bring the custom field upto this VO. Do i need to create a new VO for custom SQL and then map that particular field to that attribute based on the requisition_line_id? Could please help me how to do the coding. can you please share if you have any sample code for it. I am quite novice to the OA Framework

            oracle.apps.icx.por.req.server.PoReqDistributionsVO,oracle.apps.icx.por.schema.server.PoReqDistributionEO & RequisitionAM

            Thank You!
            krishna
            • 3. Re: How to populate custom table field value into standard DFF
              Gauravv
              Hi,

              First grab the value which you want to set in string variable.

              String value = row.getAttribute("AttributeName");

              Now just check what is the attribute name for the DFF Field. Suppose its Attribut2

              then grab the DFF VO.

              OAViewObject vo = (OAViewObject)pageContext.getApplicationModule(webBean).findViewObject("DFFVO");
              Row row = (Row)vo.first();
              row.setAttribute("Attribute2",value);

              Thanks,
              Gaurav
              • 4. Re: How to populate custom table field value into standard DFF
                krishna vadlapatla
                Thanks Gaurav, this is really help ful. I want to extend the controller, please correct me if my approach is wrong.
                If my approach is wrong please suggest what kind of extension i need to do.

                Extending the controller and writing the logic in the process request
                1) first getting the application module
                2) getting the Cutom table field value from the SQL Query by creating a dynamic VO within the controller.
                3) Finding the VO which has that DFF field.
                4) get the result value from the dynamic VO from step 2
                5) set value to the dff Attribute field for the current row.

                Framework java coding is new to me. can you please provide the sample code so that i can mimic the approach. Any help will be greatly appreciated.

                Regards
                Krishna
                • 5. Re: How to populate custom table field value into standard DFF
                  Gauravv
                  Hi,

                  Extend the controller and in process request make use of Prepared Statement
                  to execute the query and get the results.

                  No need for creating a dynamic VO.

                  As you grab the value then you can set it on DFF Field by the code as i gave you.

                  Thanks,
                  Gaurav
                  • 6. Re: How to populate custom table field value into standard DFF
                    ORA_AJ
                    Here is how you can use for Prepared Statement

                    http://oracleanil.blogspot.com/2009/04/serialqueryvoxml.html

                    Thanks
                    AJ
                    • 7. Re: How to populate custom table field value into standard DFF
                      803889
                      Thanks Gourav, AJ....I am really struggling to write the code in controller extension,
                      Could you please provide sample that has process request and prepared statement code and setting the attribute.




                      Regards
                      krishna
                      • 8. Re: How to populate custom table field value into standard DFF
                        ORA_AJ
                        Krishna

                        The link that i have forwarded you already contains how to use prepared statement.I would suggest go through it .

                        http://oracleanil.blogspot.com/2009/04/serialqueryvoxml.html

                        Thanks
                        AJ
                        • 9. Re: How to populate custom table field value into standard DFF
                          803889
                          Thanks Aj. Finally i made some progress....but i am getting an error in the inst_top OPMN folder 10/10/08 15:37:14 Error: <connector name="OracleASjms" path="OracleASjms.rar" /> will not be bootstrapped since corresponding module declaration was not found in application.xml. I cleared the cache, bounced the webserver. Could not able to understand what is this error

                          Following is the code that i have written. I am not able to find out what is the error. please help me how to fix this error. there is no changes in the page and the value is not auto populating. the page is having the normal behaviour as the standard one.

                          Thanks in Advance for your help...


                          public class xxCheckoutDistsCO extends CheckoutDistsCO
                          {

                          public void processRequest(OAPageContext pageContext, OAWebBean webBean)
                          {
                          super.processRequest(pageContext, webBean);

                          String UnitId="";

                          //First get the Application Module
                          OAApplicationModule am = pageContext.getApplicationModule(webBean);


                          OAViewObject vo = (OAViewObject)am.findViewObject("PoRequisitionLinesVO");
                          String Reqlineid="";
                          String Linenum="";
                          String DeliverLoc="";
                          if(vo.first() !=null)
                          {
                          Reqlineid= vo.first().getAttribute("RequisitionLineId").toString();
                          Linenum = vo.first().getAttribute("LineNum").toString();
                          DeliverLoc = vo.first().getAttribute("DeliverToLocationId").toString();

                          // if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
                          // {
                          // pageContext.writeDiagnostics("TEST >", Reqlineid,1);
                          // pageContext.writeDiagnostics("TEST >", Linenum,2);
                          // pageContext.writeDiagnostics("TEST >", DeliverLoc,3);
                          // }

                          }
                          UnitId=null;
                          String Querry="select amli_icx_oaf_utils.get_blding_unit_id (?,?,?) from dual";
                          try
                          {
                          PreparedStatement ps=am.getOADBTransaction().getJdbcConnection().prepareStatement(Querry);
                          ps.setInt(1,Integer.parseInt(Reqlineid));
                          ps.setInt(2,Integer.parseInt(Linenum));
                          ps.setInt(3,Integer.parseInt(DeliverLoc));
                          ResultSet rs=ps.executeQuery();
                          // ps.execute();
                          // am.getOADBTransaction().commit();
                          while (rs.next())
                          {
                          System.out.println(" Query Results ");
                          UnitId= rs.getString(1);
                          System.out.println(" first > ");

                          }
                          rs.close();
                          ps.close();
                          }
                          catch(SQLException a)
                          {
                          System.out.println(" Error "+a);
                          System.out.println(" Second > ");
                          }

                          System.out.println(" Third > "); ----the program is executing upto here...it is not setting the value after this.
                          OAViewObject povo = (OAViewObject)am.findViewObject("PoReqDistributionsVO");

                          if(povo.getCurrentRow()!=null ) --------If i remove this condition i am getting the nullpointer exception in page.....
                          {
                          System.out.println(" Fourth > ");

                          povo.getCurrentRow().setAttribute("Attribute12",UnitId);

                          // if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
                          //{
                          // pageContext.writeDiagnostics("TEST >", UnitId, 1);
                          //}


                          }

                          }

                          }


                          Thanks
                          krishna
                          • 10. Re: How to populate custom table field value into standard DFF
                            Kurzweil4
                            Krishna,

                            You are doing some things here that you should not be doing. First you should not be finding a view by a hard-coded name. You should be calling the getXxxVO of the AM. Second, you should really void calling prepared statements in OAF code. Third, you should be working with VOs only in the AM. Fourth, you should not be calling the getAttribute() on a row unless you have no choice for some reason. Use the VO row client interface and call getRequisitionId(), or use the RowImpl class of there is no client interface.

                            Here is what you can do to avoid these:

                            Create a custom AM. Personalize the page and add a stacked layout item. Make the AM of the stacked layout your custom AM, full path (not the Impl).

                            In your custom AM you will import the AMImpl of the AM of the page for which you are extending the controller. In your custom AM, you will create a public method to do your work. Create an interface class for your custom AM by going to the AM dialog->Client Methods and moving your method to the right.

                            Create a VO for the query of the prepared statement you had and add this to your custom AM. Use :1, :2, and :3 instead of ?. See the Java docs and dev guide to see how to execute your VO with the parameters.

                            In the method in the custom AM, call rootAMImpl = (rootAMImpl) this.getRootApplicationModule() to get the root AM of the page. Now you have access to the rootAM.getPoRequisitionLinesVO().

                            In the method in the custom AM, do this.getMyVO() and call executeQuery(), then use the getXxx() methods of the row class.

                            In your extended controller, do something like this:

                            OAStackLayoutBean stackBean= ( OAStackLayoutBean ) webBean.findChildRecursive( "IDOfPersonalizedStackLayout" );
                            ClientInterfaceForYourAM yourIntfForAM = ( ClientInterfaceForYourAM ) pageContext.getApplicationModule( stackBean);
                            yourIntfForAM.yourWorkMethod();

                            If you follow the above, your error will likely go away, and you won't be breaking so many rules ;-)

                            Kurz
                            • 11. Re: How to populate custom table field value into standard DFF
                              gareth.roberts
                              I may be missing something here, but if you want a custom field from custom table in a standard DFF, you can define value set on custom table and have that value set on the DFF segment? No custom code needed...

                              Regards,
                              Gareth
                              • 12. Re: How to populate custom table field value into standard DFF
                                krishna vadlapatla
                                Hi All

                                Finally my issue is resolved by following the below approach. Thank you all for your support. I am closing the thread now.

                                1) created a message text input bean for DFF attribute10 field in the shopping cart page for requistion lines VO.
                                2) next extended the controller in the shopping cart page and wrote the defaulting value logic in PR for the above attribute field.
                                3) Enabled the descriptive flexfield for attribute10 in PO Req distributions. when we enable the DFF on the forms, a message text input will automatically create on the page (CheckOutDistPG).
                                4) Using por_custom_pkg defaulted the attribute10 value in PO Req distributions which was captured in the step1.
                                In standard plsql hook, I wrote the below logic por_custom_pkg.custom_default_req_dist

                                IF line_att10 IS NOT NULL
                                THEN
                                distribution_att10 :=line_att10 ;
                                --ELSE
                                -- distribution_att10 := NULL;
                                END IF;

                                5) I have set the rendered property to false for attribute10 field in shopping cart page to hide (in my requirement i don't have to show on the requisition lines level).

                                6) Once we default the DFF attribut10 value in PO Req Distributions, the standard functionality will carry over this field to the PO Distributions. (Showing this Value in PO Distributions is my final destination)


                                Regards
                                Krishna