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-report

Former Member
0 Likes
678

Hi,

How to create Checkbox in alv report??

give an example..

If i have my subroutine in my report and that now i want to use that one in another report, how is it possible??

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
652

hi,

Take a field field1 type c in ur internal table.

Then in fieldcatalog.

it_fieldcat-fieldname = field1.

it_fieldcat-checkbox = 'X'.

it_fieldcat-edit = 'X'.

append it_fieldcat.

and pass this fieldcat to parameters of reuse_alv_grid_display.

perform <performname> in program <progname>.

Rgds.,

subash

5 REPLIES 5
Read only

Former Member
0 Likes
652

Hi,

if you call the perform with the information of the other program, it should work:

perform yourroutine(yourfirstprogram)

2. Define your internal table for ALV with selk(1).

DATA: BEGIN OF verkauf OCCURS 0,

selk(1),

....

end of verkauf.

and

FORM layout_build USING u_er_layout TYPE slis_layout_alv.

  • u_er_layout-info_fieldname = 'LINE_COLOR'.

u_er_layout-box_fieldname = 'SELK'. " Checkbox

u_er_layout-get_selinfos = 'X'.

u_er_layout-confirmation_prompt = 'X'. "Sicherheitsabfrage

u_er_layout-key_hotspot = 'X'. "Schlüssel als Hotspot

u_er_layout-info_fieldname = 'COL'. "Zeilenfarbe

ENDFORM. " LAYOUT_BUILD

Regards

Nicole

Edited by: Nicole Lorenz on Jun 27, 2008 2:17 AM

Edited by: Nicole Lorenz on Jun 27, 2008 2:19 AM

Read only

Former Member
0 Likes
653

hi,

Take a field field1 type c in ur internal table.

Then in fieldcatalog.

it_fieldcat-fieldname = field1.

it_fieldcat-checkbox = 'X'.

it_fieldcat-edit = 'X'.

append it_fieldcat.

and pass this fieldcat to parameters of reuse_alv_grid_display.

perform <performname> in program <progname>.

Rgds.,

subash

Read only

Former Member
0 Likes
652

In your output table, create a field of type char1.

types: begin of tab,

check(1) type c, "Field for checkbox

other fields.

end of tab.

fieldcatalogue for this field - set Filedcat-checkbox = 'X'.

Then this field will be displayed as checkbox.

Reward if useful.

Read only

Former Member
0 Likes
652

Thanks,

Asha..

Read only

Former Member
0 Likes
652

hi

I am passing you a simple prog code which display checkBox in ALV display.


*&---------------------------------------------------------------------*
*& Report  Z03_CHKBOX_ALV
*&
*&---------------------------------------------------------------------*
*&  Program with Check Box display into ALV output
*&
*&---------------------------------------------------------------------*

REPORT  Z03_CHKBOX_ALV.

TYPES: BEGIN OF ITAB,
        ROLL_NO(10) TYPE C,
        NAME(10) TYPE C,
        CHK_B(1) TYPE C,
      END OF ITAB.
DATA: IT1 TYPE ITAB OCCURS 0 WITH HEADER LINE.

TYPE-POOLS:SLIS.

DATA: FCAT TYPE SLIS_T_FIELDCAT_ALV,
      TEVE TYPE SLIS_T_EVENT.

IT1-ROLL_NO = '1'.
IT1-NAME = 'AAA'.
IT1-CHK_B = 'X'.
APPEND IT1.

IT1-ROLL_NO = '2'.
IT1-NAME = 'BBB'.
IT1-CHK_B = ''.
APPEND IT1.

IT1-ROLL_NO = '3'.
IT1-NAME = 'CCC'.
IT1-CHK_B = 'X'.
APPEND IT1.

IT1-ROLL_NO = '4'.
IT1-NAME = 'DDD'.
IT1-CHK_B = ''.
APPEND IT1.

IT1-ROLL_NO = '5'.
IT1-NAME = 'EEE'.
IT1-CHK_B = 'X'.
APPEND IT1.

PERFORM CRE_FCAT USING FCAT.
PERFORM CRE_EVE.
PERFORM DIS_DATA.

*&---------------------------------------------------------------------*
*&      Form  CRE_FCAT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_FCAT  text
*----------------------------------------------------------------------*
FORM CRE_FCAT  USING    P_FCAT TYPE SLIS_T_FIELDCAT_ALV.
  DATA: WA TYPE SLIS_FIELDCAT_ALV.

  WA-TABNAME = 'IT1'.
  WA-FIELDNAME = 'ROLL_NO'.
  WA-SELTEXT_L = 'Roll Number'.
  APPEND WA TO P_FCAT.
  CLEAR WA.

  WA-TABNAME = 'IT1'.
  WA-FIELDNAME = 'NAME'.
  WA-SELTEXT_L = 'NAME'.
  APPEND WA TO P_FCAT.
  CLEAR WA.

  WA-TABNAME = 'IT1'.
  WA-FIELDNAME = 'CHK_B'.
  WA-SELTEXT_L = 'Check Box'.
  WA-CHECKBOX = 'X'.
  APPEND WA TO P_FCAT.
  CLEAR WA.

ENDFORM.                    " CRE_FCAT

*&---------------------------------------------------------------------*
*&      Form  CRE_EVE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM CRE_EVE .
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
   EXPORTING
     I_LIST_TYPE           = 0
   IMPORTING
     ET_EVENTS             = TEVE
* EXCEPTIONS
*   LIST_TYPE_WRONG       = 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.                    " CRE_EVE

*&---------------------------------------------------------------------*
*&      Form  DIS_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM DIS_DATA .
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
     I_CALLBACK_PROGRAM                = 'Z03_CHKBOX_ALV'
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
*   IS_LAYOUT                         =
     IT_FIELDCAT                       = FCAT
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
     IT_EVENTS                         = TEVE
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
    TABLES
      T_OUTTAB                          = IT1
* 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.                    " DIS_DATA

With Regards

Dharmishta