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 in REUSE_ALV_GRID_DISPLAY

amber_garg
Active Participant
0 Kudos

I m a newbie and I want to diplay a very simple ALV GRID. I searched a lot of places but couldnt find out my problem. My prob is the alv grid is getting displayed with the headin n all but there is no data inside it although the internal table contains the data.


 REPORT  ZLIST1                                  .

type-pools: SLIS.

data: begin of wemp occurs 0,
       wempno like zamber_emp-empno,
       wname like zamber_emp-name,
      end of wemp.

data: col_info type slis_fieldcat_alv,
      tab_info type slis_t_fieldcat_alv.

select empno name from zamber_emp into table wemp.

col_info-fieldname = 'wempno'.   {color:red}*MARK 1  {color}
col_info-tabname = ''.         {color:red}* MARK 2 - {color}
col_info-seltext_l = 'Employee No'.
col_info-outputlen = '10'.

APPEND col_info to tab_info.

CLEAR col_info.

col_info-fieldname = 'wname'. {color:red}*MARK 3  {color}
col_info-tabname = ''.        {color:red}* MARK 4 - {color}
col_info-seltext_l = 'Name'.
col_info-outputlen = '30'.

APPEND col_info to tab_info.


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
     I_CALLBACK_PROGRAM = 'zlist1'
     IT_FIELDCAT = tab_info
*     I_STRUCTURE_NAME                  = 'zamber_emp'
  TABLES
    T_OUTTAB                          = wemp
  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.

can u please tell me the explanation of the HOTSPOTS i made in the code (MARK 1 , MARK2 etc) and what exactly the values should be there.

If u see the comment for I_STRUCTURE_NAME , when i uncomment that it works coz its taking the structure from the table but wat i want is that grid should take structure from slis_t_fieldcat_alv

1 ACCEPTED SOLUTION

Former Member
0 Kudos

col_info-fieldname = 'wname'. should be col_info-fieldname = 'WNAME'.

you should use caps for all the field names while preparing the field catalog

Thanks

Bala Duvvuri

2 REPLIES 2

Former Member
0 Kudos

col_info-fieldname = 'wname'. should be col_info-fieldname = 'WNAME'.

you should use caps for all the field names while preparing the field catalog

Thanks

Bala Duvvuri

0 Kudos

Thanks a ton sir , it worked.I was fed for for 5 hrs coz of this.Thanks again