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: 

how to use REUSE_ALV_POPUP_TO_SELECT fm

Former Member
0 Kudos

hi,

My problem is i am getting error when using the FM REUSE_ALV_POPUP_TO_SELECT.

Please any one tell me how to use this and give me sample code if have.

My scenario is to display one internal table as popup in a table format and user selects one row means that will retrieve that selected row.

regards,

Mithun

1 ACCEPTED SOLUTION

former_member184551
Contributor

Hi

Its fairly simple. if you post your code it will be easier to tell where you might be going wrong. A sample is given below for your reference.

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

i_title = 'Send Orders to SQL'

i_checkbox_fieldname = 'CHECKBOX'

i_tabname = 'TLINE'

it_fieldcat = fieldcat[]

it_excluding = extab[]

IMPORTING

e_exit = e_exit

TABLES

t_outtab = tline

EXCEPTIONS

program_error = 1

OTHERS = 2.

CHECK sy-subrc = 0.

IF NOT e_exit IS INITIAL.

MESSAGE s368(00) WITH 'Action cancelled'.

EXIT.

ENDIF.

LOOP AT tline WHERE checkbox = 'X'.

SUBMIT z_u5_ms_send_job_data_to_sql

WITH p_aufnr = tline-line(12)

AND RETURN.

WRITE:/ 'Job sent:', tline-line.

ENDLOOP.

Rgds

Sameer

3 REPLIES 3

former_member184551
Contributor

Hi

Its fairly simple. if you post your code it will be easier to tell where you might be going wrong. A sample is given below for your reference.

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

i_title = 'Send Orders to SQL'

i_checkbox_fieldname = 'CHECKBOX'

i_tabname = 'TLINE'

it_fieldcat = fieldcat[]

it_excluding = extab[]

IMPORTING

e_exit = e_exit

TABLES

t_outtab = tline

EXCEPTIONS

program_error = 1

OTHERS = 2.

CHECK sy-subrc = 0.

IF NOT e_exit IS INITIAL.

MESSAGE s368(00) WITH 'Action cancelled'.

EXIT.

ENDIF.

LOOP AT tline WHERE checkbox = 'X'.

SUBMIT z_u5_ms_send_job_data_to_sql

WITH p_aufnr = tline-line(12)

AND RETURN.

WRITE:/ 'Job sent:', tline-line.

ENDLOOP.

Rgds

Sameer

0 Kudos

hi sameer,

thanks for your reply, i want to know what are these importing parameters

i_checkbox_fieldname = 'CHECKBOX'

i_tabname = 'TLINE'

it_fieldcat = fieldcat[]

it_excluding = extab[].

please explain me.

regards,

Mithun

0 Kudos

Q. i_checkbox_fieldname = 'CHECKBOX'

A. If the table output in the popup has checkboxes at the beginning of the rows (e.g. for multiple selection), the internal table must contain a field containing the value of the checkbox.

Assign the name of this field to the parameter I_CHECKBOX_FIELDNAME.

Q. i_tabname = 'TLINE'

A. This is the name of ur input help internal table

Q. it_fieldcat = fieldcat[]

A The table u gonna display has to have a fieldcat.

Q. it_excluding = extab[].

A. In case u wanna exclude some functions.

Below is a working example, paste it in se38 and activate.

!!! Warning SAVE IT AS A LOCAL OBJECT !!!

report ztests1.

type-pools: slis.

data: index type i.

data: l_kunnr like kna1-kunnr.

data: input(10) type c,

text(4) type c,

text1(5) type c.

data: begin of itab occurs 10,

kunnr like kna1-kunnr,

name1 like kna1-name1,

end of itab.

data: e_exit.

data: fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.

parameter: p_kunnr(10) type c.

at selection-screen on value-request for p_kunnr.

select kunnr name1 up to 10 rows

from kna1

into table itab.

fieldcat-tabname = 'ITAB'.

fieldcat-fieldname = 'KUNNR'.

fieldcat-seltext_m = 'Cust'.

fieldcat-ddictxt = 'M'.

fieldcat-outputlen = 10.

APPEND fieldcat.

CLEAR fieldcat.

fieldcat-tabname = 'ITAB'.

fieldcat-fieldname = 'NAME1'.

fieldcat-seltext_m = 'Cust Name'.

fieldcat-ddictxt = 'M'.

fieldcat-outputlen = 30.

APPEND fieldcat.

CLEAR fieldcat.

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

I_TITLE = 'Customer Selection'

  • I_SELECTION = 'X'

  • I_ALLOW_NO_SELECTION =

  • I_ZEBRA = ' '

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_CHECKBOX_FIELDNAME =

  • I_LINEMARK_FIELDNAME =

  • I_SCROLL_TO_SEL_LINE = 'X'

i_tabname = 'ITAB'

  • I_STRUCTURE_NAME =

IT_FIELDCAT = fieldcat[]

  • IT_EXCLUDING =

  • I_CALLBACK_PROGRAM =

  • I_CALLBACK_USER_COMMAND =

  • IS_PRIVATE =

IMPORTING

  • ES_SELFIELD =

E_EXIT = e_exit

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.