Skip to Content
author's profile photo Former Member
Former Member

ALV Display Problem

Hello guys!

In my program I am using REUSE_ALV_GRID_DISPLAY function and the table i pass to it contains data (5 rows: run it on debug mode). However, after execution, the 5 rows of the table are displayed in the ALV but empty.

The code i'm using in this program works fine with another case.

Could anyone help me with this?

Thanks a lot

Hajar

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 06:13 PM

    My result_tab is loaded somewhere else, i'm sure that it's filled with data and that the wa_result_tab is also filled. I used the type string just to try with it after that I tried using another structure that its elements have the same types as the ones in the table but it didn't work.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi

      I've never used a field type string for alv, so i don't know if it can be some problem.

      So try to define the fields of your table like the dictionary fields

      data : begin of wa_result_tab occurs 0,

      pernr like <table>-pernr,

      end of wa_result_tab.

      and use this fm to load catalog:

      REUSE_ALV_FIELDCATALOG_MERGE

      Max

      Message was edited by: max bianchi

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 04:06 PM

    have u prepared the catalog data for the fields used and passed it to the FM - REUSE_ALV_GRID_DISPLAY

    Regards

    swanand

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 04:07 PM

    Not clear abt the problem. Can you please paste your code.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi,

      u need to build a field catalogue internal table for all ur fields used in the display.

      code

      form add_field_to_catalogue using x_col_pos

      x_fieldname

      x_tabname

      x_key

      x_reptext

      x_rollname

      x_lowercase

      x_outputlen.

      ----


      wa_fieldcatalog-col_pos = x_col_pos.

      wa_fieldcatalog-fieldname = x_fieldname.

      wa_fieldcatalog-tabname = x_tabname.

      wa_fieldcatalog-key = x_key.

      wa_fieldcatalog-reptext = x_reptext.

      wa_fieldcatalog-dd_roll = x_rollname.

      wa_fieldcatalog-lowercase = x_lowercase.

      wa_fieldcatalog-outputlen = x_outputlen.

      append wa_fieldcatalog to t_fieldcatalog.

      endform.

      Regards

      Swanand

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 04:09 PM

    Hi hajar,

    check whether you are passing internal table or not and check in debug mode whether records are shown in your internal table or not

     CALL function 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_bypassing_buffer        = 'X'
    *            i_buffer_active          = ' '
                i_callback_program        = g_repid
    *            i_callback_pf_status_set  = g_status_set
                i_callback_user_command   = g_user_command
                i_structure_name          = 'WA'
                is_layout                 = gs_layout
                it_fieldcat               = lt_fieldcat
                i_save                    = g_save
                is_print                  = gs_print
                is_variant                = gs_variant
    *            it_events                 = gt_events[]
                i_grid_title              = list_title
                colwidth_optimize         = 'X'  "optimale Spaltenbreite
           IMPORTING
                e_exit_caused_by_caller   = g_exit_caused_by_caller
                es_exit_caused_by_user    = gs_exit_caused_by_user
           TABLES
                t_outtab                  = <b>itab</b>
           EXCEPTIONS
                program_error             = 1
                others                    = 2.

    or give your code.

    reward points for helpfull answers and close the thread if your question is solved.

    regards,

    venu.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 05:53 PM

    thanks a lot for your help. I used technical names in my field catalogue but i still get empty ALV.

    any other suggestions???

    Your help is really appreciated.

    Hajar

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi

      This is your routine to fill wa_result_tab, but where do you load result_tab?

      FORM data_retrieval.

      loop at result_tab into result_struct.

      wa_result-pernr = result_struct-pernr.

      wa_result-nachn = result_struct-nachn.

      wa_result-vorna = result_struct-vorna.

      wa_result-libattes = result_struct-libattes.

      wa_result-datdem = result_struct-datdem.

      wa_result-datdep = result_struct-datdep.

      wa_result-statdem = result_struct-statdem.

      wa_result-delivre = result_struct-delivre.

      wa_result-modlivr = result_struct-modlivr.

      wa_result-user = result_struct-user.

      append wa_result to wa_result_tab.

      endloop.

      ENDFORM. " DATA_RETRIEVAL

      Why do you use type STRING for define your table?

      Max

      Message was edited by: max bianchi

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 04:36 PM

    To clarify more here is my code:

    TYPE-POOLS: slis. "ALV Declarations

    types : begin of wa,

    pernr type string,

    nachn type string,

    vorna type string,

    libattes type string,

    datdem type string,

    datdep type string,

    statdem type string,

    delivre type string,

    modlivr type string,

    user type string,

    end of wa.

    data: wa_result_tab TYPE STANDARD TABLE OF wa INITIAL SIZE 0,

    wa_result TYPE wa.

    *ALV data declarations

    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,

    gd_tab_group TYPE slis_t_sp_group_alv,

    gd_layout TYPE slis_layout_alv.

    PERFORM data_retrieval.

    PERFORM build_fieldcatalog.

    PERFORM build_layout.

    PERFORM display_alv_report.

    FORM user_command USING r_ucomm LIKE sy-ucomm

    rs_selfield TYPE slis_selfield.

    • Check function code

    CASE r_ucomm.

    WHEN '&IC1'.

    • Check field clicked on within ALVgrid report

    IF rs_selfield-fieldname = 'Mat.'.

    • Read data table, using index of row user clicked on

    READ TABLE result_tab INTO result_struct INDEX rs_selfield-tabindex.

    • Set parameter ID for transaction screen field

    SET PARAMETER ID 'BES' FIELD result_struct-pernr.

    • Sxecute transaction ME23N, and skip initial data entry screen

    CALL TRANSACTION 'ZTRIAL' AND SKIP FIRST SCREEN.

    ENDIF.

    ENDCASE.

    ENDFORM.

    *&----

    -


    *

    *& Form BUILD_FIELDCATALOG

    *&----

    -


    *

    • Build Fieldcatalog for ALV Report

    *----

    -


    *

    FORM build_fieldcatalog.

    fieldcatalog-fieldname = 'Mat.'.

    fieldcatalog-seltext_m = 'Matricule de l agent'.

    fieldcatalog-col_pos = 0.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'Nom'.

    fieldcatalog-seltext_m = 'Nom de l agent'.

    fieldcatalog-col_pos = 1.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'Prénom'.

    fieldcatalog-seltext_m = 'Prénom de l agent'.

    fieldcatalog-col_pos = 2.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'Attestation'.

    fieldcatalog-seltext_m = 'Type d attestation'.

    fieldcatalog-col_pos = 3.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'Date de demande'.

    fieldcatalog-seltext_m = 'Date de demande de l attestation'.

    fieldcatalog-col_pos = 4.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'Date de traitement'.

    fieldcatalog-seltext_m = 'Date de traitement de l attestation'.

    fieldcatalog-col_pos = 5.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'Statut'.

    fieldcatalog-seltext_m = 'Statut de l attestation'.

    fieldcatalog-col_pos = 6.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'Délivré par'.

    fieldcatalog-seltext_m = 'Service émetteur'.

    fieldcatalog-col_pos = 7.

    fieldcatalog-outputlen = 15.

    *fieldcatalog-datatype = 'CURR'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'Mode de réception'.

    fieldcatalog-seltext_m = 'Mode de réception'.

    fieldcatalog-col_pos = 8.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'Gestionnaire'.

    fieldcatalog-seltext_m = 'Code du gestionnaire qui'.

    fieldcatalog-col_pos = 9.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    ENDFORM. " BUILD_FIELDCATALOG

    *&----

    -


    *

    *& Form BUILD_LAYOUT

    *&----

    -


    *

    • Build layout for ALV grid report

    *----

    -


    *

    FORM build_layout.

    gd_layout-no_input = 'X'.

    gd_layout-colwidth_optimize = 'X'.

    ENDFORM. " BUILD_LAYOUT

    *&----

    -


    *

    *& Form DISPLAY_ALV_REPORT

    *&----

    -


    *

    • Display report using ALV grid

    *----

    -


    *

    FORM display_alv_report.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = sy-repid

    i_callback_user_command = 'USER_COMMAND'

    is_layout = gd_layout

    it_fieldcat = fieldcatalog[]

    i_save = 'X'

    TABLES

    t_outtab = wa_result_tab

    EXCEPTIONS

    program_error = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. " DISPLAY_ALV_REPORT

    *&----


    *

    *& Form DATA_RETRIEVAL

    *&----


    *

    • Retrieve data form EKPO table and populate itab it_ekko

    *----


    *

    FORM data_retrieval.

    loop at result_tab into result_struct.

    wa_result-pernr = result_struct-pernr.

    wa_result-nachn = result_struct-nachn.

    wa_result-vorna = result_struct-vorna.

    wa_result-libattes = result_struct-libattes.

    wa_result-datdem = result_struct-datdem.

    wa_result-datdep = result_struct-datdep.

    wa_result-statdem = result_struct-statdem.

    wa_result-delivre = result_struct-delivre.

    wa_result-modlivr = result_struct-modlivr.

    wa_result-user = result_struct-user.

    append wa_result to wa_result_tab.

    endloop.

    ENDFORM. " DATA_RETRIEVAL

    When i run this code i get an ALV containing 5 empty rows (my table contain 5 full rows)

    thanks a lot for your help

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi

      Your catalog table is wrong, look at your internal table:

      types : begin of wa,

      pernr type string,

      nachn type string,

      vorna type string,

      libattes type string,

      datdem type string,

      datdep type string,

      statdem type string,

      delivre type string,

      modlivr type string,

      user type string,

      end of wa.

      data: wa_result_tab TYPE STANDARD TABLE OF wa INITIAL SIZE 0,

      Now see the code you have wroten to build catalog:

      fieldcatalog-fieldname = 'Mat.'.

      fieldcatalog-seltext_m = 'Matricule de l agent'.

      fieldcatalog-col_pos = 0.

      APPEND fieldcatalog TO fieldcatalog.

      CLEAR fieldcatalog.

      fieldcatalog-fieldname = 'Nom'.

      fieldcatalog-seltext_m = 'Nom de l agent'.

      fieldcatalog-col_pos = 1.

      APPEND fieldcatalog TO fieldcatalog.

      CLEAR fieldcatalog.

      fieldcatalog-fieldname = 'NACHN'.

      fieldcatalog-seltext_m = 'Prénom de l agent'.

      fieldcatalog-col_pos = 2.

      APPEND fieldcatalog TO fieldcatalog.

      CLEAR fieldcatalog.

      ......

      But where field Mat. is? or Prénom? and so...

      You have to insert the technical name of field in the field fieldname:

      so

      fieldcatalog-fieldname = 'PERNR'.

      fieldcatalog-seltext_m = 'Matricule de l agent'.

      fieldcatalog-col_pos = 0.

      APPEND fieldcatalog TO fieldcatalog.

      CLEAR fieldcatalog.

      ...........

      Max

      Message was edited by: max bianchi

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 05:21 PM

    in fieldcatalogue build form specify the data type and length of the field.

    Regards

    Swanand

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 06:27 PM

    Thanks a lot max i'll try right now and let you know

    Hajar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 07:04 PM

    Thank you very much max finally my problem is solved.

    Hajar

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.