FM parameters with RANGES
Hi!
I would like to create an FM in SE37. I would like to pass a RANGE to it, as an Import or Tables parameter.
As a result, I would like to retrieve also a RANGE, as an Exporting or Table parameter.
Unfortunately I don't know, what kind of TYPE do I have to use for ranges in the paramteres?
Thank you
Tamá
as mentioned in the table section put the parameter there with like
for many fields range structures already exist like
BUKR_RANGE
AUFNR_RANG
TYPE_KOKRS_RANGE
search in se11 for structures which contain you're fieldname to find if its already there otherwise define a new structure where the low and high field reference to you're field
I made for instance an catst status structure for this
name structure: zcats_status_range
component type component
SIGN SIGN_RANGE
OPTION OPT_RANGE
LOW CATSSTATUS
HIGH CATSSTATUS
reward if usefull ofcourse
arthur
Message was edited by:
A. de Smidt
Similar Messages
-
How to execute the FM K_COSTS_PLAN_INTERFACE_TOTAL with ranges
Hi All,
can anybody suggest me, how to execute the Function module K_COSTS_PLAN_INTERFACE_TOTAL with range of Cost element(KSTAR)
and what is the field for Cost Element TO
The fm is for tcode KP06
Edited by: Kachi Reddy on Feb 17, 2012 2:26 PMHi, Kachi.
Try this example:
REPORT rkkipl1t.
* The parameters are used to fill the internal table and describe the
* planning object.
PARAMETERS: p_kokrs LIKE tka01-kokrs MEMORY ID cac OBLIGATORY,
p_perab LIKE cobk-perab DEFAULT '001' OBLIGATORY,
p_perbi LIKE cobk-perbi DEFAULT '012' OBLIGATORY,
p_gjahr LIKE cobk-gjahr MEMORY ID gjr OBLIGATORY,
p_versn LIKE cobk-versn MEMORY ID kvt OBLIGATORY,
p_kostl LIKE cssl-kostl OBLIGATORY,
p_kstar LIKE cskb-kstar OBLIGATORY,
p_vrgng LIKE cobk-vrgng DEFAULT 'RKP1' OBLIGATORY,
p_kwaer RADIOBUTTON GROUP ein DEFAULT 'X',
p_owaer RADIOBUTTON GROUP ein,
p_twaer RADIOBUTTON GROUP ein,
p_waers LIKE coss-twaer.
DATA: i_rku01_cur LIKE rku01_cur.
* internal table for function
DATA: itrku01g TYPE TABLE OF rku01g WITH HEADER LINE.
REFRESH itrku01g.
PERFORM fill_itrku01g.
* Which currency is to be used?
IF p_twaer = 'X'.
* planning in transaction currency
i_rku01_cur-wtg_man = p_twaer.
i_rku01_cur-wtf_man = p_twaer.
ELSEIF p_owaer = 'X'.
* planning in object currency
i_rku01_cur-wog_man = p_owaer.
i_rku01_cur-wof_man = p_owaer.
ELSE.
* planning in controlling area currency
i_rku01_cur-wkg_man = 'X'.
i_rku01_cur-wkf_man = 'X'.
ENDIF.
CALL FUNCTION 'K_COSTS_PLAN_INTERFACE_TOTAL'
EXPORTING
* BLTXT = ' '
* COMMIT = 'X'
* DELTA = ' '
gjahr = p_gjahr
kokrs = p_kokrs
messages_show = 'X'
perab = p_perab
perbi = p_perbi
update_values = 'X'
versn = p_versn
vrgng = p_vrgng
* ONLINE_VB = ' '
irku01_cur = i_rku01_cur
* TESTMODE = ' '
* KEEP_TWAER = ' '
TABLES
irku01g = itrku01g
EXCEPTIONS
messages_occured = 1
OTHERS = 2
IF sy-subrc = 0.
MESSAGE s000(15).
* Verbuchung wurde erfolgreich durchgeführt
ENDIF.
* FORM FILL_ITRKU01G
FORM fill_itrku01g.
* fill internal table for function
CLEAR itrku01g.
itrku01g-kostl = p_kostl. "for CCA planning
itrku01g-kstar = p_kstar. "must be filled
itrku01g-wtgbtr = 12000. "value when planning
itrku01g-wkgbtr = 12000. "value when planning
itrku01g-wogbtr = 12000. "value when planning
itrku01g-twaer = p_waers. "transaction currency
itrku01g-fcwkg = '1'. "distribution key must be filled
itrku01g-fcwkf = '1'. "must be filled
itrku01g-fcwkv = '1'. "must be filled
itrku01g-fcmeg = '1'. "must be filled
itrku01g-fcmef = '1'. "must be filled
itrku01g-fcmev = '1'. "must be filled
APPEND itrku01g.
ENDFORM. "FILL_ITRKU01G.
Best regards,
George Shlyahov. -
Query parameters with the same name and different values
According to HTTP, multiple query or post parameters with the
same name and different values are permitted. They are transfered
over the wire in the following format -
name1=val1&name1=val2&name1=val3
The problem is that I can't see anyway of assigning multiple
parameters with the same name and different values to the request
object of mx.rpc.http.HTTPService. I have tried using the
flash.utils.Dictionary object as it does strict key comparison but
that doesn't work too. I have tried setting an array of values to a
property of the request object but that sends the request to the
server in the following format -
name1=val1,val2,val3
The java servlet engines throw exceptions when they see this.
Any help would be greatly appreciated.If you're not on 8.1.4 move there. 8.1.3 had limitations in the wsrp
release.
wrote:
I have an html select box that contains several values, and multiple
selection is enabled. When my code runs as a remote portlet, the
following is showing up in the soap monitor when I select multiple
values and submit the form:
<urn:interactionParams>
<urn:portletStateChange>cloneBeforeWrite</urn:portletStateChange>
<urn:interactionState>_action=addEmployeesToGroup</urn:interactionState>
<urn:formParameters
name="P62005wlw-select_key:{actionForm.selectedEmployees}OldValue">
<urn:value>true</urn:value>
</urn:formParameters>
<urn:formParameters
name="P62005wlw-select_key:{actionForm.selectedEmployees}">
<urn:value>beatest1</urn:value>
</urn:formParameters>
In this case, I selected beatest1 and beatest2, but only beatest1 comes
through to the remote portlet. Is this a known bug, and, if so, is
there a patch or workaround available?
Thanks in advance,
Andy -
Passing multiple URL parameters with same name
Hi,
I have a question which is not entirely related to Java. But although its related HTTP calls, so I thought I might get some ideas here.
Background:
I am making HTTP URL call from SAP ABAP code. Its pretty much similar to Java (creating URL connection, setting HTTP headers, connecting, receiving response and everything)
For example,
http://service_server:8080/a7/extension.services.SearchRequirements.a7x?RequestStatus=CR&RequestStatus=RR
Now, this service_server runs a query to database where it uses both these values of "RequestStatus" to form 'OR' condition for a field.
Issue:
When I run this URL from browser, it shows XML response containing results for both values. In short, this is the ideal response.
(I am using getParameterValues(string) at service_server to read multiple values for same parameter)
But when I see response in SAP system, I see that it is returning data for only one value of 'RequestStatus'.
I checked the logs of service_server, and I see that it has received only one parameter, not two.
Question:
It seems like SAP systems web server is truncating both parameters with same name and passing just one of them to outside server(??)
Is there any configuration at Web Server side or any HTTP headers to be set so as to avoid this?
Can anybody suggest something on this?I managed to resolve this issue by using HTTP 'Post' method to send the data.
CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_URL
EXPORTING
URL = L_URL
IMPORTING
CLIENT = L_HTTP_CLIENT
EXCEPTIONS
ARGUMENT_NOT_FOUND = 1
PLUGIN_NOT_ACTIVE = 2
INTERNAL_ERROR = 3
OTHERS = 4 .
"STEP-2 : AUTHENTICATE HTTP CLIENT
CALL METHOD L_HTTP_CLIENT->AUTHENTICATE
EXPORTING
USERNAME = 'name'
PASSWORD = 'password'.
"STEP-3 : SET HTTP HEADERS
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
EXPORTING NAME = 'Accept'
VALUE = 'text/xml'.
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
EXPORTING NAME = '~request_method'
VALUE = 'POST' .
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_CONTENT_TYPE
EXPORTING CONTENT_TYPE = 'application/x-www-form-urlencoded' .
"SETTING REQUEST DATA FOR 'POST' METHOD
IF L_PARAMS_STRING IS NOT INITIAL.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = L_PARAMS_STRING
IMPORTING
BUFFER = L_PARAMS_XSTRING
EXCEPTIONS
FAILED = 1
OTHERS = 2.
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_DATA
EXPORTING DATA = L_PARAMS_XSTRING .
ENDIF.
"STEP-4 : SEND HTTP REQUEST
CALL METHOD L_HTTP_CLIENT->SEND
EXCEPTIONS
HTTP_COMMUNICATION_FAILURE = 1
HTTP_INVALID_STATE = 2.
"STEP-5 : GET HTTP RESPONSE
CALL METHOD L_HTTP_CLIENT->RECEIVE
EXCEPTIONS
HTTP_COMMUNICATION_FAILURE = 1
HTTP_INVALID_STATE = 2
HTTP_PROCESSING_FAILED = 3.
"STEP-6 : READ RESPONSE DATA
CALL METHOD L_HTTP_CLIENT->RESPONSE->GET_CDATA
RECEIVING DATA = L_RESULT .
"STEP-7 : CLOSE CONNECTION
CALL METHOD L_HTTP_CLIENT->CLOSE
EXCEPTIONS
HTTP_INVALID_STATE = 1
OTHERS = 2 .
{code} -
How to use lexical parameters with Sql Server Stored Procedure?
Hi,
I'm developing a BI Publisher report on a sql server database. I need to execute a stored procedure to dynamically build the query by replacing the lexical parameters with the values of varaibles of the stored procedure. With Oracle stored procedures, I have used data template and had reference the varaiable in SP by prefixing it with '&'.
It doesn't work if I try to do the same thing with SQL server. Is there anyone who has come across the similar situation? Please let me know if anyone has got any ideas...
Thanks in Advance
RagTopLink currently doesn't support multiple ResultSets. Multiple ResultSets support is considered for a future release.
-
There is misleading information in two system views (sys.data_spaces & sys.destination_data_spaces) about the physical location of data after a partitioning MERGE and before an INDEX REBUILD operation on a partitioned table. In SQL Server 2012 SP1 CU6,
the script below (SQLCMD mode, set DataDrive & LogDrive variables for the runtime environment) will create a test database with file groups and files to support a partitioned table. The partition function and scheme spread the test data across
4 files groups, an empty partition, file group and file are maintained at the start and end of the range. A problem occurs after the SWITCH and MERGE RANGE operations, the views sys.data_spaces & sys.destination_data_spaces show the logical, not the physical,
location of data.
--=================================================================================
-- PartitionLabSetup_RangeRight.sql
-- 001. Create test database
-- 002. Add file groups and files
-- 003. Create partition function and schema
-- 004. Create and populate a test table
--=================================================================================
USE [master]
GO
-- 001 - Create Test Database
:SETVAR DataDrive "D:\SQL\Data\"
:SETVAR LogDrive "D:\SQL\Logs\"
:SETVAR DatabaseName "workspace"
:SETVAR TableName "TestTable"
-- Drop if exists and create Database
IF DATABASEPROPERTYEX(N'$(databasename)','Status') IS NOT NULL
BEGIN
ALTER DATABASE $(DatabaseName) SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DROP DATABASE $(DatabaseName)
END
CREATE DATABASE $(DatabaseName)
ON
( NAME = $(DatabaseName)_data,
FILENAME = N'$(DataDrive)$(DatabaseName)_data.mdf',
SIZE = 10,
MAXSIZE = 500,
FILEGROWTH = 5 )
LOG ON
( NAME = $(DatabaseName)_log,
FILENAME = N'$(LogDrive)$(DatabaseName).ldf',
SIZE = 5MB,
MAXSIZE = 5000MB,
FILEGROWTH = 5MB ) ;
GO
-- 002. Add file groups and files
--:SETVAR DatabaseName "workspace"
--:SETVAR TableName "TestTable"
--:SETVAR DataDrive "D:\SQL\Data\"
--:SETVAR LogDrive "D:\SQL\Logs\"
DECLARE @nSQL NVARCHAR(2000) ;
DECLARE @x INT = 1;
WHILE @x <= 6
BEGIN
SELECT @nSQL =
'ALTER DATABASE $(DatabaseName)
ADD FILEGROUP $(TableName)_fg' + RTRIM(CAST(@x AS CHAR(5))) + ';
ALTER DATABASE $(DatabaseName)
ADD FILE
NAME= ''$(TableName)_f' + CAST(@x AS CHAR(5)) + ''',
FILENAME = ''$(DataDrive)\$(TableName)_f' + RTRIM(CAST(@x AS CHAR(5))) + '.ndf''
TO FILEGROUP $(TableName)_fg' + RTRIM(CAST(@x AS CHAR(5))) + ';'
EXEC sp_executeSQL @nSQL;
SET @x = @x + 1;
END
-- 003. Create partition function and schema
--:SETVAR TableName "TestTable"
--:SETVAR DatabaseName "workspace"
USE $(DatabaseName);
CREATE PARTITION FUNCTION $(TableName)_func (int)
AS RANGE RIGHT FOR VALUES
0,
15,
30,
45,
60
CREATE PARTITION SCHEME $(TableName)_scheme
AS
PARTITION $(TableName)_func
TO
$(TableName)_fg1,
$(TableName)_fg2,
$(TableName)_fg3,
$(TableName)_fg4,
$(TableName)_fg5,
$(TableName)_fg6
-- Create TestTable
--:SETVAR TableName "TestTable"
--:SETVAR BackupDrive "D:\SQL\Backups\"
--:SETVAR DatabaseName "workspace"
CREATE TABLE [dbo].$(TableName)(
[Partition_PK] [int] NOT NULL,
[GUID_PK] [uniqueidentifier] NOT NULL,
[CreateDate] [datetime] NULL,
[CreateServer] [nvarchar](50) NULL,
[RandomNbr] [int] NULL,
CONSTRAINT [PK_$(TableName)] PRIMARY KEY CLUSTERED
[Partition_PK] ASC,
[GUID_PK] ASC
) ON $(TableName)_scheme(Partition_PK)
) ON $(TableName)_scheme(Partition_PK)
ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_GUID_PK] DEFAULT (newid()) FOR [GUID_PK]
ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_CreateDate] DEFAULT (getdate()) FOR [CreateDate]
ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_CreateServer] DEFAULT (@@servername) FOR [CreateServer]
-- 004. Create and populate a test table
-- Load TestTable Data - Seconds 0-59 are used as the Partitoning Key
--:SETVAR TableName "TestTable"
SET NOCOUNT ON;
DECLARE @Now DATETIME = GETDATE()
WHILE @Now > DATEADD(minute,-1,GETDATE())
BEGIN
INSERT INTO [dbo].$(TableName)
([Partition_PK]
,[RandomNbr])
VALUES
DATEPART(second,GETDATE())
,ROUND((RAND() * 100),0)
END
-- Confirm table partitioning - http://lextonr.wordpress.com/tag/sys-destination_data_spaces/
SELECT
N'DatabaseName' = DB_NAME()
, N'SchemaName' = s.name
, N'TableName' = o.name
, N'IndexName' = i.name
, N'IndexType' = i.type_desc
, N'PartitionScheme' = ps.name
, N'DataSpaceName' = ds.name
, N'DataSpaceType' = ds.type_desc
, N'PartitionFunction' = pf.name
, N'PartitionNumber' = dds.destination_id
, N'BoundaryValue' = prv.value
, N'RightBoundary' = pf.boundary_value_on_right
, N'PartitionFileGroup' = ds2.name
, N'RowsOfData' = p.[rows]
FROM
sys.objects AS o
INNER JOIN sys.schemas AS s
ON o.[schema_id] = s.[schema_id]
INNER JOIN sys.partitions AS p
ON o.[object_id] = p.[object_id]
INNER JOIN sys.indexes AS i
ON p.[object_id] = i.[object_id]
AND p.index_id = i.index_id
INNER JOIN sys.data_spaces AS ds
ON i.data_space_id = ds.data_space_id
INNER JOIN sys.partition_schemes AS ps
ON ds.data_space_id = ps.data_space_id
INNER JOIN sys.partition_functions AS pf
ON ps.function_id = pf.function_id
LEFT OUTER JOIN sys.partition_range_values AS prv
ON pf.function_id = prv.function_id
AND p.partition_number = prv.boundary_id
LEFT OUTER JOIN sys.destination_data_spaces AS dds
ON ps.data_space_id = dds.partition_scheme_id
AND p.partition_number = dds.destination_id
LEFT OUTER JOIN sys.data_spaces AS ds2
ON dds.data_space_id = ds2.data_space_id
ORDER BY
DatabaseName
,SchemaName
,TableName
,IndexName
,PartitionNumber
--=================================================================================
-- SECTION 2 - SWITCH OUT
-- 001 - Create TestTableOut
-- 002 - Switch out partition in range 0-14
-- 003 - Merge range 0 -29
-- 001. TestTableOut
:SETVAR TableName "TestTable"
IF OBJECT_ID('dbo.$(TableName)Out') IS NOT NULL
DROP TABLE [dbo].[$(TableName)Out]
CREATE TABLE [dbo].[$(TableName)Out](
[Partition_PK] [int] NOT NULL,
[GUID_PK] [uniqueidentifier] NOT NULL,
[CreateDate] [datetime] NULL,
[CreateServer] [nvarchar](50) NULL,
[RandomNbr] [int] NULL,
CONSTRAINT [PK_$(TableName)Out] PRIMARY KEY CLUSTERED
[Partition_PK] ASC,
[GUID_PK] ASC
) ON $(TableName)_fg2;
GO
-- 002 - Switch out partition in range 0-14
--:SETVAR TableName "TestTable"
ALTER TABLE dbo.$(TableName)
SWITCH PARTITION 2 TO dbo.$(TableName)Out;
-- 003 - Merge range 0 - 29
--:SETVAR TableName "TestTable"
ALTER PARTITION FUNCTION $(TableName)_func()
MERGE RANGE (15);
-- Confirm table partitioning
-- Original source of this query - http://lextonr.wordpress.com/tag/sys-destination_data_spaces/
SELECT
N'DatabaseName' = DB_NAME()
, N'SchemaName' = s.name
, N'TableName' = o.name
, N'IndexName' = i.name
, N'IndexType' = i.type_desc
, N'PartitionScheme' = ps.name
, N'DataSpaceName' = ds.name
, N'DataSpaceType' = ds.type_desc
, N'PartitionFunction' = pf.name
, N'PartitionNumber' = dds.destination_id
, N'BoundaryValue' = prv.value
, N'RightBoundary' = pf.boundary_value_on_right
, N'PartitionFileGroup' = ds2.name
, N'RowsOfData' = p.[rows]
FROM
sys.objects AS o
INNER JOIN sys.schemas AS s
ON o.[schema_id] = s.[schema_id]
INNER JOIN sys.partitions AS p
ON o.[object_id] = p.[object_id]
INNER JOIN sys.indexes AS i
ON p.[object_id] = i.[object_id]
AND p.index_id = i.index_id
INNER JOIN sys.data_spaces AS ds
ON i.data_space_id = ds.data_space_id
INNER JOIN sys.partition_schemes AS ps
ON ds.data_space_id = ps.data_space_id
INNER JOIN sys.partition_functions AS pf
ON ps.function_id = pf.function_id
LEFT OUTER JOIN sys.partition_range_values AS prv
ON pf.function_id = prv.function_id
AND p.partition_number = prv.boundary_id
LEFT OUTER JOIN sys.destination_data_spaces AS dds
ON ps.data_space_id = dds.partition_scheme_id
AND p.partition_number = dds.destination_id
LEFT OUTER JOIN sys.data_spaces AS ds2
ON dds.data_space_id = ds2.data_space_id
ORDER BY
DatabaseName
,SchemaName
,TableName
,IndexName
,PartitionNumber
The table below shows the results of the ‘Confirm Table Partitioning’ query, before and after the MERGE.
The T-SQL code below illustrates the problem.
-- PartitionLab_RangeRight
USE workspace;
DROP TABLE dbo.TestTableOut;
USE master;
ALTER DATABASE workspace
REMOVE FILE TestTable_f3 ;
-- ERROR
--Msg 5042, Level 16, State 1, Line 1
--The file 'TestTable_f3 ' cannot be removed because it is not empty.
ALTER DATABASE workspace
REMOVE FILE TestTable_f2 ;
-- Works surprisingly!!
use workspace;
ALTER INDEX [PK_TestTable] ON [dbo].[TestTable] REBUILD PARTITION = 2;
--Msg 622, Level 16, State 3, Line 2
--The filegroup "TestTable_fg2" has no files assigned to it. Tables, indexes, text columns, ntext columns, and image columns cannot be populated on this filegroup until a file is added.
--The statement has been terminated.
If you run ALTER INDEX REBUILD before trying to remove files from File Group 3, it works. Rerun the database setup script then the code below.
-- RANGE RIGHT
-- Rerun PartitionLabSetup_RangeRight.sql before the code below
USE workspace;
DROP TABLE dbo.TestTableOut;
ALTER INDEX [PK_TestTable] ON [dbo].[TestTable] REBUILD PARTITION = 2;
USE master;
ALTER DATABASE workspace
REMOVE FILE TestTable_f3;
-- Works as expected!!
The file in File Group 2 appears to contain data but it can be dropped. Although the system views are reporting the data in File Group 2, it still physically resides in File Group 3 and isn’t moved until the index is rebuilt. The RANGE RIGHT function means
the left file group (File Group 2) is retained when splitting ranges.
RANGE LEFT would have retained the data in File Group 3 where it already resided, no INDEX REBUILD is necessary to effectively complete the MERGE operation. The script below implements the same partitioning strategy (data distribution between partitions)
on the test table but uses different boundary definitions and RANGE LEFT.
--=================================================================================
-- PartitionLabSetup_RangeLeft.sql
-- 001. Create test database
-- 002. Add file groups and files
-- 003. Create partition function and schema
-- 004. Create and populate a test table
--=================================================================================
USE [master]
GO
-- 001 - Create Test Database
:SETVAR DataDrive "D:\SQL\Data\"
:SETVAR LogDrive "D:\SQL\Logs\"
:SETVAR DatabaseName "workspace"
:SETVAR TableName "TestTable"
-- Drop if exists and create Database
IF DATABASEPROPERTYEX(N'$(databasename)','Status') IS NOT NULL
BEGIN
ALTER DATABASE $(DatabaseName) SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DROP DATABASE $(DatabaseName)
END
CREATE DATABASE $(DatabaseName)
ON
( NAME = $(DatabaseName)_data,
FILENAME = N'$(DataDrive)$(DatabaseName)_data.mdf',
SIZE = 10,
MAXSIZE = 500,
FILEGROWTH = 5 )
LOG ON
( NAME = $(DatabaseName)_log,
FILENAME = N'$(LogDrive)$(DatabaseName).ldf',
SIZE = 5MB,
MAXSIZE = 5000MB,
FILEGROWTH = 5MB ) ;
GO
-- 002. Add file groups and files
--:SETVAR DatabaseName "workspace"
--:SETVAR TableName "TestTable"
--:SETVAR DataDrive "D:\SQL\Data\"
--:SETVAR LogDrive "D:\SQL\Logs\"
DECLARE @nSQL NVARCHAR(2000) ;
DECLARE @x INT = 1;
WHILE @x <= 6
BEGIN
SELECT @nSQL =
'ALTER DATABASE $(DatabaseName)
ADD FILEGROUP $(TableName)_fg' + RTRIM(CAST(@x AS CHAR(5))) + ';
ALTER DATABASE $(DatabaseName)
ADD FILE
NAME= ''$(TableName)_f' + CAST(@x AS CHAR(5)) + ''',
FILENAME = ''$(DataDrive)\$(TableName)_f' + RTRIM(CAST(@x AS CHAR(5))) + '.ndf''
TO FILEGROUP $(TableName)_fg' + RTRIM(CAST(@x AS CHAR(5))) + ';'
EXEC sp_executeSQL @nSQL;
SET @x = @x + 1;
END
-- 003. Create partition function and schema
--:SETVAR TableName "TestTable"
--:SETVAR DatabaseName "workspace"
USE $(DatabaseName);
CREATE PARTITION FUNCTION $(TableName)_func (int)
AS RANGE LEFT FOR VALUES
-1,
14,
29,
44,
59
CREATE PARTITION SCHEME $(TableName)_scheme
AS
PARTITION $(TableName)_func
TO
$(TableName)_fg1,
$(TableName)_fg2,
$(TableName)_fg3,
$(TableName)_fg4,
$(TableName)_fg5,
$(TableName)_fg6
-- Create TestTable
--:SETVAR TableName "TestTable"
--:SETVAR BackupDrive "D:\SQL\Backups\"
--:SETVAR DatabaseName "workspace"
CREATE TABLE [dbo].$(TableName)(
[Partition_PK] [int] NOT NULL,
[GUID_PK] [uniqueidentifier] NOT NULL,
[CreateDate] [datetime] NULL,
[CreateServer] [nvarchar](50) NULL,
[RandomNbr] [int] NULL,
CONSTRAINT [PK_$(TableName)] PRIMARY KEY CLUSTERED
[Partition_PK] ASC,
[GUID_PK] ASC
) ON $(TableName)_scheme(Partition_PK)
) ON $(TableName)_scheme(Partition_PK)
ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_GUID_PK] DEFAULT (newid()) FOR [GUID_PK]
ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_CreateDate] DEFAULT (getdate()) FOR [CreateDate]
ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_CreateServer] DEFAULT (@@servername) FOR [CreateServer]
-- 004. Create and populate a test table
-- Load TestTable Data - Seconds 0-59 are used as the Partitoning Key
--:SETVAR TableName "TestTable"
SET NOCOUNT ON;
DECLARE @Now DATETIME = GETDATE()
WHILE @Now > DATEADD(minute,-1,GETDATE())
BEGIN
INSERT INTO [dbo].$(TableName)
([Partition_PK]
,[RandomNbr])
VALUES
DATEPART(second,GETDATE())
,ROUND((RAND() * 100),0)
END
-- Confirm table partitioning - http://lextonr.wordpress.com/tag/sys-destination_data_spaces/
SELECT
N'DatabaseName' = DB_NAME()
, N'SchemaName' = s.name
, N'TableName' = o.name
, N'IndexName' = i.name
, N'IndexType' = i.type_desc
, N'PartitionScheme' = ps.name
, N'DataSpaceName' = ds.name
, N'DataSpaceType' = ds.type_desc
, N'PartitionFunction' = pf.name
, N'PartitionNumber' = dds.destination_id
, N'BoundaryValue' = prv.value
, N'RightBoundary' = pf.boundary_value_on_right
, N'PartitionFileGroup' = ds2.name
, N'RowsOfData' = p.[rows]
FROM
sys.objects AS o
INNER JOIN sys.schemas AS s
ON o.[schema_id] = s.[schema_id]
INNER JOIN sys.partitions AS p
ON o.[object_id] = p.[object_id]
INNER JOIN sys.indexes AS i
ON p.[object_id] = i.[object_id]
AND p.index_id = i.index_id
INNER JOIN sys.data_spaces AS ds
ON i.data_space_id = ds.data_space_id
INNER JOIN sys.partition_schemes AS ps
ON ds.data_space_id = ps.data_space_id
INNER JOIN sys.partition_functions AS pf
ON ps.function_id = pf.function_id
LEFT OUTER JOIN sys.partition_range_values AS prv
ON pf.function_id = prv.function_id
AND p.partition_number = prv.boundary_id
LEFT OUTER JOIN sys.destination_data_spaces AS dds
ON ps.data_space_id = dds.partition_scheme_id
AND p.partition_number = dds.destination_id
LEFT OUTER JOIN sys.data_spaces AS ds2
ON dds.data_space_id = ds2.data_space_id
ORDER BY
DatabaseName
,SchemaName
,TableName
,IndexName
,PartitionNumber
--=================================================================================
-- SECTION 2 - SWITCH OUT
-- 001 - Create TestTableOut
-- 002 - Switch out partition in range 0-14
-- 003 - Merge range 0 -29
-- 001. TestTableOut
:SETVAR TableName "TestTable"
IF OBJECT_ID('dbo.$(TableName)Out') IS NOT NULL
DROP TABLE [dbo].[$(TableName)Out]
CREATE TABLE [dbo].[$(TableName)Out](
[Partition_PK] [int] NOT NULL,
[GUID_PK] [uniqueidentifier] NOT NULL,
[CreateDate] [datetime] NULL,
[CreateServer] [nvarchar](50) NULL,
[RandomNbr] [int] NULL,
CONSTRAINT [PK_$(TableName)Out] PRIMARY KEY CLUSTERED
[Partition_PK] ASC,
[GUID_PK] ASC
) ON $(TableName)_fg2;
GO
-- 002 - Switch out partition in range 0-14
--:SETVAR TableName "TestTable"
ALTER TABLE dbo.$(TableName)
SWITCH PARTITION 2 TO dbo.$(TableName)Out;
-- 003 - Merge range 0 - 29
:SETVAR TableName "TestTable"
ALTER PARTITION FUNCTION $(TableName)_func()
MERGE RANGE (14);
-- Confirm table partitioning
-- Original source of this query - http://lextonr.wordpress.com/tag/sys-destination_data_spaces/
SELECT
N'DatabaseName' = DB_NAME()
, N'SchemaName' = s.name
, N'TableName' = o.name
, N'IndexName' = i.name
, N'IndexType' = i.type_desc
, N'PartitionScheme' = ps.name
, N'DataSpaceName' = ds.name
, N'DataSpaceType' = ds.type_desc
, N'PartitionFunction' = pf.name
, N'PartitionNumber' = dds.destination_id
, N'BoundaryValue' = prv.value
, N'RightBoundary' = pf.boundary_value_on_right
, N'PartitionFileGroup' = ds2.name
, N'RowsOfData' = p.[rows]
FROM
sys.objects AS o
INNER JOIN sys.schemas AS s
ON o.[schema_id] = s.[schema_id]
INNER JOIN sys.partitions AS p
ON o.[object_id] = p.[object_id]
INNER JOIN sys.indexes AS i
ON p.[object_id] = i.[object_id]
AND p.index_id = i.index_id
INNER JOIN sys.data_spaces AS ds
ON i.data_space_id = ds.data_space_id
INNER JOIN sys.partition_schemes AS ps
ON ds.data_space_id = ps.data_space_id
INNER JOIN sys.partition_functions AS pf
ON ps.function_id = pf.function_id
LEFT OUTER JOIN sys.partition_range_values AS prv
ON pf.function_id = prv.function_id
AND p.partition_number = prv.boundary_id
LEFT OUTER JOIN sys.destination_data_spaces AS dds
ON ps.data_space_id = dds.partition_scheme_id
AND p.partition_number = dds.destination_id
LEFT OUTER JOIN sys.data_spaces AS ds2
ON dds.data_space_id = ds2.data_space_id
ORDER BY
DatabaseName
,SchemaName
,TableName
,IndexName
,PartitionNumber
The table below shows the results of the ‘Confirm Table Partitioning’ query, before and after the MERGE.
The data in the File and File Group to be dropped (File Group 2) has already been switched out; File Group 3 contains the data so no index rebuild is needed to move data and complete the MERGE.
RANGE RIGHT would not be a problem in a ‘Sliding Window’ if the same file group is used for all partitions, when they are created and dropped it introduces a dependency on full index rebuilds. Larger tables are typically partitioned and a full index rebuild
might be an expensive operation. I’m not sure how a RANGE RIGHT partitioning strategy could be implemented, with an ascending partitioning key, using multiple file groups without having to move data. Using a single file group (multiple files) for all partitions
within a table would avoid physically moving data between file groups; no index rebuild would be necessary to complete a MERGE and system views would accurately reflect the physical location of data.
If a RANGE RIGHT partition function is used, the data is physically in the wrong file group after the MERGE assuming a typical ascending partitioning key, and the 'Data Spaces' system views might be misleading. Thanks to Manuj and Chris for a lot of help
investigating this.
NOTE 10/03/2014 - The solution
The solution is so easy it's embarrassing, I was using the wrong boundary points for the MERGE (both RANGE LEFT & RANGE RIGHT) to get rid of historic data.
-- Wrong Boundary Point Range Right
--ALTER PARTITION FUNCTION $(TableName)_func()
--MERGE RANGE (15);
-- Wrong Boundary Point Range Left
--ALTER PARTITION FUNCTION $(TableName)_func()
--MERGE RANGE (14);
-- Correct Boundary Pounts for MERGE
ALTER PARTITION FUNCTION $(TableName)_func()
MERGE RANGE (0); -- or -1 for RANGE LEFT
The empty, switched out partition (on File Group 2) is then MERGED with the empty partition maintained at the start of the range and no data movement is necessary. I retract the suggestion that a problem exists with RANGE RIGHT Sliding Windows using multiple
file groups and apologize :-)Hi Paul Brewer,
Thanks for your post and glad to hear that the issue is resolved. It is kind of you post a reply to share your solution. That way, other community members could benefit from your sharing.
Regards.
Sofiya Li
Sofiya Li
TechNet Community Support -
Deprecated system parameters with specified values:
Hi ,
I am getting below in alert log:
Deprecated system parameters with specified values:
remote_os_authent
IS this parameter is suppotable in 11G and also how can i remove it from SP file with out bouncing the instance.
thanks..1) It is deprecated in 11g as er your alert log message. http://docs.oracle.com/cd/B28359_01/server.111/b28320/initparams199.htm
2) Set it in your spfile to FALSE which will reset this back to the default. This can't be changed dynamically and you will have to reboot your instance.
alter system set remote_os_authent=false scope=spfile; -
How to define parameters with radio button
HI
How to define parameters with radio button, but that radio button should display in front of the variable name not after variable name. and under that radio button variable I hve to define parameters, select-options and some other radiobutton varibles.
I don't know how to paste figures here, otherwise i will provied u the figure for more details.
Regards.PARAMETERS : r1 RADIOBUTTON GROUP radi.
Go to --> text elements --> selection text
R1 <your text>
You can change the program selection screen lay out in screen painter (se51) .
screen number for your selection screen is 1000.
Regards,
Santosh reddy
Edited by: Santosh Reddy on Dec 9, 2008 11:21 AM -
Displaying 2 parameters with descriptions in same line of Selection-Screen
Hi All,
I want to know how can we display 2 parameters with descriptions in same line of Selection-Screen.
Means in selection screen first we will give comment as
<b>Material no</b> then <b>parameter box as MARA-MATNR</b>, In the same line description as <b>Plant</b> then <b>parameter box as T001W-WERKS</b>.
Material No - BOX - Plant - BOX.
Can any body tell me how can we do it.
Thanks in advance.
Thanks & Regards,
Rayeez.Hi shaik,
1. define two TEXT-SYMBOLS :
001 Material
002 Plant
and Activate
2. use this code (just copy paste)
REPORT abc LINE-SIZE 80.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(10) text-001 FOR FIELD p_matnr.
PARAMETERS : p_matnr TYPE mara-matnr.
SELECTION-SCREEN COMMENT 35(10) text-002 FOR FIELD p_werks.
PARAMETERS: p_werks TYPE t001w-werks.
SELECTION-SCREEN END OF LINE.
regards,
amit m. -
Complex request with range filter and boolean search
Hi
I need a build and maintain complex requests to Oracle Endeca Server. These requests could include different types of attributes: string, datetime, int.
For string attributes I have created a search interface and use boolean search. For datetime attributes I use a range filter. Separately it works as I expected, but it fails with combined search with range filter and boolean search in a single request. As I see from results range filter is completely ignored. What could be wrong with following request?
<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns3:Request xmlns:ns2="http://www.endeca.com/MDEX/lql_parser/types" xmlns:ns3="http://www.endeca.com/MDEX/conversation/1/0">
<ns3:State/>
<ns3:Operator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns3:RecordFilterOperator">
<ns3:RecordFilter Name="OnlyData">AND(NOT(mdex-property_Key),NOT(mdex-dimension_Key),NOT(mdex-config_Key),NOT(mdex-precedenceRule_Key),NOT(system-group_Key),NOT(system-group-membership_Key))</ns3:RecordFilter>
</ns3:Operator>
<ns3:Operator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns3:SortOperator" Direction="Descending" Key="string_prop" OwnerId="Records"/>
<ns3:Operator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns3:RangeFilterOperator">
<ns3:RangeFilter AttributeName="dateTime_prop">
<ns3:LowerBound Inclusive="true">2012-07-24T19:47:01Z</ns3:LowerBound>
</ns3:RangeFilter>
</ns3:Operator>
<ns3:Operator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns3:SearchOperator">
<ns3:SearchFilter SnippetLength="20" EnableSnippeting="true" Mode="Boolean" Key="orderSearch">multiple_prop : one</ns3:SearchFilter>
</ns3:Operator>
<ns3:ContentElementConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns3:RecordListConfig" HandlerFunction="RecordListHandler" HandlerNamespace="http://www.endeca.com/MDEX/conversation/1/0" Id="Records">
<ns3:RecordsPerPage>3</ns3:RecordsPerPage>
</ns3:ContentElementConfig>
</ns3:Request>
</S:Body>
</S:Envelope>
If my approach is incorrect could you provide me a a better way to handle such requests?
Regards,
Eugene.Hi Eugene,
As you know, this issue has been discussed further, so I am posting here the summary of the findings, with the hope that this summary will benefit the Endeca Server user community at large.
* Boolean search only works with range filters for the AND operator. The documentation link above confirms this.
*Because of this restriction, you need to build another query that would achieve the same result. Both options are equally good and would achieve the results you need. Two suggestions that we've received were:
- Option 1. You could perform the key restriction of the search via a restrictive search interface rather than using the boolean match mode. This would involve creating a search interface for each field and then querying against the search interface for the field in question:
<Operator xmlns="http://www.endeca.com/MDEX/lql_parser/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SearchOperator">
<SearchFilter SnippetLength="20" EnableSnippeting="true" Mode="All" Key="orderSearch_for_field_multiple_prop">one</SearchFilter>
</Operator>
For this option, you would have to create a search interface for each attribute, using the Config Web Service. Here is the topic about loading config documents into the Endeca Server:http://docs.oracle.com/cd/E29805_01/server.230/es_dev/toc.htm#Loading%20configuration%20documents
- Option 2
* You could implement the range filter through EQL row expression syntax instead and pass it in via the DataSourceFilterOperator, which acts as a prefilter on all other query logic, using the Conversation Web Service. Thus you might include:
<Operator xmlns="http://www.endeca.com/MDEX/lql_parser/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="DataSourceFilterOperator">
<DataSourceFilterString>dateTime_prop <= TO_DATETIME('2012-07-24T19:47:01Z')</DataSourceFilterString>
</Operator>
For this option, using the DataSourceFilter does not require you to model the rest of the query in EQL. It will perform slightly better than the filter in option 1 because of the order in which record set intersections are computed, but the difference is likely to be very small.
Finally, if this addresses your question, please mark this question as answered, so that others can benefit from it on the forum. Big thanks to Endeca Server development team (you know who you are!), for helping to find solutions for this request.
Julia
Edited by: JuliaM on Aug 30, 2012 2:05 PM
Edited by: JuliaM on Aug 30, 2012 2:06 PM -
Problem in selection from data base with RANGE-TABLE.
Dear folks,
I am facing weird problem with range table in selection query.I have problem with bold part of code.Here when i give input to both ranges r_salesno,r_brandid then and the selection occurs ,when i put black in one of those it does not work.I haev passed Empty table to range if no inpiut in elements..although it does not work..I dont know why it is happening...By the i m using this code in Webdynpro ABAP.Please help points will be awarded..
if Stru_Cn_Selcrtr-ca_slsrl is not initial.
wa_salesno-sign = 'I'.
wa_salesno-option = 'EQ'.
wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
APPEND wa_salesno TO r_salesno.
CLEAR : wa_salesno .
else.
wa_salesno-sign = 'I'.
wa_salesno-option = 'EQ'.
wa_salesno-LOW = space.
APPEND wa_salesno TO r_salesno.
CLEAR : wa_salesno .
endif.
if Stru_Cn_Selcrtr-ca_brand is not initial.
wa_brandid-sign = 'I'.
wa_brandid-option = 'EQ'.
wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
APPEND wa_brandid TO r_brandid.
CLEAR : wa_brandid .
else.
wa_brandid-sign = 'I'.
wa_brandid-option = 'EQ'.
wa_brandid-LOW = space.
APPEND wa_brandid TO r_brandid.
CLEAR : wa_brandid .
endif.
*If any of these are given then select data accordingly.
<b>select * from ZNSLVWHDIMMD_LCL
into corresponding fields of table IT_VIEW
WHERE SALESRLNO in r_salesno
* and CREATEDBY in It_crtby_selopt
* and STARTDATE in It_validfrm_selopt
* and ENDDATE in It_validto_selopt
* and STATUS in It_status_selopt1
and BRANDID in r_brandid.
* and MODELNO in It_model_selopt.</b>Hello Nirad
Your coding is problematic. I assume that field SALESRLNO (of table ZNSLVWHDIMMD_LCL) probably means sales number (or sales order) and, thus, must not be empty. If this is correct then the first IF statement is probably wrong:
if Stru_Cn_Selcrtr-ca_slsrl is not initial.
wa_salesno-sign = 'I'.
wa_salesno-option = 'EQ'.
wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
APPEND wa_salesno TO r_salesno.
CLEAR : wa_salesno .
else.
REFRESH: r_salesno. " means: select all sales numbers
" NOTE: If you fill the range like below this means that only sales order
" with no sales number (= ' ', space) should be select.
" Thus, there will never be any sales order selected.
* wa_salesno-sign = 'I'.
* wa_salesno-option = 'EQ'.
* wa_salesno-LOW = space.
* APPEND wa_salesno TO r_salesno.
* CLEAR : wa_salesno .
endif.
The same logic applies to the second IF statement. If you want to select all BRANDID if none has been provided as selection criteria then code:
if Stru_Cn_Selcrtr-ca_brand is not initial.
wa_brandid-sign = 'I'.
wa_brandid-option = 'EQ'.
wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
APPEND wa_brandid TO r_brandid.
CLEAR : wa_brandid .
else.
REFRESH: r_brandid. " means: select all BRANDID
* wa_brandid-sign = 'I'.
* wa_brandid-option = 'EQ'.
* wa_brandid-LOW = space.
* APPEND wa_brandid TO r_brandid.
* CLEAR : wa_brandid .
endif.
Regards
Uwe -
Hi,
I want create a table with range value like TVARV table. With fields : Company Code, Low Value and High Value. And I want, always like TVARV table, in Maintain table (SM30) to can select value in Parameter or Select Options.
How do this?My table must contain ranges Cost Center Group link to Company Code. I don't create a simple table with only 1 CC Group for 1 Company Code, I must to use range or Select Option like TVARV table.
-
The type Iterator is not generic; it cannot be parameterized with arguments
Hi all, i have a problem, and i think is a JRE problem
The error is the following:
If i share a Web JSF Exadel project enterely, with the .classpath, the .project,
ect everything go ok. I can Check out the project
and work with it without problems.
But if i share only the JavaSource and the Webcontent of the same project
and the other files and folders like the .classpath, the .project, the ant folder,
ect are added to the subversion then appear the problem. When i Check out the project and build it (not with shift-alt-x Q but with the Build Project option of the Projec Menu in Eclipse)
appear an strange error that say: "The type Iterator is not generic; it cannot be parameterized with arguments <E>".
If i build the project using the build.xml file that came with the project everything is ok, but when i run the project into the Exadel the error
appear againt.
The error appear with all the eclipse versions from 3.1 to 3.3 and with all the ExadelStudio Pro versions from 3.5 to 4.0.4 and with the JRE versions 1.5.0_05 and 1.6.0_02
Any idea will be very appreciated.Hi, i think i found a clue to discover the mistery, i deployed the same .war in the ExadelStudio Pro 3.5.1 tomcat and in the ExadelStudio Pro 4.0.1(and 4.0.4) tomcat in the first one everythink work fine but in the second i get the error i described above.
The ExadelStudio Pro 3.5.1 use Tomcat 5.0 and ExadelStudio Pro 4.0.1 and 4.0.4 use Tomcat 5.5
There are some problem with the new versions of Tomcat?
Something related to the use of an old version of the JVM by default?
There are some problem with the jdk1.5, something related to the posibility that i can't mix code compiled with an old version of jdk with code compiled with the jdk1.5?
Any suggestion will be very appreciated -
I want parameters with f4 help for program names in value request
I want parameters with f4 help for program names in value request
points will be awarded if usefullv_name1 TYPE name1, "Vendor Name
CALL FUNCTION 'POPUP_TO_SEARCH_VALUE'
EXPORTING
textline1 = 'Vendor Name'(f09)
titel = 'Enter'(f17)
valuelength = 35
IMPORTING
value = lv_name1.
try this out .. -
XSTEP - parameter with Range as value
Hi,
In XSTEP, can I maintain a paramter with Range such as 4 - 5 so that 4 & 5 are validated against each other. when I create Process Instrcution or Process Message Characteristic, it is not accpeting 4 -5, instead it is taking 4 only. is it a std benavour..
Thanks
JKtry to print the check box selection . even though it is check box i think if you try to print that value in report u can know what it will give .
like <?$parama1?> then may be we can know what it is returning.
is it possible to print
Maybe you are looking for
-
To Call Another Form and Save Related MAster Data from a Transaction Form
Hi Our project requires that forms for creating masters be called whenever the value (Key Value) being referenced in other forms are not found. For doing this I had used the When-Validate-Item Trigger and checked for the key value in the master table
-
How to setup the oracle_base value in oraenv..?
Hi, how to setup the oracle_base value in oraenv..? It is showing like.. [oracle@localhost ~]$ . oraenv ORACLE_SID = [orcl] ? orcl ORACLE_BASE environment variable is not being set since this information is not available for the current user ID oracl
-
How should the new note & mortgage servicer report the loan on the credit report ?
History... Default on a modification to original note and mortgage with same lender/service provider that was made (the modification) after Chapter 7 bankruptcy discharge and never reaffirmed, no further monetary liability to signer on the note. Afte
-
Hello, I am working in material management/IT industry for the past 8 years, I would like to change my career to SAP MM, I have books, is there any company giving SANDBOX access through internet/web/vpn ? I would like to just read the books and lear
-
This has probably been covered somewhere so I'll apologize in advance, but... my Apple ID was created with an old work email address. I have changed it (successfully) on my computer, but my iphone still registers the old work email address. Now I