List box example

hi,
I had made a report in which i have to display the list box option in which there will be 3 options . i had searched about it but i am not able to have examples of it which fulfill my requierment.
Can anybody provide me examples of it as i had never used list box.

Hi,
Here is the steps to create list box....
You can create according to ur need.. i hope this will help u..-
LIST BOX                     
Drop down list box can be created in a dialog screen(SE51) as well as selection screen.
  The sap list box allows to select a value from the list but we cannot enter our own value in the list box .The value list that will be displayed consists of two
fields TEXT field of TYPE 80(C) and internal KEY field of TYPE 40(C).
In screen painter to create a input/output field into list box we use
'L" as a value for dropdown attribute for the i/o field.
In screen painter to determine the type of method that will be used to fill the value
list we use the attribute value list.
If it is blank  the value list will be filled by the first column of the input help assigned to the screen field.This input help can be defined in the ABAP Dictionary, on screen using SELECT,VALUES screen statements or in event POV (PROCESS ON VALUE-REQUEST ) and the input help that will be passed to the field should consists of 2 columns ,the key column is filled automatically by the system.SAP recommends value list field should be blank.
or
The value  can be 'A' meaning that the value list will be filled in the event PBO(PROCESS BEFORE OUTPUT) or before the screen is displayed.In this method we use function module VRM_SET_VALUES to fill the values and pass it to the i/o field.
If a function code is attached to the list box the selection of a value triggers a PAI
otherwise PAI will not trigger.
LIST BOX in SELECTION SCREEN
  List Box is created in selection screen using PARAMETERS staement
with AS LISTBOX addition other attributes like VISIBLE LENGTH (width of listbox)
can be specified with the declaration.
PARAMETERS name(n) AS LISTBOX VISIBLE LENGTH n.
Here n is an integer and name is the name of parameter.
To populate the value list we use the FM VRM_SET_VALUES  and the
selection screen event AT SELECTION-SCREEN OUTPUT is used to write the code to fill it.
VRM_SET_VALUES    
The function module VRM_SET_VALUES is used to fill the value list associated with a List Box .This FM uses types which are declared in type group VRM. So
we should declare TYPE-POOLS VRM before using this FM.
Some important types declared in the VRM type group are
VRM_ID
   It refers to the name of the input/output field associated with list box
VRM_VALUES
  It refers to the internal table consisting of two fields TEXT(80C) and KEY(40)C
that will be used to create the list values.
CALL FUNCTION 'VRM_SET_VALUES'
  EXPORTING
      ID                =  name of screen element ,it is of TYPE VRM_ID
      VALUES      =  internal table containing values,of TYPE VRM_VALUES 
LIST BOX with value list from input help
In this example the screen element attribute value list is set to blank as such the value list will be filled with the 1st column of the input help,We use PROCESS ON VALUE-REQUEST event to pass the value list  to the listbox.In the MODULE call used to fill the value list we can use FM like F4IF_INT_TABLE_VALUE_REQUEST to create input help as explained in the input help.The value of first column will be shown in the field when selected.
PROCESS ON VALUE-REQUEST
FIELD list MODULE fill_list_100
FIELD list MODULE fill_list_100 INPUT
SELECT f1 f2 FROM table INTO int
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
            retfield        = 'input/output screen field'
            value_org       = 'S'
       TABLES
            value_tab       = itab "it contains 2 fields that will be shown in the list box
       EXCEPTIONS
            parameter_error = 1
            no_values_found = 2
            OTHERS          = 3.
  IF sy-subrc <> 0.
ENDIF.
ENDMODULE.
VALUE LIST CREATED IN PBO
In this method we set the value list attribute to 'A'.The value list will be filled in the PBO by using FM VRM_SET_VALUES .
TYPE-POOLS : VRM
DATA : field_id TYPE VRM_ID ,
            values  TYPE VRM_VALUES,
             value   LIKE LINE OF values.
PROCESS BEFORE OUTPUT
MODULE list_fill_100
MODULE list_fill_100 OUTPUT
SELECT f1 f2 f3  FROM tab WHERE condition.
value-KEY = f1.
value-TEXT = f2
APPEND value TO VALUES
CALL FUNCTION 'VRM_SET_VALUES'
       EXPORTING
            id     = 'i/o screen field'
            values = values.
ENDMODULE.
LIST BOX with Selection Screen
For this the FM VRM_SET_VALUES is used to fill the value table and is passed to the parameter created with TYPE LISTBOX in the selection screen event
AT SELECTION-SCREEN.
PROGRAM zlist
TYPE-POOLS : VRM.
DATA: param TYPE vrm_id,
       values     TYPE vrm_values,
       value LIKE LINE OF values.
PARAMETERS: p_name(10) AS LISTBOX VISIBLE LENGTH 10.
AT SELECTION-SCREEN OUTPUT.
  param = 'P_NAME'.
  value-key = '1'.
  value-text = 'JOHN'.
  APPEND value TO values.
  value-key = '2'.
  value-text = 'PETER'.
  APPEND value TO values.
  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING id     = param
              values = values.
Thanks & Regards
Ashu Singh.

Similar Messages

  • Set Default Value  In list box

    Dear All,
                   I am using the F4IF_INT_TABLE_VALUE_REQUEST this FM for filling the list box .Now i want to set  default value in the list box
    Example-
    Supose i have 2 List box  A & B and in list box i have to set default value in A list box X value and in B list box Y value .
    X and Y value is coming in the list box from the master table .
    Thanks & Regards

    Code Snippet for your referance:
    *F4 Help for Output Type
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KSCHL
    DATA: l_repid TYPE syrepid,
            l_dynnr TYPE sydynnr.
      MOVE: sy-repid TO l_repid,
            sy-dynnr TO l_dynnr.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield        = 'KSCHL'
          dynpprog        = l_repid
          dynpnr          = l_dynnr
          dynprofield     = 'P_KSCHL'
          window_title    = text-001
          value_org       = 'S'
        TABLES
          value_tab       = it_value_tab
        EXCEPTIONS
          parameter_error = 1
          no_values_found = 2
          OTHERS          = 3

  • How to capture the selected values from module pool dialog list box !

    Hi experts,
    Can anyone help me out in capturing the values from the list box.
    i am able to set the values in the list box.But i am not able to capture the selected value from the list box. Always the list box name is getting as "space"
    I also tried in using the FM "VRM_GET_VALUES" but it is retireving all the values. Is there is any flag for filttering out the selected value.
    Your inputs are appreciated.
    Thanks,
    Vijay.

    Along with the PBO and PAI event, add a POV event in the flow logic of the screen
    DEMO_DROPDOWN_LIST_BOX -is a good demo example.
    PROCESS ON VALUE-REQUEST.
    FIELD structure_name-field_name MODULE create_dropdown_box.
    In the report :
    MODULE create_dropdown_box INPUT.
      SELECT carrid carrname
                    FROM scarr
                    INTO CORRESPONDING FIELDS OF TABLE itab_carrid.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield        = 'CARRID'
                value_org       = 'S'
           TABLES
                value_tab       = itab_carrid
           EXCEPTIONS
                parameter_error = 1
                no_values_found = 2
                OTHERS          = 3.
      IF sy-subrc <> 0.
      ENDIF.
    ENDMODULE.
    In the layout, assign a Function Code , for eg : 'SELECTED' to the listbox and lets say name of the field is SDYN_CONN-CARRID. So in the PAI module,
    MODULE user_command_0100 INPUT.
      CASE ok_code.
        WHEN 'SELECTED'.
          MESSAGE i888(sabapdocu) WITH sdyn_conn-carrid.
      ENDCASE.
    ENDMODULE.
    sdyb_conn-carrid will contain your selected field

  • How to fill the values in List Box?

    Hi Experts,
    Can anyone explain me how to fill the values in the List Box such that the value should be from the table?
    For Example : Fill the EmpID from table T1 into the ListBox?
    Thanks in Advance,
    Regards,
    Raghu

    hi,
    and u doing it through report means from se38 than here is code...
    DATA : BEGIN OF itab OCCURS 0,
            matnr LIKE mara-matnr,
           END OF itab.
    DATA : ok_code LIKE sy-ucomm.
    CALL SCREEN 0200.
    *&      Module  STATUS_0200  OUTPUT
          text
    MODULE status_0200 OUTPUT.
      SET PF-STATUS 'Z200'.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
          text
    MODULE user_command_0200 INPUT.
      CASE ok_code.
        WHEN 'BACK' OR 'UP' OR 'CANC'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    *&      Module  mat_val  INPUT
          text
    MODULE mat_val INPUT.
      SELECT matnr FROM mara INTO CORRESPONDING FIELDS OF TABLE itab
        WHERE matnr BETWEEN '000000000000000101' AND '000000000000000109'.
        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
            retfield               = 'MATNR'
           VALUE_ORG              = 'S'
          tables
            value_tab              = itab
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    ENDMODULE.                 " mat_val  INPUT
    <b>And this is flow logic..</b>
    PROCESS BEFORE OUTPUT.
      MODULE status_0200.
    PROCESS AFTER INPUT.
      MODULE user_command_0200.
    PROCESS ON VALUE-REQUEST.
      FIELD itab-matnr MODULE mat_val.

  • Multi Selection from a List Box to a Text Box

    So I want to be able to make Multi Selections within List box and export it to the Text box. Right now I have a Script running on the cal of the Text Box
    event.value = getField("LISTBOX").valueAsString;
    Which is able to do one selection but I cant find anybody that can grab two selecitons and put into a text box with commas for something. Is there a way to do this?
    -Zach

    Wow over my head a little. I understand what an array is with script but not how to write the script to handle it. I made this:
    event.value = getField("LISTBOX").value;
    But still no change in the behavior with multi selections. Example below if you want to check it out.
    https://dl.dropboxusercontent.com/u/2944617/formtext2.pdf

  • What is the data type of the value returned by the List box prompt in crystal

    Post Author: Mudit Kothiyal
    CA Forum: Formula
    Hi all,
    I am creating a report which has a list box prompt. When I am selecting a single value from the list box the report is working fine, but when I am selecting multiple values its not returning any data( although data is there). Does anyone know how the prompt values are passed to the report query by the crystal. I kno it passes the value to the report as an array. But how does it pass the value to the report query.
    I am using command query to fetch data from the DB.
    Crystal Report Version: Crystal Report XI R2.
    DB: Oracle 10g
    Also does anyone know how to pass the values of the list box prompt to the report query in comma seperated format.
    Thanks & regards,
    Mudit

    Post Author: rcoleman
    CA Forum: Formula
    In regards to the latter part of your question
    The following examples are applicable to Basic and Crystal syntax.
    The examples assume that list is a String array consisting of the 3 elements: "Chocolate", "Vanilla" and "Strawberry".
    Join (list)
    Returns the String "Chocolate Vanilla Strawberry".
    Join (list, "***")
    Returns the String "Chocolate**Vanilla**Strawberry".
    Not sure about the first part of your question,sorry.

  • How to add text dynamically in  Tree view list box

    CS3/WIN<br />hi,<br />I am new in plugin development.<br />I have a Tree View List box on a dialog.<br />b I don't want to display text when i load the plugin.<br />b I want to insert text data when i click on "Insert" button on dialog. <br />I have defined  Adapter,Mgr,Observer for list box.it is working fine when i want to display data at loading time itself.but not when i click on insert button.<br />b In dialog observer i have defined this but it is not working<br /><br />b Dialog Observer::Update<br /><br />InterfacePtr<IPanelControlData> panelControlData(this, UseDefaultIID());<br />IControlView* Grid = panelControlData->FindWidget(kESSGridTVWidgetID);<br />InterfacePtr<IStringListControlData> listControlData(Grid,UseDefaultIID());<br />if (theSelectedWidget == kESSInsertButtonWidgetID && theChange == kTrueStateMessage) <br />{<br />listControlData->AddString(strText,kESSListBoxTextWidgetID); <br />}<br /><br />b it is showing error  <br />b operator new returning nil for an allocation size of 486022320 bytes<br />(..\..\..\source\components\memoryallocator\PMNew.cpp (552))<br />b Memory allocation failure<br />(c:\development\cobalt\source\public\includes\K2Allocator.h (131))<br />can any one help to get this..<br />Thanks.

    How to populate list in tree view  dynamically
    Hi,
    I am new to  Indesign Plugin creation.
    I want to create list in tree view dynamically.
    I tried wlistboxcomposite sdk sample in indesign cs4.
    I have some doubts in this.
    1. Can i write my own method in  WLBCmpTreeViewAdapter class because it's implements ListTreeViewAdapter
    If it's possible how can i call this method.
    2. In this example they populating static string in constructor like this
    WLBCmpTreeViewAdapter::WLBCmpTreeViewAdapter(IPMUnknown* boss):ListTreeViewAdapter(boss){
    K2Vector<PMString> lists;
    for (int32 i = 0; i< 12; i++){
    PMString name(kWLBCmpItemBaseKey);name.AppendNumber(i+1);name.Translate();lists.push_bac k(name);}
    InterfacePtr<IStringListData> iListData(
    this, IID_ISTRINGLISTDATA);}
    and this list is populating on loading time but my requirement is i have one button "get list" after clicking this button i have to populate the list, how can
    i achieve this.
    Pls do needful.
    Thanks
    Arun

  • How to edit the list box items in labwindow/​CVI?

     how to edit the list box items in labwindow/CVI?

    Listbox items cannot be edited directly in the control: what you can do is to select a line an, transfer its content to a textbox control, edit text there and move text back to the listbox control. Available interactions with the listbox control are listed in the help.
    An alternative to it is to use a tree customized to appear like a listbox: tree item labels can be edited directly in the control, at least those in the base column of the tree. You can look at the example \samples\userint\treelist.cws that shows how a tree can be customized this way. I haven't opened it, but this old example too should show the ability to edit tree cells.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Table control list box. different values in each row of the list box

    Hi all,
    i have a requirement to display text box in table control. Each row of list box should contain different values.
    i tried with the below code  but the values are not getting populated in list  box. please give your ideas.
    I tried with list box which is having same values in all rows, it is working fine.
    loop at itab.
    select vbeln from ZSD_PS_BLAWB into ZSD_PS_BLAWB-vbeln
    where BLAWBNO = itab-BLAWBNO and
    BLAWBDT = itab-BLAWBDT and
    CTRNO = itab-CTRNO.
    if sy-subrc = 0.
    index = 1.
    list3-key = index.
    list3-text = ZSD_PS_BLAWB-vbeln.
    append list3 to list2.
    index = index + 1.
    endif.
    endselect.
    clear index.
    CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
    ID = 'ITAB-VBELN'
    VALUES = list2
    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.
    modify itab.
    endloop.
    Thanks in advance.

    Hi,
    this is code example for listbox
    TYPE-POOLS vrm .
    DATA: lt_vrm_values TYPE TABLE OF vrm_value.
    DATA: wa_vrm_values TYPE vrm_value.
    PARAMETER p_list AS LISTBOX VISIBLE LENGTH 10.
    INITIALIZATION.
      wa_vrm_values-key = 'Key1'.
      wa_vrm_values-text = 'Value1'.
      APPEND wa_vrm_values TO lt_vrm_values.
      wa_vrm_values-key = 'Key2'.
      wa_vrm_values-text = 'Value2'.
      APPEND wa_vrm_values TO lt_vrm_values.
      wa_vrm_values-key = 'Key3'.
      wa_vrm_values-text = 'Value3'.
      APPEND wa_vrm_values TO lt_vrm_values.
    AT SELECTION-SCREEN OUTPUT.
      CALL FUNCTION 'VRM_SET_VALUES'
           EXPORTING
                id              = 'P_LIST'
                values          = lt_vrm_values
           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.
    To fill it with data from DB, just do select in INITIALIZATION and put that values with same alghoritmus.
    Manas M.
    P.S.: This is very easy question, you should use search ...

  • How to submit a multiple-selection list box in an Infopath Sharepoint form as multiple entries on a Sharepoint list?

    I would like to be able to submit an Infopath form with a multiple selection list box in Sharepoint as multiple entries on a Sharepoint list.
    For example, a user has to complete the following fields:
    First Name:
    Last Name:
    Favorite Color (can select more than one):
    [] Blue
    [] Red
    [] Yellow
    [] Green
    If the user picks blue AND red and submits the form, the Sharepoint list would feature TWO entries, both with their first and last names, but with different colors in the "Favorite Color" column.
    Please let me know if there is a way to do this. Any guidance would be helpful!

    Hi redhotc,
    According to your description, my understanding is that you want to set multiple default values for a multiple checkbox list in InfoPath form.
    I did a test with SQL database table. I set three default values for the checkbox list by adding three values field under the group field(Data->Default values), each value field is for a default value. Then publish it to my SharePoint site, everything
    was fine.Please have a try as the below link:
    http://www.bizsupportonline.net/infopath2010/pre-select-items-multiple-selection-list-box-infopath-2010.htm
    Note: if you are using SQL databse table, you may need to enable ‘Allow cross-domain data access for user form templates that use connection settings in a data connection file’ in CA. More information, please refer to:
    http://answers.flyppdevportal.com/categories/sharepoint2010/sharepoint2010customization.aspx?ID=418b9423-a96c-4e5e-91f9-6a1b010ebb69
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Scroll bar error in list box

    Hello all,
    I work for a company using BI 7.0.
    We provide reports in Bex Web 7.0 to our users. They requested us for a problem in list box of selection (or filter).
    for example the user wants to filter on a characteristic. This characteristic has multiple possible values.
    He chooses a value on the first page of the list box. then he wants to select an other value and uses the scroll bar. So he clicks in the gap of the scroll bar in order to go to the next page of values. It happens correctly but we figured out that doing so the new page wasn't exactly the exact next values available.
    Indeed for example the first page displays 10 values (from 1 to 10) so by clicking in the gap we should go to the 10 next values 11 to 20 but it is not what is happening because the displayed values are 13 to 22, so the values 11 and 12 were passed by the scroll bar and we need to do singles click on the scroll bar to display values 11 and 12.
    Does someone have an answer for this issue ?
    Thank you by advance.
    Jérémy

    Thank you for your answer Michael.
    I tried to apply the modification but there was no fix to my problem.
    Here are screenshots to explain my problem :
    Screen 1 = First page
    http://www.monsterup.com/image.php?url=upload/1264688014660.jpg
    Screen 2 = second page
    http://www.monsterup.com/image.php?url=upload/1264688015650.jpg
    Screen 3 = missigne values between fisrt and second page
    http://www.monsterup.com/image.php?url=upload/1264688015672.jpg
    Any other clue ?
    Thanks
    Jérémy

  • Surveys - dynamic list box option

    Hi,
    How can I control the entries for the answer category "Dynamic list box with single selection"?
    Thanks,
    Susana Messias

    Hello Susana,
    To maintain dynamic values for a specific answer, select your survey in the Survey Suite and go to the maintenance of survey attributes (CTRL+F12). Under the tab 'Technical settings', you can maintain the 'Callback to PBO' function module, which allows you to modify the survey at runtime. (The function module you specify here is called by the survey tool runtime environment at PBO.)
    As an example, you can have a look at the function module 'CRM_SVY_EXAMPLE_DYNAMIC_PBO', which contains a section to set answer options at runtime. Of course, you would have to program your own logic to meet your specific requirements for setting the values.
    I hope this helps.
    Kind regards,
    Kristoff

  • Multiple List Box showing Duplicate Options in Existing Form Library forms.

    Good day.  I currently have an InfoPath 2010 form library template that has a view containing 4 multiple selection list boxes.  These list boxes get their values from a hidden view that contains 4 repeating tables in which I've set default values
    for Value and Display name to populate the multiple selection list boxes.
    The issue I am having is this: When adding new options to the repeating tables through the Default Values option window and publish, new forms display the new selection options successfully, while existing forms in the library when opened are displayed duplicates
    of the first default value in the table in the place of the new options. (Example, Create Data[display] - 10[value] is displaying 4 times after adding 3 new options to the characteristics table that contains Create Data as it's first row item.)
    When comparing the .XML of a new form to an existing form, groupX in this case shows all options in the new form .XML, but shows the duplicates in the .XML of an existing .XML file.
    Is there a way to resolve this issue so that existing documents will display the proper selection options instead of the duplicates?  I'd like to note that another list box had a value added and it displayed the value properly when published in both
    new and existing forms.
    Thanks!

    Hi Hemendra:
    There are no rules on Section A.
    Two out of three forms used so far by the users have these problems.
    We did extensive trending study on all the submitted forms on both where the submit was successful and ones with Section A frozen up. Also, requested a user to submit a few forms per our instructions on different browsers.  Even though there are some
    forms in the past which could be claimed as success has some attachment uploaded to the Section A of the form, currently every time an attempt by any usetr to attach a smallest document the section A, it wipes out all the existing completed fields and freezes
    up all the rest of the controls of that section and not any other part of the form.
    Thanks,
    SRA
    SRAEngineer

  • In ALV  list box

    How to set the List box to the field in ALV Grid/List display.

    If you don't have a newer version, then you won't have this program.  I copied it out of my 6.40 engine into my 46c system and modified it, so that you don't have to create a screen.  Just copy/paste the code in SE38.  It will show you what you need to do.  If you don't have any flight data in your system run program SAPBC_TOOLS_GENERATOR_NEW
    report zrich_0003 .
    * Purpose:
    * ~~~~~~~~
    * This example shows how to define a dropdown listbox for all cells
    * of one column in an editable ALV Grid Control.
    * To check program behavior
    * ~~~~~~~~~~~~~~~~~~~~~~~~~
    * Klick on the dropdown button of column 'WUNIT'. It shows
    * 'KG' and 'G' as suitable units for luggage weight.
    * (The standard F4-Help shows many other units that does not
    * make sense in this context).
    * Essential steps (search for '§')
    * ~~~~~~~~~~~~~~~
    * 1.Define a dropdown table and pass it to ALV.
    * 2.Set status of column WUNIT to editable and set a dropdown handle.
    data: ok_code like sy-ucomm,
          save_ok like sy-ucomm,
          g_container type scrfname value 'BCALV_GRID_DEMO_0100_CONT1',
          g_docking type ref to cl_gui_docking_container,
          g_grid  type ref to cl_gui_alv_grid,
          g_custom_container type ref to cl_gui_custom_container,
          gt_fieldcat type lvc_t_fcat,
          gs_layout type lvc_s_layo,
          g_max type i value 100.
    data: gt_outtab type table of sbook.
    data: repid type sy-repid.
    parameters: p_check.
    at selection-screen output.
      repid = sy-repid.
      create object g_docking
                  exporting repid     = repid
                            dynnr     = sy-dynnr
                            side      = g_docking->dock_at_left
                            extension = 1700.
      if g_custom_container is initial.
        perform create_and_init_alv changing gt_outtab
                                             gt_fieldcat.
      endif.
    *&      Form  BUILD_FIELDCAT
    form build_fieldcat changing pt_fieldcat type lvc_t_fcat.
      data ls_fcat type lvc_s_fcat.
      call function 'LVC_FIELDCATALOG_MERGE'
           exporting
                i_structure_name = 'SBOOK'
           changing
                ct_fieldcat      = pt_fieldcat.
      loop at pt_fieldcat into ls_fcat.
        if    ls_fcat-fieldname eq 'WUNIT'.
    *§2.Set status of column WUNIT to editable and set a dropdown handle.
          ls_fcat-edit = 'X'.
          ls_fcat-drdn_hndl = '1'.
          ls_fcat-outputlen = 7.
    * Field 'checktable' is set to avoid shortdumps that are caused
    * by inconsistend data in check tables. You may comment this out
    * when the test data of the flight model is consistent in your system.
          ls_fcat-checktable = '!'.        "do not check foreign keys
          modify pt_fieldcat from ls_fcat.
        endif.
      endloop.
    endform.
    *&      Form  CREATE_AND_INIT_ALV
    form create_and_init_alv changing pt_outtab like gt_outtab[]
                                      pt_fieldcat type lvc_t_fcat.
      data: lt_exclude type ui_functions,
            lt_f4 type lvc_t_f4 with header line.
      create object g_grid
             exporting i_parent = g_docking.
    * Build fieldcat and set column WUNIT
    * edit enabled. Assign a handle for the dropdown listbox.
      perform build_fieldcat changing pt_fieldcat.
    * Optionally restrict generic functions to 'change only'.
    *   (The user shall not be able to add new lines).
      perform exclude_tb_functions changing lt_exclude.
    * Define a drop down table.
      perform set_drdn_table.
      select * from sbook into table pt_outtab up to g_max rows.
                                                           "#EC  ci_nowhere
      if sy-subrc ne 0.
    * generate own entries if database table is empty
        perform generate_entries changing pt_outtab.
      endif.
      call method g_grid->set_table_for_first_display
           exporting it_toolbar_excluding  = lt_exclude
           changing  it_fieldcatalog       = pt_fieldcat
                     it_outtab             = pt_outtab.
    * Set editable cells to ready for input initially
      call method g_grid->set_ready_for_input
       exporting
        i_ready_for_input = 1.
      clear lt_f4.
      lt_f4-fieldname = 'WUNIT'.
      lt_f4-register = 'X'.
      append lt_f4.
    endform.
    *&      Form  EXCLUDE_TB_FUNCTIONS
    form exclude_tb_functions changing pt_exclude type ui_functions.
    * Only allow to change data not to create new entries (exclude
    * generic functions).
      data ls_exclude type ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
      append ls_exclude to pt_exclude.
    endform.
    *&      Form  set_drdn_table
    form set_drdn_table.
    *§1.Define a dropdown table and pass it to ALV.
    *   One listbox is referenced by a handle, e.g., '1'.
    *   For each entry that shall appear in this listbox
    *   you have to append a line to the dropdown table
    *   with handle '1'.
    *   This handle can be assigned to several columns
    *   of the output table using the field catalog.
      data: lt_dropdown type lvc_t_drop,
            ls_dropdown type lvc_s_drop.
    * First listbox (handle '1').
      ls_dropdown-handle = '1'.
      ls_dropdown-value = 'KG'.
      append ls_dropdown to lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = 'G'.
      append ls_dropdown to lt_dropdown.
      call method g_grid->set_drop_down_table
                exporting it_drop_down = lt_dropdown.
    endform.
    *&      Form  generate_entries
    form generate_entries changing pt_sbook type standard table.
    * This form is only needed if database table sbook is empty.
    * It generates some entries so that you may
    * still try out this example program.
      data: ls_sbook type sbook,
            l_month(2) type c,
            l_day(2) type c,
            l_date(8) type c,
         l_prebookid type i.
      ls_sbook-carrid = 'LH'.
      ls_sbook-connid = '0400'.
      ls_sbook-forcurkey = 'DEM'.
      ls_sbook-loccurkey = 'USD'.
      ls_sbook-custtype = 'B'.
      do 110 times.
        l_prebookid = sy-index.
        ls_sbook-forcuram = sy-index * 10.
        ls_sbook-loccuram = ls_sbook-loccuram * 2.
        ls_sbook-customid = sy-index.
        ls_sbook-counter = 18.
        ls_sbook-agencynum = 11.
        l_month = sy-index / 10 + 1.
        do 2 times.
          l_day = 3 + l_month + sy-index * 2.
          l_date+0(4) = '2000'.
          l_date+4(2) = l_month.
          l_date+6(2) = l_day.
          ls_sbook-fldate = l_date.
          subtract 3 from l_day.
          ls_sbook-order_date+0(6) = l_date+0(6).
          ls_sbook-order_date+6(2) = l_day.
          ls_sbook-bookid = l_prebookid * 2 + sy-index.
          if sy-index eq 1.
            ls_sbook-smoker = 'X'.
          else.
            ls_sbook-smoker = space.
          endif.
          ls_sbook-luggweight = l_prebookid * 10.
          if ls_sbook-luggweight ge 1000.
            ls_sbook-wunit = 'G'.
            ls_sbook-class = 'C'.
          else.
            ls_sbook-wunit = 'KG'.
            ls_sbook-class = 'Y'.
          endif.
          if ls_sbook-bookid > 40 and ls_sbook-wunit eq 'KG'.
            ls_sbook-invoice = 'X'.
          endif.
          if ls_sbook-bookid eq 2.
            ls_sbook-cancelled = 'X'.
            ls_sbook-class = 'F'.
          endif.
          append ls_sbook to pt_sbook.
        enddo.
      enddo.
    endform.
    Please make sure to award points for helpful answers and mark your post as solved when you problem is solved. THanks.
    Regards,
    Rich Heilman

  • List Box Problem In MODULE POOL PROGRAM(EDIT MODE)

    I Have Developed A MODULE POOL PROGRAM ,
    It Basically Consists Of   CREATE  EDIT and DISPLAY Modes.
    CREATE MODE:
    When I am Creating For Example FORM NO 1,it is having Fields With drop down list box with values
    A,B and C. if I Choose A then That form will Get Created With A value and Form 1 will be created.
    EDIT MODE:
    The same form If u want to edit In EDIT Mode ,it is displaying value A and it Showing the list box in the fillowing Manner.A,B,C,and A.(This is what the problem I am Facing Know).It Is Displaying the value two times.How to Avoid this ,PLs Help me in this regard.
    Thaks & Regards,
    Anuradha.

    Where ever you are populating the List Box, write a REFRESH statement just before that.
    Means Refresh the old content and add new content

Maybe you are looking for

  • How to Add New Domain To Available Domans List Under General Parameters

    On the SMTP Inbound Server configuration page how does one add a domain to the list of local available domains? It appears to only give me a choice of my current domain and then a "com" domain.

  • With iPad 2 I can use Messages to text other iPhone users, but not others.

    With iPad 2 I can use Messages to text other iPhone users, but when I try others I get the big red x on the contact. I have upgrade to Iso 6. According to the help on Messages, it should have the capability to text outside Apple Products

  • Business process of AP &AP\R

    Hi All, Can anybody explain me the Generall business process of Ap &AR 1)what is Business process? 2)please explain me General business process of Accounts Payable and Accounts Recivable? Thanks in Advance Regards, Chandu.

  • Swf playback controls not working correctly

    Hello all - When I publish the Captivate project that contains a swf file and an audio file everything plays well until I use the controls. Stop/pause works fine,but when I use rewind or ff etc the swf file will not rewind nor start over. Any help wo

  • How many minutes can fit on a red laser "high def" dvd?

    using the share feature in FCP7 and making the "bluray" (avchd) dvd but on a standard 4.7 dvd, how many minutes of footage can I burn? What about a double layer 8.5gb DVD??