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: 

REUSE_ALV_POPUP_TO_SELECT replacement?

Former Member
0 Kudos
134

I wrote the following code, but it seams such a tedious way to just get a personalized popup to select. Is there a more elegant way or SAP standard methods existing?

&----


*& Form FM_ZLGTP_F4

&----


FORM FM_ZLGTP_F4.

TYPES: BEGIN OF TP_POPUP,

LGNUM TYPE LGNUM,

ZLGTP TYPE ZLGTP.

TYPES: END OF TP_POPUP.

DATA LT_POPUP TYPE TABLE OF TP_POPUP.

DATA LS_POPUP LIKE LINE OF LT_POPUP.

*

DATA L_REPID LIKE SY-REPID VALUE SY-REPID.

DATA LS_SELFIELD TYPE SLIS_SELFIELD.

DATA LT_FCAT TYPE SLIS_T_FIELDCAT_ALV. " LVC_T_FCAT.

DATA LS_FCAT LIKE LINE OF LT_FCAT.

DATA L_ATINN TYPE CAWN-ATINN.

*

REFRESH LT_POPUP.

IF GD_LGNUM CO ' '.

GET PARAMETER ID 'LGN' FIELD GD_LGNUM.

ENDIF.

SELECT DISTINCT LGNUM ZLGTP

INTO CORRESPONDING FIELDS OF TABLE LT_POPUP

FROM ZELOAD_CASE

WHERE LGNUM EQ GD_LGNUM

ORDER BY ZLGTP.

CHECK LINES( LT_POPUP ) GT 0.

*

IF LINES( LT_FCAT ) LE 0.

LS_FCAT-FIELDNAME = 'LGNUM'.

LS_FCAT-ROLLNAME = 'LGNUM'.

LS_FCAT-SELTEXT_S = 'Whse No.'.

LS_FCAT-SELTEXT_L = 'Warehouse Number'.

APPEND LS_FCAT TO LT_FCAT.

CLEAR LS_FCAT.

*

LS_FCAT-FIELDNAME = 'ZLGTP'.

LS_FCAT-ROLLNAME = 'ZLGTP'.

LS_FCAT-SELTEXT_S = 'ExportType'.

LS_FCAT-SELTEXT_L = 'Export Type'.

APPEND LS_FCAT TO LT_FCAT.

CLEAR LS_FCAT.

ENDIF.

*

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

I_TITLE = 'Select Destination'

I_TABNAME = 'LT_POPUP'

IT_FIELDCAT = LT_FCAT

I_CALLBACK_PROGRAM = L_REPID

IMPORTING

ES_SELFIELD = LS_SELFIELD

TABLES

T_OUTTAB = LT_POPUP.

IF SY-SUBRC = 0.

READ TABLE LT_POPUP INTO LS_POPUP

INDEX LS_SELFIELD-TABINDEX.

IF SY-SUBRC = 0.

MOVE LS_POPUP-ZLGTP TO GD_ZLGTP.

ENDIF.

ENDIF.

ENDFORM. " FM_ZLGTP_F4

*

1 ACCEPTED SOLUTION

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos
65

Try POPUP_TO_DECIDE_LIST

2 REPLIES 2

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos
66

Try POPUP_TO_DECIDE_LIST

0 Kudos
65

Not really what I'm looking for, but thanks for your reply Sandeep