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: 

Problem when creating dynamic Z-Transparent table during runtime.

Former Member
0 Kudos

Hi All,

The below code seems not working when i try to create a Z-transparent table using DDIF_TABL_PUT, with the table structure of SPFLI using DDIF_TABL_GET.

Any mistake there? Please correct me..

DATA: t_dd03p LIKE dd03p OCCURS 0 WITH HEADER LINE,

wa_dd02v LIKE dd02v,

wa_dd09l LIKE dd09l.

START-OF-SELECTION.

CALL FUNCTION 'DDIF_TABL_GET'

EXPORTING

name = 'SPFLI'

state = 'A'

IMPORTING

dd02v_wa = wa_dd02v

dd09l_wa = wa_dd09l

TABLES

dd03p_tab = t_dd03p

EXCEPTIONS

illegal_input = 1. " Value not Allowed for Parameter

CALL FUNCTION 'DDIF_TABL_PUT'

EXPORTING

name = 'ZNEWTABLE'

dd02v_wa = wa_dd02v

dd09l_wa = wa_dd09l

TABLES

dd03p_tab = t_dd03p

EXCEPTIONS

tabl_not_found = 1 " Table Header could not be Found

name_inconsistent = 2 " Name in Sources Inconsistent with NAME

tabl_inconsistent = 3 " Inconsistent Sources

put_failure = 4 " Write Error (ROLLBACK Recommended)

put_refused = 5. " Write not Allowed

CALL FUNCTION 'DDIF_TABL_ACTIVATE'

EXPORTING

name = 'ZNEWTABLE' " ddobjname Name of the Table to be Activated

auth_chk = 'X' " ddbool_d 'X': Perform Author. Check for DB Operations

EXCEPTIONS

not_found = 1 " Table not Found

put_failure = 2. " Table could not be Written

Thank you..

1 ACCEPTED SOLUTION

0 Kudos

Please use the below code. i have emtnioned for creating one internal table.

DATA : i_tab TYPE TABLE OF dfies,

wa_tab TYPE dfies,

i_fc TYPE lvc_t_fcat,

w_table TYPE dfies-tabname,

wa_fc TYPE lvc_s_fcat,

w_dy_table TYPE REF TO data.

FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.

REFRESH : i_fc, i_tab.

CLEAR: wa_tab, w_dy_table.

w_table = Source table name from selection screen.

**get the structure details and fill the field catalogue.

CALL FUNCTION 'DDIF_FIELDINFO_GET'

EXPORTING

tabname = w_table

langu = sy-langu

TABLES

dfies_tab = i_tab

EXCEPTIONS

not_found = 1

internal_error = 2

OTHERS = 3.

LOOP AT i_tab into wa_tab.

CLEAR : wa_fc.

wa_fc-fieldname = wa_tab-fieldname.

wa_fc-datatype = wa_tab-inttype.

wa_fc-inttype = wa_tab-inttype.

wa_fc-intlen = wa_tab-outputlen.

wa_fc-decimals = wa_tab-decimals.

wa_fc-ref_table = w_table.

wa_fc-ref_field = wa_tab-fieldname.

APPEND wa_fc TO i_fc.

ENDLOOP.

CHECK i_fc[] IS NOT INITIAL.

**if field catalogue is filled, then pass it to method to create the internal table, **which then assign it to field symbol and utilize as required.

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = i_fc

IMPORTING

ep_table = w_dy_table.

TRY.

UNASSIGN: <fs_table>.

ASSIGN w_dy_table->* TO <fs_table>.

IF sy-subrc NE 0.

MESSAGE u2018Error while creating dynamic tableu2019.

ENDIF.

3 REPLIES 3

Former Member
0 Kudos

Hi,

Have you debugged and checked value of sy-subrc after every FM?

DO you get any error message?

0 Kudos

Please use the below code. i have emtnioned for creating one internal table.

DATA : i_tab TYPE TABLE OF dfies,

wa_tab TYPE dfies,

i_fc TYPE lvc_t_fcat,

w_table TYPE dfies-tabname,

wa_fc TYPE lvc_s_fcat,

w_dy_table TYPE REF TO data.

FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.

REFRESH : i_fc, i_tab.

CLEAR: wa_tab, w_dy_table.

w_table = Source table name from selection screen.

**get the structure details and fill the field catalogue.

CALL FUNCTION 'DDIF_FIELDINFO_GET'

EXPORTING

tabname = w_table

langu = sy-langu

TABLES

dfies_tab = i_tab

EXCEPTIONS

not_found = 1

internal_error = 2

OTHERS = 3.

LOOP AT i_tab into wa_tab.

CLEAR : wa_fc.

wa_fc-fieldname = wa_tab-fieldname.

wa_fc-datatype = wa_tab-inttype.

wa_fc-inttype = wa_tab-inttype.

wa_fc-intlen = wa_tab-outputlen.

wa_fc-decimals = wa_tab-decimals.

wa_fc-ref_table = w_table.

wa_fc-ref_field = wa_tab-fieldname.

APPEND wa_fc TO i_fc.

ENDLOOP.

CHECK i_fc[] IS NOT INITIAL.

**if field catalogue is filled, then pass it to method to create the internal table, **which then assign it to field symbol and utilize as required.

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = i_fc

IMPORTING

ep_table = w_dy_table.

TRY.

UNASSIGN: <fs_table>.

ASSIGN w_dy_table->* TO <fs_table>.

IF sy-subrc NE 0.

MESSAGE u2018Error while creating dynamic tableu2019.

ENDIF.

0 Kudos

Hi Ramesh,

Thanks for the info..

I have solve my issue.