Skip to Content
author's profile photo Former Member
Former Member

Selecting single line in the function module "REUSE_ALV_POPUP_TO_SELECT"

Hi,

I am using the function module REUSE_ALV_POPUP_TO_SELECT to display the data for selection.Using this any no. of data records can be selected.

However i want that only one line should be selected.

How can i do this?

thanks,

vartika

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Nov 20, 2007 at 08:01 AM

    Hi Vartika,

    I think you can use another FM for your requirement. But if you wish to use the FM, you can do as below.

    DATA l_line TYPE i VALUE 2.

    WHILE l_line <> 1.

    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'.

    EXPORTING

    E_EXIT = l_exit

    TABLES

    T_OUTTAB = t_out.

    IF l_exit IS INITIAL.

    l_line = LINES( t_out[] ). "Check the number of records selected

    ELSE.

    l_line = 1. "If user cancel the selection

    ENDIF.

    ENDWHILE.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 20, 2007 at 07:57 AM

    REPORT.

    TYPE-POOLS: SLIS. TYPE: SLIS.

    TYPES: BEGIN OF TY_DATEN. TYPES: BEGIN OF TY_DATEN.

    INCLUDE STRUCTURE DD04T. INCLUDE STRUCTURE DD04T.

    TYPES: CHECKBOX(1) TYPE C, TYPES: CHECKBOX (1) TYPE C,

    END OF TY_DATEN. END OF TY_DATEN.

    DATA: T_DATEN TYPE STANDARD TABLE OF TY_DATEN DATA: T_DATEN TYPE STANDARD TABLE OF TY_DATEN

    WITH NON-UNIQUE DEFAULT KEY, WITH NON-UNIQUE DEFAULT KEY,

    WA_DATEN LIKE LINE OF T_DATEN, WA_DATEN LIKE LINE OF T_DATEN,

    ES_SELFIELD TYPE SLIS_SELFIELD, ES_SELFIELD TYPE SLIS_SELFIELD,

    E_EXIT TYPE FLAG. E_EXIT TYPE FLAG.

    END-OF-SELECTION. END.

    • Demodaten aufbauen * Demo build data

    SELECT * UP TO 100 ROWS * SELECT UP TO 100 ROWS

    INTO CORRESPONDING FIELDS OF TABLE T_DATEN INTO CORRESPONDING FIELDS OF TABLE T_DATEN

    FROM DD04T FROM DD04T

    WHERE ROLLNAME LIKE 'ROL%'. WHERE ROLLNAME LIKE '% ROL'.

    • Ausgabe * Issue

    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT' FUNCTION CALL 'REUSE_ALV_POPUP_TO_SELECT'

    EXPORTING EXPORTING

    • I_TITLE = * I_TITLE =

    I_SELECTION = 'X' I_SELECTION = 'X'

    • I_ZEBRA = ' ' * I_ZEBRA = ''

    • I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0 * I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0 * I_SCREEN_END_LINE = 0

    • i_checkbox_fieldname = 'CHECKBOX' * I_checkbox_fieldname = 'CHECKBOX'

    • I_LINEMARK_FIELDNAME = * I_LINEMARK_FIELDNAME =

    • I_SCROLL_TO_SEL_LINE = 'X' * I_SCROLL_TO_SEL_LINE = 'X'

    I_TABNAME = 'T_DATEN' I_TABNAME = 'T_DATEN'

    I_STRUCTURE_NAME = 'DD04T' I_STRUCTURE_NAME = 'DD04T'

    • IT_FIELDCAT = * IT_FIELDCAT =

    • IT_EXCLUDING = * IT_EXCLUDING =

    • I_CALLBACK_PROGRAM = * I_CALLBACK_PROGRAM =

    • I_CALLBACK_USER_COMMAND = * I_CALLBACK_USER_COMMAND =

    IMPORTING IMPORTING

    ES_SELFIELD = ES_SELFIELD ES_SELFIELD = ES_SELFIELD

    E_EXIT = E_EXIT E_EXIT = E_EXIT

    TABLES TABLES

    T_OUTTAB = T_DATEN T_OUTTAB = T_DATEN

    EXCEPTIONS EXCEPTIONS

    PROGRAM_ERROR = 1 PROGRAM_ERROR = 1

    OTHERS = 2. OTHERS = 2

    IF E_EXIT = 'X'. IF E_EXIT = 'X'.

    WRITE:/ 'Keine Auswahl durch Benutzer'. WRITE: / 'No selection by users'.

    ELSE. ELSE.

    WRITE:/ 'Benutzer hat Zeile', WRITE: / 'user has line',

    ES_SELFIELD-TABINDEX,'gewählt'. ES_SELFIELD-TABINDEX, 'elected'.

    READ TABLE T_DATEN INTO WA_DATEN INDEX ES_SELFIELD-TABINDEX. READ TABLE T_DATEN INTO WA_DATEN INDEX ES_SELFIELD-TABINDEX.

    IF SY-SUBRC = 0. IF SY - SUBRC = 0

    WRITE:/ 'Datenelement:',AT 20 WA_DATEN-ROLLNAME, WRITE: / 'data element:' AT 20 WA_DATEN-ROLLNAME,

    / 'Sprache:',AT 20 WA_DATEN-DDLANGUAGE, / 'Language', AT 20 WA_DATEN-DDLANGUAGE,

    / 'Kurzbeschreibung:', AT 20 WA_DATEN-DDTEXT, / 'Brief description:' AT 20 WA_DATEN-DDTEXT,

    / 'Bezeichner:', / 'Identifiers',

    AT 20 WA_DATEN-REPTEXT, AT 20 WA_DATEN-REPTEXT,

    /20 WA_DATEN-SCRTEXT_S, / 20 WA_DATEN-SCRTEXT_S,

    /20 WA_DATEN-SCRTEXT_M, / 20 WA_DATEN-SCRTEXT_M,

    /20 WA_DATEN-SCRTEXT_L. / 20 WA_DATEN-SCRTEXT_L.

    ENDIF. ENDIF.

    ENDIF. ENDIF.</b>

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 20, 2007 at 07:58 AM

    first alv line click. get that line key filed .

    and pass thought select field. REUSE_ALV_POPUP_TO_SELECT.

    refer this code.

    data: fs_fieldcat type slis_t_fieldcat_alv.

    DATA: W_NAME LIKE SY-REPID.

    data: fs_layout type slis_layout_alv.

    DATA: BEGIN OF FS_TAB,

    CARRID TYPE SPFLI-CARRID,

    CONNID TYPE SPFLI-CONNID,

    END OF FS_TAB.

    DATA: T_TAB LIKE STANDARD TABLE OF FS_TAB.

    DATA: BEGIN OF FS_TAB1,

    CARRID TYPE SFLIGHT-CARRID,

    CONNID TYPE SFLIGHT-CONNID,

    FLDATE TYPE SFLIGHT-FLDATE,

    END OF FS_TAB1.

    DATA: T_TAB1 LIKE STANDARD TABLE OF FS_TAB1.

    DATA: BEGIN OF FS_SPFLI,

    ROW(4),

    BOX(1),

    CARRID TYPE SPFLI-CARRID,

    CONNID TYPE SPFLI-CONNID,

    COUNTRYFR TYPE SPFLI-COUNTRYFR,

    CITYFROM TYPE SPFLI-CITYFROM,

    AIRPFROM TYPE SPFLI-AIRPFROM,

    COUNTRYTO TYPE SPFLI-COUNTRYTO,

    CITYTO TYPE SPFLI-CITYTO,

    AIRPTO TYPE SPFLI-AIRPTO,

    FLTIME TYPE SPFLI-FLTIME,

    DEPTIME TYPE SPFLI-DEPTIME,

    ARRTIME TYPE SPFLI-ARRTIME,

    DISTANCE TYPE SPFLI-DISTANCE,

    DISTID TYPE SPFLI-DISTID,

    FLTYPE TYPE SPFLI-FLTYPE,

    PERIOD TYPE SPFLI-PERIOD,

    END OF FS_SPFLI.

    DATA: T_SPFLI LIKE

    STANDARD TABLE

    OF FS_SPFLI.

    DATA: BEGIN OF FS_SFLIGHT,

    ROW(4),

    BOX(1),

    CARRID TYPE SFLIGHT-CARRID,

    CONNID TYPE SFLIGHT-CONNID,

    FLDATE TYPE SFLIGHT-FLDATE,

    PLANETYPE TYPE SFLIGHT-PLANETYPE,

    SEATSMAX TYPE SFLIGHT-SEATSMAX,

    SEATSOCC TYPE SFLIGHT-SEATSOCC,

    PAYMENTSUM TYPE SFLIGHT-PAYMENTSUM,

    SEATSMAX_B TYPE SFLIGHT-SEATSMAX_B,

    SEATSOCC_B TYPE SFLIGHT-SEATSOCC_B,

    SEATSMAX_F TYPE SFLIGHT-SEATSMAX_F,

    SEATSOCC_F TYPE SFLIGHT-SEATSOCC_F,

    END OF FS_SFLIGHT.

    data: t_sflight like

    standard table

    of fs_sflight.

    DATA: T_SBOOK LIKE

    SBOOK OCCURS 0 WITH HEADER LINE.

    FS_LAYOUT-BOX_FIELDNAME = 'BOX'.

    FS_LAYOUT-INFO_FIELDNAME = 'ROW'.

    SELECT *

    FROM SPFLI

    INTO CORRESPONDING FIELDS OF TABLE T_SPFLI.

    W_NAME = SY-REPID.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE = ' '

    I_CALLBACK_PROGRAM = W_NAME

    I_CALLBACK_PF_STATUS_SET = 'DEMO'

    I_CALLBACK_USER_COMMAND = 'SEC_LIST'

    I_STRUCTURE_NAME = 'SPFLI'

    IS_LAYOUT = FS_LAYOUT

    • IT_FIELDCAT =

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    • I_SAVE = ' '

    • IS_VARIANT =

    • IT_EVENTS = FS_EVENT

    • 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

    • IR_SALV_LIST_ADAPTER =

    • IT_EXCEPT_QINFO =

    • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    T_OUTTAB = T_SPFLI

    • 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. " IF SY-SUBRC <> 0.

    FORM DEMO USING TAB TYPE SLIS_T_EXTAB.

    SET PF-STATUS 'STATUS' .

    ENDFORM. " FORM DEMO

    FORM SEC_LIST USING UCOMM LIKE SY-UCOMM

    SELFIELD TYPE SLIS_SELFIELD.

    READ TABLE T_SPFLI INDEX SELFIELD-TABINDEX INTO FS_SPFLI.

    LOOP AT T_SPFLI INTO FS_SPFLI.

    IF FS_SPFLI-BOX = 'X'.

    MOVE FS_SPFLI-CARRID TO FS_TAB-CARRID.

    MOVE FS_SPFLI-CONNID TO FS_TAB-CONNID.

    APPEND FS_TAB TO T_TAB.

    FS_SPFLI-ROW = 'C610'.

    FS_SPFLI-BOX = '0'.

    MODIFY T_SPFLI FROM FS_SPFLI TRANSPORTING ROW BOX.

    ENDIF. " IF FS_SPFLI-BOX = 'X'.

    ENDLOOP. " LOOP AT T_SPFLI

    IF T_TAB IS INITIAL.

    MESSAGE 'POSITION ON CHECK BOX ' TYPE 'E'.

    ENDIF.

    SELFIELD-REFRESH = 'X'.

    select carrid

    connid

    fldate

    planetype

    seatsmax

    seatsocc

    seatsmax_b

    seatsocc_b

    seatsmax_f

    seatsocc_f

    paymentsum "up to 100 rows

    from sflight

    into corresponding fields of table t_sflight

    FOR ALL ENTRIES IN T_TAB

    WHERE CARRID EQ T_TAB-CARRID

    AND CONNID EQ T_TAB-CONNID.

    REFRESH T_TAB.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE = ' '

    I_CALLBACK_PROGRAM = W_NAME

    I_CALLBACK_PF_STATUS_SET = 'DEMO2'

    I_CALLBACK_USER_COMMAND = 'THIRD_LIST'

    I_STRUCTURE_NAME = 'SFLIGHT'

    IS_LAYOUT = fs_layout

    • IT_FIELDCAT = fs_fieldcat

    • 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

    • IR_SALV_LIST_ADAPTER =

    • IT_EXCEPT_QINFO =

    • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    T_OUTTAB = t_sflight

    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. " IF SY-SUBRC <> 0.

    ENDFORM. " LIST_SECOND

    FORM DEMO2 USING TAB TYPE SLIS_T_EXTAB.

    SET PF-STATUS 'STATUS1' .

    ENDFORM. " DEMO2

    FORM THIRD_LIST USING UCOMM1 LIKE SY-UCOMM

    SELFIELD TYPE SLIS_SELFIELD.

    READ TABLE T_SFLIGHT INDEX SELFIELD-TABINDEX INTO FS_SFLIGHT.

    LOOP AT T_SFLIGHT INTO FS_SFLIGHT.

    IF FS_SFLIGHT-BOX = 'X'.

    MOVE FS_SFLIGHT-CARRID TO FS_TAB1-CARRID.

    MOVE FS_SFLIGHT-CONNID TO FS_TAB1-CONNID.

    MOVE FS_SFLIGHT-FLDATE TO FS_TAB1-FLDATE.

    APPEND FS_TAB1 TO T_TAB1.

    FS_SFLIGHT-ROW = 'C610'.

    FS_SFLIGHT-BOX = '0'.

    MODIFY T_SFLIGHT FROM FS_SFLIGHT TRANSPORTING ROW BOX.

    ENDIF. " IF FS_SFLIGHT-BOX = 'X'.

    ENDLOOP. " LOOP AT T_SFLIGHT...

    IF T_TAB1 IS INITIAL.

    MESSAGE 'POSITION ON CHECK BOX ' TYPE 'E'.

    ENDIF.

    SELFIELD-REFRESH = 'X'.

    SELECT *

    FROM SBOOK

    INTO CORRESPONDING FIELDS OF TABLE T_SBOOK

    FOR ALL ENTRIES IN T_TAB1

    WHERE CARRID EQ T_TAB1-CARRID

    AND CONNID EQ T_TAB1-CONNID

    AND FLDATE EQ T_TAB1-FLDATE.

    REFRESH T_TAB1.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE = ' '

    • I_CALLBACK_PROGRAM = ' '

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    I_STRUCTURE_NAME = 'SBOOK'

    • IS_LAYOUT = FS_LAYOUT

    • IT_FIELDCAT =

    • 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

    • IR_SALV_LIST_ADAPTER =

    • IT_EXCEPT_QINFO =

    • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    T_OUTTAB = T_SBOOK

    • 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. " IF SY-SUBRC <> 0.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.