‎2015 May 07 6:01 AM
Hi, i am creating one module pool program in which for one input/ouput field i have create a drop down list.
i have done the changes in screen attributes but dont have idea how to do in flow logic.
i have search other blogs but all creating drop down list from dict. feilds/values.
i want to have my own custom options in the drop down.
Thanks,
Amit Dwivedi
‎2015 May 07 6:10 AM
Hi Amit..
Before u write the post,Plz check existing solution posted by our SCN members..
comes to question..
in Screen painter you have to mention that field as listbox.
and in PBO u have to fill the list box(key and value by using your custom code..)
Example:
MODULE fill_carrid OUTPUT.
* Do not use this process (but it works)
TYPE-POOLS vrm.
DATA values TYPE vrm_values WITH HEADER LINE.
IF init is initial.
SELECT * FROM scarr.
values-text = scarr-carrname.
values-key = scarr-carrid.
APPEND values.
ENDSELECT.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'SBOOK-CARRID'
values = values[]
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.
ENDIF.
scarr-carrid = 'LH'.
init = 'X'.
ENDMODULE. " FILL_CARRID OUTPUT
**********
in sap standard Module pool program is there,name: rsdemo_dropdown_listbox
Thanks ,
P.Ravi
‎2015 May 07 6:10 AM
Hi Amit..
Before u write the post,Plz check existing solution posted by our SCN members..
comes to question..
in Screen painter you have to mention that field as listbox.
and in PBO u have to fill the list box(key and value by using your custom code..)
Example:
MODULE fill_carrid OUTPUT.
* Do not use this process (but it works)
TYPE-POOLS vrm.
DATA values TYPE vrm_values WITH HEADER LINE.
IF init is initial.
SELECT * FROM scarr.
values-text = scarr-carrname.
values-key = scarr-carrid.
APPEND values.
ENDSELECT.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'SBOOK-CARRID'
values = values[]
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.
ENDIF.
scarr-carrid = 'LH'.
init = 'X'.
ENDMODULE. " FILL_CARRID OUTPUT
**********
in sap standard Module pool program is there,name: rsdemo_dropdown_listbox
Thanks ,
P.Ravi
‎2015 May 07 6:15 AM
Hi Ravi,
Thanks for the quick reply. but as i mentioned earlier i don't want fields/data from dict.
I want to populate my own list in drop down. such as Freight Charges, Air charges, TMS Charges.
i checked other blogs but all are from dict.
Please advice
Thanks,
Amit
‎2015 May 07 6:31 AM
Hi amit,
can you Please tell briefly about your requirement..
thanks,
Ravi.
‎2015 May 07 6:34 AM
Hi Ravi,
i want to have list drop down.
Freight Charges,
Air charges,
TMS Charges.
Above 3 charges i want to have in my list drop. User will select the appropriate charges and in next field wil update the amt.
Thanks,
Amit
‎2015 May 07 6:53 AM
Amit,
data: GV_CHARGE.
In screen painter GV_CHARGE as dropdown with FCODE:<ACT>
In PBO
TYPE-POOLS vrm.
DATA values TYPE vrm_values WITH HEADER LINE.
values-text = 'Freight Charges'.
values-key = '1.
APPEND values.
values-text = 'Air charges'.
values-key = '2'.
APPEND values.
values-text = 'TMS Charges'.
values-key = '3'.
APPEND values.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'GV_CHARGE'
values = values[]
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
In PAI
USERCOMMAND:
WHEN 'ACT'.
read values with key key = gv_charge.
if sy-subrc = 0.
if values-key = '2'.
amount = '20,000'.
endif.
endif.
Thank you,
Ravi.
‎2015 May 07 6:58 AM
Hi Ravi,
Thank u very much for ur help.
just one question. while searching other blogs i got 1 solution that we can make fixed value entries in Domain--->Value range.
What is the difference beween these 2.
Thanks,
Amit Dwivedi
‎2015 May 07 7:24 AM
yes Amit,
first..we can fill the drop down (key and text) in Module pool program/Report by using
1.SE11 - Dictionary(Domain level).
2.Manual filling in Program(fill internal table VALUES[] by using providing our key and text)(Program level).
3.Process on Value Request.(Program level).
Depending the user Requirement/Maintaining values we have to decide..
i already mentioned earlier Standard programs are in SAP regarding this listbox..
ex:rsdemo_dropdown_listbox
please check this program to learn more about listbox..
Thanks,
P.Ravi