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

TRANSLTE command

Former Member
0 Likes
1,131

Dear All,

In the following, i'm trying to change and update the value of the field by replacing with some string or atleast from upper to Lower Case, but none of them are working. I'm in the 4.7 version. Pl. give me your inputs.

DATA: ITAB LIKE MARC OCCURS 0 WITH HEADER LINE.

SELECT * INTO CORRESPONDING FIELDS OF TABLE ITAB

UP TO 2 ROWS FROM MARC.

*TRANSLATE ITAB-PSTAT FROM CODE PAGE O_VAL TO CODE PAGE C_VAL.

*TRANSLATE ITAB-PSTAT USING C_VAL.

TRANSLATE ITAB-PSTAT TO LOWER CASE.

APPEND ITAB.

UPDATE MARC FROM TABLE ITAB.

LOOP AT ITAB.

WRITE:/ ITAB-PSTAT.

ENDLOOP.

with regards

Mahesh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,031

first check the MARC-PSTAT Field in SE11,check the domain,if domain level,there is check box called Lower case,if it is checked then lower case command should work,otherwise lower case will not work.

Simple example ,goto MAKT table,just see MAKTX Domain ,here they checked the check box called lower case.here you will be able to save as lower case.

I think your case is ruled out unless if you chage domain of PSTAT.

Thanks

Seshu

7 REPLIES 7
Read only

Former Member
0 Likes
1,032

first check the MARC-PSTAT Field in SE11,check the domain,if domain level,there is check box called Lower case,if it is checked then lower case command should work,otherwise lower case will not work.

Simple example ,goto MAKT table,just see MAKTX Domain ,here they checked the check box called lower case.here you will be able to save as lower case.

I think your case is ruled out unless if you chage domain of PSTAT.

Thanks

Seshu

Read only

Former Member
0 Likes
1,031

Hi,

for eg: if a variable having value like '123,232,223.00'

if you use

translate varibel using ', '. here ', ' a space is also there

then it will become '123 232 223.00'

it will remove the , and replace it with a space.

DATA: ITAB LIKE MARC OCCURS 0 WITH HEADER LINE.

SELECT * INTO CORRESPONDING FIELDS OF TABLE ITAB

UP TO 2 ROWS FROM MARC.

if sy-subrc eq 0.

loop at itab.

TRANSLATE ITAB-PSTAT TO LOWER CASE.

modify itab transporting pstat.

endloop.

UPDATE MARC FROM TABLE ITAB.

endif.

regards,

Venkatesh

Read only

Former Member
0 Likes
1,031

HI,

u r doing a mistake here

here itab is internal table with header line.

u are trying to modify a field in header line but header is not filled.

try this.

DATA: ITAB LIKE MARC OCCURS 0 WITH HEADER LINE.

SELECT * INTO CORRESPONDING FIELDS OF TABLE ITAB

UP TO 2 ROWS FROM MARC.

*TRANSLATE ITAB-PSTAT FROM CODE PAGE O_VAL TO CODE PAGE C_VAL.

*TRANSLATE ITAB-PSTAT USING C_VAL.

<b>loop at itab.</b>

TRANSLATE ITAB-PSTAT TO LOWER CASE.

<b>modify ITAB translating pstat.</b>

<b>endloop.</b>

UPDATE MARC FROM TABLE ITAB.

LOOP AT ITAB.

WRITE:/ ITAB-PSTAT.

ENDLOOP.

<b>reward if helpful</b>

rgds,

bharat.

Read only

Former Member
0 Likes
1,031

try this:

REPORT ZRV_SDN8 .

DATA: ITAB LIKE MARC OCCURS 0 WITH HEADER LINE.

SELECT * INTO CORRESPONDING FIELDS OF ITAB

UP TO 2 ROWS FROM MARC.

*TRANSLATE ITAB-PSTAT FROM CODE PAGE O_VAL TO CODE PAGE C_VAL.

*TRANSLATE ITAB-PSTAT USING C_VAL.

TRANSLATE ITAB-PSTAT TO LOWER CASE.

APPEND ITAB.

*

*UPDATE MARC FROM TABLE ITAB.

<b>endselect.</b>

LOOP AT ITAB.

WRITE:/ ITAB-PSTAT.

ENDLOOP.

<b>Please reward the helpful entries.</b>

Regards,

Raman.

Read only

varma_narayana
Active Contributor
0 Likes
1,031

Hi Mahesh..

This is the code. DONT USE append RATHER USE modify ...

DATA: ITAB LIKE MARC OCCURS 0 WITH HEADER LINE.

SELECT * INTO CORRESPONDING FIELDS OF TABLE ITAB

UP TO 2 ROWS FROM MARC.

*TRANSLATE ITAB-PSTAT FROM CODE PAGE O_VAL TO CODE PAGE C_VAL.

*TRANSLATE ITAB-PSTAT USING C_VAL.

LOOP AT ITAB.

TRANSLATE ITAB-PSTAT TO LOWER CASE.

MODIFY ITAB transporting PSTAT.

ENDLOOP.

UPDATE MARC FROM TABLE ITAB.

LOOP AT ITAB.

WRITE:/ ITAB-PSTAT.

ENDLOOP.

<b>REWARD IF HELPFUL</b>

Read only

Former Member
0 Likes
1,031

Hey,

All of your answers are helpful to me, i can award the points.

I have requirement like this.

Actually i'm trying to replace the values with some string

DATA: O_VAL(52) VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.

DATA: C_VAL(52) VALUE 'PJZIYMTAUKRBGWCXVDLFHOENSQ'.

but the following logic is not working. saying that, in the Unicode context , code page will not work.. can you guys suggest any other alternative.

TRANSLATE ITAB-PSTAT FROM CODE PAGE O_VAL TO CODE PAGE C_VAL.

thank you

Mahesh

Read only

0 Likes
1,031

Okay then see the below weblog :

/people/thomas.mann2/blog/2006/08/22/sap-upgrade-conflicts-1

<b>As new SAP systems are made Unicode enabled, there was an issue with translations done using ABAP code. Issue was with any Programs that uses TRANSLATE <string> TO UPPERCASE statement in a multi lingual environment. You might get a warning as dangerous use of TRANSLATE in Multi lingual environment. For this either we can use SET LOCALE LANGUAGE language, before the statement or use the Function Module AIPC_CONVERT_TO_UPPERCASE with the language parameter.</b>

Thanks

Seshu