Problem in sorting of table
Hi Friends:
Below are the records in my table:
a...|b|c...... |d.....|e................|f
100||25000|......|0000012998|0002259999
100|*|25000|1405|0000012998|0002251405
100|*|25000|1406|0000012998|0002251406
100|*|25000|1407|0000012998|0002251407
100|*|25000|1409|0000012998|0002251409
100|*|25000|1410|0000012998|0002251410
100|*|25000|1411|0000012998|0002251411
100|*|25000|1419|0000012998|0002251419
100|*|25000|1420|0000012998|0002251420
100|*|25000|1421|0000012998|0002251421
a = client
b= Leg.Dept Code
c= Legacy Product
d= Legacy Location
e= Cost Center
f= Profit Center
Please consider '.' as space.
The problem arises in the sorting of the table records. The first record shown in the record set above has the following entry:
a...|b|c...... |d.....|e................|f
100||25000|......|0000012998|0002259999
This is the default entry that is to be used if there is no Leg.Location (where Leg. Location = *). If there is an entry for the specific Leg. Location, then it should be used prior to using this record.
Problem appears to be that the ABAP program locates this default record prior to encountering the specific record, for example:
a...|b|c...... |d.....|e................|f
100|*|25000|1419|0000012998|0002251419
Because the program encounters the wildcard one first, even if the Leg. Location that the program is searching for is 1419 (which appears in the table, just lower in the listing) the program returns a Profit Center of 2259999 instead of the correct value of 2251419.
Is it possible to change the native sort of this table so that the wildcard entries appear at the bottom of the listing instead of the top? If yes, can it be done permanently.
This would allow the program to encounter the specific entries prior to encountering the wildcard ones.
Hi Paul:
Thanks for your response. Can you please look at the code below. Actually I've got this issue in the form of a ticket.
FORM resolve_product_code TABLES pt_accntmap TYPE gtty_accntmap
USING p_structraw TYPE gty_structraw.
DATA: lwa_structraw TYPE gty_structraw,
lwa_accntmap TYPE gty_accntmap,
lt_accntmap TYPE gtty_accntmap.
MOVE p_structraw TO lwa_structraw.
lt_accntmap[] = pt_accntmap[].
LOOP AT lt_accntmap INTO lwa_accntmap.
CLEAR: lwa_accntmap-accntcompstr,
lwa_accntmap-fndtype,
lwa_accntmap-posi2.
IF lwa_accntmap-z_product CA '*_'.
TRANSLATE lwa_accntmap-z_product USING '_+'.
SEARCH lwa_structraw-proddiv FOR lwa_accntmap-z_product.
IF lwa_structraw-proddiv CP lwa_accntmap-z_product.
IF sy-subrc EQ 0.
lwa_accntmap-accntcompstr = lwa_structraw-proddiv.
lwa_accntmap-fndtype = '*'.
lwa_accntmap-posi2 = sy-fdpos.
ENDIF.
ELSE.
Must be a full match to win
IF lwa_structraw-proddiv EQ lwa_accntmap-z_product.
lwa_accntmap-accntcompstr = lwa_structraw-proddiv.
lwa_accntmap-fndtype = space.
lwa_accntmap-posi2 = 6.
ENDIF.
ENDIF.
MODIFY lt_accntmap FROM lwa_accntmap
TRANSPORTING accntcompstr fndtype posi2.
ENDLOOP.
IF sy-subrc EQ 0.
Remove any unresolved entries based on Natural Account Code
DELETE lt_accntmap WHERE accntcompstr NE lwa_structraw-proddiv.
ENDIF.
pt_accntmap[] = lt_accntmap[].
ENDFORM. " resolve_product_code
Can you please help me with the exact problem in this code.Or if you can give me some idea. It would be a great help.
Similar Messages
-
Problem in sorting of table data
Hi all,
I had gone through the PDF given (Developing with tables in webdynpro).
i got struck in creating TableSorter.java file...
can any one tell me how to create that java file in my project and how to send the colum which i want to sort to TableSorter.java
Regards
PadmaTo implement it ,create a value attribute say "sorter" of java native type
com.sap.tc.webdynpro.tests.utils.TableSorter. (The package name MIGHT be different.)
In wdDoModifyView,obtaine a refernce to the table objject like
table = (IWDTable)view.getElement("table ui name);
and use
wdContext.currentContextElement().setSorter(
new TableSorter(table, wdThis.wdGet
<action name for sort>Action(), null));
Now inside that action handler,
wdContext.currentContextElement().getTableSorter().sort(wdEvent,
wdContext.node<nodename>());
also chk it
Re: Sort a table
sort table columns
Table Sorting ( In Case Insensitive order)
null -
Problem in sorting advacned table attribute
Hello everyone,
Would anyone please help me to sort the column of advanced table becoz I need readonly type columns but when I sort in converts into writeable format...
thanks in advanceHi,
In coloumnHeaderPrompt ther is one property ;Sort All and Initila Staus set them,,,
wht is the style of the columns in AdvancE Table RN...? IF u want only read only make it to "MessageStyledText"
Nani
Edited by: Nani652595 on Feb 24, 2010 10:06 PM -
Problem in sorting Advanced Table
Hi,
I unable to sort the data in advanced table.The data in the table is populated from an external LOV.When i set the initial sort sequence attribute of the sortable column of the table it is sorting in desecnding order by default.How to sort the data in the ascending order.Please help me it is very urgent.
Thanks in advance
Regards
SrikanthThe sorting on the table is done by adding the order by clauase and then re querying the vo.
However here the data is coming from an LOV not from VO.
Hence what you need to do is add the order by clause to the VO of the multiselect LOV.
By making the LOV columns sortable (OR ASCENDING BY DEFAULT) and then sorting them in ascending order, see what comes to the base page?..
IF sorting on lov does not suffices and the need is to provide sorting on the base table is also needed then my suggestion is to associate the same vo of the lov with the advanced table (or put the same query of the lov vo for the advanced table vo) -
Hi friends,
I am having a problem when sorting the table control dynamically based on the fields selectd.
sorting is not working, when you select multiple fields ( one numeric field and one character field ) I have written code for handling multiple field sort,gettting field names correctly, everything looks fine but internal table is not getting sorted.
Is it related unicode issue..?
Any help will be appreciated.
Sample code:
loop at tc_control into lc_cols.
case lc_cols-selected.
wehn 'X'.
split lc_cols-screen-name at '-' into gv_tabname gv_fieldname.
move gv_fieldname gs_struc+lv_off(20)
add 20 to lv_off.
endcase.
endloop.
if ok_code = 'ASCE'.
sort itab by (gs_struc-field1) (gs_struc-field2) ..... ascending
endif.
Thanks in advance
Thiru.pHi
Try using an internal table for the field names..
Example
DATA: BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
WERKS TYPE WERKS_D,
END OF ITAB.
DATA: ITAB_FIELD(30) OCCURS 0 WITH HEADER LINE.
DATA
ITAB-MATNR = 'ABC'.
ITAB-WERKS = 'ABCD'.
APPEND ITAB.
ITAB-MATNR = 'ABC'.
ITAB-WERKS = 'ABC'.
APPEND ITAB.
SORT INTERNAL TABLE
ITAB_FIELD = 'MATNR'.
<b>APPEND ITAB_FIELD.</b>
ITAB_FIELD = 'WERKS'.
<b>APPEND ITAB_FIELD.</b>
<b>SORT ITAB BY (ITAB_FIELD).</b>
LOOP AT ITAB.
WRITE: / ITAB-MATNR,ITAB-WERKS.
ENDLOOP.
Thanks
Naren -
Hi all,
I have a small problem with sorting WD tables.
I have java bean model as datasource for table. In this bean, I have non-string attributes like date, etc. I want to format them, so I've added additional String attribute for every attribute I want to format.
When i'm click to sort (I use standard TableSorter) by some of additional String attribute (column with original attr. is invisible and I put that invisible column name to sortBy method to achieve correct sorting behaviour), I lost ascending/descending icon on that substituted column...
Have somebody solution for this?
Best Regards,
MichalHi,
If not how can I turn off sorting on such a columns.
As far, there is no such provision for table columns!. However in ALV, you can use IF_SALV_WD_SORT~SET_SORT_ALLOWED method to set sort on/off for ALV column.
Regards,
Kiran -
Problem of sorting month name in pivot table
Hello,
I have a month name that is sorted by month number in my repository.
When I select Year + month name + measure sorted by year then by month name and I look the result in a table, everything works perfectly but when I switch to a pivot table the sorting doesn't work : the pivot table sorts my month name in an alphabetical order instead of using the month number .... Is it normal ?
To find a solution, I have added my month number and I have sorted by year then by month number and I have hidden my column month number. This have solved my problem for the pivot table but if I attached a chart to it (by selecting "Chart Pivoted Results"), the label of the bottom axis contains the month number and the month name and I haven't found where I can hide this month number. Why the hidden option only works on the pivot table and not on the pivot chart ? And how I can do that ?
Thanks in advance for your help.No there is no Transient attribute involved , could you please tell me what might cause this error .
Basically this page is for inserting a record.
Thanks ,
Keerthi
Edited by: user1140193 on Oct 21, 2011 7:15 AM
Edited by: user1140193 on Oct 21, 2011 7:16 AM -
Problem with sorting and filtering of table
Hello,
using VC 7.1 SP5 I have created [this|http://img232.imageshack.us/img232/2460/screenshotsr0.png] model. The webservice returns a collection of structured elements. The table is meant to display values of top-level attributes. This works as expected.
However, the table cannot be sorted or filtered. What is the reason for this? How can I fix that?
I tried to store the result of the web service in a data bridge. That did not succeed.
Best regards
AlexanderHi Natty,
How are you trying to sort it?
I want to be able to sort the table by clicking on the table column headers. Furthermore, I want be able to filter the table by using the built-in table feature. However, table sorting and filtering seem to be disabled for this particular table, whereas other tables in my model provide the desired features.
Best regards
Alexander -
Problem sorting the table .
hi
iam trying to sort the table in ascending
and descending order ,
but iam not able to sort my model node table .
below is the code i have written
and other thing i have created a class called Tablesorter.java
and copied the code of the TableSorter present in
IDE\eclipse\examples as i was not able to copy and
paste the TableSorter Class , in the
src\pkg.
import com.sap.tc.webdynpro.tests.utils.TableSorter;
if(firstTime)
view.nowCreateAllCustomExtensionFields();
IWDTable tab= (IWDTable)view.getElement("Table");
wdContext.currentContextElement().setCustomerTableSorter(new TableSorter(tab,wdThis.wdGetTableSortAction(),null,new String[] {"Customers") ));
in the above coding i am getting error as Constructor TableSorter is undefined.
wdContext.currentContextElement().getCustomerTableSorter().sort(wdEvent,wdContext.nodeCustomers());
can any one help me out ?hi
thanks for the response
i cannot copy the model node data to the value node
as i am performing some operations in the itemlistbox
and then populating the model node table
and there will be thousands of data , so copying
the data to the value node will affect the performance
and other thing is i have one more table of model node
where i have to perform sorting , so is there a way
that TABLESORTING can be directly performed on the
model node , i have to perform ascending and descending order sorting on the two tables w.r.t the columns
can any one help me out ? -
A Problem With Sorting via Applescript
Hello everyone. I have always lurked these forums and learnt many things along the way, but this is my first question, and I hope that someone can help me out. I apologise for the huge post.
I have created a spreadsheet in Numbers that I plan to use for a soccer tournament. There are 8 Groups of 4 teams in the competition, so I have set each Group up on its own sheet in order to record the results of the games. Group 1 is on Sheet 1, Group 2 is on Sheet 2 etc. These results are then fed into a second table on the each page in order to create a competition ladder for each group. So far so good, works beautifully. See image:
My next step is sorting these tables so that they form a proper "results table" with the best team on top. My wish is to sort the results table in this order:
Points
Diff
F
Although not very experienced with Applescript, I have written a script to sort all of the 8 sheets so that I don't have to do them one at a time. Unfortunately I find that every second sheet does not sort correctly, even though I am using the same instructions for each seet in my script.
See here, sheet two:
Sheet 3 sorts correctly but not sheet 4, sheet 5 is good but sheet 6 bad etc...
This is my script:
tell application "Numbers"
tell table "Ladder1" of sheet "Group1" of document "Manu"
sort by column "k" direction descending
end tell
tell table "Ladder1" of sheet "Group1" of document "Manu"
sort by column "i" direction descending
end tell
tell table "Ladder1" of sheet "Group1" of document "Manu"
sort by column "g" direction descending
end tell
tell table "Ladder2" of sheet "Group2" of document "Manu"
sort by column "k" direction descending
end tell
tell table "Ladder2" of sheet "Group2" of document "Manu"
sort by column "i" direction descending
end tell
tell table "Ladder2" of sheet "Group2" of document "Manu"
sort by column "g" direction descending
end tell
tell table "Ladder3" of sheet "Group3" of document "Manu"
sort by column "k" direction descending
end tell
tell table "Ladder3" of sheet "Group3" of document "Manu"
sort by column "i" direction descending
end tell
tell table "Ladder3" of sheet "Group3" of document "Manu"
sort by column "g" direction descending
end tell
tell table "Ladder4" of sheet "Group4" of document "Manu"
sort by column "k" direction descending
end tell
tell table "Ladder4" of sheet "Group4" of document "Manu"
sort by column "i" direction descending
end tell
tell table "Ladder4" of sheet "Group4" of document "Manu"
sort by column "g" direction descending
end tell
tell table "Ladder5" of sheet "Group5" of document "Manu"
sort by column "k" direction descending
end tell
tell table "Ladder5" of sheet "Group5" of document "Manu"
sort by column "i" direction descending
end tell
tell table "Ladder5" of sheet "Group5" of document "Manu"
sort by column "g" direction descending
end tell
tell table "Ladder6" of sheet "Group6" of document "Manu"
sort by column "k" direction descending
end tell
tell table "Ladder6" of sheet "Group6" of document "Manu"
sort by column "i" direction descending
end tell
tell table "Ladder6" of sheet "Group6" of document "Manu"
sort by column "g" direction descending
end tell
tell table "Ladder7" of sheet "Group7" of document "Manu"
sort by column "k" direction descending
end tell
tell table "Ladder7" of sheet "Group7" of document "Manu"
sort by column "i" direction descending
end tell
tell table "Ladder7" of sheet "Group7" of document "Manu"
sort by column "g" direction descending
end tell
tell table "Ladder8" of sheet "Group8" of document "Manu"
sort by column "k" direction descending
end tell
tell table "Ladder8" of sheet "Group8" of document "Manu"
sort by column "i" direction descending
end tell
tell table "Ladder8" of sheet "Group8" of document "Manu"
sort by column "g" direction descending
end tell
end tell
Can anybody see any obvious errors with the script? Any info would be greatly appreciated. Thanks!First I would look at some items to simplify the script:
I did NOT run this.
tell application "Numbers"
set LadderNumber to 1
repeat 8 times
set theLadder to "Ladder" & LadderNumber
set theGroup to "Group" & LadderNumber
tell table theLadder of sheet theGroup of document "Manu"
sort by column "k" direction descending
sort by column "i" direction descending
sort by column "g" direction descending
end tell
set LadderNumber to (LadderNumber + 1)
end repeat
end tell
I don't see a problem with the script. I suggest adding a dummy table to each sheet and confirming you can set a value in the dummy table from the script (maybe after manually setting the value to some default value). you can also add print dialogs at each step to see what's happening... like:
set aValue to <what ever>
display dialog "The value is: " & aValue
just some thoughts -
Dear SAP Experts,
For this problem I recd the reply and also followed this step, but still there is the problem.
Step 1:
Insert a module line after the module "LISTE_INITIALISIEREN" .
e.g.
PROCESS BEFORE OUTPUT.
MODULE LISTE_INITIALISIEREN.
MODULE sort .
LOOP AT EXTRACT ...
Step 2:
In your new module (in my example "sort"), do the sorting as follows. I will sort my table by the field "f3" .Thank God because ABAP gives assignment regardless of structures of both sides. Here what I mean:
e.g.
MODULE sort OUTPUT.
DATA gt_ztest LIKE ztest OCCURS 1 WITH HEADER LINE .
*--Getting the content of extract in an internal table
*-having the structure of my table.
gt_ztest] = extract[ .
*--Sorting it
SORT gt_ztest BY f3 .
*--Restoring extract from my sorted table
extract] = gt_ztest[ .
ENDMODULE. " sort OUTPUT
here in this code, which is given above:
gt_ztest] = extract[ .
when I put this code it shows syntax error...
PLease help me to solve the problem.
Regards
Lakshmikanth KDear SAP Experts,
For this problem I recd the reply and also followed this step, but still there is the problem.
Step 1:
Insert a module line after the module "LISTE_INITIALISIEREN" .
e.g.
PROCESS BEFORE OUTPUT.
MODULE LISTE_INITIALISIEREN.
MODULE sort .
LOOP AT EXTRACT ...
Step 2:
In your new module (in my example "sort"), do the sorting as follows. I will sort my table by the field "f3" .Thank God because ABAP gives assignment regardless of structures of both sides. Here what I mean:
e.g.
MODULE sort OUTPUT.
DATA gt_ztest LIKE ztest OCCURS 1 WITH HEADER LINE .
*--Getting the content of extract in an internal table
*-having the structure of my table.
gt_ztest] = extract[ .
*--Sorting it
SORT gt_ztest BY f3 .
*--Restoring extract from my sorted table
extract] = gt_ztest[ .
ENDMODULE. " sort OUTPUT
here in this code, which is given above:
gt_ztest] = extract[ .
when I put this code it shows syntax error...
PLease help me to solve the problem.
Regards
Lakshmikanth K -
Problem with sorting involving user defined types and reports
Hello!
I have a problem with sorting involving Reports and user defined objet types.
I have created the following object types
CREATE TYPE type_balance_compte AS OBJECT
NUM_CPT_SEQ NUMBER(8)
,NUM_CPT VARCHAR2(35)
CREATE TYPE TB_type_balance_compte IS TABLE OF type_balance_compte
At the reports query I use:
SELECT ...
FROM table(cast(test_pkg.balance_comptes(:P_num_soc) as TB_type_balance_compte)) c
The procedure balance_comptes will retrieve data from various tables into the type.
The report is ordered by a certain string field that usually contains characters and numbers.
I need to have numbers always before characters, meaning the data should come in this order in the report for example:
0
1
A
B
So, before the report query, I have placed a call to DBMS_SESSION.SET_NLS( 'nls_sort', 'binary' ) to guarantee NLS_SORT in case it is originally set to FRENCH.
The problem here is that even after this call, I have the report ordered like this
A
B
0
1
And not the numbers before as it should be.
To try and find out where the problem was, I have created a table to use instead of the object type described above. In this case, it worked correctly. So all I know by now is that is has something to do with the type or cast, but what exactly? Does anybody now how to solve this without using a table?
Many thanks
AriadneI have placed a call to DBMS_SESSION.SET_NLS( 'nls_sort', 'binary' ) why not order directly then:
SQL> select *
from table (sys.dbms_debug_vc2coll ('A', 1, '5', 'C', 'a'))
order by nlssort (column_value, 'NLS_SORT = binary')
COLUMN_VALUE
1
5
A
C
a
5 rows selected.? -
How To Sort the Table Through Push Buttons (ASC & Desc)???
Hi,
I am facing a problem with regard to 'Push Buttons' that I have created on
my Form. I want the 'Push Button' to sort the table with respect to a
specific column in 'Ascending order' on first push and then in 'Descending
order' on second push and then again in 'Ascending order' on third push and so
on...
please help me to achieve this
regards,
.Hello,
You could try something like this:
Declare
LC$Order Varchar2(128) := Get_Block_Property( 'EMP', ORDER_BY ) ;
Begin
If Instr( LC$Order, 'DESC' ) > 1 Then
Set_Block_Property( 'EMP', ORDER_BY, 'EMPNO ASC' ) ;
Else
Set_Block_Property( 'EMP', ORDER_BY, 'EMPNO DESC' ) ;
End if ;
Execute_Query ;
End ; Francois -
Hello,
I am having problems sorting a table.
The internal table has following data:
Doc_num..........ver_num
TEST123.............02
TEST123.............01
TESTXYZ.............02
TESTXYZ.............03
TESTXYZ.............01
TESTXYZ.............04
Now I am using statement :
SORT itab by doc_num ver_num.
Now this does sort the data according to correct doc_num but not according to ver_num.
Please help.
Thanks.
Regards,
RajeshNote: I have defined doc_num and ver_num s string....
My input is:
TEST123.............1
TEST123.............2
TESTXYZ.............1
TESTXYZ.............20
TESTXYZ.............10
TESTXYZ.............2
I am seeing following:
TEST123.............1
TEST123.............1
TESTXYZ.............1
TESTXYZ.............10
TESTXYZ.............20
TESTXYZ.............2
I want to see as follows:
TEST123.............1
TEST123.............2
TESTXYZ.............1
TESTXYZ.............2
TESTXYZ.............10
TESTXYZ.............20 -
Hi all,
We've implemented a tablewiew in MVC. The property sort is "SERVER". When a row of the tableview is selected an we try to sort the table, the selected row is lost.
How we keep the selected row when we sort the tableview?
Thanks in advance.Hi Mario
What is happening in case you are sorting the table is it is refreshing the selectedrowindex.
If you want the same index to remain selected, you can do one thing, just save the selectedrowindex in some variable before sorting and assign that variable to selectedrowindex after sorting. It will show that index as selected.
If you want the same item to remain selected. i.e. let you have selected index 5 and after sorting the item of index 5 move to 2, And now you want the same item which is now on index 2 , to be selected. Than you need to store the key values of that item in some variable before sorting and after sorting Loop through the table to get the index of that item having same set of KEY VALUES.
Now use that index to set the selectedrowindex value.
This will make that item selected.........
I think it will solve your problem, otherwise do revert back.........
Have a nice time..
Mithlesh
Maybe you are looking for
-
SSO PL/SQL Sample Application Error
Hi, I've tried the PL/SQL SSO demo application located in the PDK October release. Symptom: The sample application shows the success page, even the user is not authenticated by the Login Server. Cause: There's a code line in the SAMPLE_SSO_PAPP packa
-
Iphone switches off when using apps needing a connection
Hi all, my first post, really hope you can help!! My iphone has been giving me trouble for some time now. It started to turn off when i am connected, via wifi or 3g, doesnt matter, it shows the little circle loader, and turns off. Also i have restore
-
Authorization at profit center level
Dear All, In FI Module we have a requirement of Authorization at Profit Center Level. For Example : in FB50 transaction we want to allow some users to enter only for "1001" profit center. We have tried the following : We have create authorization obj
-
Make dual boot Lion and Snow Leopard Mac ???
I have a SSD for my MBP. I formatted it with two partitions and installed snow leopard on each. I also have a 400 GB HDD that has snow leopard on it. I'd like to trade out my optical drive for the SSD. I'd like to update one SSD partition to Lion, th
-
I bought an audiobook and had it go to my laptop. I want to sync it to my iPad and nothing I do works. This is so frustrating as I wanted it on my iPad originally. I have gone in 'books' and selected the 'audiobooks' below and it still won't sync.