Base tables to set up tables

Hi,
      how we extract data from base tables to set up tables? n what is multidimentional modeling?
   thanks in advance
     charu

in LO extraction you run transaction oli*bw to post the data from the application tables to the setup tables (e.g. run oli7bw to fill the setup tables for appl. 11 which is sales orders). In case of generic extraction you cannot use setup tables. For this type of extraction you use views on database tables or the tables directly, you can use your own function modules and you can just grap some texts from domain fixed values.
regards
Siggi

Similar Messages

  • How to stored data after clicking checkbox in data base table

    REPORT  ZT                                      .
    TYPE-pools: slis.
    tables:mkpf,mseg,mard,COWB_COMP,ZTABLE.
    Types:BEGIN OF tp_data,
         mblnr LIKE mseg-mblnr,
         matnr LIKE mseg-matnr,
         werks LIKE mard-werks,
         lgort LIKE mard-lgort,
         lgpbe LIKE mard-lgpbe,
         charg LIKE mseg-charg,
         bwart LIKE mseg-bwart,
         budat LIKE mkpf-budat,
         menge LIKE mseg-menge,
         meins LIKE mseg-meins,
         kostl LIKE mseg-kostl,
         aufnr LIKE mseg-aufnr,
         rsnum LIKE mseg-rsnum,
         endkz like COWB_COMP-endkz,
    END OF tp_data,
    tp_tbl_data TYPE STANDARD TABLE OF tp_data.
    MODIFIED*******************
    DATA: WA TYPE TP_DATA.
    MODIFIED*******************
    *data: t_data like Y00_MM_ISSUE_DAT occurs 0 with header line.
    Constants
    Data objects (variable declarations and definitions)
    Report data to be shown.
    DATA: it_data TYPE STANDARD TABLE OF tp_data.
    MODIFIED*******************
    DATA : V_REPID LIKE SY-REPID.
    MODIFIED*******************
    Heading of the report.
    DATA: t_heading TYPE slis_t_listheader.
    *========================== Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:smblnr FOR mseg-mblnr MODIF ID m1,
                  smatnr FOR mseg-matnr MODIF ID m2,
                  swerks FOR mard-werks MODIF ID m3,
                  slgort FOR mard-lgort MODIF ID m4,
                  slgpbe FOR mard-lgpbe MODIF ID m5,
                  scharg FOR mseg-charg MODIF ID m6,
                  sbwart FOR mseg-bwart MODIF ID m7,
                  skostl FOR mseg-kostl MODIF ID m8,
                  saufnr FOR mseg-aufnr MODIF ID m9,
                  srsnum FOR mseg-rsnum MODIF ID m10.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS:pre RADIOBUTTON GROUP radi USER-COMMAND ucomm DEFAULT 'X',
              pse RADIOBUTTON GROUP radi,
              bps RADIOBUTTON GROUP radi.
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETER:layout TYPE i.
    SELECTION-SCREEN END OF BLOCK b3.
    MODIFIED*******************
    INITIALIZATION.
    V_REPID = sy-repid.
    MODIFIED*******************
    *=========================== Event Blocks
    AT selection-SCREEN.
    start-OF-selection.
    PERFORM get_data USING it_data.
    END-OF-selection.
    PERFORM build_alv USING it_data t_heading.
    *=========================== Subroutines
    *&      Form  get_data
          Gets the information to be shown in the report.
    FORM get_data USING t_data TYPE tp_tbl_data.
    SELECT msegmblnr msegmatnr mardwerks mardlgort mard~lgpbe
    msegcharg msegbwart mkpf~budat
       msegmenge  msegmeins msegkostl msegaufnr mseg~rsnum
    INTO CORRESPONDING FIELDS OF TABLE t_data
    FROM mseg
    JOIN mard ON mardmatnr EQ msegmatnr
                  JOIN mkpf ON msegmblnr EQ mkpfmblnr
                  WHERE mseg~matnr IN smatnr.
    ENDFORM.                    " get_data
    *&      Form  build_alv
          Builds and display the ALV Grid.
    FORM build_alv USING t_data TYPE tp_tbl_data
         t_heading  TYPE slis_t_listheader.
    ALV required data objects.
    DATA: w_title   TYPE lvc_title,
           w_comm    TYPE slis_formname,
           w_status  TYPE slis_formname,
           x_layout  TYPE slis_layout_alv,
           t_event    TYPE slis_t_event,
           t_fieldcat TYPE slis_t_fieldcat_alv,
           t_sort     TYPE slis_t_sortinfo_alv.
    REFRESH t_fieldcat.
    REFRESH t_event.
    REFRESH t_sort.
    CLEAR x_layout.
    CLEAR w_title.
    Field Catalog
    PERFORM set_fieldcat2 USING:
           1 'MBLNR' 'MBLNR' 'MSEG' space space space space space space
    space space space space space space t_fieldcat ,
           2 'MATNR' 'MATNR' 'MSEG' space space space space space space
    space space space space space space  t_fieldcat ,
           3 'WERKS' 'WERKS' 'MARD' space space space space space space
    space space space space space space  t_fieldcat,
           4 'LGORT' 'LGORT' 'MARD' space space space space space space
    space space space space space space t_fieldcat ,
           5 'LGPBE' 'LGPBE' 'MARD' space space space space space space
    space space space space space space t_fieldcat ,
           6 'CHARG' 'CHARG' 'MSEG' space space space space space space
    space space space space space space t_fieldcat ,
           7 'BWART' 'BWART' 'MSEG' space  space space space space space
    space space space space space space t_fieldcat,
           8 'BUDAT' 'BUDAT' 'MKPF' space  space space space space space
    space space space space space space t_fieldcat,
           9 'MENGE' 'MENGE' 'MSEG' space  space space space space space
    space space space space space space t_fieldcat,
           10 'MEINS' 'MEINS' 'MSEG' space  space space space space space
    space space space space space space t_fieldcat,
           11 'KOSTL' 'KOSTL' 'MSEG' space  space space space space space
    space space space space space space t_fieldcat,
           12 'AUFNR' 'AUFNR' 'MSEG' space  space space space space space
    space space space space space space t_fieldcat,
           13 'RSNUM' 'RSNUM' 'MSEG' space  space space space space space
    space space space space space space t_fieldcat,
       14 'ENDKZ' 'ENDKZ' 'COWB_COMP' space space 'select' 'Select this row' 'Sel' 'Select this row' space space space 'X' 'X' space t_fieldcat.
    Layout
    x_layout-zebra = 'X'.
    Top of page heading
    PERFORM set_top_page_heading USING t_heading t_event.
    Events
    PERFORM set_events USING t_event.
    GUI Status
    w_status = ''.
    User commands
    w_comm   = 'USER_COMMAND'.
    Order
    Example
    PERFORM set_order USING '<field>' 'IT_DATA' 'X' space space t_sort.
    PERFORM set_order USING 'MBLNR' 'IT_DATA' 'X' space 'X' t_sort.
    PERFORM set_order USING 'EBELN' 'IT_DATA' 'X' space 'X' t_sort.
    PERFORM set_order USING 'EBELP' 'IT_DATA' 'X' space space t_sort.
    Displays the ALV grid
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       i_callback_program       = V_REPID
       it_fieldcat              = t_fieldcat
       is_layout                = x_layout
       it_sort                  = t_sort
       i_callback_pf_status_set = w_status
       i_callback_user_command  = w_comm
       i_save                   = 'X'
       it_events                = t_event
       i_grid_title             = w_title
    TABLES
       t_outtab                 = t_data
    EXCEPTIONS
       program_error            = 1
       OTHERS                   = 2.
    IF sy-subrc <> 0.
       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM.                    " build_alv.
    *&      Form  set_top_page_heading
          Creates the report headings.
    FORM set_top_page_heading USING t_heading TYPE slis_t_listheader
         t_events  TYPE slis_t_event.
    DATA: x_heading TYPE slis_listheader,
           x_event   TYPE LINE OF slis_t_event.
    Report title
    CLEAR t_heading[].
    CLEAR x_heading.
    x_heading-typ = 'H'.
    x_heading-info = 'Reporte Prueba'(001).
    APPEND x_heading TO t_heading.
    Program name
    CLEAR x_heading.
    x_heading-typ = 'S'.
    x_heading-KEY = 'Program: '.
    x_heading-info = sy-repid.
    APPEND x_heading TO t_heading.
    User who is running the report
    CLEAR x_heading.
    x_heading-typ = 'S'.
    x_heading-KEY = 'User: '.
    x_heading-info = sy-uname.
    APPEND x_heading TO t_heading.
    Date of execution
    CLEAR x_heading.
    x_heading-typ = 'S'.
    x_heading-KEY = 'Date: '.
    WRITE sy-datum TO x_heading-info.
    APPEND x_heading TO t_heading.
    Time of execution
    CLEAR x_heading.
    x_heading-typ = 'S'.
    x_heading-KEY = 'Time: '.
    WRITE sy-uzeit TO x_heading-info.
    APPEND x_heading TO t_heading.
    Top of page event
    x_event-name = slis_ev_top_of_page.
    x_event-FORM = 'TOP_OF_PAGE'.
    APPEND x_event TO t_events.
    ENDFORM.
    *&      Form  set_events
          Sets the events for ALV.
          The TOP_OF_PAGE event is alredy being registered in
          the set_top_page_heading subroutine.
    FORM set_events USING t_events TYPE slis_t_event.
    DATA: x_event   TYPE LINE OF slis_t_event.
    Example
    clear x_event.
    x_event-name = .
    x_event-form = .
    append x_event to t_event.
    ENDFORM.
    *&      Form  set_order
          Adds an entry to the order table.
    FORM set_order USING p_fieldname p_tabname p_up p_down p_subtot
         t_sort TYPE slis_t_sortinfo_alv.
    DATA: x_sort TYPE slis_sortinfo_alv.
    CLEAR x_sort.
    x_sort-fieldname = p_fieldname.
    x_sort-tabname   = p_tabname.
    x_sort-UP = p_up.
    x_sort-down = p_down.
    x_sort-subtot = p_subtot.
    APPEND x_sort TO t_sort.
    ENDFORM.                    "set_order
    *&      Form  set_fieldcat2
          Adds an entry to the field catalog.
    FORM set_fieldcat2 USING p_colpos p_fieldname p_ref_fieldname
    p_ref_tabname
         p_outputlen p_noout
         p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
         p_hotspot p_showasicon p_checkbox p_edit
         p_dosum
         t_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: wa_fieldcat TYPE slis_fieldcat_alv.
    CLEAR wa_fieldcat.
    General settings
    wa_fieldcat-fieldname = p_fieldname.
    wa_fieldcat-col_pos = p_colpos.
    wa_fieldcat-no_out = p_noout.
    wa_fieldcat-HOTSPOT = p_hotspot.
    wa_fieldcat-CHECKBOX = p_checkbox.
    wa_fieldcat-ICON = p_showasicon.
    wa_fieldcat-do_sum = p_dosum.
    Set reference fieldname, tablenam and rollname.
    If p_ref_tabname is not given, the ref_fieldname given is a data
    *element.
    If p_ref_tabname is given, the ref_fieldname given is a field of a
    *table. In case ref_fieldname is not given, it is copied from the
    *fieldname.
    IF p_ref_tabname IS INITIAL.
       wa_fieldcat-rollname =   p_ref_fieldname.
    ELSE.
       wa_fieldcat-ref_tabname = p_ref_tabname.
       IF p_ref_fieldname EQ space.
         wa_fieldcat-ref_fieldname =   wa_fieldcat-fieldname.
       ELSE.
         wa_fieldcat-ref_fieldname =   p_ref_fieldname.
       ENDIF.
    ENDIF.
    Set output length.
    IF NOT p_outputlen IS INITIAL.
       wa_fieldcat-outputlen = p_outputlen.
    ENDIF.
    Set text headers.
    IF NOT p_seltext_m IS INITIAL.
       wa_fieldcat-seltext_m = p_seltext_m.
    ENDIF.
    IF NOT p_seltext_l IS INITIAL.
       wa_fieldcat-seltext_l = p_seltext_l.
    ENDIF.
    IF NOT p_seltext_s IS INITIAL.
       wa_fieldcat-seltext_s = p_seltext_s.
    ENDIF.
    IF NOT p_reptext_ddic IS INITIAL.
       wa_fieldcat-reptext_ddic = p_reptext_ddic.
    ENDIF.
    IF NOT p_ddictxt IS INITIAL.
       wa_fieldcat-ddictxt = p_ddictxt.
    ENDIF.
    Set as editable or not.
    IF NOT p_edit IS  INITIAL.
       wa_fieldcat-INPUT     = 'X'.
       wa_fieldcat-EDIT     = 'X'.
    ENDIF.
    APPEND wa_fieldcat TO t_fieldcat.
    ENDFORM.                   "set_fieldcat2
    *&      Form  top_of_page
          Called on top_of_page ALV event.
          Prints the heading.
    FORM top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
         i_logo             = 'TRVPICTURE04'
       it_list_commentary = t_heading.
    ENDFORM.                    " alv_top_of_page
    *&      Form  user_command
          Called on user_command ALV event.
          Executes custom commands.
    FORM user_command USING r_ucomm     LIKE sy-ucomm
         rs_selfield TYPE slis_selfield.
    case sy-ucomm.
    WHEN '&DATA_SAVE'.
    LOOP AT IT_DATA INTO WA WHERE ENDKZ = 'X'.
       IF WA-ENDKZ = 'X'.
    *******MODIFIED*********************************
    U DELETE THIS CODE N USER UR INSERT CODE TO CHECK
    SY-MSGV1 = WA-MBLNR.                              " U CAN DELETE
    SY-MSGV2 = WA-MATNR.                              " U CAN DELETE
    MESSAGE ID 'BC_BOR' TYPE 'I' NUMBER '888'          " U CAN DELETE
            WITH SY-MSGV1 SY-MSGV2. " U CAN DELETE
    *******MODIFIED*********************************
       INSERT ZTABLE.
       ENDIF.
    endloop.
    ENDCASE.
    ENDFORM.                    "user_command
    this is my code, database will stored in fields only.data is empty,
    how to slove that one,send any sugestion.

    Hi Lakshmi,
           Can u explain briefly what is ur requirement. U mean to say that after clicking the checkbox in data base table or Screen?
    Regards,
      Jayaram...

  • ORA-01776: cannot modify more than one base table through a join view

    I have created EO based on a database view than consists of two tables, and only one is updateable.
    When I try to update a row using EO, I got a following message: "ORA-01776-cannot modify more than one base table through a join view"
    In Forms, this issue is resolved by setting "Query Only" property of non-updateable items to "True".
    Is it possible to do something like that in ADF BC?
    Thanks

    Thanks for answer.
    When I set "updateable" property to "Never", that attribute is protected from any change.
    I'm sorry for incomplete usecase.
    I have set up a list of value on that attribute, because it is a lookup field for another table and I need to get an ID from that table.
    Basically, I need that attribute to be updateble for BC, but not for database.
    Edited by: MarioK on Oct 13, 2011 9:28 AM

  • Cannot modify more than one base table through a join view

    hi guys, my current problem is that i have a datablock based on a view, now all the fields bar 1 are updateable, but this one field that is obtained through a join is displayed, the user can enter data in this field which then pupulates other fields which are required, but this specific field should not be updated. Is there an option to state this as i keep getting the error:
    cannot modify more than one base table through a join view
    Any help would be greatly appreciated, thanks.

    the user can enter data in this field which then pupulates other fields So, using the value of "this field" you then query the rest of the fields? Can you show us the code you use to populate the rest of the fields?
    but this specific field should not be updatedHave you tried setting the "Query Only" property of the field to "Yes" and the other DML properties (Ins, Upd, Del) to No?
    Also, what is your Forms version?
    Thanks,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Data is visible in base tables of BOM routing but not visible in front end

    Hi,
    Through BOM_RTG_PUB API I am populating routing data into base tables, it is successfull.. but that data is not visible in front end when i queried from front end..
    i am getting error while i run API as......
    An error occured while processing business object BOM_ITEM12 in organization MMO. Please check the data in this business object and re-run the import process.
    Can any one help me in finding out what's wrong with this..
    Thanks in advance..
    Edited by: 875417 on Feb 6, 2012 10:49 PM

    Your obeservation is correct, and expected behavior.
    This behavior is useful when you have inputs that you would like to set as defaults for the user.
    Obviously, if there is a value to be saved, it will require some memory to store the value.
    If the input is left empty by default, that memory is made available again.
    It may not be easy to think of a good use for this for a graph, but think about for numeric or string controls.
    What if the user isnt sure how they should input a certain parameter or value?
    You could store a default value so they could see how they should input their value.
    Message Edited by Cory K on 09-15-2009 11:12 AM
    Cory K

  • Base table not found

    CF5 Newbie needs help.
    I am trying to create a webpage with a searchable access
    database that displays photos.
    I am getting the message ODBC Error Code = S0002 (Base table
    not found). I have verified my database.
    Maybe there is a problem with one of my initial files. I have
    the search, results and details querry set up am I missing an
    additional file here that would cause this problem?
    Thanks -any help is greatly appreciated,
    Jen

    Hi,
    pPerhaps one should explain some basics about privileges in the database.
    You connected as sysdba, named superdba.
    The table(s) you are looking for have been created by the user SAPAJ4DB.
    If a user creates a table, noone !!, really noone is allowed to select them except this owner.
    Not even the sysdba is allowed to select them.
    And it is good that it is like this. I personally do have some private info in tables and do NOT
    want to let them being seen by my boss being the sysdba of the db.
    If the owner wants to allow access to this table, he has to grant privileges to other users.
    There are select, insert, update, delete ( to name the DML-privileges ).
    If the owner of the table you are looking for, did not do this, the sysdba is not allow to see them.
    And then he will receive the error -4004.
    Yes, the table DOES exist. But for the user not having a privileges for this table,
    this table looks like not existing, causing this error to occur.
    Therefore: connect as the owner, select there what you want.
    And then think about your needs and grant the corresponding privileges to other users / the sysdba.
    Have a nice weekend,
      Elke

  • Aggregation table - Diffrent agg levels for base table and agg table

    Is it possible to have Different aggregation level for base table and Aggregation. Say sum on a column in AGG table and Count for the same column in Fact table.
    Example
    Region,Day_product,sales person, customer are dimensions and Call is a fact measure
    FACT_TABLE has columns Region, Day, Product, Sales person,Customer, Call
    AGG_TABLE has columns Region, Month,Product, call
    We already have a Logical Table definition for the fact table say FACT_CALL
    We have a Logical column called No of customers.
    For the Data source as FACT_TABLE Formula for the column is "Customer" and Aggregation level is count distinct.
    But agg table we already have a calculated column call TOT_CUSTOMERS. which is been calculated and aggregated in the ETL.
    IF we map this to the logical column we have to set the formula as TOT_CUSTOMERS and we need to define aggregation type as SUM as this is at REGION, MONTH AND Product level. But OBI does not allow to do so.
    Is there a work around for this? Can you please let us know.
    Regard
    Arun D

    The way BI server picks up the table that would satisfy the query is through column mappings and contents levels. You have set the column mappings to TOT_CUSTOMER, which is right. When it comes to aggregation, since its already precalculated through ETL, you want to set the aggregation to SUM. Which I would say - is not correct, you can set the aggregation to COUNT DISTIMCT which is same as that of the detailed fact. But set the content levels to month in date table, and appropriate levels in region etc., So now BI Server will be aware of how to aggregate the rows when it chooses the agg table.

  • Updating a Base Table Block Record

    We have a form where there is a multi array base Table block. this is used for generating employee number for various depts. the columns are like this with some sample data
    Dept Start No end No Start Date End Date
    sales 1001 1100 01-Jun-2009 31-12-2050
    Accts 2001 2100 01-Jun-2009 31-12-2050
    HR 3001 3100 01-Jun-2009 31-12-2050
    and the data is populated from its table. These Data were created at the backend while implementation and is not modified for some long time. Now the client wants to modifiy the data . i.e they want to add new set of Start nos and End nos for the existing Dept So they will add at the bottom of the Block
    like this
    sales 1101 1200 01-Apr-2011 31-12-2050
    when they add this the end date of the existing record should get modified with sysdate as they add the new records. at any time they can add new set of numbers of any number of depts.
    can u please guide me how to do this ?

    If I understand correctly, you need to take the following data:
    Dept  Start No   end No   Start Date   End Date
    sales 1001       1100     01-Jun-2009  31-12-2050
    Accts 2001       2100     01-Jun-2009  31-12-2050
    HR    3001       3100     01-Jun-2009  31-12-2050and change it so it is like this:
    Dept  Start No   end No   Start Date    End Date
    sales 1101       1200     01-Apr-2011   31-12-2050
    when they add this the end date of the existing record should get modified with sysdate as they add the new records.First, I will assume you are using Oracle Forms (since your question was in the Forms forum) but you didn't specify a version. In Forms, you could easily put this logic in the Block Pre-Inser t Trigger. You'll have to set the SYSDATE through DML rather then requery the block after changes are saved. This is easier than trying to find the existing record in the block and setting the SYSDATE.
    at any time they can add new set of numbers of any number of depts.Is this data used for anything more than just reference? If so, what is the key value and how does making changes like this affect the existing data and relationships?
    Just from the small description you gave, the process sounds very closed - meaning it is not easily changed. If this is true, than you probably need more than just "Use a Pre-Ins Trigger" answer. You also need to know how to update all of the related records that just changed because of the new department number and for this answer we'll need more information. ;)
    Craig...

  • Updating a Base Table through a View having UNPIVOT function.

    Hi,
    I have a requirement of updating a Base Table through a View.
    This View has the query using a UNPIVOT function for displaying the columns of the Base tables in rows.
    I need to update/insert into/delete the Base Table by accessing the View (The user doesn't have an access to the Base Table, hence the DML's on the View).
    Following is the table I've created:-
    CREATE TABLE PERSON_DETAILS
      PID            VARCHAR2(10 BYTE),
      FIRSTNAME      VARCHAR2(1000 BYTE),
      LASTNAME       VARCHAR2(1000 BYTE),
      PHONENUMBER    VARCHAR2(1000 BYTE),
      ADDRESS1       VARCHAR2(1000 BYTE),
      ADDRESS2       VARCHAR2(1000 BYTE),
      COUNTRY_CODE   VARCHAR2(1000 BYTE),
      LANGUAGE_CODE  VARCHAR2(1000 BYTE),
      EMAIL          VARCHAR2(1000 BYTE)
    )The sample values are inserted in this table through the below script:-
    insert into person_details values ('1','XYZ','ABC','1234567890','India','Asia','IN','EN','[email protected]');
    insert into person_details values ('2','XYZ2','ABC2','1234567890','India','Asia','IN','EN','[email protected]');The code for the view is as below:-
    CREATE OR REPLACE FORCE VIEW PERSON_DETAILS_VIEW
       PID,
       CD_NAME,
       CD_VALUE
    AS
       SELECT "PID", "CD_NAME", "CD_VALUE"
         FROM person_details UNPIVOT INCLUDE NULLS (cd_value
                             FOR cd_name
                             IN  (firstname AS 'First Name',
                                 lastname AS 'Last Name',
                                 phonenumber AS 'Phonenumber',
                                 address1 AS 'address1',
                                 address2 AS 'address2',
                                 country_code AS 'Country Code',
                                 language_code AS 'Language Code',
                                 email AS 'Email') );Below are the values from the view:-
    PID CD_NAME         CD_VALUE
    1    First Name       XYZ
    1    Last Name       ABC
    1    Phonenumber  1234567890
    1    address1         India
    1    address2         Asia
    1    Country Code   IN
    1    Language Code EN
    1    Email               [email protected]
    2    First Name       XYZ2
    2    Last Name       ABC2
    2    Phonenumber  1234567890
    2    address1         India
    2    address2         Asia 
    2    Country Code   IN
    2    Language Code EN
    2    Email               [email protected] user would fire some statement like below:-
    update person_details_view
    set cd_value = 'US' where CD_NAME = 'IN'The above statement should update the base table PERSON_DETAILS.
    I understand I can write an INSTEAD OF trigger but I do not know what logic to write in the trigger so that the requirement gets fulfilled.
    My Oracle Version
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0    Production
    TNS for Solaris: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - ProductionAny help would be highly appreciated.
    Thank You,
    Ankit Khare.
    Edited by: Ankit_Khare84 on Jun 28, 2012 2:47 PM

    it is definitively possible with an instead of trigger.
    for Example:
    create or replace
    TRIGGER ioft_person
    INSTEAD OF UPDATE
    ON person_details_view
    FOR EACH ROW
    declare
    firstname1  person_details.firstname%type;
    BEGIN
                  SELECT firstname_new into firstname1
                  FROM   (SELECT pid, cd_name, cd_value
                          FROM  
                                  select * from person_details_view where (pid, cd_name) not in (select :new.pid, :new.cd_name from dual)
                                  union all
                                  select :new.pid, :new.cd_name, :new.cd_value from dual
                  PIVOT  ( max(cd_value) AS new FOR (cd_name) IN
                                                          ('First Name' AS firstname,
                                                            'Last Name' as lastname,
                                                            'Phonenumber' as phonenumber,
                                                            'address1' as address1,
                                                            'address2' AS address2,
                                                            'Country Code' as country_code,
                                                            'Language Code' as language_code,
                                                            'Email' as email
                  )  where pid = :old.pid;
      UPDATE person_details
      SET firstname = firstname1
      WHERE pid = :old.pid;
    END ioft_role_perm;and than run
    update person_details_view
    set cd_value = 'X|X' where cd_name = 'First Name' and pid=1The logic is: you must convert back the view through pivoting

  • How to Compare Data length of staging table with base table definition

    Hi,
    I've two tables :staging table and base table.
    I'm getting data from flatfiles into staging table, as per requirement structure of staging table and base table(length of each and every column in staging table is 25% more to dump data without any errors) are different for ex :if we've city column with varchar length 40 in staging table it has 25 in base table.Once data is dumped into staging table I want to compare actual data length of each and every column in staging table with definition of base table(data_length for each and every column from all_tab_columns) and if any column differs length I need to update the corresponding row in staging table which also has a flag called err_length.
    so for this I'm using cursor c1 is select length(a.id),length(a.name)... from staging_table;
    cursor c2(name varchar2) is select data_length from all_tab_columns where table_name='BASE_TABLE' and column_name=name;
    But we're getting data atonce in first query whereas in second cursor I need to get each and every column and then compare with first ?
    Can anyone tell me how to get desired results?
    Thanks,
    Mahender.

    This is a shot in the dark but, take a look at this example below:
    SQL> DROP TABLE STAGING;
    Table dropped.
    SQL> DROP TABLE BASE;
    Table dropped.
    SQL> CREATE TABLE STAGING
      2  (
      3          ID              NUMBER
      4  ,       A               VARCHAR2(40)
      5  ,       B               VARCHAR2(40)
      6  ,       ERR_LENGTH      VARCHAR2(1)
      7  );
    Table created.
    SQL> CREATE TABLE BASE
      2  (
      3          ID      NUMBER
      4  ,       A       VARCHAR2(25)
      5  ,       B       VARCHAR2(25)
      6  );
    Table created.
    SQL> INSERT INTO STAGING VALUES (1,RPAD('X',26,'X'),RPAD('X',25,'X'),NULL);
    1 row created.
    SQL> INSERT INTO STAGING VALUES (2,RPAD('X',25,'X'),RPAD('X',26,'X'),NULL);
    1 row created.
    SQL> INSERT INTO STAGING VALUES (3,RPAD('X',25,'X'),RPAD('X',25,'X'),NULL);
    1 row created.
    SQL> COMMIT;
    Commit complete.
    SQL> SELECT * FROM STAGING;
            ID A                                        B                                        E
             1 XXXXXXXXXXXXXXXXXXXXXXXXXX               XXXXXXXXXXXXXXXXXXXXXXXXX
             2 XXXXXXXXXXXXXXXXXXXXXXXXX                XXXXXXXXXXXXXXXXXXXXXXXXXX
             3 XXXXXXXXXXXXXXXXXXXXXXXXX                XXXXXXXXXXXXXXXXXXXXXXXXX
    SQL> UPDATE  STAGING ST
      2  SET     ERR_LENGTH = 'Y'
      3  WHERE   EXISTS
      4          (
      5                  WITH    columns_in_staging AS
      6                  (
      7                          /* Retrieve all the columns names for the staging table with the exception of the primary key column
      8                           * and order them alphabetically.
      9                           */
    10                          SELECT  COLUMN_NAME
    11                          ,       ROW_NUMBER() OVER (ORDER BY COLUMN_NAME) RN
    12                          FROM    ALL_TAB_COLUMNS
    13                          WHERE   TABLE_NAME='STAGING'
    14                          AND     COLUMN_NAME != 'ID'
    15                          ORDER BY 1
    16                  ),      staging_unpivot AS
    17                  (
    18                          /* Using the columns_in_staging above UNPIVOT the result set so you get a record for each COLUMN value
    19                           * for each record. The DECODE performs the unpivot and it works if the decode specifies the columns
    20                           * in the same order as the ROW_NUMBER() function in columns_in_staging
    21                           */
    22                          SELECT  ID
    23                          ,       COLUMN_NAME
    24                          ,       DECODE
    25                                  (
    26                                          RN
    27                                  ,       1,A
    28                                  ,       2,B
    29                                  )  AS VAL
    30                          FROM            STAGING
    31                          CROSS JOIN      COLUMNS_IN_STAGING
    32                  )
    33                  /*      Only return IDs for records that have at least one column value that exceeds the length. */
    34                  SELECT  ID
    35                  FROM
    36                  (
    37                          /* Join the unpivoted staging table to the ALL_TAB_COLUMNS table on the column names. Here we perform
    38                           * the check to see if there are any differences in the length if so set a flag.
    39                           */
    40                          SELECT  STAGING_UNPIVOT.ID
    41                          ,       (CASE WHEN ATC.DATA_LENGTH < LENGTH(STAGING_UNPIVOT.VAL) THEN 'Y' END) AS ERR_LENGTH_A
    42                          ,       (CASE WHEN ATC.DATA_LENGTH < LENGTH(STAGING_UNPIVOT.VAL) THEN 'Y' END) AS ERR_LENGTH_B
    43                          FROM    STAGING_UNPIVOT
    44                          JOIN    ALL_TAB_COLUMNS ATC     ON ATC.COLUMN_NAME = STAGING_UNPIVOT.COLUMN_NAME
    45                          WHERE   ATC.TABLE_NAME='BASE'
    46                  )       A
    47                  WHERE   COALESCE(ERR_LENGTH_A,ERR_LENGTH_B) IS NOT NULL
    48                  AND     ST.ID = A.ID
    49          )
    50  /
    2 rows updated.
    SQL> SELECT * FROM STAGING;
            ID A                                        B                                        E
             1 XXXXXXXXXXXXXXXXXXXXXXXXXX               XXXXXXXXXXXXXXXXXXXXXXXXX                Y
             2 XXXXXXXXXXXXXXXXXXXXXXXXX                XXXXXXXXXXXXXXXXXXXXXXXXXX               Y
             3 XXXXXXXXXXXXXXXXXXXXXXXXX                XXXXXXXXXXXXXXXXXXXXXXXXXHopefully the comments make sense. If you have any questions please let me know.
    This assumes the column names are the same between the staging and base tables. In addition as you add more columns to this table you'll have to add more CASE statements to check the length and update the COALESCE check as necessary.
    Thanks!

  • List the base tables of a view

    Hi All,
    I have a view but I do not have any information about the base tables and the query that was used to set up this view. Is there a way to atleast list the base tables on which the view was created!
    Thanks in advance!
    ~

    SQL> desc user_source
    Name Null?
    Type
    NAME
    ARCHAR2(30) - > Name of the View.
    TYPE
    ARCHAR2(12)
    LINE
    NUMBER
    VARCHAR2(4000) -> will give you the text to
    create the View.-----------------------------------------------------------------------------------------------------------------------
    For some reason the view I have is not listed in the NAME ..

  • Two LVO link to the same not base table field

    I would like to know if it possible to relate two LOV to the same not base table field. If it possible, how to do it.
    Thanks,
    Julia

    You can set the LOV with set_item_property(<item>,LOV_NAME,<lov>). This way you can associate 2 or more different LOV's with an item. Of course only one LOV can be active at any given time.

  • Required to create a script for base table update using XMLSTORE package.

    Hi can anybody provide me some help full suggestion on how to update base table using XMLSTORE package.
    I created a simple script for Employee table and can able to do the basic operation like Insert and update on the table.
    Query is as follow's
    DECLARE
    insCtx DBMS_XMLSTORE.ctxType;
    rows NUMBER;
    xmlDoc CLOB :=
    '<ROWSET>
    <ROW num="1">
    <EMPLOYEE_ID>922</EMPLOYEE_ID>
    <SALARY>1801</SALARY>
    <HIRE_DATE>17-DEC-2007</HIRE_DATE>
    <JOB_ID>ST_CLERK</JOB_ID>
    <EMAIL>RAUSSJACK</EMAIL>
    <LAST_NAME>JACK</LAST_NAME>
    <DEPARTMENT_ID>20</DEPARTMENT_ID>
    </ROW>
    <ROW>
    <EMPLOYEE_ID>923</EMPLOYEE_ID>
    <SALARY>2001</SALARY>
    <HIRE_DATE>31-DEC-2005</HIRE_DATE>
    <JOB_ID>ST_CLERK</JOB_ID>
    <EMAIL>PATHAK</EMAIL>
    <LAST_NAME>PRATIK</LAST_NAME>
    <DEPARTMENT_ID>20</DEPARTMENT_ID>
    </ROW>
    </ROWSET>';
    BEGIN
    insCtx := DBMS_XMLSTORE.newContext('EMPLOYEES'); -- Get saved context
    DBMS_XMLSTORE.clearUpdateColumnList(insCtx); -- Clear the update settings
    -- Set the columns to be updated as a list of values
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'EMPLOYEE_ID');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'SALARY');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'HIRE_DATE');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'JOB_ID');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'EMAIL');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'LAST_NAME');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'DEPARTMENT_ID');
    -- Insert the doc.
    rows := DBMS_XMLSTORE.insertXML(insCtx, xmlDoc);
    --COMMIT;
    DBMS_OUTPUT.put_line(rows || ' rows inserted.');
    -- Close the context
    DBMS_XMLSTORE.closeContext(insCtx);
    END;
    SELECT employee_id, LAST_name FROM employees WHERE employee_id = 114;
    DECLARE
    updCtx DBMS_XMLSTORE.ctxType;
    rows NUMBER;
    xmlDoc CLOB :=
    '<ROWSET>
    <ROW>
    <EMPLOYEE_ID>114</EMPLOYEE_ID>
    <LAST_NAME>PRABHU</LAST_NAME>
    </ROW>
    </ROWSET>';
    BEGIN
    updCtx := DBMS_XMLSTORE.newContext('EMPLOYEES'); -- get the context
    DBMS_XMLSTORE.clearUpdateColumnList(updCtx); -- clear update settings
    -- Specify that column employee_id is a "key" to identify the row to update.
    DBMS_XMLSTORE.setKeyColumn(updCtx, 'EMPLOYEE_ID');
    rows := DBMS_XMLSTORE.updateXML(updCtx, xmlDoc); -- update the table
    DBMS_XMLSTORE.closeContext(updCtx); -- close the context
    commit;
    END;
    Nowi want little modification on this above query like as i am passing static XML tags and i want it to pick the dynamic XML from web and use the XMLSTORE for the update.
    and also for complex XML having 2-3 levels how this query needs to be changed.As i am new to this Oracle utillity any help from xepert will be a great help for me.
    Thanks

    Nowi want little modification on this above query like as i am passing static XML tags and i want it to pick the dynamic XML from webFrom a Web Service?
    You'll need UTL_HTTP or HttpUriType interface to send the request and receive the XML response.
    Search in the forum, there are already a lot of useful examples available.
    and also for complex XML having 2-3 levels how this query needs to be changed.DBMS_XMLStore is OK for readily processing a canonical XML format (/ROWSET/ROW/COLUMN structure or alike).
    However, if you have to deal with a more complex structure, you either have to :
    - use a target object table that matches the XML structure
    - preprocess the input document using XSLT to transform it to canonical format
    That's why DBMS_XMLStore is not appropriate for multilevel documents, especially if they contain nested repeating groups.
    In this case, XMLTable is a more flexible way of parsing the XML and process it relationally at the same time.
    Depending on the size of the document, performance may be improved with schema-based object-relational storage.
    For more help, please post a new thread in the {forum:id=34} forum, with the following information :
    - database version (select * from v$version)
    - a sample XML document (the complex one)
    - DDL of your target table
    - mapping between XML elements and columns (ie which tag goes to which column?)
    - an XML schema (if you have one)

  • Query on Non-base-table column in form

    Hi,
    Does anyone have an example of code to allow users to query on non-base-table column from forms? For example, a personnel form displays a persons' name and department name. The form is based on PERSON table, which contains the department id, not the name. The form uses post-query to display the department name. When in query mode, the user wants to enter department name, and display the people in the department (still using this form, which is based on PERSON table.
    Thanks!

    Try this:
    For data block person set these properties as follows:
    1.Set Query Data Source Name = "person , departments"
    2.Set DML data target name = "person"
    3.Set Where Clause to join i.e. condition "person.dno = departments.dno"
    For filed department name set these properties as follows:
    1.Data base item = "Yes"
    2.Column Name = "departments.dname"
    3.Query Only = "Yes"
    4.Insert Allowed = "No"
    5.Update Allowed= "No"
    6.Keyboard Navigable = "No"
    If you face ambiguous column name check for the same filed name exist on both tables and set column name for this filed to person.filed_name
    Regards
    null

  • Sales employee base table

    Dear experts,
    I want to create sales employee wise billing report . I dont know what is the base table for sales employee and how to link the sales employee field with vbrk or vbrp table. Please help me.

    Hi,
    You can acheive this by configuration as well,
    Assign sales employee in customer master or in your sales order so that it is copied to billing as well,
    now go to the following path IMG>Sales and Distribution>Sales Support>Lists>Set updating of Partner Index
    Trans.group---- Function -Name
    7(billing)----SE--
    Sales employee
    Now Goto T.code VF05 Press Partner function button
    Choose SE (Sales Employee) from F4 help
    now give your Sales Employee number and execute
    you will get the list of your sales employee
    Regards
    Senya

Maybe you are looking for