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

Regarding List Box

hi

experts..

can any one give a simple example for using of list box in a report..

thanks

Spandana

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 30, 2008 at 07:00 AM

    hi

    chk this thread:

    problem in dropdown list display in module pool

    check the sample program

    DEMO_DYNPRO_DROPDOWN_LISTBOX.

    regards,

    madhumitha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 30, 2008 at 07:05 AM

    DEMO_DYNPRO_DROPDOWN_LISTBOX it is for screen program

    and code below is for report program

    type-pools: vrm.

    data: name type vrm_id,

    list type vrm_values,

    value like line of list.

    data : v_temp type werks.

    types : begin of t_werks,

    werks type werks,

    end of t_werks.

    data : wa_t001w type t001w.

    data : wa_werks type t_werks.

    data : it_werks type standard table of t_werks.

    parameters: p_werks type werks as listbox visible length 50 obligatory.

    parameters : p_obj1 as listbox visible length 100 obligatory default 'B'.

    data p(4) type c value 0.

    at selection-screen output .

    clear list .

    refresh list .

    name = 'P_WERKS'.

    select werks from t001w into table it_werks.

    loop at it_werks into wa_werks.

    p = p + 1.

    value-key = p.

    value-text = wa_werks-werks.

    append value to list .

    endloop.

    call function 'VRM_SET_VALUES'

    exporting

    id = name

    values = list.

    name = 'P_OBJ1'.

    clear list .

    refresh list .

    value-key = 'A'.

    value-text = 'Object A'.

    append value to list .

    value-key = 'B'.

    value-text = 'Object B'.

    append value to list .

    call function 'VRM_SET_VALUES'

    exporting

    id = name

    values = list

    exceptions

    id_illegal_name = 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.

    start-of-selection.

    set pf-status 'Z11_AP_CONTEXTMENU'.

    loop at it_werks into wa_werks.

    write:/ wa_werks.

    endloop.

    at user-command.

    case sy-ucomm.

    when 'PLANT'.

    select name1 from t001w into wa_t001w-name1 where werks = v_temp.

    write:/ wa_t001w-name1.

    endselect.

    when 'CANCEL'.

    leave program.

    endcase.

    &----


    *& Form on_ctmenu_request

    &----


    • text

    ----


    • -->L_MENU text

    ----


    form on_ctmenu_request using l_menu type ref to cl_ctmenu.

    data lin type i.

    get cursor line lin value v_temp.

    if sy-lsind = 0.

    call method l_menu->add_function

    exporting

    fcode = 'PLANT'

    text = 'PLANT'.

    endif.

    call method l_menu->add_function

    exporting

    fcode = 'CANCEL'

    text = 'CANCEL'.

    endform. "on_ctmenu_request

    demo program RSDEMO_DROPDOWN_LISTBOX is also for report program

    reward if helpful

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 30, 2008 at 07:17 AM

    Hi

    Try the following code.

    REPORT abc.
    
    TYPE-POOLS : VRM.
    
    DATA : LIST TYPE VRM_VALUES,
           VALUE LIKE LINE OF LIST.
    
    PARAMETERS: para(12) AS LISTBOX VISIBLE LENGTH 10 OBLIGATORY.
    
    INITIALIZATION.
    
      VALUE-KEY = '1'.
      VALUE-TEXT = 'Annual'.
      APPEND VALUE TO LIST.
      VALUE-KEY = '2'.
      VALUE-TEXT = 'Quaterly'.
      APPEND VALUE TO LIST.
      VALUE-KEY = '3'.
      VALUE-TEXT = 'Monthly'.
      APPEND VALUE TO LIST.
      CLEAR value.
      CALL FUNCTION 'VRM_SET_VALUES'
           EXPORTING
                ID              = 'PARA'
                VALUES          = LIST.
    
      START-OF-SELECTION.
    
       READ TABLE LIST INTO VALUE WITH KEY key = para.
       para = VALUE-text.
    
    write para.

    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.