Application Development 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: 

Alternate of 'Translate Codepage' in ECC 6.0

Former Member
0 Kudos

Hi Guys,

I am having problem with the syntax of the below statement

TRANSLATE itab TO CODE PAGE P_PCODE

*----


where

P_PCODE containscodepage value for UNIX file system I guess.

and ITAB is

DATA: BEGIN OF ITAB OCCURS 0,

RECTYP(1) TYPE C,

DATA(1000) TYPE C,

END OF ITAB.

*----


I found that it is obsolete in ECC 6.0 and I am supposed to use the class CL_ABAP_CONV_OUT_CE and the method CONVERT_STRUC

But when I import the signature of this method to pass the parameter I can not make out which parameter to pass.Can you suggest on this. Reward points guaranteed.

CALL METHOD me->CONVERT_STRUC

EXPORTING

DATA =

VIEW =

  • IMPORTING

  • BUFFER =

  • TRUNCATION_FLAG =

This is signature of this method ( I am avoiding the try n catch part)

If you have any alternate solution please suggests.

1 REPLY 1

Former Member
0 Kudos

Hello Anid,

Did you read the documentation of the class cl_abap_conv_out_ce?

The usage of the method to convert codepages of structures is described including this code sample:

DATA:
  BEGIN OF struc,
    text(5) TYPE c,
    int TYPE i,
  END OF struc.

DATA:
  buffer TYPE xstring,
  conv TYPE REF TO cl_abap_conv_out_ce,
  view TYPE REF TO cl_abap_view_offlen.

view = cl_abap_view_offlen=>create_legacy_view( struc ).

conv = cl_abap_conv_out_ce=>create(
                            encoding = '0120'
                            endian = 'B' ).

struc-text = 'Abc12'.
struc-int  = 65538.
conv->convert_struc( EXPORTING data = struc
                               view = view
                     IMPORTING buffer = buffer ).

I think this should be adaptable to your question.

best regards,

Sven