Application Development and Automation 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: 
Read only

Dropdown menu with items from table

Former Member
0 Likes
750

Hello, I am trying to make a dropdown menu, which will be filled by items from table. I am running this code, but it doesn't work for me. I looked on youtube and here so long and I couldn't find a fix, hope somebody here help me figure out where is the problem.


I have a screen 0100 being called at begining. I have there a subscreen 0102, where I created input/outpud field called 'ZTOVAR-NAZOVTOVARU' marked as dropdown listmenu. The screen Flow logic is here:

PROCESS BEFORE OUTPUT.


PROCESS AFTER INPUT.

PROCESS ON VALUE-REQUEST.
FIELD ZTOVAR-NAZOVTOVARU MODULE CREATE_DROPDOWN_BOX.

So I have a table called 'ZTOVAR' and I want to put all elements from row 'NAZOVTOVARU' into that dropbox.

Here is snip of code I am using.

*& CREATING OF DROPDOWN BOX FOR BLOK SCREEN*


TABLES ZTOVAR.

TYPES: BEGIN OF TYPE_TOVAR,
IDTOVARU TYPE ZTOVAR-IDTOVARU,
NAZOVTOVARU TYPE ZTOVAR-NAZOVTOVARU,
CENATOVARU TYPE ZTOVAR-CENATOVARU,
POCETTOVARU TYPE ZTOVAR-POCETTOVARU,
END OF TYPE_TOVAR.

DATA itab_TOVAR TYPE STANDARD TABLE OF
TYPE_TOVAR WITH HEADER LINE.

START-OF-SELECTION.

*&---------------------------------------------------------------------*
*& Module CREATE_DROPDOWN_BOX INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module CREATE_DROPDOWN_BOX input.
SELECT IDTOVARU NAZOVTOVARU CENATOVARU POCETTOVARU
FROM ZTOVAR
INTO CORRESPONDING FIELDS OF TABLE itab_TOVAR.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING
retfield = 'NAZOVTOVARU'
value_org = 's'
TABLES
value_tab = itab_TOVAR
EXCEPTIONS
parameter_error = 1
no_values_found = 2
others = 3.

IF SY-SUBRC <> 0.
ENDIF.

endmodule. " CREATE_DROPDOWN_BOX INPUT

1 REPLY 1
Read only

former_member34
Product and Topic Expert
Product and Topic Expert
0 Likes
642

Thank you for visiting SAP Community to get answers to your questions. Since this is your first question, I recommend that you familiarize yourself with our Q&A Tutorial: https://developers.sap.com/tutorials/community-qa.html, as it provides tips for preparing questions that draw responses from our members. Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your profile you encourage readers to respond: https://www.youtube.com/watch?v=46bt1juWUUM

Many thanks!