Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamic Internal Table

Former Member
0 Likes
539

Hi,

I am trying to sort the entries populated to dynamic internal table and collect the same.

Is there any way to achieve the same.

Thanks in advance.

Regards,

Navas

5 REPLIES 5
Read only

Kanagaraja_L
Active Contributor
0 Likes
502

DATA L_FILED TYPE CHAR25.

L_FIELD = 'MATNR'

SORT <FS_TABLE> BY (L_FIELD).

Kanagaraja L

Read only

0 Likes
502

Hi,

I am trying to sort an amount field of type curr which is not possible by normal sort as

l_field1 = 'DMBTR'.

SORT <dyn_table> BY (l_field1).

Please suggest a way to achieve the way.

Regards,

M.Navas

Read only

0 Likes
502

Use the follwoing coding and check in the debug mode it will sort

DATA l_field TYPE char25.
DATA:g_data           TYPE REF TO data.

FIELD-SYMBOLS <fs_table> TYPE STANDARD TABLE.
l_field = 'DMBTR'.
CREATE DATA g_data TYPE TABLE OF bsad.
ASSIGN g_data->*  TO <fs_table>.
SELECT * FROM bsad INTO CORRESPONDING FIELDS OF TABLE <fs_table>.
SORT <fs_table> BY (l_field).

Kanagaraja L

Read only

Former Member
0 Likes
502

Hi,

Please look at the functionality existing in the standard program given by SAP.

Prog Name - BCALV_TABLE_CREATE

Read only

Former Member
0 Likes
502

hi,

Try this


DATA: it_tab TYPE abap_sortorder_tab.
FIELD-SYMBOLS:<itab> TYPE STANDARD TABLE.

*get data into your table then

SORT <itab> BY (it_tab).

However if column names don't match it will throw an error

Hope This helps you.