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

Creating a dictionary structure via abap

Former Member
0 Likes
838

Hi all,

i have to copy about 140 structures from a no SAP system to my 4.6c. I've seen there is the a function that can help me (DDIF_TABL_PUT ) but I need a little help because I can't define the original language of what I'm creating with my report... It seems I can only create object in english....

this my sample code, I'm trying to create a structure from a file definition.

REPORT z0017_struct_create .

DATA: my_row(500) TYPE c,

my_file_1 LIKE my_row OCCURS 0 WITH HEADER LINE.

DATA: dd02v TYPE dd02v.

DATA: my_file_tab1 LIKE dd03p OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text

NO INTERVALS.

PARAMETERS:

name TYPE ddobjname,

testo TYPE text40,

file_1 LIKE rlgrap-filename.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN END OF BLOCK blk.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_1.

PERFORM file_selection USING file_1.

INITIALIZATION.

text = text-001.

START-OF-SELECTION.

IF file_1 IS INITIAL.

MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 001.

EXIT.

ENDIF.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

filename = file_1

filetype = 'ASC'

TABLES

data_tab = my_file_1.

IF sy-subrc <> 0.

MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 002.

EXIT.

ENDIF.

LOOP AT my_file_1.

IF sy-tabix > 1.

CLEAR my_file_tab1.

SPLIT my_file_1 AT ';' INTO

my_file_tab1-fieldname

my_file_tab1-datatype

my_file_tab1-leng

my_file_tab1-decimals

my_file_tab1-ddtext

.

my_file_tab1-inttype = 'C'.

my_file_tab1-INTLEN = my_file_tab1-leng.

my_file_tab1-tabname = name.

my_file_tab1-position = sy-tabix - 1.

<b>my_file_tab1-ddlanguage = sy-langu.</b>

my_file_tab1-OUTPUTLEN = my_file_tab1-leng.

APPEND my_file_tab1.

ENDIF.

ENDLOOP.

dd02v-tabname = name.

<b> dd02v-ddlanguage = sy-langu.</b>

dd02v-tabclass = 'INTTAB'.

dd02v-DDTEXT = testo.

<b> dd02v-MASTERLANG = sy-langu.</b>

IF NOT my_file_tab1[] IS INITIAL.

CALL FUNCTION 'DDIF_TABL_PUT'

EXPORTING

name = name

dd02v_wa = dd02v

TABLES

dd03p_tab = my_file_tab1

EXCEPTIONS

tabl_not_found = 1

name_inconsistent = 2

tabl_inconsistent = 3

put_failure = 4

put_refused = 5

OTHERS = 6

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ELSE.

MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 003.

EXIT.

ENDIF.

&----


*& Form file_selection

&----


  • -->P_FILE_1 text

----


FORM file_selection USING p_file.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

def_filename = ''

def_path = 'c:\'

mask = ',.,..'

mode = '0'

title = 'Selezione file'

IMPORTING

filename = p_file

  • RC = RCODE

EXCEPTIONS

inv_winsys = 1

no_batch = 2

selection_cancel = 3

selection_error = 4

OTHERS = 5.

ENDFORM. " file_selection

And here is the file...

Fieldname;Data Type;Lentgh;Dec.;Descr.

FIELD1;CHAR;000020;000000;my field 1

FIELD2;CHAR;000008;000000;my field 2

FIELD3;CHAR;000007;000000;my field 3

FIELD4;CHAR;000006;000000;my field 4

Everything works fine, the only trouble is that the SE11 reports 'EN' as original language, but I'm logged in italian.

All suggestions are welcome ...

Thanks in advance,

Gianluca

Hi all,

i have to copy about 140 structures from a no SAP system to my 4.6c. I've seen there is the a function that can help me (DDIF_TABL_PUT ) but I need a little help because I can't define the original language of what I'm creating with my report... It seems I can only create object in english....

this my sample code, I'm trying to create a structure from a file definition.

REPORT z0017_struct_create .

DATA: my_row(500) TYPE c,

my_file_1 LIKE my_row OCCURS 0 WITH HEADER LINE.

DATA: dd02v TYPE dd02v.

DATA: my_file_tab1 LIKE dd03p OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text

NO INTERVALS.

PARAMETERS:

name TYPE ddobjname,

testo TYPE text40,

file_1 LIKE rlgrap-filename.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN END OF BLOCK blk.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_1.

PERFORM file_selection USING file_1.

INITIALIZATION.

text = text-001.

START-OF-SELECTION.

IF file_1 IS INITIAL.

MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 001.

EXIT.

ENDIF.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

filename = file_1

filetype = 'ASC'

TABLES

data_tab = my_file_1.

IF sy-subrc <> 0.

MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 002.

EXIT.

ENDIF.

LOOP AT my_file_1.

IF sy-tabix > 1.

CLEAR my_file_tab1.

SPLIT my_file_1 AT ';' INTO

my_file_tab1-fieldname

my_file_tab1-datatype

my_file_tab1-leng

my_file_tab1-decimals

my_file_tab1-ddtext

.

my_file_tab1-inttype = 'C'.

my_file_tab1-INTLEN = my_file_tab1-leng.

my_file_tab1-tabname = name.

my_file_tab1-position = sy-tabix - 1.

<b>my_file_tab1-ddlanguage = sy-langu.</b>

my_file_tab1-OUTPUTLEN = my_file_tab1-leng.

APPEND my_file_tab1.

ENDIF.

ENDLOOP.

dd02v-tabname = name.

<b> dd02v-ddlanguage = sy-langu.</b>

dd02v-tabclass = 'INTTAB'.

dd02v-DDTEXT = testo.

<b> dd02v-MASTERLANG = sy-langu.</b>

IF NOT my_file_tab1[] IS INITIAL.

CALL FUNCTION 'DDIF_TABL_PUT'

EXPORTING

name = name

dd02v_wa = dd02v

TABLES

dd03p_tab = my_file_tab1

EXCEPTIONS

tabl_not_found = 1

name_inconsistent = 2

tabl_inconsistent = 3

put_failure = 4

put_refused = 5

OTHERS = 6

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ELSE.

MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 003.

EXIT.

ENDIF.

&----


*& Form file_selection

&----


  • -->P_FILE_1 text

----


FORM file_selection USING p_file.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

def_filename = ''

def_path = 'c:\'

mask = ',.,..'

mode = '0'

title = 'Selezione file'

IMPORTING

filename = p_file

  • RC = RCODE

EXCEPTIONS

inv_winsys = 1

no_batch = 2

selection_cancel = 3

selection_error = 4

OTHERS = 5.

ENDFORM. " file_selection

And here is the file...

Fieldname;Data Type;Lentgh;Dec.;Descr.

FIELD1;CHAR;000020;000000;my field 1

FIELD2;CHAR;000008;000000;my field 2

FIELD3;CHAR;000007;000000;my field 3

FIELD4;CHAR;000006;000000;my field 4

Everything works fine, the only trouble is that the SE11 reports 'EN' as original language, but I'm logged in italian.

All suggestions are welcome ...

Thanks in advance,

Gianluca

2 REPLIES 2
Read only

Former Member
0 Likes
548

Done...

Thanks again,

Gianluca

Read only

0 Likes
548

Hi Gianluca,

I'm trying to create tables with function DDIF_TABL_PUT and I have the same problem you had. In my case the original language is always german althoug i specify english for the original language in the program (and the login language is english when i run the program).

Did you find a solution?

Nico