<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Listbox in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/listbox/m-p/4164655#M995660</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;STRONG&gt;Euclides Lopez&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the following code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*----------------------------------------------------------------------*
* Type pool declarations                                               *
*----------------------------------------------------------------------*
TYPE-POOLS:
  slis,                                " Global types for generic list
  vrm.                                 " Value Request Manager
*----------------------------------------------------------------------*
* Tables declaration                                                   *
*----------------------------------------------------------------------*
TABLES:
  ekko.                                " Purchasing Document Header
*----------------------------------------------------------------------*
* Field strings declaration                                            *
*----------------------------------------------------------------------*
DATA:
  fs_event    TYPE slis_alv_event,     " Used to trigger top-of-page
* To capture return values of ZWOODWARDPO function module
  fs_return   TYPE bapiret2,
* To fill fieldcatlog
  fs_fieldcat TYPE LINE OF slis_t_fieldcat_alv.

*----------------------------------------------------------------------*
* Internal tables declaration                                          *
*----------------------------------------------------------------------*
DATA:
* To hold the purchase order related data
  t_podata    TYPE STANDARD TABLE
                OF zwoodwardpo,
* To hold event names for ALV list display
  t_events    TYPE slis_t_event,
* To hold field catlog information
  t_fieldcat  TYPE slis_t_fieldcat_alv,
  t_materials TYPE STANDARD TABLE      " To hold material numbers
                OF zmaterialnum,
  t_phierars  TYPE STANDARD TABLE      " To hold product hierarchies
                OF zphierarchy,
  t_accounts  TYPE vrm_values.         " To hold bank accounts

*----------------------------------------------------------------------*
* Constants                                                            *
*----------------------------------------------------------------------*
CONSTANTS:
  c_msgtyp_e    TYPE bapiret2-type
               VALUE 'E',              " Message type   : E
  c_msgtyp_s    TYPE bapiret2-type
               VALUE 'S',              " Message type   : S
  c_tabname     LIKE fs_fieldcat-tabname
               VALUE 'T_PODATA',       " Table name     : T_PODATA
  c_onli        TYPE sy-ucomm
               VALUE 'ONLI',           " Function code  : ONLI
  c_bacc_a      TYPE c
               VALUE 'A',              " Baccount account : A
  c_bacc_b      TYPE c
               VALUE 'B',              " Baccount account : B
  c_bacc_c      TYPE c
               VALUE 'C'.              " Baccount account : C


PARAMETERS:
  p_bacc  TYPE char35                  " Bank account
            AS LISTBOX VISIBLE LENGTH 30
            LOWER CASE.

*----------------------------------------------------------------------*
*            AT SELECTION-SCREEN ON VALUE-REQUEST                      *
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bacc.
  PERFORM fill_accounts.
  PERFORM display_accounts.

*----------------------------------------------------------------------*
* FORM FILL_ACCOUNTS                                                   *
*----------------------------------------------------------------------*
* This subroutine is used to fill accounts for the drop down facility  *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine.   *
*----------------------------------------------------------------------*
FORM fill_accounts .

  DATA:
* Field string to fill bank accounts
    lfs_accounts TYPE LINE OF vrm_values.

  REFRESH t_accounts.

  lfs_accounts-key = c_bacc_a.
  lfs_accounts-text = text-baa.
  APPEND lfs_accounts TO t_accounts.

  lfs_accounts-key = c_bacc_b.
  lfs_accounts-text = text-bab.
  APPEND lfs_accounts TO t_accounts.

  lfs_accounts-key = c_bacc_c.
  lfs_accounts-text = text-bac.
  APPEND lfs_accounts TO t_accounts.

ENDFORM.                               " FILL_ACCOUNTS

*----------------------------------------------------------------------*
* FORM DISPLAY_ACCOUNTS                                                *
*----------------------------------------------------------------------*
* This subroutine is used to display list box in Bank account field.   *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine.   *
*----------------------------------------------------------------------*
FORM display_accounts .

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = 'P_BACC'
      values          = t_accounts[]
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.

  IF sy-subrc NE 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ENDIF.                               " IF SY-SUBRC NE 0

ENDFORM.                               " DISPLAY_ACCOUNTS&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Mahi&lt;/STRONG&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Jul 2008 05:33:59 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-25T05:33:59Z</dc:date>
    <item>
      <title>Listbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/listbox/m-p/4164650#M995655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi guys, I'm kind of lost, can anybody tellme the steps to create a dropdown listbox? I need to now, how to set its values and where I decide the next step after certain option was selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2008 18:03:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/listbox/m-p/4164650#M995655</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-24T18:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Listbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/listbox/m-p/4164651#M995656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the demo program DEMO_DYNPRO_DROPDOWN_LISTBOX&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2008 18:07:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/listbox/m-p/4164651#M995656</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-24T18:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Listbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/listbox/m-p/4164652#M995657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Euclides,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this link for creation of drop down list box:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://sap.niraj.tripod.com/id38.html" target="test_blank"&gt;http://sap.niraj.tripod.com/id38.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chandra Sekhar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jul 2008 03:29:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/listbox/m-p/4164652#M995657</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-25T03:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Listbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/listbox/m-p/4164653#M995658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Euclides,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create a list box according to ur need in the following way...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIST BOX                      &lt;/P&gt;&lt;P&gt;Drop down list box can be created in a dialog screen(SE51) as well as selection screen.&lt;/P&gt;&lt;P&gt;  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&lt;/P&gt;&lt;P&gt;fields TEXT field of TYPE 80(C) and internal KEY field of TYPE 40(C).&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; In screen painter to create a input/output field into list box we use &lt;/P&gt;&lt;P&gt; 'L" as a value for dropdown attribute for the i/o field.&lt;/P&gt;&lt;P&gt; In screen painter to determine the type of method that will be used to fill the value&lt;/P&gt;&lt;P&gt;list we use the attribute value list.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt; If a function code is attached to the list box the selection of a value triggers a PAI&lt;/P&gt;&lt;P&gt;otherwise PAI will not trigger. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIST BOX in SELECTION SCREEN&lt;/P&gt;&lt;P&gt;  List Box is created in selection screen using PARAMETERS staement &lt;/P&gt;&lt;P&gt;with AS LISTBOX addition other attributes like VISIBLE LENGTH (width of listbox)&lt;/P&gt;&lt;P&gt;can be specified with the declaration.&lt;/P&gt;&lt;P&gt;PARAMETERS name(n) AS LISTBOX VISIBLE LENGTH n.&lt;/P&gt;&lt;P&gt; Here n is an integer and name is the name of parameter.&lt;/P&gt;&lt;P&gt; To populate the value list we use the FM VRM_SET_VALUES  and the &lt;/P&gt;&lt;P&gt;selection screen event AT SELECTION-SCREEN OUTPUT is used to write the code to fill it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VRM_SET_VALUES     &lt;/P&gt;&lt;P&gt; 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 &lt;/P&gt;&lt;P&gt;we should declare TYPE-POOLS VRM before using this FM.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; Some important types declared in the VRM type group are&lt;/P&gt;&lt;P&gt;VRM_ID&lt;/P&gt;&lt;P&gt;   It refers to the name of the input/output field associated with list box&lt;/P&gt;&lt;P&gt;VRM_VALUES&lt;/P&gt;&lt;P&gt;  It refers to the internal table consisting of two fields TEXT(80C) and KEY(40)C&lt;/P&gt;&lt;P&gt;that will be used to create the list values.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'VRM_SET_VALUES'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;      ID                =  name of screen element ,it is of TYPE VRM_ID&lt;/P&gt;&lt;P&gt;      VALUES      =  internal table containing values,of TYPE VRM_VALUES  &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;LIST BOX with value list from input help&lt;/P&gt;&lt;P&gt; 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.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;PROCESS ON VALUE-REQUEST&lt;/P&gt;&lt;P&gt;FIELD list MODULE fill_list_100&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;FIELD list MODULE fill_list_100 INPUT&lt;/P&gt;&lt;P&gt;SELECT f1 f2 FROM table INTO int &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            retfield        = 'input/output screen field'&lt;/P&gt;&lt;P&gt;            value_org       = 'S'&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            value_tab       = itab "it contains 2 fields that will be shown in the list box&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            parameter_error = 1&lt;/P&gt;&lt;P&gt;            no_values_found = 2&lt;/P&gt;&lt;P&gt;            OTHERS          = 3.&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    ...&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDMODULE. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;VALUE LIST CREATED IN PBO&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;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 .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;TYPE-POOLS : VRM&lt;/P&gt;&lt;P&gt;DATA : field_id TYPE VRM_ID ,&lt;/P&gt;&lt;P&gt;            values  TYPE VRM_VALUES,&lt;/P&gt;&lt;P&gt;             value   LIKE LINE OF values.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;PROCESS BEFORE OUTPUT&lt;/P&gt;&lt;P&gt;MODULE list_fill_100&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;MODULE list_fill_100 OUTPUT&lt;/P&gt;&lt;P&gt;SELECT f1 f2 f3  FROM tab WHERE condition.&lt;/P&gt;&lt;P&gt;value-KEY = f1.&lt;/P&gt;&lt;P&gt;value-TEXT = f2&lt;/P&gt;&lt;P&gt;APPEND value TO VALUES&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'VRM_SET_VALUES'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            id     = 'i/o screen field' &lt;/P&gt;&lt;P&gt;            values = values.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDMODULE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIST BOX with Selection Screen&lt;/P&gt;&lt;P&gt; 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&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;PROGRAM zlist&lt;/P&gt;&lt;P&gt;TYPE-POOLS : VRM.&lt;/P&gt;&lt;P&gt;DATA: param TYPE vrm_id, &lt;/P&gt;&lt;P&gt;       values     TYPE vrm_values, &lt;/P&gt;&lt;P&gt;       value LIKE LINE OF values. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: p_name(10) AS LISTBOX VISIBLE LENGTH 10.&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN OUTPUT. &lt;/P&gt;&lt;P&gt;  param = 'P_NAME'. &lt;/P&gt;&lt;P&gt;  value-key = '1'.&lt;/P&gt;&lt;P&gt;  value-text = 'JOHN'.&lt;/P&gt;&lt;P&gt;  APPEND value TO values.&lt;/P&gt;&lt;P&gt;  value-key = '2'. &lt;/P&gt;&lt;P&gt;  value-text = 'PETER'.&lt;/P&gt;&lt;P&gt;  APPEND value TO values. &lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'VRM_SET_VALUES' &lt;/P&gt;&lt;P&gt;    EXPORTING id     = param &lt;/P&gt;&lt;P&gt;              values = values. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Ashu Singh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jul 2008 03:51:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/listbox/m-p/4164653#M995658</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-25T03:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Listbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/listbox/m-p/4164654#M995659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Declare the LISTBOX on the selection screen as follows..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: P1 AS LISTBOX VISIBLE LENGTH &amp;lt;n&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set the values in the LISTBOX In the INITIALIZATION EVENT using the &lt;/P&gt;&lt;P&gt;Function Module "VRM_GET_VALUES" .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this would help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Murthy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jul 2008 05:16:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/listbox/m-p/4164654#M995659</guid>
      <dc:creator>former_member787646</dc:creator>
      <dc:date>2008-07-25T05:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: Listbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/listbox/m-p/4164655#M995660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;STRONG&gt;Euclides Lopez&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the following code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*----------------------------------------------------------------------*
* Type pool declarations                                               *
*----------------------------------------------------------------------*
TYPE-POOLS:
  slis,                                " Global types for generic list
  vrm.                                 " Value Request Manager
*----------------------------------------------------------------------*
* Tables declaration                                                   *
*----------------------------------------------------------------------*
TABLES:
  ekko.                                " Purchasing Document Header
*----------------------------------------------------------------------*
* Field strings declaration                                            *
*----------------------------------------------------------------------*
DATA:
  fs_event    TYPE slis_alv_event,     " Used to trigger top-of-page
* To capture return values of ZWOODWARDPO function module
  fs_return   TYPE bapiret2,
* To fill fieldcatlog
  fs_fieldcat TYPE LINE OF slis_t_fieldcat_alv.

*----------------------------------------------------------------------*
* Internal tables declaration                                          *
*----------------------------------------------------------------------*
DATA:
* To hold the purchase order related data
  t_podata    TYPE STANDARD TABLE
                OF zwoodwardpo,
* To hold event names for ALV list display
  t_events    TYPE slis_t_event,
* To hold field catlog information
  t_fieldcat  TYPE slis_t_fieldcat_alv,
  t_materials TYPE STANDARD TABLE      " To hold material numbers
                OF zmaterialnum,
  t_phierars  TYPE STANDARD TABLE      " To hold product hierarchies
                OF zphierarchy,
  t_accounts  TYPE vrm_values.         " To hold bank accounts

*----------------------------------------------------------------------*
* Constants                                                            *
*----------------------------------------------------------------------*
CONSTANTS:
  c_msgtyp_e    TYPE bapiret2-type
               VALUE 'E',              " Message type   : E
  c_msgtyp_s    TYPE bapiret2-type
               VALUE 'S',              " Message type   : S
  c_tabname     LIKE fs_fieldcat-tabname
               VALUE 'T_PODATA',       " Table name     : T_PODATA
  c_onli        TYPE sy-ucomm
               VALUE 'ONLI',           " Function code  : ONLI
  c_bacc_a      TYPE c
               VALUE 'A',              " Baccount account : A
  c_bacc_b      TYPE c
               VALUE 'B',              " Baccount account : B
  c_bacc_c      TYPE c
               VALUE 'C'.              " Baccount account : C


PARAMETERS:
  p_bacc  TYPE char35                  " Bank account
            AS LISTBOX VISIBLE LENGTH 30
            LOWER CASE.

*----------------------------------------------------------------------*
*            AT SELECTION-SCREEN ON VALUE-REQUEST                      *
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bacc.
  PERFORM fill_accounts.
  PERFORM display_accounts.

*----------------------------------------------------------------------*
* FORM FILL_ACCOUNTS                                                   *
*----------------------------------------------------------------------*
* This subroutine is used to fill accounts for the drop down facility  *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine.   *
*----------------------------------------------------------------------*
FORM fill_accounts .

  DATA:
* Field string to fill bank accounts
    lfs_accounts TYPE LINE OF vrm_values.

  REFRESH t_accounts.

  lfs_accounts-key = c_bacc_a.
  lfs_accounts-text = text-baa.
  APPEND lfs_accounts TO t_accounts.

  lfs_accounts-key = c_bacc_b.
  lfs_accounts-text = text-bab.
  APPEND lfs_accounts TO t_accounts.

  lfs_accounts-key = c_bacc_c.
  lfs_accounts-text = text-bac.
  APPEND lfs_accounts TO t_accounts.

ENDFORM.                               " FILL_ACCOUNTS

*----------------------------------------------------------------------*
* FORM DISPLAY_ACCOUNTS                                                *
*----------------------------------------------------------------------*
* This subroutine is used to display list box in Bank account field.   *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine.   *
*----------------------------------------------------------------------*
FORM display_accounts .

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = 'P_BACC'
      values          = t_accounts[]
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.

  IF sy-subrc NE 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ENDIF.                               " IF SY-SUBRC NE 0

ENDFORM.                               " DISPLAY_ACCOUNTS&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Mahi&lt;/STRONG&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jul 2008 05:33:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/listbox/m-p/4164655#M995660</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-25T05:33:59Z</dc:date>
    </item>
  </channel>
</rss>

