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: 

Listbox after selection, no value

Former Member
0 Kudos
2,387

Hi All,

I am using ABAP Listbox with VRM to set the dropdown.

I am able to set the dropdown, but the user selected value doesnot appear in the parameter specified.

I have tried using VRM_GET_VALUES but the same didnt work.

Please guide.

Below is my code:

REPORT zbw_mosl_file_upd.

TYPE-POOLS: vrm, slis.

TYPES: BEGIN OF ty_retailer,

        /bic/zcretalr TYPE /bic/oizcretalr,

       END OF ty_retailer.

TYPES: BEGIN OF ty_pzcfilenm2,

       checkbox TYPE xfeld,

       /bic/zcfilenm TYPE /bic/oizcfilenm,

       objvers TYPE rsobjvers,

       changed TYPE rsrchangeflag,

       /bic/zcstat TYPE /bic/oizcstat,

       /bic/zcretalr TYPE /bic/oizcretalr,

      END OF ty_pzcfilenm2.

DATA: lt_retailer TYPE TABLE OF ty_retailer,

      ls_retailer TYPE ty_retailer.

DATA: lt_pzcfilenm TYPE TABLE OF /bic/pzcfilenm,

      ls_pzcfilenm LIKE LINE OF lt_pzcfilenm.

DATA: lt_pzcfilenm2 TYPE TABLE OF ty_pzcfilenm2,

      ls_pzcfilenm2 LIKE LINE OF lt_pzcfilenm2.

DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,

      ls_fieldcat TYPE slis_fieldcat_alv.

DATA: name TYPE vrm_id,

      list TYPE vrm_values,

      value LIKE LINE OF list,

      lv_records TYPE i,

      lv_message TYPE string.

DATA: lv_repid TYPE sy-repid VALUE sy-repid.

DATA lr_grid TYPE REF TO cl_gui_alv_grid.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS: p_retail LIKE /bic/pzcfilenm-/bic/zcretalr AS LISTBOX VISIBLE LENGTH 30.

SELECTION-SCREEN: END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.

  SELECT /bic/zcretalr

    FROM /bic/pzcfilenm

    INTO TABLE lt_retailer

    WHERE /bic/zcretalr IS NOT NULL.

  IF sy-subrc NE 0.

    MESSAGE e000(zbw_mosl_file_upd) WITH 'Error'.

    EXIT.

  ELSE.

    SORT lt_retailer.

    DELETE ADJACENT DUPLICATES FROM lt_retailer.

    LOOP AT lt_retailer INTO ls_retailer.

      value-key = sy-tabix.

      value-text = ls_retailer-/bic/zcretalr.

      APPEND value TO list.

    ENDLOOP.

    name = 'P_RETAIL'.

    CALL FUNCTION 'VRM_SET_VALUES'

      EXPORTING

        id     = name

        values = list.

  ENDIF.

AT SELECTION-SCREEN.

  "Fetch all the Filenames which have Loaded status for the selected retailer

*  PERFORM fetch_loaded.

  CALL FUNCTION 'VRM_GET_VALUES'

    EXPORTING

      id     = name

    IMPORTING

      values = list.

12 REPLIES 12

Former Member
0 Kudos
400

Hi Shrihari,

By seeing your code, P_RETAIL will have the integer value 0, 1, 2 etc.

The Value of the field in the list box will always be the Key Value.

Thanks and Regards,

Vinay Mutt

0 Kudos
400

Hi Vinay,

I have mapped text value to the dropdown display and key field is filled with integers.

Also P_RETAIL is of the type text which is required to be displayed.

Thanks,

Srihari

0 Kudos
400

Hi Srihari,

Are you able to see the drop down on the selection screen.

After you select a value from the drop down, in debug mode can you please check what is the value of the field P_RETAIL. Whether P_RETAIL has any value or is it blank.

Regards,

Vinay Mutt

0 Kudos
400

Hi Srihari,

Once Check your Key Values .

Ex:

w_value-key = 'K1'.

w_value-text = 'SALES'.

append w_value to v_value.

clear w_value.

Former Member
0 Kudos
400

Hi,

Please call the code to populate the Listbox in Initialization Event and retrive the value of the selected the value from Selection-Screen field "Listbox" at event "AT Selection-Screen on ".

Thanks

Ashg1402
Contributor
0 Kudos
400

Hi,

You didn't put 'START-OF-SELECTION' event statement after 'AT SELECTION-SCREEN'.  That's why you are not getting the result. Try this and check. It will work.

Remove that function module 'VRM_GET_VALUES'. You will get the value in parameter p_retail directly.

Regards

Ashish

Former Member
0 Kudos
400

Hi,

You have specified sy-tabix as the key field and defined the parameter P_RETAIL as LISTBOX for /bic/pzcfilenm-/bic/zcretalr which might be the problem.


If you are mentioning sy-tabix as the key of the list, then the parameter has to be defined LIKE sy-tabix AS LISTBOX. With the current ddefinition of the parameter, you have to set ls_retailer-/bic/zcretalr as the key of the list.

Please let me know if this solves your issue.

Regards,

Shayeree.

deepak_sharma_sap
Active Participant
400

Hi Srihari,

Use the condense statement after assigning the value to KEY field of your List.

Since you have used SY-TABIX and field VALUE-KEY is of 40 Char.

VALUE-KEY = Sy-tabix.

condense Value-key.

Append value to list.

You should get the value under same Parameter.

Thanks

Deepak

0 Kudos
400

Thanks Deepak,

Using Condense has solved my issue.

0 Kudos
400

Please mark Deepak's answer as the right answer, and close your question. Thanks.

former_member218528
Participant
0 Kudos
400

Hi Srihari,


    * Please refer this sample code..it is working..


***************************************************************************************************************


REPORT ztest_2.

TYPE-POOLS : vrm.

TYPES : BEGIN OF ty_mara,

          matnr TYPE char10,

         END   OF ty_mara.

DATA : it_mara TYPE TABLE OF ty_mara,

        wa_mara TYPE          ty_mara,

        it_list TYPE TABLE OF vrm_value,

        wa_list TYPE          vrm_value.

PARAMETERS : p_matnr TYPE char10 AS LISTBOX VISIBLE LENGTH 15.

AT SELECTION-SCREEN OUTPUT.

   wa_list-key = 1.

   wa_list-text = '0000000001'.

   APPEND wa_list TO it_list.

   wa_list-key = 2.

   wa_list-text = '0000000002'.

   APPEND wa_list TO it_list.

   CALL FUNCTION 'VRM_SET_VALUES'

     EXPORTING

       id              = 'P_MATNR'

       values          = it_list

     EXCEPTIONS

       id_illegal_name = 1

       OTHERS          = 2.

   IF sy-subrc <> 0.

* Implement suitable error handling here

   ENDIF.


***************************************************************************************************************

Regards,


    Rohan

deepak_sharma_sap
Active Participant
0 Kudos
400

Hi Srihari,

Can you please mark this question as answered mentioning the correct answer.

If the issue still persists , kindly let me know.

Thanks

Deepak