Application Development and Automation 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: 
Read only

ALV grid

Former Member
0 Likes
919

Hi all,

I have a issue which is like this need to create a check box on the selection screen , when the user check this ..the out of alv grid should show 5 required fields and when he doent it should show 8 required fields in alv grid .. at the moment it is displaying all the fields of tables vbak and kna1...is there any way we restrict or delete the fields with FM 'REUSE_ALV_FIELDCATALOG_MERGE'..

thxs,

vin.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
890

Hi vind,

1. simple.

2. fieldcat-no_out = 'X'.

3. For those 3 fields, which u don't, want to display,

just

Loop at the field catalogue,

and make

NO_OUT = 'X'

(for those 3 fields)

regards,

amit m.

Hi all,

I have a issue which is like this need to create a check box on the selection screen , when the user check this ..the out of alv grid should show 5 required fields and when he doent it should show 8 required fields in alv grid .. at the moment it is displaying all the fields of tables vbak and kna1...is there any way we restrict or delete the fields with FM 'REUSE_ALV_FIELDCATALOG_MERGE'..

thxs,

vin.

6 REPLIES 6
Read only

Former Member
0 Likes
890

Hello Vin,

When building the field catalog,

If P_CHECK = 'X'.

field-key = 'X'.

ENDIF.

If useful reward points.

Regards,

Vasanth

Read only

Former Member
0 Likes
890

Hi,

after you get the fieldcat from the FM 'REUSE_ALV_FIELDCATALOG_MERGE'

you need to delete the entries from fieldcat which you don't want to show when check box is checked or you can do this also make them as TECH fields.


if p_check = 'X'.
loop at it_fieldcat into x_fieldcat.
if x_fieldcat-fieldname = 'ABC'. "this is the field i don't want to show..

x_fieldcat-tech = 'X'.

modify it_feildcat from x_fieldcat index sy-tabix transporting tech.

endif.
endloop.

endif.

like this you add the other fields .

when you make tech = 'X' those fields will not be visible in Output display.

Regards

vijay

Read only

Former Member
0 Likes
890

U MAY USE THE IF CONDITION FOR THAT PASS THE FUNCTION CODE OF THE CHECK BOX IN YOUR PROGRAM AND USE IF CONDITION RATHER THEN MODIFYING YOUR FUNCTION MODULE.

Read only

Former Member
0 Likes
891

Hi vind,

1. simple.

2. fieldcat-no_out = 'X'.

3. For those 3 fields, which u don't, want to display,

just

Loop at the field catalogue,

and make

NO_OUT = 'X'

(for those 3 fields)

regards,

amit m.

Read only

andreas_mann3
Active Contributor
0 Likes
890

hi,

or work simply with a predefined layout

  x_save = 'X'.
  gs_variant-report     = sy-repid.

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
            I_STRUCTURE_NAME = c_tabname
            IS_VARIANT       = gs_variant
            IS_layout        = lay
            I_SAVE           = x_save
       TABLES
            T_OUTTAB         = gridtab
       EXCEPTIONS
            OTHERS           = 1.

A.

Read only

Former Member
0 Likes
890

Hi,

Check this code , this is exactly what you are looking...

REPORT  ZTEST_ALV_CHECK     MESSAGE-ID ZZ           .


TYPE-POOLS: SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
      IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
      L_LAYOUT TYPE SLIS_LAYOUT_ALV.

DATA: BEGIN OF ITAB OCCURS 0,
      VBELN LIKE VBAK-VBELN,
      POSNR LIKE VBAP-POSNR,
      MATNR like vbap-matnr,
     END OF ITAB.

parameters: p_check as checkbox.

SELECT VBELN
       POSNR
       MATNR
       FROM VBAP
       UP TO 20 ROWS
       INTO TABLE ITAB.


CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
 EXPORTING
   I_PROGRAM_NAME               = sy-repid
   I_INTERNAL_TABNAME           = 'ITAB'
   I_INCLNAME                   = sy-repid
  CHANGING
    CT_FIELDCAT                  = it_fieldcat
 EXCEPTIONS
   INCONSISTENT_INTERFACE       = 1
   PROGRAM_ERROR                = 2
   OTHERS                       = 3
          .
IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

<b>if p_check = 'X'.
loop at it_fieldcat into x_fieldcat.
if x_fieldcat-fieldname = 'MATNR'.
x_fieldcat-tech = 'X'.
modify it_fieldcat from x_fieldcat index sy-tabix transporting tech.
endif.
endloop.
endif.</b>

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    I_CALLBACK_PROGRAM       = SY-REPID
    IS_LAYOUT                = L_LAYOUT
    IT_FIELDCAT              = IT_FIELDCAT
  TABLES
    T_OUTTAB                 = ITAB
  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.

Regards

vijay