SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

listbox с месяцами



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
nebo
Участник
Участник



Joined: 29 Dec 2007
Posts: 31

PostPosted: Wed Apr 30, 2008 7:03 pm    Post subject: listbox с месяцами Reply with quote

Добрый вечер,
мне нужен выпадающий список с названиями месяцев.
Создал пераметр
PARAMETER: p_mon(10) OBLIGATORY AS LISTBOX VISIBLE LENGTH 10 DEFAULT 'Январь'.

Как добавить оставшиеся месяцы в список?
Back to top
View user's profile Send private message
luka_rus
Участник
Участник



Joined: 21 Jan 2008
Posts: 35

PostPosted: Thu May 01, 2008 7:40 pm    Post subject: Reply with quote

LIST TYPE VRM_VALUES,

CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'XXXX'
VALUES = LIST.
Back to top
View user's profile Send private message
vga
Мастер
Мастер


Age: 175
Joined: 04 Oct 2007
Posts: 1218
Location: Санкт-Петербург

PostPosted: Thu May 01, 2008 9:25 pm    Post subject: Reply with quote

Code:
TYPE-POOLS : vrm. "Value Request Manager

PARAMETERS: p_test AS LISTBOX VISIBLE LENGTH 12 OBLIGATORY.

INITIALIZATION.

PERFORM f4_value_request.

START-OF-SELECTION.

WRITE P_TEST.

&--------------------------------------------------------------------
*& Form f4_value_request
&--------------------------------------------------------------------
text
---------------------------------------------------------------------
FORM f4_value_request.

DATA: l_name TYPE vrm_id,
li_list TYPE vrm_values,
l_value LIKE LINE OF li_list.

l_value-key = '1'.
l_value-text = 'January'.
APPEND l_value TO li_list.
CLEAR l_value.

l_value-key = '2'.
l_value-text = 'February'.
APPEND l_value TO li_list.
CLEAR l_value.

l_value-key = '3'.
l_value-text = 'March'.
APPEND l_value TO li_list.
CLEAR l_value.

l_value-key = '4'.
l_value-text = 'April'.
APPEND l_value TO li_list.
CLEAR l_value.

l_value-key = '5'.
l_value-text = 'May'.
APPEND l_value TO li_list.
CLEAR l_value.

l_value-key = '6'.
l_value-text = 'June'.
APPEND l_value TO li_list.
CLEAR l_value.

l_value-key = '7'.
l_value-text = 'July'.
APPEND l_value TO li_list.
CLEAR l_value.

l_value-key = '8'.
l_value-text = 'August'.
APPEND l_value TO li_list.
CLEAR l_value.

l_value-key = '9'.
l_value-text = 'September'.
APPEND l_value TO li_list.
CLEAR l_value.

l_value-key = '10'.
l_value-text = 'October'.
APPEND l_value TO li_list.
CLEAR l_value.

l_value-key = '11'.
l_value-text = 'November'.
APPEND l_value TO li_list.
CLEAR l_value.

l_value-key = '12'.
l_value-text = 'December'.
APPEND l_value TO li_list.
CLEAR l_value.

l_name = 'P_TEST'.
p_test = '1'. "this is to set the default value of the list box.

CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = l_name
values = li_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.

ENDFORM. " f4_value_request
Back to top
View user's profile Send private message Blog Visit poster's website
imp
Участник
Участник



Joined: 14 Oct 2007
Posts: 12

PostPosted: Sun May 04, 2008 11:54 am    Post subject: Reply with quote

Добавлю еще, что список названий месяцев на нужном языке с номерами можно получить с помощью ФМ MONTH_NAMES_GET:

Code:

DATA: l_retcode LIKE like sy-subrc,
     lt_month LIKE t247 OCCURS 1 WITH HEADER LINE.
                                                                       
CALL FUNCTION 'MONTH_NAMES_GET'
    EXPORTING
         language              = sy-langu
    IMPORTING
         return_code           = l_retcode
    TABLES
         month_names           = lt_month
    EXCEPTIONS
         month_names_not_found = 1
         OTHERS                = 2.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.