Getting run time value on form field by sql query and function

Hi All,
we have below requirement -
create a form with fields as below -
KRA_Type Grade Weightage Start Date End date
Functinal E2 30 1-Jan-2010 1-jan-2011
Organizational E2 70 1-jan-2010 1-jan-2011
lov of kra_type has 2 values (Functinal, Organizational). requirement is to validate Weightage field such that for same grade :- Fuctional Weightage + Organizational Weightage = 100.
please suggest on how to approch this.
Thanks,
Sam D

this is not related to FORMS at all......
1) create a database function which take grade parameter and return the total weightage.
2) use it on when-validate-item trigger to validate
create or replace function get_grade_weightage(p_grade varchar2)
return number
is
v_grade number;
begin
  select sum(Weightage)
   into v_weightage
  from mytable
where grade = p_grade;
exception when no_data_found then
   return 0;
end;
select get_grade_weightage(:grade)  into v_weigtage from dual;
if :current_weigth < v_weightage then
    -- do something
else
  --do something
end if;Hope it helps
plz mark the answer as correct or helpful if it is

Similar Messages

  • Get the Last Value of Status Field from SQL TABLE using SQL 2008

    I have a table with Fields such as
    UploadstartTime, UploadEndtime, STATUS From TBLA.
    The STATUS Field, has values =7 and 11 are failed and 12 is SUCCESS. I cannot do a max, since it will always show 12, I need to get the MAX(UPLOADENDTIME, and get STATUS For that record. How can I do that using 1 SQL Query?
    My current code is: The issue is
    select
      TBLNAME
    MaxUploadstarttime
    =
    max(UploadStartTime),
    MaxUploadEndtime
    =
    max(UpLoadEndTime),
         Status=max(status)
    from  DB.DBO.LOGTABLE
    p1

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. You failed! Temporal
    data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    >> I have a table with Fields such as <<
    Fields are not columns! There is no generic status in RDBMS. Putting “tbl-” in a table name is called tibbling and we make fun of people who do it (Google Phil Factor's humor columns. If you were polite is this what you wanted to post? 
    CREATE TABLE Something_Uploads
    (upload_source_name CHAR(15) NOT NULL,
     upload_start_timestamp DATETIME2(0) NOT NULL,
     PRIMARY KEY (upload_source_name, upload_start_timestamp),
     upload_end_timestamp DATETIME2(0),
     CHECK(upload_start_timestamp < upload_end_timestamp),
     upload_status INTEGER NOT NULL 
       CHECK (upload_status IN (7,11,12, ..))
    >> I cannot do a max, since it will always show 12, I need to get the MAX(UPLOADENDTIME, and get upload_status For that record [sic]. How can I do that using 1 SQL Query?  <<
    Since you told us nothing and gave no sample data, want to correct this postign? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Get maximum value in a field using SQL query

    Hi,
    I want to retrieve the row containing the maximum value for a particular field.
    select max(fieldname) from tablename
    How do I do this using database connectivity toolkit.
    Shiva

    Hello,
    I figured out the answer. It was sql syntax.
    Thanks for coming in here to help.
    I created another post earlier because I had a little different question that pertained to fetch.vi.  How do you get an array out from fetch.vi without creating error. I also made type an array also but it does not allow an array.
    Thanks for your help.
    By the way, how do I as the original poster get rid of a whole thread I created, especially if its a duplicate.

  • Passing multiple values to a parmeters in SQL Query

    Hi friends,
    I have the following requirement -
    I need to pass multiple values to the parameter 'WHERE hou.name = (:id1)' and the query is copied below for your reference .
    SELECT partno part_num,
         customer customer_name,
         hou.name op_name
         FROM hr_organization_units hou,
         oe_transaction_types_all sot,
         ra_customers rc,
         ra_addresses_all ra,
         ra_site_uses_all rsu,
         oe_order_headers_all h,
         oe_order_lines_all l,pwr_sod50 ps
         WHERE hou.name = (:id1)
    -- and hou.name = (:id4)
    --hou.name in ('CPS FRANCE','CPS GERMANY')
    --and hou.name = (:id1,hou.name)
         and trunc(ps.sch_ship_date) between nvl(:id2,trunc(ps.sch_ship_date)) and nvl(to_date(:id3)+.99999,trunc(ps.sch_ship_date))
         and ps.group_id = 9999999
         and hou.organization_id=h.org_id
         and ps.line_id =l.line_id
         and l.header_id =h.header_id
         and h.invoice_to_org_id=rsu.site_use_id
         and rsu.address_id =ra.address_id
         and ra.customer_id =rc.customer_id
         and h.order_type_id =sot.transaction_type_id
    Looking for your help on this.
    Thanks In Advance.
    Thanks & Regards
    Ramya Nomula

    Hi karthik,
    I am sorry for the wrong updation of my anonymus block.
    My requirement is to pass a multiple values to the parameter in SQL query, and here is the code which is working now for the multiple values with ourt single quotes to the values -
    SELECT partno part_num,
         customer customer_name,
         ps.customer_id customer_id,
         avail_qty avail_qty,
         sch_ship_date schedule_Ship_date,
         so_num order_no,
         h.header_id header_id,
         line_num line_no,
         l.ordered_quantity ordered_quantity,
         scd_qty qty_open,
         s_price unit_price,
         part_flag flag,
         sub_inv subinv,
         sbu,
         hold,
         qoh,
         line_detail_id detail_id,
         picking_line_id,
         picking_line_detail_id,
         rc.customer_name cust_name,
         rc.customer_number customer_number,
         rsu.location location,
         sot.attribute5 order_type,
         ps.line_id line_id,
         h.transactional_curr_code transactional_curr_code,
         hou.name op_name
         FROM hr_organization_units hou,
         oe_transaction_types_all sot,
         ra_customers rc,
         ra_addresses_all ra,
         ra_site_uses_all rsu,
         oe_order_headers_all h,
         oe_order_lines_all l,pwr_sod50 ps
         WHERE ','||:id1||',' like '%,'||hou.name||',%'
         and trunc(ps.sch_ship_date) between nvl(:id2,trunc(ps.sch_ship_date)) and nvl(to_date(:id3)+.99999,trunc(ps.sch_ship_date))
         and ps.group_id = 9999999
         and hou.organization_id=h.org_id
         and ps.line_id =l.line_id
         and l.header_id =h.header_id
         and h.invoice_to_org_id=rsu.site_use_id
         and rsu.address_id =ra.address_id
         and ra.customer_id =rc.customer_id
         and h.order_type_id =sot.transaction_type_id;
    Condition for sending multiple Oprtaing Units -
    WHERE ','||:id1||',' like '%,'||hou.name||',%'
    This above condition is working when i am passing multiple values with out single quotes...but not working for multiple values with single quotes.
    Sample queries tested -
    select 1 from dual where ',aa,bb,cc,' like '%,bb,%' (This is working)
    select 1 from dual where ','aa','bb','cc',' like '%,'bb',%'(This is not working).
    Thanks In Advance!
    Looking for Your Great Help.
    Thanks & Regards
    Ramya Nomula

  • When I try to use the Submit Form button on the Interactive PDF I created (IN Design CS6) I get this message. "There is no value in form field 'Program.' Please put in it before proceeding. What can I do to fix this and make the Submit button work?

    When I try to use the Submit Form button on the Interactive PDF I created (In Design CS6), I get this message:
    There is no value in form field "Program." Please put in it before proceeding.
    How can I fix this and make the Submit Form button work?

    Are you running modified software on your phone?  This error seems to be common if the firmware has been modified and you're trying to restore the phone again. 

  • How to convert the value in GET RUN TIME statement in minutes value...

    Hello Experts,
    As I understand, the value that is being passed from GET RUN TIME FIELD statement
    is in microseconds. Now, how do I convert it in minutes value?
    Thank you guys and take care!

    This will give in Hours , minutes, seconds.
    data time type sy-uzeit.
    get time field time.
    write time.
    Check it.

  • Onblur get values for form field from table.

    Hello,
    I created one from with report for TableA.TableA has 5 column. Now after i enter first field ,on blur, i want 2 other fields should get populated.They should get the 2 values from TableB.Table A and Table B are connected through primary key foreigh key constraint.First field is primary key of TableA.
    How can i do this.I am writing a javascript function which i am calling from first form field.
    But in the function how to take values from the table for the other 2 fields.
    Can i just Select statements inside javascript function?
    Thanks
    Swapna.T

    Swapna,
    You can do this using AJAX. See link.
    Hope it helps
    Cheers,
    Hari

  • How to pass a run time value as a parameter to a webdynpro iview

    Hi,
    we have a webdynpro which we can call with passing a run time value in this form:
    https://xxx.yyy.zzz/sap/bc/webdynpro/sap/zfkq_inv_1?WI_ID=000000004332&sap-client=700&sap-language=EN&sap-wd-sapgui=X
    This link will be sent to many users but the WI_ID will change every time.
    It works fine but now we want to implement this webdynpro in our portal. The user shall get a link like this
    https://xxx.yyy.zzz/irj/portal/webdynpro-test?wi_id=000000004332. With this link he will navigate directly to the webdnypro (quicklink-function).
    The problem is that i don't know how to transfer the parameter WI_ID in the url to the webdynpro.
    It's no problem to fix the WI_ID in the application parameter properties but this is not what we want.
    Is it possible to transfer the url parameter to the application parameters of the webdynpro iview ?
    Thanks in advance.
    Best Regards
    Mirko Berscheidt

    Hi Mirko,
    The first thought I had is if your scenario makes sense at all. Because you might send out the links, but probably the iView will also be accessible via navigation, and in that case this additional parameter won't be there!?! (And if the iView is not accessible by navigation, then why going the way via the portal and not the direct way to the application like with your first link given?!).
    Anyhow, I think this should be possible by using the AppIntegrator, see The customer exit of the Application Integrator
    For an example about how to add individual values to users which you then can add to the URL see this discussion: App Integrator, and custom URL parameters using Customer Exits - this might be a possibility that each user can call the "same" iView but in fact the app integrator then would be fired with different URL parameters (per user).
    Hope it helps
    Detlev

  • Setting default value for form field assoc with a table column

    On a "Create Record" situation I was trying to set the default values of some form fields using a page level "Process". These form fields have Source Type = Database Column. It wasn't working, I could only set non-db assoc form field values no matter when the "Process" was set to exec. From some other posts it seems that this is by design, ie. not being able to programatically set the initial values of form fields that are sourced to db columns. I was hoping to have just one "Process" that would exec to set these initial values in one place rather than scattered about for each field that needed a default value. These particular default values come from ref tables and may be different for each user.
    So, it looks like I have to use a "Default Value" plsql chunk for each field on the form itself or else set their value on the calling form's Redirect in the "Set these Items" area.
    Is this correct?

    You could define a database function which accepts the name of the item and the user ID of the user running the application. Based on the item name and the user ID have the function return the appropriate initial value. Invoke this function in a "Default Value" PL/SQL block.
    Does that help in centralizing your initial values? You could have one function per page or one function per application. I would do one function per application.

  • Run Time: type conflicts in field symbol

    In this statement i am getting run time error : assign component.
    type conflicts in field symbol
    FIELD-SYMBOLS:
        <fs_tab> TYPE ANY table,
         <wa_tab> TYPE ANY,
         <fs_field> type crmd_orderadm_h.
    DATA:      w_data    TYPE REF TO data.
    CREATE DATA w_data TYPE STANDARD TABLE OF (c_tabname) WITH NON-                     UNIQUE DEFAULT KEY.
        ASSIGN w_data->* TO <fs_tab>.
    SELECT * FROM (c_tabname)
              INTO CORRESPONDING FIELDS OF TABLE <fs_tab>
      LOOP AT <fs_tab> ASSIGNING <wa_tab>.
          DO.
            ASSIGN COMPONENT sy-index OF STRUCTURE <wa_tab> TO <fs_field>.
    *Writeing: fs_field here*
    Enddo.

    FIELD-SYMBOLS: <fs_field> type crmd_orderadm_h.
    <fs_field> type any.
    i cannot pass "
      lv_header_guid =    <fs_field>-guid.
    complete code as follows.
      LOOP AT <fs_tab> ASSIGNING <wa_tab>.
          DO.
            ASSIGN COMPONENT sy-index OF STRUCTURE <wa_tab> TO <fs_field>.
    *i am assining fs_field-guid here. Thats why i am taking this field symbol as type "crmd_orderadm_h"*
    *bold* * <fs_field>-guid.*bold**
            lv_header_guid =    <fs_field>-guid.
            iv_header_guid = lv_header_guid.
            REFRESH: lt_header_guid.
            INSERT iv_header_guid INTO TABLE lt_header_guid.
            REFRESH: im_orderadm_h,im_text.
            CALL FUNCTION 'CRM_ORDER_READ'
              EXPORTING
                it_header_guid       = lt_header_guid
              IMPORTING
                et_orderadm_h        = im_orderadm_h
                et_text              = im_text
              EXCEPTIONS
                document_not_found   = 1
                error_occurred       = 2
                document_locked      = 3
                no_change_authority  = 4
                no_display_authority = 5
                no_change_allowed    = 6
                OTHERS               = 7.
            IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            ENDIF.
          ENDDO.

  • Kp26 getting run time error  in program "COCC2009 "

    Dear all
    Im getting run time error massage once the KP26 running . "The data object "ITDAT1" has no component called "TXTUPL", but there is a component called "TXTUP".
    The following syntax error occurred in program "COCC2009 " in include "RKCCAI02
    We are working on upgraded system. please hep me to solve this issue.
    Regard,
    nawa

    Hi
    I am using ECC 6.0 and when I checked the field mentioned TXTUPL, it is available there.
    Can you check the COCC2009 program whether the field is there or not.
    Shiva

  • Getting run time error while calling smartform

    hi,
    i am getting run time error of "maintain output device in your master data" while calling smart form.
    p_output_options-xsfcmode = 'X' .
      p_output_options-xsf = space .
      p_output_options-xdfcmode = 'X' .
      p_output_options-xdf = space .
      p_output_options-tddest = 'LP01'.
      p_output_options-tdnewid = 'X'.
      p_output_options-tddelete = SPACE.
      p_control_parameters-no_dialog = 'X' .
      p_control_parameters-getotf = 'X' .
      p_control_parameters-DEVICE = 'PRINTER'.

    Hi Neha
    Your program looks out for the default printer configured against your user (Check SU01 : Constant tab ). You dont seem to have maintained it properly as a result of which you get this message. You will have to configure your printer device to overcome this error.
    Choose menu: System -> User Profile -> Own data.
    On the Defaults tab, give LOCL code for the output device.
    You can also check the output device setting in transaction SPAD.
    Regards,
    Uday

  • I get run time error in step Set Report in reportgen_xml sequence

    I get run time error in step "Set Report" in reportgen_xml.seq. The error code is "Out of memory".
    I don't know what to do.
    I use BatchModel, I have 6 batch loops. The problem appears on the 3d loop. I have NI 3.5.
    Help me!!!!!!
    I send attachment (screen of error).
    Attachments:
    problem.jpg ‏106 KB

    Hi Terry, it happened again :-(
    Actually I see that the problem appeares in the same subsequence of my sequence. In that  subsequence I have approximately 25 numeric steps, 6 of them are on skip now.
    The problem appeares suddenly after many batch loops.  I have the message "Error, Parameter new value: Out of memory. [Error code -17000, out of memory].
    After that on next loop I see it runs and writes reports for others subsequences and steps, but on the "problem subsequence" again I get message "Out of memory"...
    At the one of the problem loops I saw other message "An error occured calling 'Process One Result' in ITSO FlyReportGen of TestStand on-the-Fly-Report-Generator. Out of memory. Source: TSOTFRG  [Error Code: -17000, Out of memory].
    I use "Discard Results or Disable Results " enable option in the ModelOptions. But without success. Is this a problem of TestStand or may be is this the special problem of my subsequence or any step in that subsequence?

  • Dynamic Query and default run-time values

    I am trying to build a dynamic query within dreamweaver and
    retain access from the bindings panel.
    here is a simple pseudo-query I want to expand on.
    "SELECT object FROM objects_table WHERE widget_number =
    widgets"
    widgets is set up as a variable with a run-time value that
    relates to $_GET['widgets']
    this works fine but now i want to expand on this so the query
    returns all results if $_GET['widgets'] is undefined. I was hoping
    I could set the default value for widgets to equal widget_number so
    I would get....
    "SELECT object FROM objects_table WHERE widget_number =
    widget_number" but the runtime query is actually
    "SELECT object FROM objects_table WHERE widget_number =
    'widget_number' " which obviously doesn't work.
    I can alter the query manually from the code view but then I
    lose access to the bindings panel as dreamweaver doesn't parse the
    query properly.
    Any pointers?
    Thanks in advance
    - Andrew

    Andy Millne wrote:
    > That will work fine server-side yeah but dreamweaver
    cannot parse the code at
    > design time so by altering the code in this way you lose
    access to the bindings
    > panel and all the server behaviours that depend on the
    recordset have
    > exclamation marks alongside.
    This is simply a question of organizing your workflow. As you
    have
    discovered, Dreamweaver no longer recognizes a recordset if
    you make
    changes to the basic structure of the code. The answer is to
    use
    Dreamweaver to construct your page using an unaltered
    recordset. Once
    the design stage is complete, make the changes required by
    inserting
    your conditional statement. Yes, the fieldnames disappear
    from the
    Bindings panel, and you get exclamation marks in the Server
    Behaviors
    panel, but that's not important. If you need to restore them
    for any
    reason, just wrap the changes in /* */ comments. Remove the
    comments
    when you have finished.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Help Please!!! - Unable to read or execute SQL with Next Run Time value.

    Hello,
    We have a requirement where we need to pick the results every five minutes based on the scheduler task "Next Run Time" value. The below is the SQL which was used to run the task every 5 minutes
    SELECT <%RESULTS%>
    FROM
    <%SCHEMA%>.FCI_MAS_CONTACT T1
    RIGHT OUTER JOIN <%SCHEMA%>.FCI_MAS_VENDOR T2
    ON (T2.OBJECTID = T1.PARENT_OBJECT_ID)
    WHERE
    T1.CONTEXTID=<%CONTEXT(masterdata.Contact)%>
    AND T1.INACTIVE=0
    AND T2.INACTIVE=0
    AND T1.CREATED_AT>=
    SELECT
    (ALERT_AT_DATETIME - NUMTODSINTERVAL('5','MINUTE'))
    FROM
    <%SCHEMA%>.FCI_SYS_MANAGED_DAEMON SD,
    <%SCHEMA%>.FCI_SYS_ALERT SA
    WHERE
    SD.INACTIVE = 0
    AND SA.OWNERREF_CLASS_ID = 10502
    AND SA.OWNERREF_OBJECT_ID = SD.OBJECTID
    AND SD.SYSTEM_MANAGED <> 1
    AND SD.CONTEXTID=<%CONTEXT(common.ManagedDaemonType)%>
    AND SD.DISPLAY_NAME = 'Vendor Sync Program'
    OR
    T1.MODIFIED_AT >=
    SELECT
    (ALERT_AT_DATETIME - NUMTODSINTERVAL('5','MINUTE'))
    FROM
    <%SCHEMA%>.FCI_SYS_MANAGED_DAEMON SD,
    <%SCHEMA%>.FCI_SYS_ALERT SA
    WHERE
    SD.INACTIVE = 0
    AND SA.OWNERREF_CLASS_ID = 10502
    AND SA.OWNERREF_OBJECT_ID = SD.OBJECTID
    AND SD.SYSTEM_MANAGED <> 1
    AND SD.CONTEXTID=<%CONTEXT(common.ManagedDaemonType)%>
    AND SD.DISPLAY_NAME = 'Vendor Sync Program'
    While we run the above SQL as scheduler task, we do not see any output. However when we run this as a standalone, we see the results. Please advice if we have missed any step while run the report as schedule task.
    Rgds,
    Vinod

    Hi
    Have you:
    1. Assigned a valid agent to your task - and have you checked that agent found is within the range of valid agents
    2. If you have transported / or is testing on another client, remember that agent assignment must be made on that system as well - and remember - SWU_OBUF.
    3. if this does not help check the authorizations  -  display access to authorization PLOG is required for infotype 1000, 1001 for objecttype AC.
    Regards
    Morten Nielsen

Maybe you are looking for

  • Xcode breakpoints not catching

    I've been having some trouble in XCode where breakpoints won't catch sometimes. In all cases, the breakpoint indicator on the left side of the source editor window shows up as orange with a blue outline. They are usually solid blue. But when I debug

  • Xperia Z2 Does not detect earphones

    Hi All, My sony xperia Z2 mobile phone does not detect sony xperia or any other earphones.Can anyone one help me in this?

  • How to display data sent from a midlet to a servlet over an outputstream in

    a browser?? Hello Currently I send data to a servlet from a midlet and the servlet recieves and processes the data (confirmed through breakpoints) but I want to display the data in a JSP or directly thru the servlet using html tags. However I can for

  • Is "Find your iPhone" the only way to locate a stolen iPod?

    Was just wondering was it the only way to locate iPod.

  • Can't play MP4 files

    Today after i downloaded some MP4 files at first it was telling me so and so mp4 file is not a valid win32 application after uninstalling and reinstalling quicktime now when I try to play the file only like a quarter of the quicktime window even show