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: 

ALV List: extended field isn't filled

former_member183924
Active Participant
0 Kudos

Hi experts,

I've made a alvlist and need one more field, all is working for the ALV-control but the additional field isn't filled with the values from GT_STXL_EXT (in debugger I can see the values)! I already searched in forum and looked into the ALV Grid Control reference but with no success to solve this problem.




TABLES: stxl, stxh.

TYPE-POOLS: slis.

TYPES: BEGIN OF gs_stxl_ext.
         INCLUDE STRUCTURE stxl.
TYPES:   tdline  TYPE stxitfd-tdline,
       END OF gs_stxl_ext.

DATA: container01    TYPE REF TO cl_gui_docking_container,
      alv_list1      TYPE REF TO cl_gui_alv_grid,
      g_repid        TYPE sy-repid,
      g_find(20)     TYPE c,
      g_okcode       TYPE sy-ucomm
      .

DATA:

      gt_stxl_ext TYPE TABLE OF gs_stxl_ext,
      wa_stxl_ext TYPE          gs_stxl_ext,

      gt_text     TYPE TABLE OF tline,
      wa_text     TYPE tline
      .

FIELD-SYMBOLS: <fs_stxl>     TYPE stxl,
               <fs_stxl_ext> TYPE gs_stxl_ext

  DATA: ls_layout    TYPE lvc_s_layo
        ,ls_fcat     TYPE lvc_s_fcat
        ,lt_fieldcatalog TYPE lvc_t_fcat
        .

  SELECT tdid tdspras tdname tdobject
  FROM stxl
  INTO CORRESPONDING FIELDS OF TABLE gt_stxl_ext
  WHERE tdobject IN so_tdob
  AND   tdspras  IN so_tdsp
  AND   tdid     IN so_tdid
  .



LOOP AT gt_stxl_ext INTO wa_stxl_ext.
  CALL FUNCTION 'READ_TEXT'
  EXPORTING
    client           = sy-mandt
    id               = wa_stxl_ext-tdid
    language         = wa_stxl_ext-tdspras
    name             = wa_stxl_ext-tdname
    object           = wa_stxl_ext-tdobject
  TABLES    lines    = gt_text
  .

  IF sy-subrc = 0.
    READ TABLE gt_text INTO wa_text INDEX 1.

    FIND g_find IN wa_text-tdline IGNORING CASE.

    IF sy-subrc = 0.
*      <fs_stxl_ext>-tdline = wa_text-tdline.
      wa_stxl_ext-tdline = wa_text-tdline.
      MODIFY gt_stxl_ext FROM wa_stxl_ext.

    ELSE.
*      wa_stxl_ext = <fs_stxl_ext>.
      DELETE TABLE gt_stxl_ext FROM wa_stxl_ext.
    ENDIF.

  ENDIF.

ENDLOOP.

  g_repid = sy-repid.

  IF container01 IS INITIAL.

    CREATE OBJECT container01
      EXPORTING
        parent     = cl_gui_container=>screen0
        side       = cl_gui_docking_container=>dock_at_left
        ratio      = 90 
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5
        OTHERS                      = 6.
    IF sy-subrc <> 0.
        CALL FUNCTION 'POPUP_TO_INFORM'
           EXPORTING
                titel = g_repid
                txt2  = sy-subrc
                txt1  = 'The control could not be created'.
    ENDIF.

    CALL METHOD container01->set_extension
      EXPORTING   extension  = 99999
      EXCEPTIONS  CNTL_ERROR = 1
                  others     = 2.
    IF sy-subrc <> 0.
      CALL FUNCTION 'POPUP_TO_INFORM'
           EXPORTING
                titel = g_repid
                txt2  = sy-subrc
                txt1  = 'The extension of container_dock could not be set.'.
    ENDIF.

    CREATE OBJECT alv_list1  EXPORTING i_parent = container01.

  ENDIF.



  ls_layout-NO_ROWMARK = ' '.
  ls_layout-SEL_MODE   = 'A'.
  ls_layout-CWIDTH_OPT = 'X'.
  ls_layout-ZEBRA      = 'X'.
  ls_layout-GRID_TITLE = 'the title'.




  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING i_structure_name = 'STXL'
    CHANGING  ct_fieldcat      = lt_fieldcatalog[]
    .

  CLEAR ls_fcat .
  ls_fcat-fieldname = 'tdline'.
  ls_fcat-ref_table = 'STXITFD'.
*  ls_fcat-ref_table = 'GT_stxl_ext'.
*  ls_fcat-ref_field = 'tdline'.
*  ls_fcat-inttype   = 'C'.
*  ls_fcat-outputlen = '132' .
  ls_fcat-coltext   = 'Materiallangtext'.
*  ls_fcat-seltext   = 'Materiallangtext'.
*  ls_fcat-datatype  = 'CHAR'.
*  ls_fcat-domname   = 'TDSTXLLINE'.
  ls_fcat-col_pos   = '7'.
  ls_fcat-tabname   = '1'.
  APPEND ls_fcat to lt_fieldcatalog.


    CALL METHOD alv_list1->set_table_for_first_display
        EXPORTING is_layout        = ls_layout
        CHANGING  it_outtab        = gt_stxl_ext
                  it_fieldcatalog  = lt_fieldcatalog
        .

  CALL METHOD alv_list1->set_toolbar_interactive.
  CALL METHOD cl_gui_control=>set_focus EXPORTING control = alv_list1.

1 ACCEPTED SOLUTION

Pawan_Kesari
Active Contributor
0 Kudos

Check these lines


  ls_fcat-fieldname = 'TDLINE'.
  ls_fcat-ref_table = 'STXITFD'.
  ls_fcat-ref_fielfname = 'TDLINE' .
  ls_fcat-coltext   = 'Materiallangtext'.
  APPEND ls_fcat to lt_fieldcatalog.

put field values in CAPS

3 REPLIES 3

Pawan_Kesari
Active Contributor
0 Kudos

Check these lines


  ls_fcat-fieldname = 'TDLINE'.
  ls_fcat-ref_table = 'STXITFD'.
  ls_fcat-ref_fielfname = 'TDLINE' .
  ls_fcat-coltext   = 'Materiallangtext'.
  APPEND ls_fcat to lt_fieldcatalog.

put field values in CAPS

0 Kudos

There was typo in prev reply

use this code


  CLEAR ls_fcat .
  ls_fcat-fieldname = 'TDLINE'.
  ls_fcat-ref_table = 'STXITFD'.
  ls_fcat-ref_field = 'TDLINE' .
  ls_fcat-coltext   = 'Materiallangtext'.
  ls_fcat-col_pos   = '7'.
  ls_fcat-tabname   = '1'.
  APPEND ls_fcat TO lt_fieldcatalog.

Former Member
0 Kudos

try this it may work

ls_fcat-fieldname = 'TDLINE'. " IN CAPS

*ls_fcat-ref_table = 'STXITFD'.

  • ls_fcat-ref_table = 'GT_stxl_ext'.

  • ls_fcat-ref_field = 'tdline'.

  • ls_fcat-inttype = 'C'.

  • ls_fcat-outputlen = '132' .

ls_fcat-coltext = 'Materiallangtext'.

  • ls_fcat-seltext = 'Materiallangtext'.

  • ls_fcat-datatype = 'CHAR'.

  • ls_fcat-domname = 'TDSTXLLINE'.

ls_fcat-col_pos = '7'.

ls_fcat-tabname = 'GS_STXL_EXT'.

APPEND ls_fcat to lt_fieldcatalog.

Regards

shiba dutta