09-20-2008 5:58 AM
I create a one vendor field in z table but this vendor field is data sort wrongly pls help me
09-20-2008 6:22 AM
Hi,
If you want to sort the values while inserting into the z-table means, you want to
to create a TMG for the table and you can use the events to sort the values before
inserting into the table.
Utilities -> Table Maintenance Generator
and then Environment -> Modification -> Events.
OR
Bofore inserting and while accessing the values use
SORT itab ASCENDING BY field_name.
SORT itab DESCENDING BY field_name.
09-20-2008 6:01 AM
SORT itab BY lifnr -- > if you want to sort ascending
If you want to sort by dscending
SORT itab DSCENDING BY lifnr.
In case of Z tables it will get stored in the order how and when the tables gets updated.
09-20-2008 6:04 AM
HI,
you have to put your fields in an i_tab then use
sort tablename by ( i_tab ).
Here is an example:
PARAMETERS dbtab TYPE c LENGTH 30.
SELECT-OPTIONS columns FOR dbtab NO INTERVALS.
DATA: otab TYPE abap_sortorder_tab,
oline TYPE abap_sortorder,
dref TYPE REF TO data.
FIELD-SYMBOLS: <column> LIKE LINE OF columns,
<itab> TYPE STANDARD TABLE.
TRY.
CREATE DATA dref TYPE STANDARD TABLE OF (dbtab).
ASSIGN dref->* TO <itab>.
CATCH cx_sy_create_data_error.
MESSAGE 'Wrong data type!' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE PROGRAM.
ENDTRY.
TRY.
SELECT *
FROM (dbtab)
INTO TABLE <itab>.
CATCH cx_sy_dynamic_osql_semantics.
MESSAGE 'Wrong database table!' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE PROGRAM.
ENDTRY.
LOOP AT columns ASSIGNING <column>.
oline-name = <column>-low.
APPEND oline TO otab.
ENDLOOP.
TRY.
SORT <itab> BY (otab).
CATCH cx_sy_dyn_table_ill_comp_val.
MESSAGE 'Wrong column name!' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE PROGRAM.
ENDTRY.
Regards,
Satish
09-20-2008 6:09 AM
Thank u sir,
z table updated Correctly , but vender field showing worng.
pls help me sir.,
Edited by: siva kumar on Sep 20, 2008 7:12 AM
09-20-2008 6:17 AM
hi,
what do u mean by vendor field showing wrong?
if u r updating data correctly in to the ztable then u will not be having any problem with sorting the ztable.
09-20-2008 6:22 AM
Suppose xxxx vendor update in 15 records in z table.
I give the same vendor in selection screen it showing 10 records.
Whatu2019s the problem?
09-20-2008 6:27 AM
hi,
u just look for the other conditions tht u have mentioned in ur program.
if u r retriving data only from tht table using only vendor condition thn u shd get all the records.
check ur code properly or post it here.
09-20-2008 6:22 AM
Hi,
If you want to sort the values while inserting into the z-table means, you want to
to create a TMG for the table and you can use the events to sort the values before
inserting into the table.
Utilities -> Table Maintenance Generator
and then Environment -> Modification -> Events.
OR
Bofore inserting and while accessing the values use
SORT itab ASCENDING BY field_name.
SORT itab DESCENDING BY field_name.
09-20-2008 6:34 AM
Many records update in z table itu2019s not new table, itu2019s already created table I insert a vendor filed.
that vendor filed is problem.