Delete values for a range

Hi ,
     I want to delete records only for a given range. Below is the script it deletes the records based on the given MP range.
And in this Switch table screen shot i have a switchID and ControlPointID column as main reference . For the given range only those records will be deleted. Now i want to delete a different table called SSDB_WIUDATA only for the controlpointIDs deleted on
this switch table. The scenario is ControlpointID will be same even out of the given range also.but switchID will be different So it was easy to delete the records in switch. But while deleting in WIU data i have  WIUDataID and ControlPointID as main
column reference . How do i delete the values from WIUData only for the values deleted in switch table? Here ControlPoint ID will be same even out of the range also. So i should delete only within the range that is deleted in Switch table. I dont have Milepost
refernce also in WIU table.i have only ControlPointID as reference. Pls help me 
IF (CURSOR_STATUS('global','Switch_cur')) >= -1 
BEGIN 
DEALLOCATE Switch_cur 
END
DECLARE Switch_cur CURSOR FOR
Select SwitchID,ControlPointID FROM SSDB_Switch
WHERE Milepost BETWEEN @BeginMP AND @EndMP 
AND SubdivisionID = @subdivisionID
OPEN Switch_cur
FETCH NEXT FROM Switch_cur INTO @SwitchID,@ControlPointID
WHILE (@@FETCH_STATUS=0)
BEGIN
   set @Swi = (select Talon_LocEqup_ID from Mapping
   where SSDB_ControlpointId_Asset_Id = @SwitchID and AssetType='PTC-Switch')
Delete from tbl_equipmentObjectPropertyValues 
where equipmentObjectPropertyValue_object_guid_fk = ''+@Swi+''
Delete from tbl_objects
where object_guid_pk = ''+@Swi+''
DELETE from Mapping
where SSDB_ControlpointId_Asset_Id = @SwitchID
 DELETE FROM SSDB_Clearancepoint
 WHERE SwitchID = @SwitchID
DELETE FROM  SSDB_TurnoutSpeed
WHERE SwitchID = @SwitchID
 DELETE FROM SSDB_SwitchRelationship
 WHERE SwitchID = @SwitchID
 DELETE FROM SSDB_Switch
 WHERE SwitchID = @SwitchID
  FETCH FROM Switch_cur INTO @SwitchID,@ControlPointID
     END ----Cur End
CLOSE Switch_cur
    DEALLOCATE Switch_cur        
Deepa

Below is the table structure of Switch and WIUData
CREATE TABLE SSDB_Switch (
SwitchID int IDENTITY PRIMARY KEY,
ControlPointID int,
WIUDataID int,
MilepostPrefix varchar(5),
MilepostSuffix varchar(5),
Milepost decimal(10,3) NOT NULL,
TrackName varchar(20) NOT NULL,
Latitude decimal(15,8) NOT NULL,
FOREIGN KEY(WIUDataID) REFERENCES               SSDB_WIUData(WIUDataID),
FOREIGN KEY(ControlPointID) REFERENCES          SSDB_ControlPoint(ControlPointID)
CREATE TABLE SSDB_WIUData (
WIUDataID int IDENTITY PRIMARY KEY,
ControlPointID int,
DeviceStatusTableID int NOT NULL,
BeaconFlag varchar(1) NOT NULL,
ConfigCRC varchar(8) NOT NULL,
EncryptedHmacKey varchar(64) NOT NULL,
WIUAddress varchar(64) NOT NULL,
WIUID decimal(12,0),
WIUName varchar(40),
WSRSType varchar(17),
InsertDate Datetime NOT NULL DEFAULT getdate(),
UpdateDate Datetime,
InsertUser varchar(50),
UpdateUser varchar(50),
FOREIGN KEY(ControlPointID) REFERENCES SSDB_ControlPoint(ControlPointID),
FOREIGN KEY(DeviceStatusTableID) REFERENCES SSDB_DeviceStatusConfiguration(DeviceStatusTableID),
FOREIGN KEY(BeaconFlag) REFERENCES SSDB_BeaconFlag(BeaconFlag),
FOREIGN KEY(WSRSType) REFERENCES SSDB_WSRSType(WSRSType)
Below is the screen shot for Switch for a range of 170 to 172 Milepost.For this range i have control point ID as 48. And even ControlPoint ID is same for 173 Milepost also. In switch i have deleted only for the range.
Below is the screenshot for WIU table . Here i have only ControlPointID as reference. Even in this table i should delete only the records deleted in switch table.
Deepa

Similar Messages

  • Delete value for PART_PRCTR (Partner Profit Center)

    Dear,
    I would like to delete value for partner profit center  if business partner is empty when I load data from R3 into BW. I use routne.
    I have code:
    if COMM_STRUCTURE-PART_PRCTR is not initial.
      if COMM_STRUCTURE-PCompany is initial.
    ??? I would like to delete value for Part_PRCTR, but I do not know how can I use code.
    Please help me.
    Thank you in advance for your help.
    Regards,
    anka

    not sure where exactly you are adding code.
    but in normal ABAP it would be
    clear COMM_STRUCTURE-PART_PRCTR

  • How to set the parameter ID value for a range

    I am trying to call transaction KSB1 (Display actual line items for cost center) by supplying all the default values for the selection options/parameters and skipping the selection screen from the calling program. However, for the cost center range, both HIGH and LOW field have the same PID (i.e. KOS). Same thing for the cost element range. When I set the value for PID "KOS", only the low value got populated.
    I tried to pass a BDC table to the
    CALL TRANSACTION 'KSB1' USING  bdc_tab
    , but the PID used before takes higher priority so the bdc_tab values got overwritten by the PID values for those fields.
    Does anybody know how to find or set the PID for a selection range? I need PID for Cost center range, cost element range and the period (PID="VPE").
    Any advice is appreicated. Thank you
    Minami

    otherwise try to make use of SUBMIT command.
    <b>Hi Preetahm ,
    KSB1 is a Report , not a Tcode to maintain master data or any thing like that ?, u can also cross check?</b>
    by using SUBMIT command u have to <b>RKAEP000</b> this program along with the selection screen.
    regards
    Prabhu
    Message was edited by: Prabhu Peram

  • Delete values for 0CALMONTH in QDesigner

    Hi gurus..
    I have a trouble in my Query designer.
    When i try to select the values for 0CALMONTH, this show me a lot of values that i was load data for this cube.
    I want to delete some values for this screen (for example 01.0000 or 02.0000), this items come from a wrong load data that i delete from the cube.
    What´s the way for delete completly this kind of values?
    Can you help us with this?
    TY ...
    Neo

    Hi,
    you can set this property in the <i>Info provider specific settings</i>.I.e you will set the F4 functionality to read from the infocube .So that it will shoe you only values for which there are entries in Info cube.
    Refer <i>Structure-Specific Properties of the InfoObject</i>in the below link:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/80/1a644ce07211d2acb80000e829fbfe/frameset.htm
    With rgds,
    Anil Kumar Sharma .P
    Message was edited by:
            Anil Kumar Sharma

  • Can you specify the allowable values for vertical range and offset for the NI 5112 PCI Digitizer?

    The NI 5112 manual indicates that the vertical range can be set from +/- 25mV to +/-25V in 10% steps. Can you explain exactly what this means? (For example, could you give me a series of allowable values.)
    Also, what are the allowable values for voltage offset?
    The reason for my question is: I am specifying the vertical configuration using the niScope_ConfigureVertical() function. The observed raw (8 bit) sampling does not appear to change at all for small changes in voltage range and offset. I would like to know where the hardware breakpoints are, so that I can apply correct scaling from bits to voltage.
    In addition, I have tried to use the niScope_CheckAt
    tributeViReal64() function to "check" a value before applying it to NISCOPE_ATTR_VERTICAL_RANGE or NISCOPE_ATTR_VERTICAL_OFFSET, but it fails in the linking step in Microsoft Dev. Studio. (niScope.lib & niscope_32.lib do not seem to contain any of the CheckAttribute functions that are listed in the NI-Scope function reference.)
    Thank you for your response.

    There is a nice reference at:
    http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/38f18d418e2433ed8625690e006bbe94?OpenDocument
    which explains that allowable voltage ranges can be expressed by the equation:
    next_range_value = range_value * 1.1 starting at +/- 25 mV.
    When a range is specified that does not match this series, the device driver rounds UP to the next value.

  • How to make default values for date range?

    Dear Colleagues,
    My customer is asking for a default value for a date range prompt.
    The FromDate should contain the 1st of current month, the ToDate should contain current date.
    Does anyone have any idea how I can meet this demand?
    Regards Silje

    Hi Federico,
    Thank you for the answer, we are back to the challenge after summer vacations!
    I have created a variable in the universe: SELECT current date  as TODAY FROM SYSIBM.SYSDUMMY1. I Called it TODAY.
    Then I created a prompt in the query based on Date. In Prompt Properties I tagged for "Set Default Values" and I typed in TODAY.
    When I try to run the query I get the error message:  The date for the query filter based on 'Date' is invalid (WIS10704).
    What is wrong? What do I have to do differently?
    My goal is to have a default for Date that gives me today..
    Regards Silje

  • Get unique value for a range of values from a table

    Please help to identify the sql to get unique value for following scenario
    Table A has 3 columns
    column1 column2 column3

    user7666373 wrote:
    Please help to identify the sql to get unique value for following scenarioUnique combinations of three columns? If so:
    select DISTINCT column1,column2,column3 from A;SY.

  • Dynamic Date Value for Date Range Parameter - Scheduling in BI

    Hi,
    I am New to BO Enterprise XI R3. I want to schedule the Crystal report which takes Date Range as parameter. Is any option available to calculate From Date automatically based on Current Date based on the range required?
    Currently, Parameter option accepts parameters and enterprise process the report for configured parameters. In this case, report always prints only for configured date range eventhough report generated after one month. I am expecting report has to print data for date range (eg. 1 weeks, 4 days, or any range) based on system current date.
    Thanks in Advance,
    Venkateswaran.P

    I'm am in the same situation.  I need to be able to have the date parameter dynamically change based on the current day's date when I schedule a report.  However, because this parameter comes from a Stored Procedure from the database, it cannot be modified in the Report Designer (as far as I know).  I've tried to set a default for it to use "currentdate" but it doesn't seem to take.  Anyone know if this can be accomplished in the scheduler?
    Thanks
    -Tom

  • Alternative to isblank for a range of cells

    Hi,
    I am trying to get a formula using countifs that will return the number of cells containing a checkbox with a "true" value if a related cell on a different row is not blank.
    In my mind this would look somewhat like =countifs(checkbox range, true, isblank(range b), false)
    Is there a function that does what isblank does for a range of cell? Or should I use another function?
    Thanks for the help!

    Hello,
    The above answers seemed alright but they do not get to the heart of the issue that I am having in trying to get summary data on a range of particular cells +determined by a condition+. For this purpose the SUMIFS and COUNTIFS functions are brilliant because you can isolate a range based on conditions; for example, getting rows with a particular string and number.
    I have a long list of newspapers, each with a city, year and rank by population. There are about 10 decades and many different cities (which change as the rankings change), totaling over a thousand rows. The year, rank and city often repeat but the newspapers are all unique.
    It was easy to count the number of newspapers by rank (or city) and year using COUNTIFS but there seems to be no corollary for the MAX (or LARGE) function. I need this because I have circulation numbers and I'd like to know what the MAX circulation is for each city (or rank) in each year.
    This means I need to be able to pluck out a max value for a range of cells based on a calculation. It seems ridiculous to have to put in row numbers in: there should be a simple way to perform a test on a defined range using conditions.
    Hopefully I am simply missing how that is done. Thanks ahead of time,
    Jamil

  • Default value for variable are not within permitted value range (precalc)

    Hello BW community
    Issue:
    I have created a variable (Characteristic Value/ Manual input-default value) and use the precalculated value set (details-basic settings). In the further variable definition I could select the  precalculated value set in 'Default values', which I have defined beforehand in the broadcaster..
    The precalculated value set in the broadcaster settings is just based on a master data query on 0CUSTOMER.
    Error:
    The variable gets the error E991/R9E Errors: Default values for variable 'XXX' are not within permitted value range.
    The detail description of the error is: You defined default values for variable 'Sold-to party precalc value set for manuel input' that are not appropriate for the variable type; for example, a range is defined as a default value for a variable that only permits a single value.
    So please has someone had the same issue and found out how to solve it? It would be excelent to get good solution for this issue.
    Best regards and thanks
    Christian
    PS-1: System BW 701 / SAPKW70105
    PS-2 : there has been a SDN entry with the same topic but not resolved too.
    link: /thread/980839 [original link is broken]

    Hello,
    Thanks for your response.
    I should have mentioned that in my post. I tried this very first time. I thought that this is the place where you provide default value. But I got following exception at that time, so I thought, may be this is used for something else.
    <LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
    javax.faces.FacesException: javax.servlet.ServletException: OracleJSP error:
    oracle.jbo.NameClashException: JBO-25001: Object viewAllInd of type Control Binding Definition already exists.
         at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:415)Do I need handle something else when you put the default value?
    Thanks,
    Jai

  • Mapping input values for a web service connection to a range of cells

    I've created a web service connection in Xcelsius data manager. My web service requires an array of integer as input parameter. How do I map input values for a web service connection to read from a range of cells in the spreadsheet, e.g. $A$2:$A$20, in similar way of mapping output values to write to a range of cells in the spreadsheet?
    For output values of the web service, I can specify to map the output values to write to a range of cells. However, it doesn't seem to work for reading the input values.
    I can map input values for each node to a single cell, e.g. $A$2, in the spreadsheet. However, when I set the "Read From" field to a range of cells, e.g. $A$2:$A$20, it only reads in the first value in the range.
    Is there any way that we can do this mapping for input values as we do for output values?
    Your assistance is very much appreciated.
    Regards,
    Van

    Van,
    There is a workaround for that...
    Example:
    My Webservice accepts input data range in a specific format with " :" symbol, i.e. 072008:082008
    Now what i do is
    A1 = 072008
    A2 = 082008
    A3 = CONCATENATE(A1,":",A2)
    so A3 = 072008:082008
    Now i map the input value in web service to cell A3
    P.S have 2 input box components and map it to cells A1 and A2, i.e you are giving users an  option to enter the range of values...then web service will capture the range and refreshes data with the range of values user entered.
    hope this helps..
    -Anil

  • Query filter on  a value with dash confuses for a range

    Hello, I've a web query, have a variable on a legacy PO which is char 10, the legacy PO values have legitimate - in their value for ex: 65011-001
    when i enter this value in the query filter (variable value), the query comes with msg ' this characteristic info object doest not support interval selections', and ignores the filter and bring the all the values.
    I tried putting PO enclosed with single and double quotes  but that didnt seem to work either, how can we make the variable take the literal value and do not interpret it as a range or interval.
    thanks for the help.
    Mayil

    Alright figure it out..
    looks like i've to give a escape in this case '\'
    so if i entered the value like 64917\-001 it is able to filter out in the web.
    i wonder if there is a way i cannot do this and get by..
    thanks
    Mayil

  • Defining Range values for a keyfigure

    Hi Frnds,
    I have a keyfigure which is populated at cube level for calculating total years of experience with routine.
    In my query it is giving me perfect result. But I want to display the Years of experience between range values. i.e
    For eg:
    Range    | Number of employees
    <1         |  10
    1-2         |   20
    3-5         |   30
    I have tried with conditions but it didnt work.
    So how can I define ranges for a keyfiger?
    Can any body pls give me solution for this.
    Thanks,
    Sridhar

    Hi
    You can get this by using restricted keyfigure.First you need to have a keyfigure for number of employees on which you can have restricted keyfigure restricting on years of experience.
    Regards
    Ravi

  • BEx Analyzer: Use Of Variable Values For Planning Sequence

    Hi experts,
    I want to start a planning sequence using a button item in a BEx Analyzer workbook. The planning sequence itself is defined with several variables, that are input ready. The same variables are used in BEx Queries that are bound to DataProviders in the workbook. Therefore the variables are filled by the user, if the workbook has been started. If the user wants to start the planning sequence, that is defined on the button item, the same variable values (which the user has already set in the beginning) should be used. But I didn't find a way to fill planning sequence variable from variables (like it is possible in the web interface using the DataBinding function). It seems, that it is only possible to set the variable with static values, that are defined in the button item. Am I erring in this point?
    Anyone here who can help me regarding this issue?

    Eitan Ohayon wrote:
    Why did you raise this question?,did you face any problem?
    Hi Eitan,
    The problem was, that the planning sequence worked fine in web but not in analyzer. The system told me in web, that several records had been read, created, changed and deleted. System messages in BEx Analyzer always indicated zero reads, creations, reads and deletions.
    Using your idea to set breakpoint in the INIT_EXECUTION method gave me the information, that all variables are not set or set with initial values (like '0000' for fiscal year). This seems to be the reason for my problem. Now I've reduced the planning sequence definition on the button only to that variables, that are really needed. Furthermore I defined the Command Range to get dynamic values for the variables from the excel sheet grid. So it seems to work.
    Thank you for your help!

  • Keep previous values for Select-Options

    I am using macros to populate my selections with the previously entered values.  Everything works fine until I want to delete the previous selections for so_snp via the Trash Can button.  The selections come back.  The issue seems to be that the selections are deleted from the so_snp range but then the AT SELECTION-SCREEN OUTPUT executes makro_get_range which re-populates the so_snp selection from the data stored in the buffer because so_snp is initial.  How do I get the AT SELECTION-SCREEN code to execute first so that the makro_set_range can clear out the shared buffer for '/SAPAPO/PT_PLAN_SNP'.  I have included excerpts from my ABAP program.
    Any help would be appreciated.  I struggled with this all day long.
    Best regards,
    Sandy
    DEFINE makro_get_range.
    initialization
      clear:
        lv_line,
        lv_key.
    import SET/GET-parameter from shared buffer
      if &2[] is initial.
        concatenate sy-uname  &1 '_T' into lv_key.          
        import &2[] from shared buffer indx(st) id lv_key.
        if sy-subrc eq 0.
          read table &2 index 1.
        endif.
      endif.
      if &2 is initial.
        get parameter id &1 field &2.
        if sy-subrc ne 0 and &2 is initial.
          refresh &2[].
        endif.
        if not &2   is initial
           and &2[] is initial.
          append &2.
        endif.
      endif.
    END-OF-DEFINITION.
    DEFINE makro_set_range.
    initialization
      clear:
        lv_line,
        lv_key.
      concatenate sy-uname &1 '_T' into lv_key.
    export SET/GET-parameter to shared buffer
      describe table &2[] lines lv_line.
      if lv_line gt 1.
        export &2[] to shared buffer indx(st) id lv_key.
      else.
        delete from shared buffer indx(st) id lv_key.
        set parameter id &1 field &2.
      endif.
    END-OF-DEFINITION.
    SELECT-OPTIONS so_snp FOR /sapapo/matloc-planner_snp.
    AT SELECTION-SCREEN OUTPUT.
       makro_get_range '/SAPAPO/PT_PLAN_SNP'    so_snp.
    AT SELECTION-SCREEN.
        makro_set_range '/SAPAPO/PT_PLAN_SNP'    so_snp.

    Can you set a flag to indicate that it needs to be done only once like below?
    AT SELECTION-SCREEN OUTPUT.
    IF v_flag_get_done_once IS INITIAL.
    *-- get the values from the shared buffer
      makro_get_range '/SAPAPO/PT_PLAN_SNP' so_snp.
      v_flag_get_done_once = 'X'.
    ELSE.
    *-- user manipulated the selection screen values, so
    *   don't do it again. Do Nothing.
    ENDIF.
    Srinivas

Maybe you are looking for