Sie sind auf Seite 1von 3

*&---------------------------------------------------------------------*

*& Report ZZBER005 *


*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*

REPORT ZZBER005 .
tables :
mara.

TYPE-POOLS: SYDES.

* p.s.

parameters : pa_test as checkbox.

*p.p.

end-of-selection.
break lbermejo.
data : l_string(100) type c,
l_hex(100) type x,
l_sep_hex(1) type x value '00'.

*data :
* begin of lit_table occurs 0,
* word(20) type x, " string,
* end of lit_table.
*
types:
linea_x(40) type x,
linea_c(40) type c.

data :
lit_table type table of linea_x,
wa_lit_table type linea_x,
lit_C type table of linea_c,
wa_lit_C type linea_c.

field-symbols <g>.

l_string = 'ABCDAEFGHIJKL'.

assign SPACE to <g> type 'X'.


break lbermejo.
assign 'A' to <g> type 'X'.

l_sep_hex = <g>.

data : campo(20) type c.

campo = 'l_string'.
assign L_STRING to <g> TYPE 'X'.
l_hex = <g>.

split l_hex at l_sep_hex into table lit_table


in byte mode.
break lbermejo.

* copiar a tabla interna en formato ASCII.


refresh lit_C.

* caracter 00 + caracter blanco en hexadecimal


data : l_00_hex(2) type x value '00'.
data : l_20_hex(2) type x value '20'.
data : l_0020_hex(2) type x value '0020'.

break lbermejo.
loop at lit_table into wa_lit_table.

replace all occurrences of l_00_hex


in wa_lit_table
with l_20_hex
in byte mode.

replace all occurrences of l_00_hex


in wa_lit_table
with l_20_hex
in byte mode.

assign wa_lit_table to <g> type 'C'.


wa_lit_c = <g>.

append wa_lit_C to lit_c.

endloop.

exit.

data : struct like mara,


N_COMPONENTE TYPE I.

field-symbols <f>.
data :
TD TYPE SYDES_DESC,
wa_td type sydes_desc,
TYP(1) TYPE C.

SELECT SINGLE * INTO STRUCT FROM MARA.

BREAK LBERMEJO.
DATA DESTINO(2048) TYPE C.

CLEAR DESTINO." (2048) TYPE C.


DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE struct TO <F>.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.

describe field <f> type typ components N_COMPONENTE.

IF TYP = 'C'.
IF SY-INDEX = 1.
DESTINO = <F>.
ELSE.
CONCATENATE DESTINO <F> INTO DESTINO SEPARATED BY '#'.
ENDIF.

ENDIF.

enddo.

* WRITE :/ STRUCT.

WRITE :/ DESTINO.

Das könnte Ihnen auch gefallen