Dynamic Case.
Hello Gurus.
a short question. I's is possibel to create an Dynamical Case Condition.
For Example
Select * From HIT into table it_hit.
Case it_hit-number.
When '1: - Dynamic ???
When '2'
endase
Hey Chris,
I was not talking about dynamic tables,
create a table with only one field of 72 chars,
DATA: Begin of gt_itab occurs 0,
line(72) type c,
End of gt_itab.
data: gv_fname(30) type c value 'ZTEST_SAMSON', "program name
gv_err(120) type c, "error variable
then move all ur code into this, as if it is a program,
gt_itab-line = 'REPORT ZTEST_SAMSON.' .
append gt_itab .
gt_itab-line = 'FORM new_sub USING <some parameters>.' .
append gt_itab .
gt_itab-line = 'ur code here ' .
append gt_itab .
keep adding lines of ur code to the table.
then close the sub routine
gt_itab-line = 'ENDFORM.'.
append gt_itab.
generate subroutine pool gt_itab name gv_fname message gv_err .
if sy-subrc eq 0.
perform new_sub in program (gv_fname) using <parameters>
if found.
write:/ gv_err .
clear gv_err.
else.
write:/ gv_err.
endif.
Regards,
Samson Rodrigues.
Similar Messages
-
select count(*)
from vwsr_all_merged_data s
where sr_tio_priority in ('Level 0','CEO','TER','Priority Assistance','Enquiry')
and sr_status = 'Open'
and SR_BUS_UNIT IN ('Business Support and Improvement','Finance and Administration','Cust Sat Simplification and Productivity','Project New and Customer Experience','Corp Strategy and Customer Experience','Other')
COUNT(*)
126the same should be possible dynamically with Case expression ,before that i create the string as
SELECT
CASE
WHEN :name = 'BS&I' THEN ('('||''''||'Business Support and Improvement'||''''||','||''''||'Finance and Administration'||','||''''||'Cust Sat Simplification and Productivity'
||''''||','||''''||'Project New and Customer Experience'||''''||','||''''||'Corp Strategy and Customer Experience'||''''||','||''''||'Other'||''''||')')
ELSE null
END
FROM dual
CASEWHEN:NAME='BS&I'THEN('('||''''||'BUSINESSSUPPORTANDIMPROVEMENT'||''''||','||
('Business Support and Improvement','Finance and Administration,'Cust Sat Simplification and Productivity','Project New and Customer Experience','Corp Strategy and Customer Experience','Other')
SQL> var name varchar2(10)
SQL> exec :name:='BS&I'
PL/SQL procedure successfully completed.the same string query i put here within subquery to make above string , it does not work.
select count(*)--sr_bus_unit,count(trunc(sr_open_date))
from vwsr_all_merged_data s
where sr_tio_priority in ('Level 0','CEO','TER','Priority Assistance','Enquiry')
and sr_status = 'Open'
and SR_BUS_UNIT IN
( SELECT
CASE
WHEN :name = 'BS&I' THEN ('('||''''||'Business Support and Improvement'||''''||','||''''||'Finance and Administration'||','||''''||'Cust Sat Simplification and Productivity'
||''''||','||''''||'Project New and Customer Experience'||''''||','||''''||'Corp Strategy and Customer Experience'||''''||','||''''||'Other'||''''||')')
ELSE null
END
FROM dual
COUNT(*)--SR_BUS_UNIT,COUNT(TRUNC(SR_OPEN_DATE))
0Edited by: user13653962 on 24/01/2013 17:09
Edited by: user13653962 on 24/01/2013 17:10No man , it is still no working , anyhow i really appreciate yours help , yours help drive me to find other way and you contributed 70% to achieve the result. Next query worked.
SQL> SET DEFINE OFF;
SQL>
SQL> SELECT COUNT (*)
2 FROM vwsr_all_merged_data s
3 WHERE sr_tio_priority IN
4 ('Level 0', 'CEO', 'TER', 'Priority Assistance', 'Enquiry')
5 AND sr_status = 'Open'
6 AND SR_BUS_UNIT IN
7 ('Business Support and Improvement',
8 'Finance and Administration',
9 'Cust Sat Simplification and Productivity',
10 'Project New and Customer Experience',
11 'Corp Strategy and Customer Experience',
12 'Other')
13 UNION ALL
14 SELECT COUNT (*) --sr_bus_unit,count(trunc(sr_open_date))
15 FROM vwsr_all_merged_data s
16 WHERE sr_tio_priority IN
17 ('Level 0', 'CEO', 'TER', 'Priority Assistance', 'Enquiry')
18 AND sr_status = 'Open'
19 AND SR_BUS_UNIT IN
20 (SELECT CASE
21 WHEN 'BS&I' = 'BS&I'
22 THEN
23 ( ''''
24 || 'Business Support and Improvement'
25 || ''''
26 || ','
27 || ''''
28 || 'Finance and Administration'
29 || ''''
30 || ','
31 || ''''
32 || 'Cust Sat Simplification and Productivity'
33 || ''''
34 || ','
35 || ''''
36 || 'Project New and Customer Experience'
37 || ''''
38 || ','
39 || ''''
40 || 'Corp Strategy and Customer Experience'
41 || ''''
42 || ','
43 || ''''
44 || 'Other'
45 || '''')
46 ELSE
47 NULL
48 END
49 FROM DUAL)
50
SQL>
SQL>
SQL> /
COUNT(*)
126
0Second Query
SQL> var name varchar2(10)
SQL> exec :name:='BS&I'
PL/SQL procedure successfully completed.
SQL> set define off
SQL> SELECT COUNT (*) --sr_bus_unit,count(trunc(sr_open_date))
2 FROM vwsr_all_merged_data s
3 WHERE sr_tio_priority IN
4 ('Level 0', 'CEO', 'TER', 'Priority Assistance', 'Enquiry')
5 AND sr_status = 'Open'
6 AND SR_BUS_UNIT IN
7 (SELECT CASE
8 WHEN :NAME = 'BS&I'
9 THEN
10 ('Business Support and Improvement')
11 ELSE
12 NULL
13 END
14 FROM DUAL
15 UNION
16 SELECT CASE
17 WHEN :NAME = 'BS&I'
18 THEN
19 ('Finance and Administration')
20 ELSE
21 NULL
22 END
23 FROM DUAL
24 UNION
25 SELECT CASE
26 WHEN :NAME = 'BS&I'
27 THEN
28 ('Cust Sat Simplification and Productivity')
29 ELSE
30 NULL
31 END
32 FROM DUAL
33 UNION
34 SELECT CASE
35 WHEN :NAME = 'BS&I'
36 THEN
37 ('Project New and Customer Experience')
38 ELSE
39 NULL
40 END
41 FROM DUAL
42 UNION
43 SELECT CASE
44 WHEN :NAME = 'BS&I'
45 THEN
46 ('Corp Strategy and Customer Experience')
47 ELSE
48 NULL
49 END
50 FROM DUAL
51 UNION
52 SELECT CASE
53 WHEN :NAME = 'BS&I'
54 THEN
55 ('Other')
56 ELSE
57 NULL
58 END
59 FROM DUAL
60 )
61 /
COUNT(*)--SR_BUS_UNIT,COUNT(TRUNC(SR_OPEN_DATE))
126
SQL> -
TSQL - Dynamic Query Case statment update issue - to update table by left shifting the rows
Hi all
I need an help on my tsql query in 2000 to fix the case statement.
I have a table like shown below.
On this table where ever I see PortID as 101 and 105 I need to remove it and shift the rows from right to left.
ie on First row PortID1 is 101 so I need to remove it and replace it with PortId2 and similarly PortID2 replaced my PortID3 and so on.
ie like on excel if you delete cell we need to shift the rows to left .
I wrote an dynamic update statement i,m not sure on the assigning dynamic case statment.
CREATE TABLE [TravelRank]
[Destination] [varchar] (50) NULL,
[PortID1] [int] NULL ,
[Distance1] [int] NULL ,
[Rating1] [int] NULL ,
[PortID2] [int] NULL ,
[Distance2] [int] NULL ,
[Rating2] [int] NULL ,
[PortID3] [int] NULL ,
[Distance3] [int] NULL ,
[Rating3] [int] NULL ,
[PortID4] [int] NULL ,
[Distance4] [int] NULL ,
[Rating4] [int] NULL
INSERT into [TravelRank]
select 'Virgin Islands','101','10','5','102','20','5','103','31','5','109','41','5'
Union all
select 'Guinea','101','15','3','102','22','3','105','32','2','110','45','4'
Union all
select 'Benin ','102','12','4','106','28','4','104','33','3','109','48','2'
Union all
select 'Ecuador','102','18','5','101','29','5','108','34','1','111','45','5'
Union all
select 'Belarus ','103','17','4','105','24','4','108','45','4','112','46','3'
Union all
select 'Cook Islands','105','11','2','108','23','2','101','32','2','107','42','4'
Here is my code to fix
declare @SQL varchar(4000)
declare @left varchar(1)
declare @right varchar(1)
select @left = '1',@right = '2'
while @left < 4
begin
select @SQL = '
update t1.PortID' + @left + ' = t2.PortID' + @right + '
t1.Distance' + @left + ' = t2.Distance' + @right + '
t1.Rating' + @left + ' = t2.Rating' + @right + '
'case @left
when '1' then
' t1.PortID' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.PortID' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.PortID' + cast(cast(@left as int)+3 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+3 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+3 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+3 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+3 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+3 as varchar(1)) +'
' when '2' then
' t1.PortID' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.PortID' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+2 as varchar(1)) +'
' when '3' then
' t1.PortID' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+1 as varchar(1)) +'
' when '3' then
' t1.PortID' + @left + ' = null '
t1.Distance' + @left + ' = null '
t1.Rating' + @left + ' = null '
else '' end'
from [TravelRank] t1
inner join [TravelRank] t2
on t1.destination = t2.destination
where t1.PortID1 = 101'
print @SQL
-- exec (@SQL)
select @left = cast(cast(@left as int) + 1 as varchar(1))
, @right = cast(cast(@right as int) + 1 as varchar(1))
end
Thanks a lot in advance.declare @SQL varchar(4000)
declare @left varchar(1)
declare @right varchar(1)
select @left = '1',@right = '2'
while @left < 4
begin
select @SQL = '
update t1.PortID' + @left + ' = t2.PortID' + @right + '
t1.Distance' + @left + ' = t2.Distance' + @right + '
t1.Rating' + @left + ' = t2.Rating' + @right + '
'+CASE @left
when '1' then
' t1.PortID' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.PortID' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.PortID' + cast(cast(@left as int)+3 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+3 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+3 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+3 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+3 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+3 as varchar(1)) +'
' when '2' then
' t1.PortID' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.PortID' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+2 as varchar(1)) +'
' when '3' then
' t1.PortID' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+1 as varchar(1)) +'
' when '3' then
' t1.PortID' + @left + ' = null '+
' t1.Distance' + @left + ' = null '+
' t1.Rating' + @left + ' = null '
else '' END + '
from [TravelRank] t1
inner join [TravelRank] t2
on t1.destination = t2.destination
where t1.PortID1 = 101'
print @SQL
-- exec (@SQL)
select @left = cast(cast(@left as int) + 1 as varchar(1))
, @right = cast(cast(@right as int) + 1 as varchar(1))
end
You were missing a couple of concats. This runs now, but I'm not completely sure if it's the output you were expecting. -
Dynamically use page number in form field on spawned pages?
I have a form with spawned pages. JS for spawning page(s) works fine. However, one text field on template is driving me nuts. I would like this field ("CaseNum") to dynamically display page number, since page number also corresponds to case number. On templage ("getcase"), I can calculate value for CaseNum using custom calc script (event.value = this.PageNum). But that doesn't work because every spawned page gets the same value (ie, whatever is last spawned page number). I also tried JS below, using P0.getcase.CaseNum as the field on the template in which I want the page number/case number to be displayed:
var oPage = this.pageNum;
this.getField("P" + oPage + ".getcase" + ".CaseNum").value = oPage;
But, this doesn't work either, because the field on the spawned page automatically gets the prefix of P + page number + .getcase appended to the field name. Is there any way to dynamically used page number in a form field on spawned pages? If so, how? Note that while I am trying to use a dynamic case number on spawned pages, it presents the same issue as dynamically displaying page numbers on spawned pages. I'm a JS newbie, so any help appreciated. I've searched high and low on web and in forums and couldn't find the answer. Thx.http://forums.adobe.com/thread/1160899
7.George Johnson,
28-Feb-2013 09:42 in reply to natelfo
Is this what you mean?
Also see:
http://www.planetpdf.com/developer/article.asp?ContentID=6466
http://www.wordwizardsinc.com/blog/finding-the-fieldname-prefix-on-acrobat-acroform-spawne d-template-pages-using-javascript-functions/ -
Error when using VML functions of Intel MKL v9.0 with LabVIEW 8.2.1
Hi,
I have created a DLL in Visual Studio 2005 which uses functions from the Intel Math Kernel Library (MKL) v9.0. The DLL works perfectly when I run it in VS 2005, but when I use it in the LabVIEW environment, I receive the error 1097 [An exception occurred within the external code called by a Call Library Function Node.].
It seems that the VML function vdPowX(), which raises each element of a vector
to the constant power, creates an access violation reading at location 0x00000000.
Unhandled exception at 0x0652d545 (OptimisationDLL_Intel.dll) in LabVIEW.exe: 0xC0000005: Access violation reading location 0x00000000.
When I trace it with VS2005, it seems to read at 0x00 when they check for the mode of the function (HA or LA) to see if the function will uses High Accuracy or Low Accuracy. You can reproduce the bug by simply trying to read the Mode with the Intel Function vmlGetMode().
I'm not sure why I only get the crash in LabVIEW and not in VS2005. The other function from the MKL that I use, daSum(), works correctly in VS2005 and LabVIEW. It doesn't have an accuracy mode since it's not in the VML family, that's probably why.
I've included the source code in C that causes the crash when the DLL is used in LabVIEW (Corellation_Intel.c).
When you attach the LabVIEW process to Visual Studio Debug mode, the execution stops at eax,dword ptr [edx+ecx*4]:
_mkl_vml_core_w7_vml_GetMode:
023D528C mov ecx,dword ptr [__tls_index (240EA0Ch)]
023D5292 mov edx,dword ptr fs:[2Ch]
023D5299 mov eax,dword ptr [edx+ecx*4]
Anyone had this kind of error or have any idea what I might have done wrong? I uses mkl_c.lib and libguide.lib libraries in the i32 of Intel MKL.
Thanks a lot for your help and feel free to contact me if you need more information.
Regards,
Mat
Attachments:
Corellation_Intel.c 2 KBDear Mat,
While more details are desirable to give precise answer I guess that I know the origins of the problem. VML functions are thread-safe. VML engineers use Mircosoft TLS mechanism to maintain thread safety of VML global variables. The TLS use is different for static and dynamic case. This implies that it is impossible to use MKL static library which contains TLS stuff to build dynamic library. Indeed, your DllMain function must have VML TLS initialization/processing/finalization stuff (for details see http://msdn2.microsoft.com/en-us/library/ms686997.aspx). In case VML TLS stuff is absent in your DllMain routine you will see Access Violation on any attempt to access VML global variables.
VML engeneers are seeking for possible solutions/workarounds. Thus far they don't see any elegant way of solving this with existing technologies. Specifically, _mkl_vml_core_w7_vml_GetMode routine does access one of VML global variables.
There is a possibility to build custom VML DLL from static MKL library using MKL Builder Tool. The limitation is that the built DLL cannot contain non-MKL stuff (recalling DllMain issue, MKL Builder Tool cannot put into DllMain routine user's stuff).
Feel free to go to Intel MKL web forum or contact Intel Tech Support in case you have additional questions.
I will keep you informed.
Regards,
Sergey Maidanov
Intel Corporation -
Error "1 (Error INF)" in InfoView when using ; as separator of value
Can anyone explain me this change of Behaviour before I log a bug ?
Here is the workflow :
1. Create a new WebI report using EMP from Oracle
2. Use Empno, Ename, Job and Mgr objects
3. Put a query filter on Mgr object In list and then prompt
4. Run the query and then select few values
5. save the report
6. Open the report in Interactive mode
7.In the left pane 'User Prompt Input' overwrite the existing value by manually inserting new ones separated by ;
8. Select advanced button
-> report is running fine
Do the same workflow as above in BOXIR2 sp4
-> error 1(Error INF) is coming up
modify the separator by a , and then no error is coming up prompt is then showing
Why is that ? Has there been some changes done between the 2 versions ?Dear Mat,
While more details are desirable to give precise answer I guess that I know the origins of the problem. VML functions are thread-safe. VML engineers use Mircosoft TLS mechanism to maintain thread safety of VML global variables. The TLS use is different for static and dynamic case. This implies that it is impossible to use MKL static library which contains TLS stuff to build dynamic library. Indeed, your DllMain function must have VML TLS initialization/processing/finalization stuff (for details see http://msdn2.microsoft.com/en-us/library/ms686997.aspx). In case VML TLS stuff is absent in your DllMain routine you will see Access Violation on any attempt to access VML global variables.
VML engeneers are seeking for possible solutions/workarounds. Thus far they don't see any elegant way of solving this with existing technologies. Specifically, _mkl_vml_core_w7_vml_GetMode routine does access one of VML global variables.
There is a possibility to build custom VML DLL from static MKL library using MKL Builder Tool. The limitation is that the built DLL cannot contain non-MKL stuff (recalling DllMain issue, MKL Builder Tool cannot put into DllMain routine user's stuff).
Feel free to go to Intel MKL web forum or contact Intel Tech Support in case you have additional questions.
I will keep you informed.
Regards,
Sergey Maidanov
Intel Corporation -
Internal table export and import in ECC 5.0 version
Hi friends,
I am trying to export and import internal table from one program to other program.
The below export and import commands are not working when I run the program in background (using SUBMIT zxxxx via JOB name NUMBER number ..)
EXPORT ITAB TO MEMORY id 'ZMATERIAL_CREATE'.
IMPORT ItAB FROM MEMORY ID 'ZMATERIAL_CREATE'.
Normally it should work. Since Its not working I am trying with another alternative..
i.e EXPORT (ptab) INTERNAL TABLE itab.
My sap version is ECC 5.0 .
For your information, here I am forwarding sap help. Pls have a look and explain how to declare ptab internal table.
+Extract from SAP help+
In the dynamic case the parameter list is specified in an index table ptab with two columns. These columns can have any name and have to be of the type "character". In the first column of ptab, you have to specify the names of the parameters and in the second column the data objects. If the second column is initial, then the name of the parameter in the first column has to match the name of a data object. The data object is then stored under its name in the cluster. If the first column of ptab is initial, an uncatchable exception will be raised.
Outside of classes you can also use a single-column internal table for parameter_list for the dynamic form. In doing so, all data objects are implicitly stored under their name in the data cluster.
My internal table having around 45 columns.
pls help me.
Thanks in advance
raghunathThe export/import should work the way you are using it. Just make sure you are using same memory id and make sure its unique - meaning u are using it only for this itab purpose and not overwriting it with other values. Check itab is not initial before you export in program 1 - then import it in prog2 with same memory id...also check case, I am not sure if its case sensitive...
Here is how you use the second variant...
Two fields with two different identifications "P1" and "P2" with the dynamic variant of the cluster definition are written to the ABAP Memory. After execution of the statement IMPORT, the contents of the fields text1 and text2 are interchanged.
TYPES:
BEGIN OF tab_type,
para TYPE string,
dobj TYPE string,
END OF tab_type.
DATA:
id TYPE c LENGTH 10 VALUE 'TEXTS',
text1 TYPE string VALUE `IKE`,
text2 TYPE string VALUE `TINA`,
line TYPE tab_type,
itab TYPE STANDARD TABLE OF tab_type.
line-para = 'P1'.
line-dobj = 'TEXT1'.
APPEND line TO itab.
line-para = 'P2'.
line-dobj = 'TEXT2'.
APPEND line TO itab.
EXPORT (itab) TO MEMORY ID id.
IMPORT p1 = text2
p2 = text1 FROM MEMORY ID id. -
METHOD onactionshow .
DATA:
Node Info
rootnode_info TYPE REF TO if_wd_context_node_info,
Context Nodes
dyn_node TYPE REF TO if_wd_context_node,
tabname_node TYPE REF TO if_wd_context_node,
String (for table name)
tablename TYPE string.
get node info of context root node
rootnode_info = wd_context->get_node_info( ).
Get the name of the table to be created
tabname_node = wd_context->get_child_node( name = 'INPUT' ).
tabname_node->get_attribute( EXPORTING name = 'TABLENAME'
IMPORTING value = tablename ).
TRANSLATE tablename TO UPPER CASE.
create sub node named TEST1 of structure (tablename)
<b>cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
parent_info = rootnode_info
node_name = tablename
structure_name = tablename
is_multiple = abap_true ).</b>
<b>DATA: stru_tab TYPE REF TO data.
FIELD-SYMBOLS:
<tab> TYPE table.</b>
create internal table
<b>CREATE DATA stru_tab TYPE TABLE OF (tablename).</b>
<b>ASSIGN stru_tab->* TO <tab>.</b>
Get table content
<b>SELECT * FROM (tablename) INTO CORRESPONDING FIELDS OF TABLE <tab>.</b>
get instance of new node
dyn_node = wd_context->get_child_node( name = tablename ).
Bind internal table to context node.
dyn_node->bind_table( <tab> ).
Please explain me the above statements which are in bold.
if u feel anything more to explain please tell me.
I am facing a lot of problem in undrestsnding those.
points will be rewarded immediately
with Regards,
lokesh@EDShi ,
if u r chosing a single database table ,u will create a node name and its attribute in component controller or in view controller.example mara as node name and its attribute as matnr ersda and ernam.then right clicking on the UI element click create binding and select ur mode of display by selecting text view or dropdownbyindex.but in dynamic case, at runtime user will give any table name and any filter condition of selecting its field .so it is impossible to create 88000 table as node and select all fields. so now give child node name as 'tablename' with type string .
in component controller it has one parent node by default.if we create a new node it comes as child of patent node 'context'.
class cl_wd_dynamic_tool contain 4 methods in that method create_nodeinfo_from_struct has all importing parameter
1. give the reference parent node name which is stored in a varible rootnode_info.
(rootnode_info = wd_context->get_node_info( ). if u go to attribute column, u can found 3 interfaces with respective data refernces like wd_this,wd_context. if u dblclick if_wd_context_node u can find all info regarding the name of context, and any other newly created parameters.)
2.give structure name or table name which is is given at runtime.
3. for accepting many fields or with only one field.
in abap oops dynamic condition is attained by 2 ways 1. data reference and 2.field symbols.
data reference alias name is "address of".
field symbol alias name is "value at".(place holder)
DATA: stru_tab TYPE REF TO data.
this means u r creating a variable stru_tab which is having a properties of data.
assume "data" is a type or class , .here only u declare only variable ,it has no content till the statement create data.(memory space will allocate only after the execution of create data.)
FIELD-SYMBOLS:
<tab> TYPE table.
u can declare a field symbol with generic type "any " keyword or "table" keyword.
dynamic means u should mention within parenthesis (table name).
conventiontional way of declaring internal table is
data: <internal table name > type table of <table name>.
here u dont know the type table u r going to pass.
but definetly ,it contain data, so declare stru_tab as data .
DATA: stru_tab TYPE REF TO data.
in this step only variable name name is create not space.
CREATE DATA stru_tab TYPE TABLE OF (tablename).
in this step space is create for variable but only internal table name is declared.but no space
ASSIGN stru_tab->* TO <tab>.
internal table is of table format .so u declared field symbol as table.
stru_tab is address of data
<tab> is value at table.
then select query
thanx
zenthil -
How to avoid creating a variable to store a temporary value
This is an artificial example, but it best illustrates what I am trying to do:
I could create a local variable whose scope doesn't extend beyond the step, but I'd like to avoid that local variable clutter. Or I could dynamically create and delete properties in post expressions, but that would lead to variable names that are invalid at edit-time. Or I could create a custom Sequence Call step type with a custom subproperty to hold the temporary value, but that is not a very generic solution.
But really, I'd like to just have two expressions I could use in the sequence Parameter and the Custom Condition that somehow each point to the other, to keep the rest of the step configuration as clean as possible (although the two expressions I am seeking may end up being more complex than the alternatives). Is this possible? I think it may be, but I can't figure it out. One of the alternative solutions wouldn't kill me, but the solution I have in mind would be nicer!What you have seems to be the most clear solution to this. For the dynamic case, if you are worried about errors, you may want to use #NoValidation. Here's a paragraph from the linked document about using #NoValidation.
http://zone.ni.com/reference/en-XX/help/370052K-01/tshelp/infotopics/2012whatsnew/
You can now use the #NoValidation directive in an expression to disable evaluation error checking for part or all of the expression. Use this directive to suppress errors reported at edit time that will not occur at run time, such as using a variable the sequence creates at run time by using the TestStand API. Use this directive without a parameter list to suppress error checking for the remainder of the expression or pass a separate expression as the parameter to this directive to suppress error checking for only the parameter expression.
Jesse S.
Applications Engineer
National Instruments -
Can we reset the the value of a sequence without re-creating again!!!?
I want to reset the sequence number based on
max number of column of a table like
This is the table
******CASE 1
records are inserted using sequence number my_seq.nextval in the perticluar column
my_tab
NUM Name
8500 A
8501 B
8502 C
commit;
Again I inserted records using the sequence
8503 D
8504 E
8505 F
rollback;
I want to start the sequence from 8502+1 again (dynamically)
********CASE 2
Some records are deleted by some body then when we are inserting the records into table can we start sequence from the max val of column!!!
Like
My_tab:
NUM Name
8510 M
8511 N
8512 O
8513 P
My_seq.Currval is 8514
After Deleting the 2 Records of last
8512 O
8513 P
The Table is
My_tab:
NUM Name
8510 M
8511 N
Can we rest the Sequence dynamically based on the Max num of a the My_tab
****Case 3
If I deleted the records from table in the moddle
like
NUM Name
8500 A
8501 B
8502 C
8503 D
8504 E
8505 F
If these records are deleted
8502 C
8503 D
then I have to rest the table like
NUM Name
8500 A
8501 B
8502 E
8503 F
Thanks,
Message was edited by:
user587217
Message was edited by:
user587217You cannot rollback a sequence increment. Furthermore, sequence exists to give you a unique number, not to have a free-gap sequence number.
It seems, by your example, that you want avoid the gap. Why ? By "reinit" the sequence, you can have some other problem. What reinit sequence value ?
Imagine two sessions which insert rows in same time.
First will get 1, 2, 3, the second 4, 5, 6. First session rollback and other commit the insertion. What value do you want for the sequence ?
What have you to achieve ? A number sequence without gap should be more an output problem, not a storage problem.
Nicolas. -
JSP output affected with cookievalue cookie.getValue() function
i need to output from a jsp
fquid=uid@domain
authtype=plaintext
this is the format expected by a calling url.
uid is dynamic
case 1: if i set
String uid="xyz";
the calling url to this jsp behaves perfect. all it matters at this point is that the calling jsp needs output in the above format.
here is the code that works.
<%
out.println( "fquid=xyz@domain\n");
out.println( "authtype=plaintext\n");
%>
case 2:
my job is to make this jsp dynamic. i need to grab the uid from a cookie and output the exact same strings. but this one bombs meaning the calling jsp does not behave correctly.
here is the code i haveth:
<%
String cookieName = "cookiename";
Cookie cookies [] = request.getCookies ();
Cookie myCookie = null;
String cval = null;
if (cookies != null)
for (int i = 0; i < cookies.length; i++)
if (cookies .getName().equals (cookieName))
myCookie = cookies[i];
// out.println( i + "," + myCookie.getValue() + "<BR>");
cval=myCookie.getValue();
break;
String uid=myCookie.getValue();
out.print( "fquid=" + uid + "@domain\n");
out.print( "authtype=plaintext\n");
%>
the moment i introduce myCookie.getValue() function into the code the calling url fails. the output of the both the snippets is same.
what is the problem here?
thanks
bhanuDid you even set the Cookie? You need to set it first in order to get it.
To set a cookie
1. Create a new Cookie object and set the name and value in it's constructor.
2. Then add the Cookie into the HTTP Response
3. Call the above code from a URL
4. Look in Browser's cache to verify if the Cookie was written
Also check if Cookies are disabled in the browser. -
RegEx To Replace Non-Static URL Variable
I have the need to strip a query string of one or more variables, which unfortunately are not static.
I've been trying to wrap my head around RegEx for this, but haven't had much luck.
A sample of my URL would be:
http://www.mydomain.com/locations.cfm?page=2&sort_method=name
Obviously the page number will change, and the sort method could be any one of a number of values.
Can anyone point me in the direction for using RegEx to "replace/rereplace" the variable and it's value?
Thank you in advance.<cfset myUrl="http://www.mydomain.com/locations.cfm?pAgE=25&Sort_Method=name06">
<!--- Dynamic case-insensitive replacement of any page number --->
<!--- [0-9]{1,3} means the page number is between 0 and 999 --->
<cfset dynamicPageNumber = 9>
<cfset newURLPage = REReplaceNoCase(myUrl,"page=[0-9]{1,3}","page=#dynamicPageNumber#")>
<!--- Case-insensitive replacement of any sort_method --->
<!--- [A-Za-z0-9]{1,8} means the sort method is between 1 and 8 alphanumeric chars --->
<cfset dynamicSortMethod = 'bkbk_method'>
<cfset newURLSortMethod = REReplaceNoCase(myUrl,"sort_method=[A-Za-z0-9]{1,8}","sort_method=#dynamicSortMethod#")>
<cfoutput>
newURLPage: #newURLPage# <br>
newURLSortMethod: #newURLSortMethod#
</cfoutput> -
To fetch subsring from below string(Urgent)
Dear All,
pls help me in getting this done,
i am having string as below.
1567|djfhdjkhkld
14|dsjfhsdjka
767|sdfhajksdjafk
3625763298|sdhafjksdjalfk
i need to get the string before the pipe (|) as i want to implement for dynamic case as well.
Thanks in advance for resolution....
regards,
shantha873618 wrote:
Dear All,
pls help me in getting this done,
i am having string as below.
1567|djfhdjkhkld
14|dsjfhsdjka
767|sdfhajksdjafk
3625763298|sdhafjksdjalfk
i need to get the string before the pipe (|) as i want to implement for dynamic case as well.
Thanks in advance for resolution....
regards,
shantha
Hi,
see below example
SQL> select * from t1;
A
1567|djfhdjkhkld
14|dsjfhsdjka
767|sdfhajksdjafk
SQL> select substr(a,1, instr(a,'|',1)-1) from t1;
SUBSTR(A,1,INSTR(A,'|',1)-1)
1567
14
767Cheers -
Dynamic file name in case of .txt output files
Hi all,
I have a query related to dynamic file name scenario.
In case of IDOC-XI-FILE sceanrio,
<b>Is it possible to generate .txt file name based on Plant number like</b>
<b>%<Plantname>%_%<BusinessDay>_filename.txt</b>
<b>Note:I have implemneted this for .xml output files but I am not able to implement it for .txt output files .</b>
PLEASE HELP ME .
Regards
PrabhatHi Prabhat,
I think, the normal Dynamic File Name generation should work fine in your case also. Even if you perform Content Conversion, you can use Variable Name Substiution to create your Destination file name as, the name of the file is determined first and only then is the content converison perfromed.
for info on content conversion, I would suggest that you go through this thread and check my reply,
Re: Dynamic File Name for Receiver File Adapter
Regards,
Bhavesh -
CASE statement in a dynamic page
I have written a query using a CASE statement in the select portion to evaluate column values and produce a text string. The query runs fine in sql*plus, but when I attempt to add the code to a dynamic page and compile it, I get the following error message:
ORA-06550: line 1, column 720:
PLS-00103: Encountered the symbol "CASE" when expecting one of the following:
( - + mod null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table avg count current max min prior sql stddev sum variance
execute the forall time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> (WWV-11230)
Critical Error in wwerr_api_error.get_errors! SQL Error Message: ORA-06502:
PL/SQL: numeric or value error: character string buffer too small (WWV-)
I am running oracle 8.1.7.1.0 using Portal 3.0.9.8.1
I have written a function as a workaround, but would like to know why portal does not seem to like the "CASE" statement.
Any suggestions would be greatly appreciated.Hi Chetan,
I still get an error message even when I attempt to create a small dynamic page with your cursor. The error message is posted below. I am definitely putting the cursor declaration between <ORACLE></ORACLE> tags. Any Ideas?
Thanks,
Dan
ORA-06550: line 1, column 215:
PLS-00103: Encountered the symbol "CASE" when expecting one of the following:
( - + mod null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table avg count current max min prior sql stddev sum variance
execute the forall time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> (WWV-11230)
Failed to parse as PORTAL30 - DECLARE CURSOR SPN_INMATE_INFO(V_SPN IN VARCHAR2) IS SELECT DISTINCT B.ENAME, B.ENAME||' '||B.ENAME F_NAME, B.DEPTNO, B.SAL, B.HIREDATE, B.SAL, B.EMPNO, B.HIREDATE, B.COMM, B.ENAME, CASE WHEN B.HIREDATE IS NULL THEN 'NO' WHEN B.HIREDATE IS NOT NULL AND B.SAL IS NOT NULL THEN 'NO' WHEN B.SAL IS NOT NULL AND B.HIREDATE IS NULL THEN 'YES' END RELEASED, C.DNAME, C.LOC, C.DEPTNO FROM SCOTT.EMP B, SCOTT.DEPT C WHERE C.DNAME NOT IN ('5397','6497','6498','6499','5011','42-9-44') AND C.LOC NOT IN ('M','F') AND B.ENAME != '00188547' AND B.DEPTNO = C.DEPTNO ORDER BY B.HIREDATE; BEGIN NULL; END; (WWV-08300)
Maybe you are looking for
-
What happened to my TV show?
I bought a TV season, but once I watch an episode, I can't find it in my library again.
-
How can i find the location of an app from the search bar?
I need to delete an app on my ipad3. I know it's on there b/c I can find it in the search bar. But for the life of me, I can't find where the icon is, so I can delete it. The search bar doesn't tell me where on the pad it is. I have 10-11 pages of ap
-
Tables used for material ledger
What are the standard tables used for material ledger
-
What info is stored by Oracle in v$session.program?
Hi all, I was trying to query V$session.program, and it appears that Oracle sometimes stores valid values like for example: "PSAPPSRV@PSA1H31 (TNS V1-V3)" and sometimes just '?' instead, like for example: "? @PSA1H31 (TNS V1-V3)" Please I need to kno
-
Other remotes in an AirPort Express - ATI Remote Wonder?
I've just bought an AirPort Express, looks like a good little product, but just wondering about plugging my USB remote into it. I've got an ATI Remote Wonder, which has a small USB receiver, and wondered if there is ever likely to be any support for