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

Using ALV as a search Help

mike_mcinerney
Participant
0 Likes
686

Has anyone used ALV as a search help presentation/selection method. I'm thinking, in a simplistic sense, it would be just creating an itab and presenting it on a grid in a container on a new screen called by an exit....

Probably too simple, huh? Pointers to any snippets that implement this would be welcome.

(additionally, might have a need to save user layouts of this info as well)

Thoughts, comments, pitfalls.... ?

Thanks...

...Mike

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
660

Once Simple way is to use

'REUSE_ALV_POPUP_TO_SELECT'

And pass the table that you want to serve as search help.

Of course there will be better andf more state of the art methods using OOPS.

A sample that I used:

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.

Rgds

Sameer

Once Simple way is to use

'REUSE_ALV_POPUP_TO_SELECT'

And pass the table that you want to serve as search help.

Of course there will be better andf more state of the art methods using OOPS.

A sample that I used:

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.

Rgds

Sameer

4 REPLIES 4
Read only

Former Member
0 Likes
661

Once Simple way is to use

'REUSE_ALV_POPUP_TO_SELECT'

And pass the table that you want to serve as search help.

Of course there will be better andf more state of the art methods using OOPS.

A sample that I used:

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.

Rgds

Sameer

Read only

Former Member
0 Likes
660

Hey Michael a working example I just made for some1

thought u might be interested

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.

Read only

uwe_schieferstein
Active Contributor
0 Likes
660

Hello Michael

The function module already mentioned is one possibility.

Another approach may be a search help exit. For example, if you run transaction PPST and use the search help for the object id you get a plethora of different search helps.

Regards

Uwe

Read only

mike_mcinerney
Participant
0 Likes
660

Thanks