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 with pushbutton

Former Member
0 Likes
885

Hi all,

When I create a ALV output with grid(using REUSE_ALV_GRID_DISPLAY), during output display I want a pushbutton to be displayed BEFORE each row.The row should not be editable.When I select the button, the whole row should be selected.

What extra code should I add in my program?

Thanks,

Shivaa......

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
844

hi Vijay,

I have added the code as you suggested.Isee the output as I wanted.But, when I click 'BACK' pushbutton,

I get following runtime error--> SNAP_NO_NEW_ENTRY...

I am enclosing the code here..Let me know if I have done any mistake.

REPORT ZALV.

initialization.

tables: lfa1.

type-pools: slis.

data: itab like lfa1 occurs 3,

fcat type slis_t_fieldcat_alv,

layo type slis_layout_alv,

pnam type sy-repid.

layo-colwidth_optimize = 'X'.

layo-zebra = 'X'.

layo-detail_popup = 'X'.

layo-box_fieldname = 'BOX_FIELD'.

start-of-selection.

pnam = sy-repid.

select * up to 20 rows from lfa1 into table itab.

perform calcat.

perform gridout.

form calcat.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = pnam

I_INTERNAL_TABNAME = 'ITAB'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = pnam

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = fcat

  • 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.

endform.

form gridout.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = pnam

  • 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 = 'Vendor Master Information'

  • I_GRID_SETTINGS =

IS_LAYOUT = layo

IT_FIELDCAT = fcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • 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

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

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.

7 REPLIES 7
Read only

Former Member
0 Likes
844

Have one more extra field in your internal table.

and specify that fieldname to the BOX_FIELDNAME of the layout.

and pass the Layout to the ALV function parameter.

nothing more than that.

Read only

Former Member
0 Likes
844

Hi Vijay,

thnx for ur quick reply...

box_fieldname type slis_fieldname stands for 'fieldname for checkbox'.

But, I dont want checkbox, I want a pushbutton.

Read only

0 Likes
844
data: begin of itab occurs 0,
       ....
       ....
       box_field type c, 
      end of itab.

layout-box_fieldname = 'BOX_FIELD'. "it will show as button 
                                  "only

Don't worry, it will show as button only incase of Grid function.

Read only

Former Member
0 Likes
845

hi Vijay,

I have added the code as you suggested.Isee the output as I wanted.But, when I click 'BACK' pushbutton,

I get following runtime error--> SNAP_NO_NEW_ENTRY...

I am enclosing the code here..Let me know if I have done any mistake.

REPORT ZALV.

initialization.

tables: lfa1.

type-pools: slis.

data: itab like lfa1 occurs 3,

fcat type slis_t_fieldcat_alv,

layo type slis_layout_alv,

pnam type sy-repid.

layo-colwidth_optimize = 'X'.

layo-zebra = 'X'.

layo-detail_popup = 'X'.

layo-box_fieldname = 'BOX_FIELD'.

start-of-selection.

pnam = sy-repid.

select * up to 20 rows from lfa1 into table itab.

perform calcat.

perform gridout.

form calcat.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = pnam

I_INTERNAL_TABNAME = 'ITAB'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = pnam

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = fcat

  • 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.

endform.

form gridout.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = pnam

  • 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 = 'Vendor Master Information'

  • I_GRID_SETTINGS =

IS_LAYOUT = layo

IT_FIELDCAT = fcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • 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

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

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.

Read only

0 Likes
844

data: itab like lfa1 occurs 3. "<---this internal table should hold a field name box_field

" or something else of type c

you have to define like this..

data: begin of itab occurs 0.
  include structure lfa1.
data: box_field type c.     "then only it will work.
data:  end of itab.

Read only

Former Member
Read only

Former Member
0 Likes
844

Thanks, Vijay..Its working now........