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

code page problem and unicode problem

Former Member
0 Likes
413

I created the function modules for converting the data into arabic language.It was displaying in BSP application i want to display in webdynpro.in webdynpro it is displaying hexadecimal language .

can you please help me in the same how to conver that hexadecimal language to conver the browser dependent arabic language.

Class CL_GUI_HTML_VIEWER methods GET_RECOMMENDED_CHARSET when u call this

method passing the SPRAS - 'A' thats for arabic language on a Unicode system it will return you the

HTML_CHARSET.

Using this can you please help me below lt_encoded_data displaying in the arabic in the table.this is problem in html browser i mean in code page.

Can any one help me in this.

call function 'Z_BI_GET_ARABIC_NAMES' destination 'DVRCLNT095'

tables

candidate = lt_candidate

encoded_data = lt_encoded_data.

FUNCTION Z_BI_GET_ARABIC_NAMES_TEST.

*"----


""Local Interface:

*" TABLES

*" CANDIDATE STRUCTURE ZCAND_ARAB_INFO OPTIONAL

*" ENCODED_DATA STRUCTURE ZCAND_ARAB_DATA

*"----


data wa_HRP9550 type HRP9550.

data: input_val type char0128.

data: output_val type CHAR512.

data wa_ENCODED_DATA type ZCAND_ARAB_DATA.

TYPES: BEGIN OF ty_cand,

CANDIDATE type hrp9550-objid,

FNAME_AR type hrp9550-fname_ar,

MNAME_AR type hrp9550-MNAME_AR,

LNAME_AR type hrp9550-LNAME_AR,

GFNAME_AR type hrp9550-GFNAME_AR ,

end of ty_cand.

data: int_cand type table of ty_cand,

wa_cand type ty_cand.

TYPES: BEGIN OF ty_summb,

objid type ZER_SUMMB_SEL-objid,

major type ZER_SUMMB_SEL-major,

major_desc type ZER_SUMMB_SEL-major_desc,

gmajor type ZER_SUMMB_SEL-gmajor,

gmajor_desc type ZER_SUMMB_SEL-gmajor_desc,

end of ty_summb.

data: int_summb type table of ty_summb,

wa_summb type ty_summb.

  • data: int_cand_arab_data type TABLE OF ZCAND_ARAB_DATA ,

  • wa_cand_arab_data type ZCAND_ARAB_DATA.

SELECT OBJID

fname_ar

mname_ar

lname_ar

gfname_ar

FROM hrp9550

into TABLE int_cand

for all entries in candidate

WHERE plvar EQ '01'

AND otype EQ 'NA'

AND objid = CANDIDATE-candidate

AND ENDDA GE sy-datum

AND BEGDA LE sy-datum.

if sy-subrc = 0.

sort int_cand by candidate.

delete ADJACENT DUPLICATES FROM int_cand COMPARING candidate.

SELECT OBJID

major

major_desc

gmajor

gmajor_desc

FROM zer_summb_sel

INTO TABLE int_summb

for all entries in int_cand

wHERE objid = int_cand-candidate.

loop at int_cand into wa_cand.

wa_encoded_data-candidate = wa_cand-candidate.

  • first name conversion

input_val = wa_cand-FNAME_AR.

CALL FUNCTION 'Z_BW_ENCODE_TO_HTML_DATA'

EXPORTING

DATA = input_val

L_ENCODING = 'UTF-8'

IMPORTING

OUTPUT = output_val.

wa_encoded_data-FNAME_AR = output_val.

clear: input_val, output_val.

  • mid name conversion

input_val = wa_cand-MNAME_AR.

CALL FUNCTION 'Z_BW_ENCODE_TO_HTML_DATA'

EXPORTING

DATA = input_val

L_ENCODING = 'UTF-8'

IMPORTING

OUTPUT = output_val.

wa_encoded_data-MNAME_AR = output_val.

clear: input_val, output_val.

  • last name conversion

input_val = wa_cand-LNAME_AR.

CALL FUNCTION 'Z_BW_ENCODE_TO_HTML_DATA'

EXPORTING

DATA = input_val

L_ENCODING = 'UTF-8'

IMPORTING

OUTPUT = output_val.

wa_encoded_data-LNAME_AR = output_val.

clear: input_val, output_val.

  • GF name conversion

input_val = wa_cand-GFNAME_AR.

CALL FUNCTION 'Z_BW_ENCODE_TO_HTML_DATA'

EXPORTING

DATA = input_val

L_ENCODING = 'UTF-8'

IMPORTING

OUTPUT = output_val.

wa_encoded_data-GFNAME_AR = output_val.

  • Read and populate Major details

read table int_summb with key objid = wa_cand-candidate

into wa_summb.

if sy-subrc = 0.

  • MAJOR

wa_encoded_data-major = wa_summb-major.

  • MAJOR_DESC

input_val = wa_summb-major_desc.

CALL FUNCTION 'Z_BW_ENCODE_TO_HTML_DATA'

EXPORTING

DATA = input_val

L_ENCODING = 'UTF-8'

IMPORTING

OUTPUT = output_val.

wa_encoded_data-major_desc = output_val.

  • GMAJOR

wa_encoded_data-gmajor = wa_summb-gmajor.

  • GMAJOR_DESC

input_val = wa_summb-gmajor_desc.

CALL FUNCTION 'Z_BW_ENCODE_TO_HTML_DATA'

EXPORTING

DATA = input_val

L_ENCODING = 'UTF-8'

IMPORTING

OUTPUT = output_val.

wa_encoded_data-gmajor_desc = output_val.

endif.

append wa_encoded_data to ENCODED_DATA.

clear: input_val, output_val, ENCODED_DATA, wa_encoded_data.

endloop.

endif.

ENDFUNCTION.

............................................end.......................................................

'Z_BW_ENCODE_TO_HTML_DATA':

FUNCTION Z_BW_ENCODE_TO_HTML_DATA.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(DATA) TYPE CHAR0128

*" REFERENCE(L_ENCODING) TYPE ABAP_ENCOD DEFAULT 'UTF-8'

*" EXPORTING

*" REFERENCE(OUTPUT) TYPE CHAR512

*"----


data: conv type ref to cl_abap_conv_out_ce,

inbuf type string,

outbuf type string,

wf_len type i,

wf_str_len type i,

wf_out type string,

wf_buf type string,

WF_BUF_I TYPE I.

IF NOT DATA IS INITIAL.

clear: wf_len, wf_str_len, wf_out.

wf_str_len = strlen( DATA ).

do.

CALL METHOD CL_ABAP_CONV_OUT_CE=>CREATE

EXPORTING

ENCODING = L_ENCODING

REPLACEMENT = '#'

IGNORE_CERR = ABAP_TRUE

RECEIVING

CONV = CONV.

clear: INBUF, OUTBUF, wf_buf, WF_BUF_I.

INBUF = DATA+wf_len(1).

  • if not INBUF is initial.

CALL METHOD CONV->WRITE

EXPORTING

DATA = INBUF.

CALL METHOD CONV->GET_BUFFER

RECEIVING

BUFFER = WF_BUF.

WF_BUF = OUTBUF.

if INBUF is not initial.

WF_BUF_I = CONV->UCCPI( INBUF ).

wf_buf = WF_BUF_I.

condense wf_buf.

  • endif.

concatenate wf_out '&#' wf_buf ';' into wf_out.

else.

concatenate wf_out ' ' into wf_out.

endif.

  • concatenate wf_out wf_buf into wf_out.

wf_len = wf_len + 1.

if wf_len eq wf_str_len.

exit.

endif.

enddo.

  • OUT-ZZFIRSTNAM_AR = wf_out.

ENDIF.

OUTPUT = wf_out.

ENDFUNCTION.

1 REPLY 1
Read only

alison_lloyd
Active Participant
0 Likes
298

have you tried posting in the ABAP webdypro forum?