*& DESCRIPTION :This program will display the meaning of a term in different
*& languages in which it is maintained in custtable The program
*& will create Dynamic Internal table based on user Input on Selection screen.
*&---------------------------------------------------------------------*
REPORT yj_test_dynamic_int_tab1.
TYPES : BEGIN OF ty_static_st,
termid TYPE yplm_termid,
term TYPE yplm_term,
spras TYPE spras,
fterm TYPE yplm_fterm,
sterm TYPE yplm_sterm,
meaning TYPE yplm_vocab_meaning,
fused TYPE yplm_term_fstused,
status TYPE mstae.
TYPES : END OF ty_static_st.
TYPES : BEGIN OF ty_f4_st,
termid TYPE yplm_termid,
term TYPE yplm_term,
END OF ty_f4_st.
DATA : gt_static TYPE TABLE OF ty_static_st,
gt_static_tt TYPE TABLE OF ty_static_st,
gt_f4_help TYPE TABLE OF ty_f4_st.
DATA gv_termid TYPE yplm_termid.
DATA gv_pos TYPE i.
* Dynamic Table Declarations
DATA : gt_dyn_table TYPE REF TO data,
gs_line TYPE REF TO data,
gs_line1 TYPE REF TO data,
gs_dyn_fcat TYPE lvc_s_fcat,
gt_dyn_fcat TYPE lvc_t_fcat.
* Field Symbols Declarations
FIELD-SYMBOLS: <gs_line>, <gs_line1>,
<gs_dyn_table> TYPE STANDARD TABLE,
<gs>.
*----------------------------------------------------------------------------
SELECTION-SCREEN : BEGIN OF BLOCK b01 WITH FRAME TITLE text-001.
SELECT-OPTIONS s_termid FOR gv_termid.
SELECTION-SCREEN :END OF BLOCK b01.
*----------------------------------------------------------------------------
AT SELECTION-SCREEN.
IF s_termid IS INITIAL.
MESSAGE text-002 TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_termid-low.
SELECT termid term FROM yplm_vocab_trans
INTO TABLE gt_f4_help.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'TERMID'
dynpprog = 'YJ_TEST_DYNAMIC_INT_TAB1'
dynpnr = '1000'
dynprofield = 'S_TERMID-LOW'
value_org = 'S'
TABLES
value_tab = gt_f4_help.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_termid-high.
REFRESH gt_f4_help.
SELECT termid term FROM yplm_vocab_trans
INTO TABLE gt_f4_help.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'TERMID'
dynpprog = 'YJ_TEST_DYNAMIC_INT_TAB1'
dynpnr = '1000'
dynprofield = 'S_TERMID-HIGH'
value_org = 'S'
TABLES
value_tab = gt_f4_help.
START-OF-SELECTION.
*Populating the static input table.
SELECT termid term spras fterm sterm meaning fused status
INTO TABLE gt_static
FROM yplm_vocab_trans
WHERE termid IN s_termid.
*Creating a dynamic structure and dynamic table
PERFORM create_structure USING gt_static.
*Populating Dynamic Internal table
PERFORM populate_dyn_table USING gt_static.
END-OF-SELECTION.
*Display Dynamic ALV O/P
PERFORM display_alv USING gt_static.
*&---------------------------------------------------------------------*
*& Form create_structure
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->Pt_static text
*----------------------------------------------------------------------*
FORM create_structure USING pt_static LIKE gt_static_tt.
DATA: lv_fieldname(10),
lv_coltext(10),
lv_outputlen TYPE i,
lv_key TYPE c.
DATA ls_static TYPE ty_static_st.
lv_fieldname = 'TERMID' . lv_outputlen = 12. lv_coltext = 'TERMID'. lv_key = abap_true. " Creating termid column
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key.
lv_fieldname = 'TERM' . lv_outputlen = 12. lv_coltext = 'TERM'. lv_key = abap_true. " Creating column term
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key.
* Loop through the internal table creating a column for every distinct language in the internal table
LOOP AT pt_static INTO ls_static .
DATA :lv_fieldname1(10) TYPE c,
fname1 TYPE string,
fname TYPE string.
READ TABLE gt_dyn_fcat INTO gs_dyn_fcat WITH KEY fieldname = ls_static-spras.
IF sy-subrc NE 0.
SELECT SINGLE sptxt FROM t002t INTO fname1 WHERE spras = 'E'
AND sprsl = ls_static-spras.
gv_pos = gv_pos + 1.
CONCATENATE fname1 'FullDesc' INTO fname SEPARATED BY space.
lv_fieldname = ls_static-spras . lv_outputlen = 10. lv_coltext = fname. lv_key = space.
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key .
CONCATENATE ls_static-spras 'S' INTO lv_fieldname1.
* Adding Small desc Column for every language
gv_pos = gv_pos + 1.
CONCATENATE fname1 'SmallDesc' INTO fname SEPARATED BY space.
lv_fieldname = lv_fieldname1 . lv_outputlen = 10. lv_coltext = fname. lv_key = space.
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key.
ENDIF.
CLEAR gs_dyn_fcat.
ENDLOOP.
lv_fieldname = 'MEANING' . lv_outputlen = 14. lv_coltext = 'Term Meaning'. lv_key = space. " Create column Meaning
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key.
lv_fieldname = 'FUSED' . lv_outputlen = 14. lv_coltext = 'Term First Used'. lv_key = space. " Create column Fused
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key.
lv_fieldname = 'STATUS' . lv_outputlen = 14. lv_coltext = 'Status'. lv_key = space. " Create column status
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key.
** Create a dynamic internal table with this structure.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
i_style_table = 'X'
it_fieldcatalog = gt_dyn_fcat
IMPORTING
ep_table = gt_dyn_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc EQ 0.
* Assign the new table to field symbol
ASSIGN gt_dyn_table->* TO <gs_dyn_table>.
* Create dynamic work area for the dynamic table
CREATE DATA gs_line LIKE LINE OF <gs_dyn_table>.
CREATE DATA gs_line1 LIKE LINE OF <gs_dyn_table>.
ASSIGN gs_line->* TO <gs_line>.
ASSIGN gs_line1->* TO <gs_line1>.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form POPULATE_DYN_TABLE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->pt_static text
*----------------------------------------------------------------------*
FORM populate_dyn_table USING pt_static LIKE gt_static_tt.
DATA :ls_static TYPE ty_static_st,
ls_static1 TYPE ty_static_st,
ls_line TYPE REF TO data,
ls_line1 TYPE REF TO data.
* Populate the dynamic table
LOOP AT pt_static INTO ls_static.
* Avoid duplicate entries for key field TERM.
READ TABLE <gs_dyn_table> INTO <gs_line1> WITH KEY ('TERM') = ls_static-term.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
* Assing values to the components other than Full Desc and Short Desc
ASSIGN COMPONENT 'TERM' OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static-term.
ASSIGN COMPONENT 'TERMID' OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static-termid.
ASSIGN COMPONENT 'MEANING' OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static-meaning.
ASSIGN COMPONENT 'FUSED' OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static-fused.
ASSIGN COMPONENT 'STATUS' OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static-status.
UNASSIGN <gs>.
* Loop on fcat to assign values to fterm and sterm
LOOP AT gt_dyn_fcat INTO gs_dyn_fcat.
DATA lv_fieldname1(10) TYPE c.
IF gs_dyn_fcat-fieldname = 'TERM'.
CONTINUE.
ENDIF.
READ TABLE pt_static INTO ls_static1 WITH KEY term = ls_static-term
spras = gs_dyn_fcat-fieldname .
IF sy-subrc = 0.
ASSIGN COMPONENT gs_dyn_fcat-fieldname OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static1-fterm.
* UNASSIGN <gs>.
CONCATENATE gs_dyn_fcat-fieldname 'S' INTO lv_fieldname1.
ASSIGN COMPONENT lv_fieldname1 OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static1-sterm.
ENDIF.
UNASSIGN <gs>.
CLEAR : ls_static1.
ENDLOOP.
* Appending the value to the dynamic Internal table
APPEND <gs_line> TO <gs_dyn_table>.
CLEAR: <gs_line>.
CLEAR: ls_static, ls_static1.
ENDLOOP.
ENDFORM. " POPULATE_DYN_TABLE
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->pt_static text
*----------------------------------------------------------------------*
FORM display_alv USING pt_static.
DATA : ls_alv_fieldcat TYPE slis_fieldcat_alv,
lt_alv_fieldcat TYPE slis_t_fieldcat_alv.
DATA lv_pos TYPE i.
LOOP AT gt_dyn_fcat INTO gs_dyn_fcat.
lv_pos = lv_pos + 1.
ls_alv_fieldcat-fieldname = gs_dyn_fcat-fieldname.
ls_alv_fieldcat-tabname = gs_dyn_fcat-tabname.
ls_alv_fieldcat-seltext_l = gs_dyn_fcat-coltext.
ls_alv_fieldcat-outputlen = gs_dyn_fcat-outputlen.
ls_alv_fieldcat-col_pos = lv_pos.
ls_alv_fieldcat-do_sum = gs_dyn_fcat-do_sum.
ls_alv_fieldcat-emphasize = gs_dyn_fcat-emphasize.
ls_alv_fieldcat-key = gs_dyn_fcat-key.
ls_alv_fieldcat-no_out = gs_dyn_fcat-no_out.
APPEND ls_alv_fieldcat TO lt_alv_fieldcat.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = lt_alv_fieldcat
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = <gs_dyn_table>.
ENDFORM. " DISPLAY_ALV
*&---------------------------------------------------------------------*
*& Form CREATE_COLUMN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PV_FIELDNAME text
* -->PV_OUTPUTLEN text
* -->PV_COLTEXT text
*----------------------------------------------------------------------*
FORM create_column USING pv_fieldname TYPE c
pv_outputlen TYPE i
pv_coltext TYPE c
pv_key TYPE c.
** This would create structure Text Lang Full-desc Short-desc etc ....
gv_pos = gv_pos + 1.
gs_dyn_fcat-fieldname = pv_fieldname. "Term id column
gs_dyn_fcat-outputlen = pv_outputlen.
gs_dyn_fcat-tabname = 'IT_DYNAMIC'.
gs_dyn_fcat-coltext = pv_coltext.
gs_dyn_fcat-col_pos = gv_pos.
gs_dyn_fcat-key = pv_key.
gs_dyn_fcat-key_sel = pv_key.
APPEND gs_dyn_fcat TO gt_dyn_fcat.
CLEAR gs_dyn_fcat.
ENDFORM. " CREATE_COLUMN
*& languages in which it is maintained in custtable The program
*& will create Dynamic Internal table based on user Input on Selection screen.
*&---------------------------------------------------------------------*
REPORT yj_test_dynamic_int_tab1.
TYPES : BEGIN OF ty_static_st,
termid TYPE yplm_termid,
term TYPE yplm_term,
spras TYPE spras,
fterm TYPE yplm_fterm,
sterm TYPE yplm_sterm,
meaning TYPE yplm_vocab_meaning,
fused TYPE yplm_term_fstused,
status TYPE mstae.
TYPES : END OF ty_static_st.
TYPES : BEGIN OF ty_f4_st,
termid TYPE yplm_termid,
term TYPE yplm_term,
END OF ty_f4_st.
DATA : gt_static TYPE TABLE OF ty_static_st,
gt_static_tt TYPE TABLE OF ty_static_st,
gt_f4_help TYPE TABLE OF ty_f4_st.
DATA gv_termid TYPE yplm_termid.
DATA gv_pos TYPE i.
* Dynamic Table Declarations
DATA : gt_dyn_table TYPE REF TO data,
gs_line TYPE REF TO data,
gs_line1 TYPE REF TO data,
gs_dyn_fcat TYPE lvc_s_fcat,
gt_dyn_fcat TYPE lvc_t_fcat.
* Field Symbols Declarations
FIELD-SYMBOLS: <gs_line>, <gs_line1>,
<gs_dyn_table> TYPE STANDARD TABLE,
<gs>.
*----------------------------------------------------------------------------
SELECTION-SCREEN : BEGIN OF BLOCK b01 WITH FRAME TITLE text-001.
SELECT-OPTIONS s_termid FOR gv_termid.
SELECTION-SCREEN :END OF BLOCK b01.
*----------------------------------------------------------------------------
AT SELECTION-SCREEN.
IF s_termid IS INITIAL.
MESSAGE text-002 TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_termid-low.
SELECT termid term FROM yplm_vocab_trans
INTO TABLE gt_f4_help.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'TERMID'
dynpprog = 'YJ_TEST_DYNAMIC_INT_TAB1'
dynpnr = '1000'
dynprofield = 'S_TERMID-LOW'
value_org = 'S'
TABLES
value_tab = gt_f4_help.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_termid-high.
REFRESH gt_f4_help.
SELECT termid term FROM yplm_vocab_trans
INTO TABLE gt_f4_help.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'TERMID'
dynpprog = 'YJ_TEST_DYNAMIC_INT_TAB1'
dynpnr = '1000'
dynprofield = 'S_TERMID-HIGH'
value_org = 'S'
TABLES
value_tab = gt_f4_help.
START-OF-SELECTION.
*Populating the static input table.
SELECT termid term spras fterm sterm meaning fused status
INTO TABLE gt_static
FROM yplm_vocab_trans
WHERE termid IN s_termid.
*Creating a dynamic structure and dynamic table
PERFORM create_structure USING gt_static.
*Populating Dynamic Internal table
PERFORM populate_dyn_table USING gt_static.
END-OF-SELECTION.
*Display Dynamic ALV O/P
PERFORM display_alv USING gt_static.
*&---------------------------------------------------------------------*
*& Form create_structure
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->Pt_static text
*----------------------------------------------------------------------*
FORM create_structure USING pt_static LIKE gt_static_tt.
DATA: lv_fieldname(10),
lv_coltext(10),
lv_outputlen TYPE i,
lv_key TYPE c.
DATA ls_static TYPE ty_static_st.
lv_fieldname = 'TERMID' . lv_outputlen = 12. lv_coltext = 'TERMID'. lv_key = abap_true. " Creating termid column
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key.
lv_fieldname = 'TERM' . lv_outputlen = 12. lv_coltext = 'TERM'. lv_key = abap_true. " Creating column term
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key.
* Loop through the internal table creating a column for every distinct language in the internal table
LOOP AT pt_static INTO ls_static .
DATA :lv_fieldname1(10) TYPE c,
fname1 TYPE string,
fname TYPE string.
READ TABLE gt_dyn_fcat INTO gs_dyn_fcat WITH KEY fieldname = ls_static-spras.
IF sy-subrc NE 0.
SELECT SINGLE sptxt FROM t002t INTO fname1 WHERE spras = 'E'
AND sprsl = ls_static-spras.
gv_pos = gv_pos + 1.
CONCATENATE fname1 'FullDesc' INTO fname SEPARATED BY space.
lv_fieldname = ls_static-spras . lv_outputlen = 10. lv_coltext = fname. lv_key = space.
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key .
CONCATENATE ls_static-spras 'S' INTO lv_fieldname1.
* Adding Small desc Column for every language
gv_pos = gv_pos + 1.
CONCATENATE fname1 'SmallDesc' INTO fname SEPARATED BY space.
lv_fieldname = lv_fieldname1 . lv_outputlen = 10. lv_coltext = fname. lv_key = space.
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key.
ENDIF.
CLEAR gs_dyn_fcat.
ENDLOOP.
lv_fieldname = 'MEANING' . lv_outputlen = 14. lv_coltext = 'Term Meaning'. lv_key = space. " Create column Meaning
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key.
lv_fieldname = 'FUSED' . lv_outputlen = 14. lv_coltext = 'Term First Used'. lv_key = space. " Create column Fused
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key.
lv_fieldname = 'STATUS' . lv_outputlen = 14. lv_coltext = 'Status'. lv_key = space. " Create column status
PERFORM create_column USING lv_fieldname
lv_outputlen
lv_coltext
lv_key.
** Create a dynamic internal table with this structure.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
i_style_table = 'X'
it_fieldcatalog = gt_dyn_fcat
IMPORTING
ep_table = gt_dyn_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc EQ 0.
* Assign the new table to field symbol
ASSIGN gt_dyn_table->* TO <gs_dyn_table>.
* Create dynamic work area for the dynamic table
CREATE DATA gs_line LIKE LINE OF <gs_dyn_table>.
CREATE DATA gs_line1 LIKE LINE OF <gs_dyn_table>.
ASSIGN gs_line->* TO <gs_line>.
ASSIGN gs_line1->* TO <gs_line1>.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form POPULATE_DYN_TABLE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->pt_static text
*----------------------------------------------------------------------*
FORM populate_dyn_table USING pt_static LIKE gt_static_tt.
DATA :ls_static TYPE ty_static_st,
ls_static1 TYPE ty_static_st,
ls_line TYPE REF TO data,
ls_line1 TYPE REF TO data.
* Populate the dynamic table
LOOP AT pt_static INTO ls_static.
* Avoid duplicate entries for key field TERM.
READ TABLE <gs_dyn_table> INTO <gs_line1> WITH KEY ('TERM') = ls_static-term.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
* Assing values to the components other than Full Desc and Short Desc
ASSIGN COMPONENT 'TERM' OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static-term.
ASSIGN COMPONENT 'TERMID' OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static-termid.
ASSIGN COMPONENT 'MEANING' OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static-meaning.
ASSIGN COMPONENT 'FUSED' OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static-fused.
ASSIGN COMPONENT 'STATUS' OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static-status.
UNASSIGN <gs>.
* Loop on fcat to assign values to fterm and sterm
LOOP AT gt_dyn_fcat INTO gs_dyn_fcat.
DATA lv_fieldname1(10) TYPE c.
IF gs_dyn_fcat-fieldname = 'TERM'.
CONTINUE.
ENDIF.
READ TABLE pt_static INTO ls_static1 WITH KEY term = ls_static-term
spras = gs_dyn_fcat-fieldname .
IF sy-subrc = 0.
ASSIGN COMPONENT gs_dyn_fcat-fieldname OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static1-fterm.
* UNASSIGN <gs>.
CONCATENATE gs_dyn_fcat-fieldname 'S' INTO lv_fieldname1.
ASSIGN COMPONENT lv_fieldname1 OF STRUCTURE <gs_line> TO <gs>.
<gs> = ls_static1-sterm.
ENDIF.
UNASSIGN <gs>.
CLEAR : ls_static1.
ENDLOOP.
* Appending the value to the dynamic Internal table
APPEND <gs_line> TO <gs_dyn_table>.
CLEAR: <gs_line>.
CLEAR: ls_static, ls_static1.
ENDLOOP.
ENDFORM. " POPULATE_DYN_TABLE
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->pt_static text
*----------------------------------------------------------------------*
FORM display_alv USING pt_static.
DATA : ls_alv_fieldcat TYPE slis_fieldcat_alv,
lt_alv_fieldcat TYPE slis_t_fieldcat_alv.
DATA lv_pos TYPE i.
LOOP AT gt_dyn_fcat INTO gs_dyn_fcat.
lv_pos = lv_pos + 1.
ls_alv_fieldcat-fieldname = gs_dyn_fcat-fieldname.
ls_alv_fieldcat-tabname = gs_dyn_fcat-tabname.
ls_alv_fieldcat-seltext_l = gs_dyn_fcat-coltext.
ls_alv_fieldcat-outputlen = gs_dyn_fcat-outputlen.
ls_alv_fieldcat-col_pos = lv_pos.
ls_alv_fieldcat-do_sum = gs_dyn_fcat-do_sum.
ls_alv_fieldcat-emphasize = gs_dyn_fcat-emphasize.
ls_alv_fieldcat-key = gs_dyn_fcat-key.
ls_alv_fieldcat-no_out = gs_dyn_fcat-no_out.
APPEND ls_alv_fieldcat TO lt_alv_fieldcat.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = lt_alv_fieldcat
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = <gs_dyn_table>.
ENDFORM. " DISPLAY_ALV
*&---------------------------------------------------------------------*
*& Form CREATE_COLUMN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PV_FIELDNAME text
* -->PV_OUTPUTLEN text
* -->PV_COLTEXT text
*----------------------------------------------------------------------*
FORM create_column USING pv_fieldname TYPE c
pv_outputlen TYPE i
pv_coltext TYPE c
pv_key TYPE c.
** This would create structure Text Lang Full-desc Short-desc etc ....
gv_pos = gv_pos + 1.
gs_dyn_fcat-fieldname = pv_fieldname. "Term id column
gs_dyn_fcat-outputlen = pv_outputlen.
gs_dyn_fcat-tabname = 'IT_DYNAMIC'.
gs_dyn_fcat-coltext = pv_coltext.
gs_dyn_fcat-col_pos = gv_pos.
gs_dyn_fcat-key = pv_key.
gs_dyn_fcat-key_sel = pv_key.
APPEND gs_dyn_fcat TO gt_dyn_fcat.
CLEAR gs_dyn_fcat.
ENDFORM. " CREATE_COLUMN