Updating EBAN table with custom field values for BAPI_PR_CREATE

Hi all,
My requirement is PR creation by BAPI_PR_CREATE Function Module .
for pr item level customer added 10 fields in the EBAN table append structure CI_EBANDB. .
i am creating PR by using Funcation module BAPI_PR_CREATE.
In this Function Module I have to pass the structure name and field values in the EXTENTIONIN .
what is the structure name I have to pass and how populate data in to the EBAN table.
after that i have to create PR and updating 10 two custom field values in the EBAN Table.
how to proceed for updating the customer field values in the eban table.
thanks in advance.
sri

Hi
First you need to append a  structure in EBAN table, The values you need to pass to the
BAPIPAREX - Ref. structure for BAPI parameter ExtensionIn/ExtensionOut
Structure will be the appen strucre created in EBAN.
You can pass the values of the 10 fileds to the VALUEPART1, VALUEPART2 fileds in the structure with 240 charcters each.
Hope this helps.
Thanks & Regards
Kishore

Similar Messages

  • Updating EBAN TAble with custom field values by BAPI_PR_CREATE

    Hi all,
    My requirement is PR creation by BAPI_PR_CREATE Function Module .
    for pr item level customer added 10 fields in the EBAN table append structure CI_EBANDB. .
    i am creating PR by using Funcation module BAPI_PR_CREATE.
    In this Function Module I have to pass the structure name and field values in the EXTENTIONIN .
    what is the structure name I have to pass and how populate data in to the EBAN table.
    after that i have to create PR and updating 10 two custom field values in the EBAN Table.
    how to proceed for updating the customer field values in the eban table.
    thanks in advance.
    sri

    Hi Sri,
    better you dont use it. try this..
    example code:
    data: i_banc type bapiebanc occurs 0 with header line.
    data: i_bkn type bapiebkn occurs 0 with header line.
    data: i_ret type bapireturn occurs 0 with header line.
    data: i_band type bapieband occurs 0 with header line.
    data: i_bantx type bapiebantx occurs 0 with header line.
    data number type bapiebanc-preq_no.
    i_banc-acctasscat = par_asset.
    i_banc-short_text = 'VehicleBooking'.
    i_banc-quantity = '1'.
    i_banc-DEL_DATCAT = '1'.
    i_banc-deliv_date = par_date .
    i_banc-mat_grp = 'TRAVEL'.
    i_banc-unit = 'ST'.
    i_banc-c_amt_bapi = 100.
    i_bkn-cost_ctr = par_cost.
    i_bkn-g_l_acct = par_gl.
    i_bkn-fund = par_fund.
    i_bkn-funds_ctr = par_fund_ctr.
    append i_banc.
    append i_bkn.
    call function 'BAPI_REQUISITION_CREATE'
    exporting
    skip_items_with_error = 'X'
    importing
    number = number
    tables
    requisition_items = i_banc
    requisition_account_assignment = i_bkn
    requisition_item_text = i_bantx
    return = i_ret
    Describe table i_ret lines count.
    If count > 0.
    loop at i_ret.
    Message e000(zbooking) with i_ret-message
    endloop.
    Endif.
    if not number is initial.
    S000(zbookings) with 'Requisition number ' , number ,' created'.
    endif.
    thanks
    trinadh

  • Problem in updating FPLT Table with custom fields of the billing plan

    Hi Guys
    I have a requirement to add 2 custom fieldd in the billing plan tab of sales order and I could not find any screen exit for that. However I got access key and added those 2 fields on the screen but I am not able to uodate table FPLT from there.
    I can see exits to pass the value but because there is no screen exit, the program cant retain the values keyed given by use on the screen.
    I really dont know where do I need to write the code and how to make screen fields read by the program.
    Please please help.
    Thanks a lot

    Hi,
    Probably too late, but here's the solution:
    - Transaction SE51 program: SAPLV60F and dynpro number: 0030
    - Goto 'Logical execution' or something like that (i'm connected in french)
    -  Modify standard code line 75: here I have added the field 'LIBEL'
        FIELD:
          FPLT-FAKSP,
          FPLT-FAREG MODULE FPLT-FAREG_PRUEFEN ON REQUEST,
    *{   REPLACE        DTAK910958                                        1
    *\      FPLT-FPTTP.
          FPLT-FPTTP,
          FPLT-LIBEL.
    *}   REPLACE
        CHAIN.
    Il means that field LIBEL will be checked with field FPTTP.
    regards.

  • How to update database table with key field?

    Hello Experts,
    I have a database table with following fields
    MATNR   - Key
    SSOUR  -  Key
    KUNNR   - Key
    MENG1 
    MENG2
    MENG3
    And this table contains records like...
    MSD50001     R      1000001     5.30    2.30    5.25
    MSD50002     R      1000002     5.30    2.30    5.25
    MSD50003     R      1000003     5.30    2.30    5.25
    MSD50005     R      1000004     5.30    2.30    5.25
    MSD50004     R      1000005     5.30    2.30    5.25
    I have an internal table with same fields of above database table.
    MSD50001     A      1000001     5.30    2.30    5.25
    MSD50002     A      1000002     5.30    2.30    5.25
    MSD50003     A      1000003     5.30    2.30    5.25
    MSD50005     A      1000004     5.30    2.30    5.25
    MSD50004     A      1000005     5.30    2.30    5.25
    MSD50006     A      1000006     5.30    2.30    5.25
    I want to update the DB table with following internal table records.
    If internal table records = db table records are same then Update....else insert from internal table to db table.
    But here, SSOUR is key field so i am not able to use
    MODIFY dbtab from itab.
    It results me , entries in internal table are inserted into db table.
    So i have double records.
    Is there any statement which updates the key field? and if no fields in db table then insert it?
    Regards
    RH

    hi,
    u cannot update akey field.u can update only non key fields by using key field as a selection criteria.For example if u go to sm30 if u enter any table for inserting values, the key field will always be greyed out it is not succumbed to chnges.but u can insert value into ,if ur inserting and in the insert staemnet if  u have key field which is already present in the table it will return sy-subrc = 4 otherwise it will insert the record and return 0.
    eg for update :
    UPDATE zdm_wtyprof  SET upload_status = 'S'
                             WHERE spart = wa_upd-spart.
    here spart is the key field and it will update the status field in the table as S.
    if updated succesfully it will return 0.
    SIMILARLY U CAN USE select.

  • How can I update the table with a single query for...

    I have a table with columns C1 and C2.
    C1 C2
    A1 null
    A1 null
    A1 null
    A1 null
    A2 null
    A2 null
    A2 null
    A3 null
    A4 null
    A4 null
    I want to update my table with a single query so that I would have data like
    C1 C2
    A1 1
    A1 2
    A1 3
    A1 4
    A2 1
    A2 2
    A2 3
    A3 1
    A4 1
    A4 2
    The updated column C2 has the values like serial no grouped on the column C1.

    SQL> create table mytable
      2  ( c1 varchar2(2)
      3  , c2 number(2)
      4  )
      5  /
    Tabel is aangemaakt.
    SQL> insert into mytable (c1)
      2  select 'A1' from dual union all
      3  select 'A1' from dual union all
      4  select 'A1' from dual union all
      5  select 'A1' from dual union all
      6  select 'A2' from dual union all
      7  select 'A2' from dual union all
      8  select 'A2' from dual union all
      9  select 'A3' from dual union all
    10  select 'A4' from dual union all
    11  select 'A4' from dual
    12  /
    10 rijen zijn aangemaakt.
    SQL> select * from mytable
      2  /
    C1                                     C2
    A1
    A1
    A1
    A1
    A2
    A2
    A2
    A3
    A4
    A4
    10 rijen zijn geselecteerd.
    SQL> merge into mytable t1
      2  using (select c1
      3              , row_number() over (partition by c1 order by null) rn
      4              , rowid rid
      5           from mytable
      6        ) t2
      7     on (t1.rowid = t2.rid)
      8   when matched then
      9        update set c2 = rn
    10   when not matched then
    11        insert values (null,null)
    12  /
    10 rijen zijn samengevoegd.
    SQL> select * from mytable
      2  /
    C1                                     C2
    A1                                      1
    A1                                      2
    A1                                      3
    A1                                      4
    A2                                      1
    A2                                      2
    A2                                      3
    A3                                      1
    A4                                      1
    A4                                      2
    10 rijen zijn geselecteerd.Regards,
    Rob.

  • Joining tables with "similar" field values

    I have run into a situation where I want to join two tables on a field called U_LotusBox.    In my main table the the feild can contain values like 1 or 2 or 3 or 1,2,3,4.  That's 1 comma 2 comma 3 comma 4.  My field in the second tables contains only single digit values, like 1 ,2, 3 up to 5.
    When the two fields are identical I am able to retrieve data.  But if my field in the main contains a value of 1,2,3 and my secondary table field value is 2 I get no data returned because the two fields are not identical.  
    Is it possible to have a join that is "fuzzy" meaning that if the main table field values contains the value of the secondary field value, 2 in my example would it be possible to return data?
    Any thoughts would be appreciated.

    Ralph,
    Here in high-level details is an SQL example of creating two tables (test1 and test2) with one column in each table (col_a and col_b, respectively) to show how a join on a substring of one column can be tied to a column of another table:
    create table test1 (col_a char(5))
    create table test2 (col_b char(1))
    insert into test1 values ('1')
    insert into test1 values ('1,2,3')
    insert into test2 values ('1')
    insert into test2 values ('2')
    select col_a,test2_tbl1.col_b
    from test1 inner join test2 as test2_tbl1 on col_a=test2_tbl1.col_b or
    substring(col_a,1,1)=test2_tbl1.col_b or
    substring(col_a,3,1)=test2_tbl1.col_b or
    substring(col_a,5,1)=test2_tbl1.col_b
    col_a     col_b
    ~~~~~~~|~~~~~
    1         1
    1,2,3     1
    1,2,3     2
    thanks,
    John

  • MS Project 2007 - Help with custom field calculation for grouped by dates view

    Hello 
    I am trying to creat a view that counts number of students in courses (while # Students is a custom field that is filled manually and courses are tasks).
    The view should be grouped by Quarters, Months, and weeks (Calculated custom Text fields)
    The weeks groups are displayed by the start day of each week.
    For example:
    The view counts how many students are in courses in a specific week/month/quarter.
    This is the group by definition:
    Those are the fields calculations:
    “WW_Start” field calculation:
    (Year([Start]) & "  W " & Format([Start],"WW") & " " & "   [" & Datevalue(ProjDateSub([Start],CStr(Weekday([Start])-1),"Standard")) & "]")
    “MM” field calculation:
    Year([Start]) & "  M " & Format([Start],"MM")
    Basically it works but it doesn't cover a situation where a course is more then a week.  
    Lets say that the duration of the task is 12 days, the task should appear on 3 different weeks groups.
    But what i did puts the tasks only in the group that shows the first week of the task.
    How can i change my calculations or my view so that in the second, and third week of the task it will also show the task and it's attributes.
    For example:
     - "UV5 ACM" task should also be in W 45 not just W 44.
    Anyone has an idea how to do that?
    Ofir Marco , MCTS P.Z. Projects

    Hi
    First, thanks for the comment "nice neat groups" :)
    I think you understood correctly what is my issue.
    Second, about your question:  the class have the same number of students during the course period.
    It will have 10 students even if the duration is 1 day or 10 days.
    if you look at the basic gantt chart you will see a row like this:
    Task name        Duration        Num_Students     Resource names (Instructors)
    Course YYY       10d                10                       
    Instructor X
    it is an attribute on the task, not the assiment.
    When i group by dates (Weeks, months, quarters) or by another field (can be course type for example) i the students are summed in the task summary level for all tasks.
    Lets say i group by all the tasks (Classes) that are in the 1st quarter, and lets say for the example that there are 3:
    Task 1 -->  5 students
    Task 2 --> 10 students
    Task 3 --> 7 students
    Then, the group by summary should count:
    Quarter 1 - 2014:   22 (students)
    Task 1 --> 5
    Task 2 --> 10
    Task 3 --> 7
    By the way, it doesn't matter if the version is project 2007,2010, 2013, the logic is the same.
    Hope it helps and i'll be glad to have some ideas or evan get examples for solution in a project file by e-mail.
    Ofir Marco , MCTS P.Z. Projects

  • Update one table with the max value of another table

    CREATE TABLE [dbo].[General](
    [a_id] int NOT NULL,
    [a_date] datetime NOT NULL,
    [c_date] datetime NULL)
    CREATE TABLE [dbo].[Specific](
    [a_id] int NOT NULL,
    [a_date] datetime NOT NULL,
    [b_id] int NOT NULL,
    [d_date] datetime NULL)
    insert into General values (111,'Jan 1 2013', null)
    insert into General values (112,'Jan 1 2013', 'Mar 10 2014')
    insert into General values (113,'Jan 1 2013', null)
    insert into General values (114,'Feb 1 2013', null)
    insert into General values (115,'Feb 1 2013', 'Apr 1 2013')
    insert into General values (116,'Feb 1 2013', 'Jan 1 1970')
    insert into Specific values (111,'Jan 1 2013',1, 'Jan 1 2013')
    insert into Specific values (111,'Jan 1 2013',2, 'Feb 1 2013')
    insert into Specific values (111,'Jan 1 2013',3, 'Mar 1 2013')
    insert into Specific values (112,'Jan 1 2013',1, 'Jan 1 2013')
    insert into Specific values (112,'Jan 1 2013',2, 'Feb 1 2013')
    insert into Specific values (113,'Jan 1 2013',1, 'Jan 1 1970')
    insert into Specific values (114,'Feb 1 2013',1, null)
    insert into Specific values (115,'Feb 1 2013',1, 'Jan 15 2013')
    insert into Specific values (115,'Feb 1 2013',2, 'Feb 15 2013')
    insert into Specific values (116,'Feb 1 2013',1, 'Jan 30 2013')
    insert into Specific values (116,'Feb 1 2013',2, 'Jan 1 1970')
    I want to update General.c_date only when the values are null or Jan 1 1970 from the maximum value of Specific.d_date as long as the maximum is not null or Jan 1 1970.    The two tables join on a_id and a_date.  In the example  above 
    a_id = 111 and a_date = Jan 1 2013 should have c_date = Mar 1 2013 and a_id = 116 and a_date = Feb 1 2013 should have c_date = Jan 30 2013.
    lg

    Try the below:
    CREATE TABLE [dbo].[General](
    [a_id] int NOT NULL,
    [a_date] datetime NOT NULL,
    [c_date] datetime NULL)
    CREATE TABLE [dbo].[Specific](
    [a_id] int NOT NULL,
    [a_date] datetime NOT NULL,
    [b_id] int NOT NULL,
    [d_date] datetime NULL)
    insert into General values (111,'Jan 1 2013', null)
    insert into General values (112,'Jan 1 2013', 'Mar 10 2014')
    insert into General values (113,'Jan 1 2013', null)
    insert into General values (114,'Feb 1 2013', null)
    insert into General values (115,'Feb 1 2013', 'Apr 1 2013')
    insert into General values (116,'Feb 1 2013', 'Jan 1 1970')
    insert into Specific values (111,'Jan 1 2013',1, 'Jan 1 2013')
    insert into Specific values (111,'Jan 1 2013',2, 'Feb 1 2013')
    insert into Specific values (111,'Jan 1 2013',3, 'Mar 1 2013')
    insert into Specific values (112,'Jan 1 2013',1, 'Jan 1 2013')
    insert into Specific values (112,'Jan 1 2013',2, 'Feb 1 2013')
    insert into Specific values (113,'Jan 1 2013',1, 'Jan 1 1970')
    insert into Specific values (114,'Feb 1 2013',1, null)
    insert into Specific values (115,'Feb 1 2013',1, 'Jan 15 2013')
    insert into Specific values (115,'Feb 1 2013',2, 'Feb 15 2013')
    insert into Specific values (116,'Feb 1 2013',1, 'Jan 30 2013')
    insert into Specific values (116,'Feb 1 2013',2, 'Jan 1 1970')
    update A
    Set c_date = (Select MAX(d_date) From Specific B where A.a_id = B.a_id Group by a_id
    having MAX(d_date) is not null
    and MAX(d_date)<>'1970-01-01 00:00:00.000')
    From General A
    Select * From General
    Drop table general,specific
    This would cause all records in General table to get updated which is not what asker want
    see below statement
    I want to update General.c_date only when the values are null or Jan 1 1970
    from the maximum value of Specific.d_date as long as the maximum is not null or Jan 1 1970
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to Update ESTMJ table with appended fields

    Attempting to do a mass load of data to table ESTMJ. Tried using an LSMW, but took a very long time...days in fact. Added a couple Z fields to this table in an append structure. Attempting to run BAPI_BUS1077_CREATE to add records, but how do I update the new Z fields using this BAPI?

    Hi,
    the af:column allows you to group columns
    <af:column>
    <af:column> </af:column>
    <af:column> </af:column>
    </af:clomn>
    Also, in HTML it is easy to assign a background color to cell, e.g. cell with Label 1 is red, Label 2 is green.
    Is there something like this in JSF?
    You can use CSS on the inlineStyl or contentStyle property to dynamically set CSS using EL. You can reference e.g. a managed bean , access the #{row} variable within the managed bean method and return the color based on the value you read for the each row
    Frank

  • Just need the record from the right (many) table with the max value for the Record on the left (one) side table

    SELECT
      ADHOC.ATS_ESH.Entry_Num
      ,ADHOC.ATS_ESH.Importer
      ,ADHOC.ATS_ESH.Version AS [ATS_ESH Version]
      ,ADHOC.ATS_ESL.Version AS [ATS_ESL Version]
    FROM
      ADHOC.ATS_ESH
      INNER JOIN ADHOC.ATS_ESL
        ON ADHOC.ATS_ESH.Customs_Entry_Num = ADHOC.ATS_ESL.Customs_Entry_Num
    I just need to see the MAXIMUM version number in the ESL table for each Entry_Num in the ESH table. ESH is the one side, ESL is the MANY side.

    Do you understand what this query is doing? Did you check the blogs I pointed you to?
    The query I provided gets the latest ESL version for each custom number. So, if max ESL version is higher than ESH version, it's just a coincidence. If you only want to see rows where versions do not match, just add an extra where condition, e.g.
    SELECT * FROM cte WHERE Rn = 1
    AND  [ATS_ESH
    Version] <>  [ATS_ESL
    Version]
    BTW, what is the type of these version
    columns and what kind of data in them? If they are character columns, sorting them in DESC order will not necessary return the latest version. Can you show some samples of the data in these two columns?
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Use of FM BAPI_EQUI_CHANGE to update equipement with customer fields

    Hello all
    I have extended the EQUI table with customer fields using customer include structure and append structure.
    I want to populate these customer fields with BAPI BAPI_EQUI_CHANGE Or BAPI_EQUI_CREATE.
    So I have extended the structure ITOB appending the same customer fields as in table EQUI.
    I have enhanced the function MAPXI_BAPI_ITOB_TO_ITOB which map data from structure BAPI_ITOB to internal structure ITOB.
    But the fields are not populated ?
    Has someone already the BAPI in that way ?
    Thanks
    Jerome

    Hello all
    I have extended the EQUI table with customer fields using customer include structure and append structure.
    I want to populate these customer fields with BAPI BAPI_EQUI_CHANGE Or BAPI_EQUI_CREATE.
    So I have extended the structure ITOB appending the same customer fields as in table EQUI.
    I have enhanced the function MAPXI_BAPI_ITOB_TO_ITOB which map data from structure BAPI_ITOB to internal structure ITOB.
    But the fields are not populated ?
    Has someone already the BAPI in that way ?
    Thanks
    Jerome

  • Creating an SQL Query for Project Custom Fields Values

    Hello:
    I'm currently trying to create an SQL Query to show all of the server's Project Custom Fields Values, along with the modification date.
    So far, I've managed to display correctly all of the data for all of the Projects' text value Custom Fields (those not based on a LookUp Table) with this query:
    SELECT
    MSP_PROJECTS.PROJ_NAME,
    MSP_CUSTOM_FIELDS.MD_PROP_NAME,
    MSP_PROJ_CUSTOM_FIELD_VALUES.CODE_VALUE,
    MSP_PROJ_CUSTOM_FIELD_VALUES.TEXT_VALUE,
    MSP_PROJ_CUSTOM_FIELD_VALUES.MOD_DATE
    FROM
    MSP_PROJ_CUSTOM_FIELD_VALUES
    INNER JOIN
    MSP_CUSTOM_FIELDS
    ON MSP_CUSTOM_FIELDS.MD_PROP_UID = MSP_PROJ_CUSTOM_FIELD_VALUES.MD_PROP_UID
    INNER JOIN
    MSP_PROJECTS
    ON MSP_PROJECTS.PROJ_UID = MSP_PROJ_CUSTOM_FIELD_VALUES.PROJ_UID
    WHERE
    MSP_PROJ_CUSTOM_FIELD_VALUES.CODE_VALUE IS NULL
    ORDER BY
    MSP_PROJ_CUSTOM_FIELD_VALUES.PROJ_UID,
    MSP_PROJ_CUSTOM_FIELD_VALUES.MD_PROP_UID
    However, when I try a new Query to obtain the actual values for the Projects Custom Fields that do use a LookUp Table, I can't seem to find what table in the model I'm supposed to link to the MSP_PROJ_CUSTOM_FIELD_VALUES.CODE_VALUE field (the TEXT_VALUE
    field has NULL value when CODE_VALUE field isn't NULL)
    Any suggestions on how to obtain the actual Projects' custom fields values instead of the Code Value, for Metadata that do use a LookUp Table?
    Also, I'm able to run this query only in the Published Database, since the MSP_CUSTOM_FIELDS table is empy in the Draft Database. Why is that?
    Awaiting your kind reply,
    Sebastián Armas PMO Project Manager

    Hi Sebastián, rather than directly accessing the database it would be better to use the PSI to get this data.  Take a look at the ProjTool sample in the SDK whcih gets this data.
    Best regards,
    Brian.
    Blog |
    Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter |
    Project Developer Center |
    Project Server Help | Project Product Page

  • How to Update EKPO table with enhancement at header level-customer data tab

    Experts,
    I have a requirement where I had to create a new button in the 'customer data' tab(header) in the ME21N/ME22N Transaction and once it gets clicked a table control will appear and in that all the line items with item no, material and plant and an additional check box will display, and once any one checks the check box against the item/material in the table control the item data with additional z fields (already created the zfields in EKPO Table) should get updated.
    Displaying Table control and item data on the click of button was successful, but once you check the check box against the item and save the PO it is not updating the z-fields in the EKPO table.
    I have implemented all the user exits , badis but no results. 
    Once you check the box in the table control against each item in the header part (Table control is in header part (customer tab)) the line item EKPO table with z fields should get updated.
    Any Clues/ideas will be appreciated.
    Thanks in advance,
    Kalikonda.

    Hi,
    Can you please share the remedy for above issue, recently we have same issue in our system.
    or please send me any supportive doc. for the below mail
    Looking forward for your positive response.
    Thanks
    Mohan
    ([email protected])

  • How to prepopulate value in webapps input fields or for any custom fields in for any other forms?

    How to prepopulate value in webapps input fields or for any custom fields in for any other forms?

    What do you want to populate the form with?

  • Best way to update a table with disinct values

    Hi, i would really appreciate some advise:
    I need to reguarly perform a task where i update 1 table with all the new data that has been entered from another table. I cant perform a complete insert as this will create duplicate data every time it runs so the only way i can think of is using cursors as per the script below:
    CREATE OR REPLACE PROCEDURE update_new_mem IS
    tmpVar NUMBER;
    CURSOR c_mem IS
    SELECT member_name,member_id
    FROM gym.members;
    crec c_mem%ROWTYPE;
    BEGIN
    OPEN c_mem;
    LOOP
    FETCH c_mem INTO crec;
    EXIT WHEN c_mem%NOTFOUND;
    BEGIN
    UPDATE gym.lifts
    SET name = crec.member_name
    WHERE member_id = crec.member_id;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
    END;
    IF SQL%NOTFOUND THEN
    BEGIN
    INSERT INTO gym.lifts
    (name,member_id)
    VALUES (crec.member_name,crec.member_id);
    END;
    END IF;
    END LOOP;
    CLOSE c_mem;
    END update_new_mem;
    This method works but is there an easier (faster) way to update another table with new data only?
    Many thanks

    >
    This method works but is there an easier (faster) way to update another table with new data only?
    >
    Almost anything would be better than that slow-by-slow loop processing.
    You don't need a procedure you should just use MERGE for that. See the examples in the MERGE section of the SQL Language doc
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_9016.htm
    MERGE INTO bonuses D
       USING (SELECT employee_id, salary, department_id FROM employees
       WHERE department_id = 80) S
       ON (D.employee_id = S.employee_id)
       WHEN MATCHED THEN UPDATE SET D.bonus = D.bonus + S.salary*.01
         DELETE WHERE (S.salary > 8000)
       WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
         VALUES (S.employee_id, S.salary*.01)
         WHERE (S.salary <= 8000);

Maybe you are looking for