09-03-2013 10:37 AM
Hi,
I have input field from MKPF (MKPF-WEVER) as check box and for this I/O field (make it as List box).Now fct code for check box is F_check and in attributes name for Drop down is WEVER.In Drop down three values are there
i.e Collective slip
individual slip
individual slip with some text
Now my requirement is how to write code for whenever check box is selected for a value.Please help me.
Thanks
09-03-2013 12:15 PM
I have not clearly understood your requirement.
If you have the check box and you need to populate the drop down accordingly, check this code.
This code will populate the value Collective slip if checkbox is checked , and the other two values if not checked in the drop box.
REPORT ZTEST_DROPDOWN_DYN_CB.
type-pools : vrm.
data ok_code like sy-ucomm.
data vers like mkpf-wever.
call screen 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'PF_100'.
SET TITLEBAR 'Drop Down'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
case OK_CODE.
when 'F_CHK'.
perform ddown_value.
when 'BACK'.
leave PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form F4_VALUE_COL2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM ddown_value .
data: lv_name type vrm_id,
lt_list type vrm_values,
ls_value like line of lt_list.
refresh lt_list.
clear lt_list.
if vers = 'X'.
ls_value-key = '01'.
ls_value-text = ' Collective slip'.
append ls_value to lt_list.
else.
ls_value-key = '02'.
ls_value-text = 'Individual slip'.
append ls_value to lt_list.
ls_value-key = '03'.
ls_value-text = 'Individual slip with text'.
append ls_value to lt_list.
endif.
lv_name = 'WEVER'.
call function 'VRM_SET_VALUES'
exporting
id = lv_name
values = lt_list.
ENDFORM. " F4_VALUE_COL2
Screen Painter
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
Make corresponding changes according to your requirement.
Let me know if the issue is solved.
(For more on drop boxes , check this link
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/frameset.htm
09-03-2013 1:05 PM
Hi Sai,
Your question is not clear, based on what I understood
In PAI ,Use it
CHK is the name of checkbox.
IF sy-ucomm EQ 'F_check' and CHK EQ 'X'.
"Write your logic
"It will work when checkbox is checked.
ENDIF.
IF sy-ucomm EQ 'F_check'.
"Write the logic
"It will work when checkbox is clicked
ENDIF.
Regards,
Jeffin
09-03-2013 1:18 PM
Hi Sai,
In the layout change the checkbox to listbox. Also specify the fcode in the layout.
After that change the code like this.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
case sy-ucomm.
when 'FCODE'.
if MKPF-WEVER = 1.
"Your code
elseif MKPF-WEVER = 2.
"Your code
else.
"Your code
endif.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Regards,
Alenlee
*Mark helpful if it is good*
09-04-2013 9:48 AM
Hey Sai,
I think you must have assigned/enabled the check-box from dictionary. Once disable it and check.
Thanks
Naresh
09-05-2013 7:42 AM
Hi,
Your check box is of type MKPF-WEVER, which contains fixed values. So MKPF-WEVER cannot take any values other than the values mentioned in the domain. If your check box is checked, it assumes 'X' as its value . So declare your check box as character of length one.
Then use the below logic in the PAI.
IF <check_box> EQ 'X'.
Write your logic
ELSE.
Write your logic.
ENDIF.
Regards,
Riju Thomas.