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

drop down button

Former Member
0 Likes
1,005

how can i use a drop down button in my program screen for month name help??

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
964

Hi,

See the following code to have drop down list :

REPORT ZROCK.

TYPE-POOLS : SLIS,VRM.

DATA : I_LB TYPE VRM_VALUES,

W_LB LIKE LINE OF I_LB.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS : P_LB(1) AS LISTBOX DEFAULT 'N' VISIBLE LENGTH 25 OBLIGATORY.

SELECTION-SCREEN END OF BLOCK B1 .

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_LB.

W_LB-KEY = '01'.

W_LB-TEXT = 'January'.

APPEND W_LB TO I_LB.

W_LB-KEY = '02'.

W_LB-TEXT = 'Febraury'.

APPEND W_LB TO I_LB.

*Write the same for all remaining months

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'P_LB'

VALUES = I_LB.

Thanks & Regards,

Rock.

8 REPLIES 8
Read only

Former Member
0 Likes
965

Hi,

See the following code to have drop down list :

REPORT ZROCK.

TYPE-POOLS : SLIS,VRM.

DATA : I_LB TYPE VRM_VALUES,

W_LB LIKE LINE OF I_LB.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS : P_LB(1) AS LISTBOX DEFAULT 'N' VISIBLE LENGTH 25 OBLIGATORY.

SELECTION-SCREEN END OF BLOCK B1 .

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_LB.

W_LB-KEY = '01'.

W_LB-TEXT = 'January'.

APPEND W_LB TO I_LB.

W_LB-KEY = '02'.

W_LB-TEXT = 'Febraury'.

APPEND W_LB TO I_LB.

*Write the same for all remaining months

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'P_LB'

VALUES = I_LB.

Thanks & Regards,

Rock.

Read only

0 Likes
964

Hi, Rock

Please Have a Look at [ATTENTION Limit of 2500 characters in a posting|/thread/1319756 [original link is broken];

Because in your Reply characters were more than Limit of 2500 so it is not in proper format so Please Take care of this next time.

Thanks and Best Regards,

Faisal

Read only

0 Likes
964

Hi, Rock

Please Have a Look at [ATTENTION Limit of 2500 characters in a posting|/thread/1319756 [original link is broken];

Because in your Reply characters were more than Limit of 2500 so it is not in proper format so Please Take care of this for next time posting.

Thanks and Best Regards,

Faisal

Read only

0 Likes
964

thanks a lot. it solved my problem. and i learned something really new and helpful.

Read only

0 Likes
964

how can i use the value of the drop down list to fetch data from the database?? if i want to convert the month into date according to the selection of the month from the drop down list, how can i do that??

Read only

Former Member
0 Likes
964

&----


*& Report DEMO_DROPDOWN_LIST_BOX *

&----


REPORT demo_dropdown_list_box.

&----


*& Global Declarations *

&----


  • Screen Interfaces

TABLES sdyn_conn.

DATA ok_code TYPE sy-ucomm.

  • Global data

TYPES: BEGIN OF type_carrid,

carrid type spfli-carrid,

carrname type scarr-carrname,

END OF type_carrid.

DATA itab_carrid TYPE STANDARD TABLE OF type_carrid.

&----


*& Processing Blocks called by the Runtime Environment *

&----


  • Event Block START-OF-SELECTION

START-OF-SELECTION.

CALL SCREEN 100.

  • Dialog Module PBO

MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

ENDMODULE.

  • Dialog Modules PAI

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE.

*

MODULE user_command_0100 INPUT.

CASE ok_code.

WHEN 'SELECTED'.

MESSAGE i888(sabapdocu) WITH sdyn_conn-carrid.

ENDCASE.

ENDMODULE.

  • Dialog Module POV

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.

Read only

Former Member
0 Likes
964

Hi Sobhan,

for dorp down list, u have to

1.change the Field(input/output box) properties to List Box with Key

2. call function module VRM_SET_VALUES in PBO of the screen to display the values in drop down

ex.code

        • in top

TYPE-POOLS : VRM.

DATA: T_VALUES TYPE VRM_VALUES WITH HEADER LINE.

        • in PBO module

SELECT xx yy FROM tqable name INTO TABLE T_VALUES

WHERE whre clause.

SORT T_VALUES[].

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = <<Field name in the screen >>

VALUES = T_VALUES[].

Edited by: SRINIVAS BUMBATHULA on May 19, 2009 8:24 AM

Read only

0 Likes
964

how can i use the value of the drop down list to fetch data from the database?? if i want to convert the month into date according to the selection of the month from the drop down list, how can i do that??