How to truncate fact tables using wb_truncate_table

Hi,
I've got a sequence of mappings that load various staging tables, dimensions and fact tables.
At present, I truncate the fact tables manually before loading the dimensions (to avoid foreigh key errors), but would like to write mappings to do the truncations.
I tried creating mappings using wb_truncate_table in a Pre-Mapping Process operator (using a constant for the filename), but can't figure out how to get this to actually truncate the fact table.
The manual says to "connect the output attribute of the Pre-Mapping Process operator to the input group of a target operator." However the PMP operator in my mapping doesn't have an output operator (and the add button is greyed out).
Sorry if I'm missing something obvious, but can anybody help, or advise on a better way to truncate my fact tables before reloading the dimensions?
Thanks in advance.
Chris

got that to work using WB_TRUNCATE_TABLE in a PMP in the first mapping to >populate one of the fact table's dimensions. The problem I was having was in >trying to create a mapping just to do the truncate, but I see now that's not the >way to go.If you want to create a mapping that just truncate some table(s) - it's very easy.
1. Just create your own function that returns, let's say, char. Inside this function, call WB_TRUNCATE_TABLE and return dummy char (e.g. '1'). Then create some dummy table with only one colum of char type.
2. Create mapping. place constant operator, your function as transformation operator, and dummy table. Link them CONSTANT - TRANSFORMATION - TABLE.
That's all. If you want to truncate more tables within one mapping, just add more FUNCTIONS and add more attributes (table names) to the constant operator.

Similar Messages

  • Multiple fact tables using one measure

    Hi Experts,
    Multiple fact tables using single measure .For example Measure name is amount . This measure is using 5 fact tables. By using this info , i have to create bmm layer document . In bmm layer documents columns are like logical table name ,column name, logical sourc name . could you please help me out to draft the document ?

    Hi ,
    My question is five fact tables are there, day level two different fact tables , period and week fact tables are there .
    Above all tables are using single measure . how to design these fact tables with measure in bmm layer ?
    Please kindly give reply .
    Thanks in advance.

  • How to restore a table using RMAN with previous backup ?

    Hi everyone,
    we have to restore a table from 1 week previous backup using RMAN.
    Could you show me how to restore a table using RMAN with previous full backup.
    please Help me out.
    Thanks
    Info > oracle 10g, OS: AIX5L

    Hi,
    first of all you must have all the archivelogs since you want to recover your table from the previous backups.
    anyways if you want to recover your table then you need to perform incomplete recovery to the point where you loss the table for that you need to restore and recover your database.you likely to loose all the transcation which occurs to the point where you you loose your table.
    thanks..

  • How to create a table using Text Layout Framework?

    How to create a table using Text Layout Framework? I meen real tables - like in HTML.

    Cell as indipendant TLF should work, I have created my table using same approach and works fine for me ... this is where it is
    http://apps.live-documents.com/docs/openWebDoc.do?docId=1480607
    Regards
    Raf

  • How to handle Fact tables with different granularity in OBIEE 11g RPD

    Hello Everyone,
    I have got stuck here and need your help.
    I have two fact tables (Say F1 and F2... F1 is containing data at month-level and F2 is containing data at day level) and one Date DIMENSION TABLE. Date_Code is the PK of Date dimension table.I need to use time-series functions also.
    Can anyone tell me how to model this requirement in the RPD.
    Can we use a single dimension table(Here Date dimension table) with two fact table of different grainularity? What would be the best way to implement this requirement?
    Thanks in advance :)

    Hi Veeravalli,
    Thanks for your reply :)
    Let me explain the problem in more detail. I have one Date dimension(Date_Code,Month_Code,Quarter_Code,Half_Year_Code,Year_Code). Here Date_Code is the PK.
    In F1---->Date (Using Month_Code key)
    F2-------->Date (Using Date_Code Key)
    Level based hierarchy is there starting from Year to Date.Each level has PK defined and chronological key selected.
    F1 has level set to Month and F2 has level set to Day.
    Now if i am using ago() function on measure of F2 (having day level data) then it's working fine but if i am using ago() function on measure of F1...I am getting an error at Presentation service: Date_code must be projected for time-series functions.
    So the whole issue is with time-series functions. As per my research...I think for time series the tables in the physical model containing the time dimension cannot join to other data sources, except at the most detailed level but here i am joining with F1(using Month_Code which is not the most detailed level).
    So kindly let me know how to achieve this in rpd?

  • How to empty Fact tables ???

    Hi everybody,
    How to supress data in fact table(but without delete data in dimension tables) before data loading ?
    I use a process chain to load the data.
    I know that manualy it is easy to do that, but with an automatic process how to do that ?
    Thanks
    Christophe

    Hi,
    just want to share my idea,instead of deleting the data,you can suppress the data to save memory by a process called " compression"
    check this link for more input
    http://www.sap-img.com/business/infocube-compression.htm
    Part of process chain,use process type "Compression of the InfoCube "
    Regards,
    Swapna.G

  • How to implement fact tables with finest level of detail (fine-grained)?

    Hi,
    Maybe this is basic knowledge what I'm asking here... I don't know, well, here it goes:
    I need to know the way carry my transactional data to a fact table, but keeping the finest level of detail possible (namely, the transactions). I implemented my cubes with MOLAP option for storage (those were the specs that I had to follow) so I can't add a unique constraint to those structures.
    I only seem to be able to load aggregated, precomputed data. If I wanted to load the transactions (after the data has been transformed and clenased) where should I do it?
    I tried to implement a version of the fact tables as ROLAP but got nowhere (I couldn't add a unique constraint or index on that column either).
    I would really, really appreciate your help.
    Best Regards,
    osvaldo.
    [osantos]

    Hi Veeravalli,
    Thanks for your reply :)
    Let me explain the problem in more detail. I have one Date dimension(Date_Code,Month_Code,Quarter_Code,Half_Year_Code,Year_Code). Here Date_Code is the PK.
    In F1---->Date (Using Month_Code key)
    F2-------->Date (Using Date_Code Key)
    Level based hierarchy is there starting from Year to Date.Each level has PK defined and chronological key selected.
    F1 has level set to Month and F2 has level set to Day.
    Now if i am using ago() function on measure of F2 (having day level data) then it's working fine but if i am using ago() function on measure of F1...I am getting an error at Presentation service: Date_code must be projected for time-series functions.
    So the whole issue is with time-series functions. As per my research...I think for time series the tables in the physical model containing the time dimension cannot join to other data sources, except at the most detailed level but here i am joining with F1(using Month_Code which is not the most detailed level).
    So kindly let me know how to achieve this in rpd?

  • General Question: should Fact Table use virtual column?

    Hi,
    I have read several articles about 11g's Virtual Column feature and it all looks very good. But I just want to know
    - Whether virtual column is also good for Fact table or not?
    - Is it recommedated?
    - Is there a 'limit' or 'recommedation'regarding how many virtual columns I should use in a table?
    Thanks

    In an OLTP system, the number of virtual columns is self-limiting because there aren't that many simple ways to combine the columns in a single table using simple expressions. In a data warehouse, there are likely a lot more expressions that you might want to compute, so you would have to be careful as oracletune points out if expressions can change over time assuming that you want the version of the computation that was in force at the time the row was written to be used.
    There really isn't a rule of thumb. It's a lot like asking how many indexes a table should have-- the only answer is to do a cost-benefit analysis on each potential index/ virtual column to determine if the benefits outweigh the cost. A virtual column allows you to avoid computing an expression when you are inserting a value but requires that you compute it at query time. If a row is queried millions of times, written once, and never updated, that probably isn't a great trade-off. If a row is queried a few times and updated a bunch, avoiding the computations is probably worthwhile. If you need to store the value and you have an OLTP system, the ability to ensure that you never have stale computations is great.
    Justin

  • PL/SQL- Problem in creating a partitioned fact table using select as syntax

    Hi All,
    I am trying to create a clone(mdccma.fact_pax_bkng_t) of existing fact table (mdccma.fact_pax_bkng) using dynamic pl/sql. However, pl/sql anonymous block errors out with following error:
    SQL> Connected.
    SQL> SQL> DECLARE
    ERROR at line 1:
    ORA-00911: invalid character
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 1608
    ORA-06512: at "SYS.DBMS_SQL", line 33
    ORA-06512: at line 50
    Here is pl/sql block:
    -- CREATING FPB_T
    DECLARE
    v_owner VARCHAR2(32) := 'MDCCMA';
    v_table_original VARCHAR2(32) := 'FACT_PAX_BKNG';
    v_table VARCHAR2(32) := 'FACT_PAX_BKNG_T';
    v_tblspc VARCHAR2(32) := v_owner||'_DATA';
    CURSOR c_parts IS SELECT TABLESPACE_NAME, PARTITION_NAME,HIGH_VALUE, ROW_NUMBER() OVER (ORDER BY PARTITION_NAME) AS ROWNUMBER
    FROM USER_TAB_PARTITIONS
    WHERE TABLE_NAME = v_table_original
    ORDER BY PARTITION_NAME;
    v_cmd CLOB := EMPTY_CLOB();
    v_cmd3 varchar2(300) := 'CREATE TABLE ' ||v_owner||'.'||v_table||' TABLESPACE '||v_tblspc
    ||' NOLOGGING PARTITION BY RANGE'||'(' ||'SNAPSHOT_DTM '||')' ||'(';
    v_part VARCHAR2(32);
    v_tblspc_name VARCHAR2(32);
    v_row number;
    v_value LONG;
    v_tmp varchar2(20000);
    v_cur INTEGER;
    v_ret NUMBER;
    v_sql DBMS_SQL.VARCHAR2S;
    v_upperbound NUMBER;
    BEGIN
    v_cmd := v_cmd3;
    OPEN c_parts;
    FETCH c_parts INTO v_tblspc_name, v_part,v_value, v_row;
    WHILE c_parts%FOUND
    LOOP
    IF (v_row = 1) THEN
    v_tmp := ' PARTITION '||v_part||' VALUES LESS THAN ' ||'('|| v_value||')'||' NOLOGGING TABLESPACE '||v_tblspc_name;
    ELSE
    v_tmp := ', PARTITION '||v_part||' VALUES LESS THAN ' ||'('|| v_value||')'||' NOLOGGING TABLESPACE '||v_tblspc_name;
    END IF;
    v_cmd := v_cmd || v_tmp;
    -- DBMS_OUTPUT.PUT_LINE(v_cmd);
    FETCH c_parts INTO v_tblspc_name, v_part,v_value, v_row;
    END LOOP;
    -- DBMS_OUTPUT.PUT_LINE('Length:'||DBMS_LOB.GETLENGTH(v_cmd));
    v_cmd := v_cmd||')'||' AS SELECT ' || '*'||' FROM ' || v_owner||'.'|| v_table_original ||' WHERE '||'1'||'='||'2'||';';
    v_upperbound := CEIL(DBMS_LOB.GETLENGTH(v_cmd)/256);
    FOR i IN 1..v_upperbound
    LOOP
    v_sql(i) := DBMS_LOB.SUBSTR(v_cmd
    ,256 -- amount
    ,((i-1)*256)+1 -- offset
    END LOOP;
    v_cur := DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(v_cur, v_sql, 1, v_upperbound, FALSE, DBMS_SQL.NATIVE);
    v_ret := DBMS_SQL.EXECUTE(v_cur);
    CLOSE c_parts;
    DBMS_OUTPUT.PUT_LINE(v_cmd);
    -- EXECUTE IMMEDIATE v_cmd ;
    END;
    The above pl/sql creates a DDL for partitioned fact table(new) based on an existing fact table and get executes through CLOB.
    Please look into the issue and let me know any changes or modifications/suggestions that are required to fix the issue. Any help is appreciated.
    Thank You,
    Sudheer

    Think this is your problem:
    v_cmd := v_cmd||')'||' AS SELECT ' || '*'||' FROM ' || v_owner||'.'|| v_table_original ||' WHERE '||'1'||'='||'2'||';';Remove the SQL terminator ';' ... dynamic SQL doesn't require it, try this instead:
    v_cmd := v_cmd||')'||' AS SELECT ' || '*'||' FROM ' || v_owner||'.'|| v_table_original ||' WHERE '||'1'||'='||'2';Thanks
    Paul

  • How to know the tables used in an Extractor?

    Hi Friends,
    Is there any method to find out the underlying tables used in an extractor?
    For example , 2LIS_11_VAITEM datasource uses tables  VBAP and VBUP( item status). For LOs we can see it in Lo **** pit. So If any extractor uses more than one table ..then how do you see those?? . If it is generic ds which is based on Functional Module, then what is the procedure other going into table tab.
    Actuall i would like to know for DS of FICA Open items 0FC_OP_01 .
    Thank in advanace
    Murthy

    Hi If it is LO extractor:
    Use transaction code LBWE  in the R/3
    Go to the extractor for which you want to see the data( Logistic app->Extractors)
    Go to maintenance
    You will get an option to update just click yes and then you will get option to create request.Just check the display, it will lead you  top the window where you can see where all the fields are and from which table it is available.
    check the Roberto's blog:
    /people/sap.user72/blog/2005/09/05/sap-bw-and-business-content-datasources-in-pursuit-of-the-origins

  • How to Update  crmd_customer_h TABLE Using CRMV_EVENT Through Funtion Module

    Hi
    How we can update customer_h table using the CRMV_EVENT Where i implemented logic below in the Funtion Module.
    data:     lt_doc_flow          TYPE crmt_doc_flow_wrkt,
              lw_cust_h_com        TYPE crmt_customer_h_com,
              lw_input_field_names TYPE crmt_input_field_names,
              lt_input_field_names TYPE crmt_input_field_names_tab,
              lt_objects_to_save TYPE crmt_object_guid_tab,
              lw_guid TYPE CRMT_OBJECT_GUID.
    DATA : lv_process_type TYPE crmt_process_type.
    data: wa_doc_flow type CRMT_DOC_FLOW_WRK.
    data: wa_customer_h type crmd_customer_h.
    *  Function module for retriving the Process type.
      CALL FUNCTION 'CRM_ORDERADM_H_READ_OW'
        EXPORTING
          iv_orderadm_h_guid     = iv_header_guid
        IMPORTING
          ev_process_type        = lv_process_type
        EXCEPTIONS
          admin_header_not_found = 1
          OTHERS                 = 2.
    if lv_process_type eq 'ZG01'.
    CALL FUNCTION 'CRM_DOC_FLOW_READ_OB'
    EXPORTING
       IV_HEADER_GUID                 = iv_header_guid
    IMPORTING
       ET_DOC_FLOW_WRK                = lt_doc_flow.
    read table lt_doc_flow with key objtype_a = 'BUS2000116' INTO wa_doc_flow. "gc_object_type-service.
                if sy-subrc eq 0.                    "set flag for service order
                lw_cust_h_com-ref_guid       =  wa_doc_flow-objkey_a.
                lw_cust_h_com-ZZTRAIL_FLAG   = 'X'.
                 lw_cust_h_com-mode           = 'A'.
                lw_cust_h_com-ref_handle     = '0000000001'.
                lw_guid = wa_doc_flow-objkey_a.
                INSERT lw_guid INTO TABLE lt_objects_to_save.
         endif.
                  lw_input_field_names-fieldname = 'REF_GUID'.
                lw_input_field_names-fieldname = 'ZZTRAIL_FLAG'.
              lw_input_field_names-changeable = ' '.
               INSERT lw_input_field_names INTO TABLE lt_input_field_names.
    Maintain Customer H
             CALL FUNCTION 'CRM_CUSTOMER_H_MAINTAIN_OW'
                  EXPORTING
                    is_customer_h_com    = lw_cust_h_com
                  CHANGING
                    ct_input_field_names = lt_input_field_names
                  EXCEPTIONS
                    header_change_error  = 1
                    header_create_error  = 2
                   error_occurred       = 3.
    ENDIF.
    *endif.
    *Clearing local variables
      clear: lv_process_type,
             lw_cust_h_com,
             lw_input_field_names.
    *Free internal tables
      free: lt_doc_flow,
            lt_input_field_names.

    Hi Faisal
    I think your not clear with what i am saying anyhow i will again explain you my requirement
    As per my requirement
    1)in the service order search report i need to add a field called "Has trail order with No Follow up" with values "Yes" & "Blank"
    For above Field i added  using the structure CRMST_QUERY_SRVO_BTIL and through configuration i am able to display the field in webui as per (Attachement Pic 1)
    2)When i  search with search criteria as  "Has trail order with No Follow up" with  "Yes"
    Then in result list i need to show the service order those having follow up as trail orders(sales order) only.if for  next document trail order  having any follow up then those service orders dont want to show in result list.
    For above requirement i implemented F.M using CRMV_EVENT & I configured for BUS2000115 And BEFORE_SAVE The Order
    The FM Will get trigger when i save the service order and for that service order if create any follow up and try to save the trail order then This FM Will trigger and in this i am doing validations.
    3)Add one AET Trail Flag field is added under CUSTOMER_H Table.
    4)in the FM I am validating for if the trail order having the preceding document as service order then i need to make flag as "X" For that service order in customer_h
    if suppose when i delete trail order from the service order then that flag must need to be "unset" from the CUSTOMER_H.
    Why bcoz we are doing above process is do show records in result list based on Flag values
    these flag checks are validating in the BADI Which we implemented for search logic.
    Please refer below Login for my requirement:-
    Proposal to have a custom “flag” field (background at table level,
         crmd_customer_h) linked to service order which gets flagged whenever at
         least one Trial order is created and saved from the Service Order.
    The flag value should be cleared when all the trial orders created and
    saved as follow up transactions are deleted from the system.
    Similarly for Trial Orders will use the same custom “flag” field
         which gets activated when at least one follow up is created and saved from Trial Order.
    The flag value should be cleared when all the follow up transactions from
    the Trial Order are deleted from the system.
    When the above search criteria “Has Trial order with no follow up”
         “is” “Yes” is applied then the logic derives all the service
         orders which satisfy additional search criteria applied in the search and
         for these Service orders checks if the custom flag field is checked to
         derive all Service orders which have Trial order. The custom flag values
         values are derived from crmd_customer_h table in CRM.
    4 )Further for all the Trial Orders determined in Step 3
    check if the Trial Order has a follow up by checking if the custom flag field
    is checked. The custom flag values are derived from crmd_customer_h table in
    CRM.
    5) If step 4 is not met populate the preceding Service
    Orders in the Result list

  • How to create a table using subform if  lifecycle designer 7.1 not availabl

    hi,
    plis tell me how to create a table because i am using adobe lifecycle 6.1 and in the library
    there is no object for table..
    also tell me that if i have adobe lifecycle designer then which is better option and why?
    use table from library directly or create a table using subform...

    Hi Sweta,
    Create the interface attributes of type string and xtring type.
    Create node in the context of type graphics. bind the interface fields to the graphic node context element properties -
    Graphic content, field of xzstring type and mimetype to be string/any char data type of suitable length.
    In  layout drag and drop the image field and bind it to the graphic element.
    In yoour report programme-
    do the code as berlow to pass the graphic data -
    <i>CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
    EXPORTING
    p_object = 'GRAPHICS'
    p_name = '<mime type graphic name>'
    p_id = 'BMAP'
    p_btype = 'BCOL' "BMON if monochrome
    RECEIVING
    p_bmp = w_binary
    EXCEPTIONS
    not_found = 1
    internal_error = 2
    OTHERS = 3.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.</i>
    in the call <form function module>
    pass the inerface values for
    xstring (graphic field) to be w_binary (import parameter of the previous method)
    and mime type  to be 'image/bmp'.
    This would work.
    Hope fully you may be able to see a tutorial on this soon ;).
    - anto.

  • How to create a table using polish

    I am able to show all the database records in table form but i want to edit a particular cell of the table, how to do that. thanks in advance.

    Cell as indipendant TLF should work, I have created my table using same approach and works fine for me ... this is where it is
    http://apps.live-documents.com/docs/openWebDoc.do?docId=1480607
    Regards
    Raf

  • How to TRUNCATE a table dynamically in a Stored Procedure?

    Hi everyone, How can I create a Procedure with dynamic sql to truncate a table name I pass by every time in Oracle? I am running the following query and nothing happens. It neither creates the procedure nor errors out.
    CREATE OR REPLACE PROCEDURE TruncateTable(TableName IN VARCHAR2(50))
    IS
    BEGIN
    SQLCmd VARCHAR(200);
    BEGIN
    SQLCmd := 'TRUNCATE TABLE ' || TableName;
    EXECUTE IMMEDIATE SQLCmd;
    END;
    Could someone please help me?
    Thanks

    Thanks Brendan for the reply. But, it neither does anything after I add a "/" on line9. Just wondering if the syntax of the proc is correct?

  • How to view one table used percentage in sqlplus?

    if the table only one record in dba_free_space,then use
    'select round(block_id/blocks,4)*100
    from dba_free_space
    where tablespace_name='xxx'"
    could list used percentage,
    but one table have many records in dba_free_space,
    how to display this table's used percentage?

    DBA_FREE_SPACE displays free extents in all tablespaces: there is no direct relationship with any given table.
    If you want to get free space in a existing table you should use DBMS_SPACE package. Here a a old but nice demo on AskTom.

Maybe you are looking for

  • How to increase memory size of a variable.

    Hello ABAP gurus, Plese clarify my doubt. My doubt is I have one variable which stores 20 characters.now i need to pass 50 characters to store 50 character.How can i achieve this. please clarify my doubt. Regards Maruthi.

  • Weblogic 10.3TP, JAX-WS and Spring integration

    Hi all We are using JAX-WS and Spring (2.0.6) and our target platform will be Weblogic 10.3. We would like to benefit from Spring injection in our web service classes. However I cannot get it to work. I follow the instructions described here: [url ht

  • Transfer Profile

    Hi Everyone, While I was creating activity for transfer profile it gives error saying 'Transfer to R/3 using mixed periodicities is not allowed'. And I am using 9ADP as periodicity. Now I changed the time bucket profile to accomodate days in it. Afte

  • How to make FaceTime and iMessage stop turning off by themselves

    Has anyone experienced FaceTime and iMessage randomly turning off?

  • Audio Channel Mapping in Premiere Pro CS6

    I am using Premiere Pro CS6 6.0.5. Double clicking on an imported 5.1 ac3 file in my bin brings up the 6 channels in waveform in Source panel. The channels are mapped L,R,Ls,Rs,C,LFE. This does not conform to Dolby Digital standard L,R,C,LFE,LS,RS. I