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

Problem with SET LOCALE LANGUAGE

Former Member
0 Likes
1,090

Hi Every body,

If i use SET LOACLE LANGUAGE in one of my programs it is going for a DUMP (TEXTENV_INVALID).

Can any body let me know what might be the reason.

Thank you.

Venkat.

Any more inputs from any body.

Thank you.

Venkat.

Message was edited by:

Venkat Chidurala

7 REPLIES 7
Read only

Former Member
0 Likes
834

check below....

Sorting Internal Tables

You can sort a standard or hashed table in a program. To sort a table by its key, use the statement

SORT ASCENDING .

The statement sorts the internal table ASCENDING

BY ASCENDING

...

ASCENDING .

The table is now sorted by the specified components ... STABLE.

allows you to perform a stable sort, that is, the relative sequence of lines that are unchanged by the sort is not changed. If you do not use the STABLE option, the sort sequence is not preserved. If you sort a table several times by the same key, the sequence of the table entries will change in each sort. However, a stable sort takes longer than an unstable sort.

Examples

DATA: BEGIN OF LINE,

LAND(3) TYPE C,

NAME(10) TYPE C,

AGE TYPE I,

WEIGHT TYPE P DECIMALS 2,

END OF LINE.

DATA ITAB LIKE STANDARD TABLE OF LINE WITH NON-UNIQUE KEY LAND.

LINE-LAND = 'G'. LINE-NAME = 'Hans'.

LINE-AGE = 20. LINE-WEIGHT = '80.00'.

APPEND LINE TO ITAB.

LINE-LAND = 'USA'. LINE-NAME = 'Nancy'.

LINE-AGE = 35. LINE-WEIGHT = '45.00'.

APPEND LINE TO ITAB.

LINE-LAND = 'USA'. LINE-NAME = 'Howard'.

LINE-AGE = 40. LINE-WEIGHT = '95.00'.

APPEND LINE TO ITAB.

LINE-LAND = 'GB'. LINE-NAME = 'Jenny'.

LINE-AGE = 18. LINE-WEIGHT = '50.00'.

APPEND LINE TO ITAB.

LINE-LAND = 'F'. LINE-NAME = 'Michele'.

LINE-AGE = 30. LINE-WEIGHT = '60.00'.

APPEND LINE TO ITAB.

LINE-LAND = 'G'. LINE-NAME = 'Karl'.

LINE-AGE = 60. LINE-WEIGHT = '75.00'.

APPEND LINE TO ITAB.

PERFORM LOOP_AT_ITAB.

SORT ITAB.

PERFORM LOOP_AT_ITAB.

SORT ITAB.

PERFORM LOOP_AT_ITAB.

SORT ITAB STABLE.

PERFORM LOOP_AT_ITAB.

SORT ITAB DESCENDING BY LAND WEIGHT ASCENDING.

PERFORM LOOP_AT_ITAB.

FORM LOOP_AT_ITAB.

LOOP AT ITAB INTO LINE.

WRITE: / LINE-LAND, LINE-NAME, LINE-AGE, LINE-WEIGHT.

ENDLOOP.

SKIP.

ENDFORM.

The output is:

G Hans 20 80.00

USA Nancy 35 45.00

USA Howard 40 95.00

GB Jenny 18 50.00

F Michele 30 60.00

G Karl 60 75.00

F Michele 30 60.00

G Hans 20 80.00

G Karl 60 75.00

GB Jenny 18 50.00

USA Howard 40 95.00

USA Nancy 35 45.00

F Michele 30 60.00

G Karl 60 75.00

G Hans 20 80.00

GB Jenny 18 50.00

USA Howard 40 95.00

USA Nancy 35 45.00

F Michele 30 60.00

G Karl 60 75.00

G Hans 20 80.00

GB Jenny 18 50.00

USA Howard 40 95.00

USA Nancy 35 45.00

USA Nancy 35 45.00

USA Howard 40 95.00

GB Jenny 18 50.00

G Karl 60 75.00

G Hans 20 80.00

F Michele 30 60.00

The program sorts a standard table with one key field four times. First, the table is sorted twice by the key field (LAND) without the STABLE addition. The sort is unstable. The sequence of the second and third lines changes. The same sort is then performed using the STABLE addition. The sort is stable. The lines remain in the same sequence. Then, it is sorted by a sort key defined as LAND and WEIGHT. The general sort order is defined as descending, but for WEIGHT it is defined as ascending.

DATA: BEGIN OF LINE,

TEXT(6),

XTEXT(160) TYPE X,

END OF LINE.

DATA ITAB LIKE HASHED TABLE OF LINE WITH UNIQUE KEY TEXT.

LINE-TEXT = 'Muller'.

CONVERT TEXT LINE-TEXT INTO SORTABLE CODE LINE-XTEXT.

INSERT LINE INTO TABLE ITAB.

LINE-TEXT = 'Möller'.

CONVERT TEXT LINE-TEXT INTO SORTABLE CODE LINE-XTEXT.

INSERT LINE INTO TABLE ITAB.

LINE-TEXT = 'Moller'.

CONVERT TEXT LINE-TEXT INTO SORTABLE CODE LINE-XTEXT.

INSERT LINE INTO TABLE ITAB.

LINE-TEXT = 'Miller'.

CONVERT TEXT LINE-TEXT INTO SORTABLE CODE LINE-XTEXT.

INSERT LINE INTO TABLE ITAB.

SORT ITAB.

PERFORM LOOP_AT_ITAB.

SORT ITAB BY XTEXT.

PERFORM LOOP_AT_ITAB.

SORT ITAB AS TEXT.

PERFORM LOOP_AT_ITAB.

FORM LOOP_AT_ITAB.

LOOP AT ITAB INTO LINE.

WRITE / LINE-TEXT.

ENDLOOP.

SKIP.

ENDFORM.

This example demonstrates alphabetical sorting of character fields. The internal table ITAB contains a column with character fields and a column with corresponding binary codes that are alphabetically sortable. The binary codes are created with the CONVERT statement (see Converting to a Sortable Format). The table is sorted three times. First, it is sorted binarily by the TEXT field. Second, it is sorted binarily by the XTEXT field. Third, it is sorted alphabetically by the TEXT field. Since there is no directly corresponding case in English, we have taken the results from a German text environment:

Miller

Moller

Muller

Möller

Miller

Moller

Möller

Muller

Miller

Moller

Möller

Muller

After the first sorting, 'Möller' follows behind 'Muller' since the internal code for the letter 'ö' comes after the code for 'u'. The other two sorts are alphabetical. The binary sort by XTEXT has the same result as the alphabetical sorting by the field TEXT.

Read only

Former Member
0 Likes
834

the language , country u had given should exist in the table TCP0C.

i guess u had given the langue as 2 characters , it should be only 1 character

chk the languages in TCP0C table

Read only

0 Likes
834

Hi,

No, i had given only one character.

SET LOCALE LANGUAGE 'C'.

In addition to this, this statement is working fine for another country(CZECH),

for SLOVAKIA it is dumping.

Thank you,

Venkat.

Read only

0 Likes
834

then for slovakia check if an entry exists in that table

lang, cntry, and mod should exist for slovakia in that table

Message was edited by:

Chandrasekhar Jagarlamudi

Read only

0 Likes
834

I checked for slovakia, there exists an entry.

How ever the MODIFIER does not exist for both CZECH and SLOVAKIA.

Thank you.

Venkat.

Read only

Former Member
0 Likes
834

Hi,

You need use SET LOCALE LANGUAGE SPACE

Regards

Sudheer

Read only

0 Likes
834

Hi,

If i use SET LOCALE LANGUAGE SPACE

How do i get SLOVAKIA text environment.

If we set to SPACE, it will take the login language text environment.

To over come this we are explicitly using this statement.

Thank you,

Venkat.