Use of Update Table in Delta Extraction ....

Hi all ,
       I have a small doubt regarding why there is an update table introduced between statistical table and delta queue in delta extraction process ... why not directly extract data from the statastical table and put it in to the delta queue .....
Kindly help me regarding this ...
Regards ,
Santosh ....

Hi Santosh,
I think it is related to resource, batch and memory, problem. Infact you can use only delta queue if you select direct update, but you use this kind of update only for huge amount of data produced in a short period of time.
The two queue let you divide transaction moment to batch collection moment.
Hope this help.
Ciao.
Riccardo.

Similar Messages

  • What is the use of setup tables in LO extraction

    Hi Friends,
    What is the use of setup tables in LO extraction, what is the functionality of setup tables
    Thanks in advance

    hi,
    to prepare data to be extracted to bw,
    more details take a look Roberto's weblog
    /people/sap.user72/blog/2004/12/16/logistic-cockpit-delta-mechanism--episode-one-v3-update-the-145serializer146
    /people/sap.user72/blog/2004/12/23/logistic-cockpit-delta-mechanism--episode-two-v3-update-when-some-problems-can-occur
    /people/sap.user72/blog/2005/01/19/logistic-cockpit-delta-mechanism--episode-three-the-new-update-methods
    /people/sap.user72/blog/2005/04/19/logistic-cockpit-a-new-deal-overshadowed-by-the-old-fashioned-lis
    /people/sap.user72/blog/2005/02/14/logistic-cockpit--when-you-need-more--first-option-enhance-it
    hope this helps.

  • Time-stamp Table for delta extraction

    Hi SDNers,
    What are the BW Time-stamp Tables for delta extraction in Source System(R/3).
    Thanks,
    Satya

    the tables involved are :
    ROOSPRMS
    ROOSPRMSC
    ROOSPRMSF
    in the second table (ROOSPRMSC) you'll find the timestamp
    M.

  • Use of update table in Unserialised V3?

    HI Pioneers,
    Can any one let me know the advantage of Update table in Unserialised V3 update mode?
    Thanks,James

    hi,
    Update table is to store the posted records(V3 update), so the the collective run can pick uprecords from there.
    Unserialized V3 update is not used now a days.
    Only queued Delta is used
    Regards,
    Ramesh

  • PCA doment missing during the delta extraction

    Hi R/3 DBA experts,
    We are using Oracle 10g Data base for our ECC6.0 R/3 system.During BW extraction some of the PCA line item records got missed which gets update in data base table GLPCA in R/3 after successful document creation.
    We are in the process of analysis to find out the root cause of the issue as we are approaching year end close.
    Please let me know how to get the following logs(Information) in R/3
    1.Total time taken in Application server for a particular document which was Entered.
    2.Total time taken for a document from posting(Document entry) to successful data base server update.
    (OR Application server to Data base server update log details OR Document posting to DB write for a document)
    Please treat this as a matter of urgency
    Regards
    Kumar

    Hi,
    To move the data from Update Tables to Delta Queue, u need to run the V3 Job Control in LBWE. Once if the job is successfully completed then all the data from Update tables are moved to Delta Queue. Check once in the job overview of V3 job control is there any errors.
    Hope this helps in solving u r problem
    Regards
    Ramakrishna Kamurthy

  • I_UPDMODE has no value in my Function Module when using Delta Extraction

    Help me please.
    My system is BW 3.52
    Please see the source code below and tell me why I_UPDMODE has not been passed value. I have ever used "I_SOURCE" but the value pass to I_DSOURCE. Can anyone tell me where is the upload mode pass to?
    FUNCTION ZBWFN_TEST_DELTA.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_REQUNR) TYPE  SBIWA_S_INTERFACE-REQUNR
    *"     VALUE(I_DSOURCE) TYPE  SBIWA_S_INTERFACE-ISOURCE OPTIONAL
    *"     VALUE(I_MAXSIZE) TYPE  SBIWA_S_INTERFACE-MAXSIZE OPTIONAL
    *"     VALUE(I_INITFLAG) TYPE  SBIWA_S_INTERFACE-INITFLAG OPTIONAL
    *"     VALUE(I_UPDMODE) TYPE  SBIWA_S_INTERFACE-UPDMODE OPTIONAL
    *"     VALUE(I_DATAPAKID) TYPE  SBIWA_S_INTERFACE-DATAPAKID OPTIONAL
    *"     VALUE(I_RLOGSYS) TYPE  SRSC_S_INTERFACE-RLOGSYS OPTIONAL
    *"     VALUE(I_READ_ONLY) TYPE  SRSC_S_INTERFACE-READONLY OPTIONAL
    *"  TABLES
    *"      I_T_SELECT TYPE  SBIWA_T_SELECT OPTIONAL
    *"      I_T_FIELDS TYPE  SBIWA_T_FIELDS OPTIONAL
    *"      E_T_DATA STRUCTURE  ZISU_ERCHC OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
    This extractor is part of a delta scenario based on a timestamp
    included in the fields of table ROVERCUBE1. The interesting part
    takes place in form get_time_interval, where the date range is
    calculated update modespecifically.
    The pointer for the date up to which delta was extracted during
    the last delta update is held in table ROBWQTSTAT.
      TABLES: ZISU_TP_ERCHC, ERCH, ERCHC.
    Auxiliary Selection criteria structure
      DATA: L_S_SELECT TYPE SBIWA_S_SELECT.
      DATA: L_ERCHC LIKE ZISU_TP_ERCHC OCCURS 0 WITH HEADER LINE.
      DATA: L_DATE LIKE SY-DATUM,
                L_ACTUAL_DATE LIKE SY-DATUM,
                L_LAST_DATE LIKE SY-DATUM.
    Maximum number of lines for DB table
      STATICS: L_MAXSIZE TYPE SBIWA_S_INTERFACE-MAXSIZE,
               BEGIN OF S_S_INTERFACE.
      INCLUDE TYPE SBIWA_S_INTERFACE.
      INCLUDE TYPE SRSC_S_INTERFACE.
      STATICS: END OF S_S_INTERFACE.
    STATICS: BEGIN OF S_R_TSTMP OCCURS 1,
                SIGN(1),
                OPTION(2),
                LOW  LIKE ROVERCUBE1-TSTMP,
                HIGH LIKE ROVERCUBE1-TSTMP,
              END   OF S_R_TSTMP.
    Initialization mode (first call by SAPI) or data transfer mode
    (following calls) ?
      IF I_INITFLAG = SBIWA_C_FLAG_ON.
    Invalid second initialization call -> error exit
        IF NOT G_FLAG_INTERFACE_INITIALIZED IS INITIAL.
          IF 1 = 2. MESSAGE E008(R3). ENDIF.
          LOG_WRITE 'E'                    "message type
                    'R3'                   "message class
                    '008'                  "message number
                    ' '                    "message variable 1
                    ' '.                   "message variable 2
          RAISE ERROR_PASSED_TO_MESS_HANDLER.
        ENDIF.
    Check DataSource validity
        CASE I_DSOURCE.
          WHEN 'ZOVER_TRANS'.
          WHEN 'TEST_ROVERCUBE'.
          WHEN 'DO_DATASOURCE'.
          WHEN '0VER_DELTA_WITH_LONG_NAME'.
          WHEN '0VER_CUBE_OLD_LIS'.
          WHEN '0VER_TYPE_ATTR'.
          WHEN OTHERS.
            IF 1 = 2. MESSAGE E009(R3). ENDIF.
            LOG_WRITE 'E'                  "message type
                      'R3'                 "message class
                      '009'                "message number
                      I_DSOURCE            "message variable 1
                      ' '.                 "message variable 2
            RAISE ERROR_PASSED_TO_MESS_HANDLER.
        ENDCASE.
    Check for supported update mode
        CASE I_UPDMODE.
          WHEN 'F'.
          WHEN 'D'.
          WHEN 'C'.
          WHEN 'R'.
          WHEN 'S'.
          WHEN OTHERS.
            IF 1 = 2. MESSAGE E011(R3). ENDIF.
            LOG_WRITE 'E'                  "message type
                      'R3'                 "message class
                      '011'                "message number
                      I_UPDMODE            "message variable 1
                      ' '.                 "message variable 2
            RAISE ERROR_PASSED_TO_MESS_HANDLER.
        ENDCASE.
        APPEND LINES OF I_T_SELECT TO G_T_SELECT.
    Fill parameter buffer for data extraction calls
        S_S_INTERFACE-REQUNR    = I_REQUNR.
        S_S_INTERFACE-ISOURCE   = I_DSOURCE.
        S_S_INTERFACE-MAXSIZE   = I_MAXSIZE.
        S_S_INTERFACE-INITFLAG  = I_INITFLAG.
        S_S_INTERFACE-UPDMODE   = I_UPDMODE.
        S_S_INTERFACE-RLOGSYS   = I_RLOGSYS.
        S_S_INTERFACE-READONLY  = I_READ_ONLY.
        G_FLAG_INTERFACE_INITIALIZED = SBIWA_C_FLAG_ON.
        APPEND LINES OF I_T_FIELDS TO G_T_FIELDS.
    here the timerange for update modes concerning delta is calculated
    and the status table is updated
        PERFORM GET_CAL_INTERVAL TABLES G_R_DELTA_DATE[]
                                  USING  S_S_INTERFACE-ISOURCE
                                             S_S_INTERFACE-UPDMODE
                                             S_S_INTERFACE-RLOGSYS.
      ELSE.                 "Initialization mode or data extraction ?
    Data transfer: First Call      calcualte range tables for key fields
                                   calculate date range due to update mode
                                   OPEN CURSOR + FETCH
                   Following Calls FETCH only
    First data package -> OPEN CURSOR
        G_COUNTER_DATAPAKID = G_COUNTER_DATAPAKID + 1.
        IF G_COUNTER_DATAPAKID = 1.
    Fill range tables.
         LOOP AT G_T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'COUNTRY'.
           MOVE-CORRESPONDING L_S_SELECT TO L_R_COUNTRY.
           APPEND L_R_COUNTRY.
         ENDLOOP.
         LOOP AT G_T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'REGION'.
           MOVE-CORRESPONDING L_S_SELECT TO L_R_REGION.
           APPEND L_R_REGION.
         ENDLOOP.
         LOOP AT G_T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'KUNNR'.
           MOVE-CORRESPONDING L_S_SELECT TO L_R_KUNNR.
           APPEND L_R_KUNNR.
         ENDLOOP.
         LOOP AT G_T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'TYPE'.
           MOVE-CORRESPONDING L_S_SELECT TO L_R_TYPE.
           APPEND L_R_TYPE.
         ENDLOOP.
         LOOP AT G_T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'GJAHR'.
           MOVE-CORRESPONDING L_S_SELECT TO L_R_GJAHR.
           APPEND L_R_GJAHR.
         ENDLOOP.
    no data must be selected in Init simulation mode
          CHECK S_S_INTERFACE-UPDMODE NE SRSC_C_UPDMODE_INITSIMU.
    Determine number of database records to be read per FETCH statement
    from input parameter I_MAXSIZE.
          L_MAXSIZE = G_S_INTERFACE-MAXSIZE.
          REFRESH: L_ERCHC.
          SELECT * FROM ERCH WHERE ERDAT IN G_R_DELTA_DATE
                                          OR AEDAT IN G_R_DELTA_DATE.
            SELECT SINGLE * FROM ERCHC WHERE BELNR = ERCH-BELNR.
            IF SY-SUBRC = 0.
              CLEAR: L_ERCHC.
              L_ERCHC-BUKRS = ERCH-BUKRS.
              L_ERCHC-ABRVORG = ERCH-ABRVORG.
              L_ERCHC-PORTION = ERCH-PORTION.
              L_ERCHC-GPARTNER = ERCH-GPARTNER.
              IF ERCHC-CPUDT IN G_R_DELTA_DATE.
                L_ERCHC-DELDT = ERCHC-CPUDT.
                L_ERCHC-DOCDT = ERCHC-BUDAT.
                L_ERCHC-RELNO = 1.
                COLLECT L_ERCHC.
              ENDIF.
              IF ERCHC-INTCPUDT IN G_R_DELTA_DATE AND
                 ERCHC-INTCPUDT IS NOT INITIAL.
                L_ERCHC-DELDT = ERCHC-INTCPUDT.
                L_ERCHC-DOCDT = ERCHC-INTBUDAT.
                L_ERCHC-REVNO = 1.
                COLLECT L_ERCHC.
              ENDIF.
            ENDIF.
          ENDSELECT.
          DELETE FROM ZISU_TP_ERCHC.
          LOOP AT L_ERCHC.
            MOVE-CORRESPONDING L_ERCHC TO ZISU_TP_ERCHC.
            INSERT ZISU_TP_ERCHC.
          ENDLOOP.
          OPEN CURSOR WITH HOLD G_CURSOR FOR
          SELECT * FROM ZISU_TP_ERCHC.
        ENDIF.                             "First data package ?
        IF S_S_INTERFACE-UPDMODE = SRSC_C_UPDMODE_INITSIMU.
          RAISE NO_MORE_DATA.
        ENDIF.
    Fetch records into interface table.
        FETCH NEXT CURSOR G_CURSOR
                   APPENDING CORRESPONDING FIELDS OF TABLE E_T_DATA
                   PACKAGE SIZE  S_S_INTERFACE-MAXSIZE.
        IF SY-SUBRC <> 0.
          RAISE NO_MORE_DATA.
        ENDIF.
      ENDIF.              "Initialization mode or data extraction ?
    ENDFUNCTION.

    Dave,
    1. You can fire SELECTS in an RFC as well, but in your case the data exists in SYSTEM A and the RFC is in System B, so you can't do that. You can fire SELECTS on tables in the same system.
    2. Quick example of two table loops - EKKO (HEADER) EKPO (ITEM).
    LOOP AT EKKO.
    LOOP AT EKPO WHERE EBELN = EKKO-EBELN.
    ENDLOOP.
    ENDLOOP.
    I hope this is clear now.
    Regards,
    Ravi

  • Code For Delta Extraction Using Function Module

    Dear Experts,
    I want a sample code for Delta Extraction using Function Module ( If it is customized already working code very helpful ), I have already created Function Module but Full update is happening. If I give delta update again it is retrieving all records. It is very urgent, if you have please send me to the following mail ID.
    [email protected]
    Best Regards,
    SGK.

    Dear KJ,
    Thank for your response. I saw the code that you sent, you have used some ztables like ZSC_DELTA_IP, ZSC_SAFETY_DELTA, ZSC_SET_EXT_TIME
    What are the fields that you have created in these tables , what is use of these tables, can you send the fields that you have used in these tables.
    Thanks & Regards,
    SGK

  • Generic delta extraction using function module

    Hi.
    I have a generic datasource , extraction being performed by a function module. The extraction works fine in full update mode. The extract structure has a timestamp field.
    I have enabled generic delta using this field(i.e., marked this field in RSO2). I understand that with this setting, I should be able to get delta data when I do a delta request. But it does not seem to happen.
    I checked the ROOSPRMSC table for the last(local) timestamp stored there. Now when I do the delta upload I expect to see only those records which are younger than the stored timestamp of last upload.
    But I still get the entire set of records.
    Questions are :
    1. Do I need to explicitly code for fetching the delta in the extractor ?
    2. If not, what could be the reason why generic delta is not working ?
    Thanks and regards,
    Anuradha

    Hi GFV,
    I read-up all the forum entries on this topic but could not find anything specifically dealing with my problem. I have browsed through the how-to paper on generic delta as well.
    I am quite sure that we don't need any special coding in the extrator for generating delta generically. Even the how-to paper does not mention that.
    I have used the FM RSAX_BIW_GET_DATA_SIMPLE as a template
    for my extractor(as suggested by F1 help in RSO2). This FM does not even have the i_updmode flag in its interface. 
    Thus this function module always does full extraction and I expect the system to take care of delta using the timestamp field.
    Are these assumptions incorrect ?
    Regards,
    Anuradha

  • R/3 table to BW via Delta Extraction (Urgent plz)

    Hello Experts,
    How to load a data from one of the R/3 tables to BW when the table doenst contains either a time stamp, Date field or numeric pointer.
    I have PS Table in R/3 (RPSCO) with over 7 hundered thousand records in it. I would like to populate the data to a ODS via delta extraction.
    The table doesnt contain either a timestamp, numeric pointer or date. How would I extract a data now to BW via delta. Would it be possible to use Generic extraction.
    Thanks and Regards,
    Harish

    Hi Harish,
    If you need ODS to make delta DataMart you can not delete data before every upload.
    For spee-up the upload you can follow these solution:
    1)Take off from parameters of your ODS Reporting BEx flag. Without this flag the system does not spent time for reporting activation of data.
    2)If upload is too slow you can try to make delta in R/3 via a program that compare previous upload and new status of your table, introducing in the tableforthe upload only modified records. It can be very slow, but it is all R/3 time.
    Ciao.
    Riccardo.

  • Short dump in delta extract  using bgRFC in NW 2004s

    Short dump in delta extract after Support Pack install, using bgRFC. 
    InfoSet Query extractor from Z-table residing on BW system into ODS. 
    Init and Full loads load successfully, delta loads short dump.
    "MESSAGE_TYPE_X"        
    "SAPLARFC" or "LARFCU25"     
    "TRFC_SET_QUEUE_RECEIVER_LIST"
    Problem began after support pack install, from SP 9 to SP 12.   Switched to Classic RFC in SM59,  seemed to correct this extractor but caused problems in  other extractors.

    Hi Kevin,
    check out this note: https://websmp205.sap-ag.de/~form/handler?_APP=01100107900000000342&_EVENT=REDIR&_NNUM=1054970&_NLANG=EN
    it might help.
    regards
    Siggi

  • Delta Extraction Using Function Module ( Customization )

    Dear Experts,
    I want a sample code for Delta Extraction using Function Module ( If it is customized already working code very helpful ), I have already created Function Module but Full update is happening. If I give delta update again it is retrieving all records. It is very urgent, if you have please send me to the following mail ID.
    [email protected]
    Best Regards,
    SGK.

    Hi SGK,
    I've done this for a delta based on a timestamp and it's actually pretty easy.  The basic steps are:
    1) Create an extract structure in SE11.  Make sure the structure has a date or timestamp field in it that you can use for delta.  You'll need to include the field twice if you also want to extract it to BW/BI since once it's chosen as the delta field then it will be hidden in the interface.
    2) Create the extractor function module in SE37.  You can use RSAX_BIW_GET_DATA_SIMPLE as a template.  Make sure your logic restricts the data it retrieves according to the selections that are passed in I_T_SELECT, including restrictions on the delta field.
    3) Create a generic DataSource in RSO2.  Click Extraction by FM then fill in your extract structure and function module.  Click Generic Delta and pick your delta field and the appropriate radio button (time stamp or calendar day).  If your delta field is a timestamp field then be sure to set the upper and lower safety limits to -86400 and 86400 respectively.  This might not be necessary on your version of SAPI but on mine there is a bug where it doesn't translate between system time and UTC (GMT) correctly so this was necessary.
    You don't need to program any special delta handling logic in your function module as long as you restrict the data you retrieve based on the delta field (I_T_SELECT).  This is because the SAPI takes care of catching the init, delta and repeat requests, translating them to the appropriate delta field values, and then passing them to your function module as if it was a full extraction for a specific date or timestamp range.
    Hope this helps!
    Jason

  • Delta Extraction: Cross Application Table

    Hello Gurus,
    While enhancing an LO extractor, I understand that we need to create a structure with the fields needed for extraction and then append this to the main extract structure and populate this through the user exit. Now what I am worried about is if the fields happend to be a from a cross application table, how the delta would be taken care of?
    As an Example, if I need to add in couple of fields of the delivery tables (LIPS and LIKP) in the Purchasing extractor (2LIS_02_SCL), am I going to get changed fields during the delta extraction?
    Thanks...

    Is that always true? Please look through the following scenario that Sunmit mentioned in response to Roberto's one of the blogs:
    If a scenario demands a cross application enhancement
    eg: Enhancing shipment relevant field in a delivery data source/extractor or delivery relevant field in an invoice relevant data source.
    Is the delta relevance of these enhanced fields retained by enhancing the datasource at communication structure level? I guess, the delta of these enhanced fields would still be lost, since they are not included in the events that are used to create the delta.
    (ie a shipment document (our field) may change without change in delivery document).
    Any ideas???

  • Update table a columns using columns from table b (values of 2 columns of table b need to taken from table c)

    Guys,
    I need to update table A columns col3, col4, col5 and col6 by table b columns col3, col4, col5 and col6 however table b col5 and col6 values need to come from table c col1.
    Means table b col5 and col6 have values in it however i need to replace them with value from table c col1 and need to update table a col5 and col6 accordingly.
    table a and table b has col1 and col2 in common.
    i am trying something like this.
    Update a
    a.col3 = b.col3,
    a.col4 = b.col4,
    a.col5 = (select col1 from table_c c where c.col2=b.col5),
    a.col6 = (select col1 from table_c c where c.col2=b.col6)
    from table_A a inner join table_b
    on  a.col1=b.col1 and a.col2=b.col2
    can someone help me reframe above update query?
    thanks in advance for your help.

    Try the below:(If you have multiple values, then you may need to use TOP 1 as commented code in the below script)
    create Table tableA(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableA values(1,2,3,4,5,6)
    create Table tableB(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableB values(1,2,30,40,50,60)
    create Table tableC(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableC values(100,50,30,40,2,2)
    --Insert into tableC values(200,50,30,40,2,2)
    Insert into tableC values(100,60,30,40,2,2)
    Select * From tablea
    Update a Set
    a.col3 = b.col3,
    a.col4 = b.col4,
    a.col5 = (select col1 from tablec c where c.col2=b.col5 ),
    a.col6 = (select col1 from tablec c where c.col2=b.col6 )
    from tableA a inner join tableb b
    on a.col1=b.col1 and a.col2=b.col2
    --Update a Set
    --a.col3 = b.col3,
    --a.col4 = b.col4,
    --a.col5 = (select Top 1 col1 from tablec c where c.col2=b.col5 Order by c.Col1 asc),
    --a.col6 = (select Top 1 col1 from tablec c where c.col2=b.col6 Order by c.Col1 asc)
    --from tableA a inner join tableb b
    --on a.col1=b.col1 and a.col2=b.col2
    Select * From tablea
    Drop table tablea,Tableb,TableC

  • What Strategies are there for updating a table when you're using a multi-table view to display it.

    I'm using a view and am able to create a grid that allows editing of one of the columns. Let's call the table where the column is updated "DepartmentFeeDetail." The view has several joins but up till now the column was editable.
    Today I needed to join DepartmentFeeDetail with itself to pick up the debit side of a debit/credit pair. I want to show the gl account number for both
    the debit and credit on the same row. I also need to update the value for both debit and credit.
    I can no longer edit the column to no surprise. When updating using MSSQLMS I get the following error:
    View or function 'MyTestView' is not updatable because the modification affects multiple base tables.
    What should my strategy be in lightswitch? The grid is populated by a query that includes my lynq expressions in DepartmentFeeRateQuery_PreprocessQuery. The query may return 1000+ rows. I need to allow the accountant to edit either a single row's column
    or enter a value in a field outside the grid and click a button "Apply fee rate to entire page."
    All this was working fine until the requirement to show the debit side gl account number and to change the debit side value somehow.
    I've tried adding a property to DepartmentFeeDetail but the "Is Computed" property wouldn't allow me to uncheck it. Is there a way to add an editable property for each grid row and initialize it to the
    current value of the column returned by the view? I could then update a collection when one of the fields changes. If they change the global value and press "Apply fee rate to entire page"
    I can update the collection as well.
    Scott Mitchell

    What I do is instead of using a View I use a updatable
    WCF RIA Service.
    This is an example of an updateable method:
    public void UpdateQuestionDetailForUser(QuestionDetailForUser objQuestionDetailForUser)
    // Get the current user
    string strCurrentUserName = System.Web.HttpContext.Current.User.Identity.Name;
    // We are under Forms Authentication so if user is blank then we
    // are debugging and we are TestUser
    if (strCurrentUserName == "")
    strCurrentUserName = "TestUser";
    // Check for an existing Answer for this Question for this User
    var objSurveyAnswer = (from SurveyAnswers in this.Context.SurveyAnswers
    where SurveyAnswers.SurveyQuestion.Id == objQuestionDetailForUser.QuestionId
    where SurveyAnswers.UserName == strCurrentUserName
    select SurveyAnswers).FirstOrDefault();
    if (objSurveyAnswer != null)
    try // This is an update ****
    // Set values
    objSurveyAnswer.Choice = Convert.ToInt32(objQuestionDetailForUser.SelectedChoice);
    objSurveyAnswer.Comment = objQuestionDetailForUser.Comments;
    // Update LightSwitch Database
    this.Context.SaveChanges(
    System.Data.Objects.SaveOptions.DetectChangesBeforeSave);
    catch (Exception ex)
    throw new Exception("Error inserting QuestionId " + objQuestionDetailForUser.QuestionId, ex);
    else // This is an Insert ****
    // Query the GetAllQuestionsForUser method because it calculates if a Question
    // is Active or not for the QuestionId being inserted
    // If it is not in the collection, do not allow the insert
    var objUserQuestion = (from QuestionForUser in this.GetAllQuestionsForUser()
    where QuestionForUser.UserName == strCurrentUserName
    where QuestionForUser.QuestionId == objQuestionDetailForUser.QuestionId
    select QuestionForUser).FirstOrDefault();
    if (objUserQuestion != null)
    try
    // Get the Survey Question
    var objSurveyQuestion = (from SurveyQuestions in this.Context.SurveyQuestions
    where SurveyQuestions.Id == objQuestionDetailForUser.QuestionId
    select SurveyQuestions).FirstOrDefault();
    // Create a SurveyAnswer object
    SurveyAnswer objNewSurveyAnswer = this.Context.CreateObject<SurveyAnswer>();
    // Set values
    objNewSurveyAnswer.UserName = strCurrentUserName;
    objNewSurveyAnswer.Choice = Convert.ToInt32(objQuestionDetailForUser.SelectedChoice);
    objNewSurveyAnswer.Comment = objQuestionDetailForUser.Comments;
    objNewSurveyAnswer.SurveyQuestion = objSurveyQuestion;
    // Update LightSwitch Database
    this.Context.SurveyAnswers.AddObject(objNewSurveyAnswer);
    this.Context.SaveChanges(
    System.Data.Objects.SaveOptions.DetectChangesBeforeSave);
    catch (Exception ex)
    throw new Exception("Error inserting QuestionId " + objQuestionDetailForUser.QuestionId, ex);
    else
    throw new Exception("Error inserting Answer. Answer is not marked Active.");
    Unleash the Power - Get the LightSwitch 2013 HTML Client / SharePoint 2013 book
    http://LightSwitchHelpWebsite.com

  • Update table using merge or Update statement

    Hi All,
    We have oracle 10G R2 On windows...
    We have tables BROK_DEALER_MAP and DTRMIS_REPORT.
    create table BROK_DEALER_MAP
    SL_NO NUMBER,     
    BROK_DLR_CODE VARCHAR2(30),     
    EMP_TAG     VARCHAR2(30),
    REMARKS     VARCHAR2(60),
    CONS_CODE VARCHAR2(30),     
    BROK_DLR_NAME VARCHAR2(50),
    BROKER_TYPE VARCHAR2(30),
    BROK_DLR_0 VARCHAR2(30),
    CATG_DESC VARCHAR2(60),     
    Category VARCHAR2(30));
    desc DTRMIS_REPORT
    SL_NO
    POSTED_DATE
    ZONE
    AMC_REGION
    CITY
    BROK_DLR_CODE
    BROK_DLR_NAME
    SUB_BROKER
    B_TYPE
    FOLIO_NO
    INVESTOR_NAME
    TAX_NO
    INV_TAG
    SCHEME_CODE
    SCHEME_NAME
    SCH_CLASS
    TRXN_MODE
    CHN_TAG
    FP_COUNT
    FP_AMOUNT
    AP_COUNT
    AP_AMOUNT
    PUR_COUNT
    PUR_AMOUNT
    SIP_COUNT
    SIP_AMOUNT
    SI_COUNT
    SI_AMOUNT
    RED_COUNT
    RED_AMOUNT
    SO_COUNT
    SO_AMOUNT
    DR_COUNT
    DR_AMOUNT
    STP_COUNT
    STP_AMOUNT
    NET_SALES
    DISTRIBUTOR_TYPE
    SCHEME_TYPE
    FOCUS_PRODUCT
    RM_CODE
    RM_NAMEtable BROK_DEALER_MAP doesn't have any duplicate records.
    table DTRMIS_REPORT have more than 2 lacks duplicate records.
    Now i want to update table DTRMIS_REPORT (DISTRIBUTOR_TYPY COLUMN) With the values of BROK_DEALER_MAP (CATEGORY COLUMN).
    For that i have written merge statement like below
    merge into dtrmis_report a
    using brok_dealer_map b
    on (a.brok_dlr_code=b.cons_code)
    when matched then
    update set a.Distributor_type=b.category
    where a.brok_dlr_code=b.cons_code;IT's giving error saying ORA-30926: unable to get a stable set of rows in the source tables.
    How to update the table.
    Please help.

    Chanchal Wankhade wrote:
    IT's giving error saying ORA-30926: unable to get a stable set of rows in the source tables.That means there are duplicate records in your source table.
    Please post the output of the below
    select cons_code
    from brok_dealer_map
    group by cons_code
    having count(*) > 1;In case of duplicate CONS_CODE, you need to decide with which the target table should get updated
    And are you seriously giving a where condition in merge like you posted..?
    Edited by: jeneesh on Dec 19, 2012 9:56 AM

Maybe you are looking for

  • How prevent simultaneous execution of multiple button threads?

    My AS 3 program has multiple buttons. Users can select one and then immediately select another and this causes 2 threads that collide.  Once one button is executing, I want the other buttons to ignore clicks. I've tried using a lock:Boolean to indica

  • How to allocate space for headers in reports through line size r line count

    hi , may i know how to allocate space for a header ( we do the same for footer through line-count ( footer space ) ) through line size or line count in reports... thanks in advance..

  • Mose Over/Out Issue

    I have a script that will expand a box on  a mouse over of a button, and shrink it on a mouse out of that button. It seems to have a problem. Most of the time its works fine, but on occasion it will tween out to 100% , and then I need to move in and

  • When will Aperture support RAW in Canon 6D

    I bought a brand new Canon 6D. Beautiful equipment! I'm hoping beautiful pictures. However, I can't see any of them in Aperture! The latest version of Lightroom 4 won't read the Canon 6D files either. Now what?

  • SBS limited connectivity

    Hi I have the following design Site A 2 server with enterprise edition Site B 1 SBS server the user who is registered to the SBS server showing limited connectivity and in the snooper I see this ms-diagnostics: 4233;reason="Presence and Conferencing