Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to make a field as a dropdown in web ui without redefining its get_p and get_v method?

Hi,

I have a requirement that I have to make a field as a dropdown in webui without redefining its Get_P and Get_V  method.can anyone please help me out to achieve this?

Former Member
Former Member replied

Hi Ritesh,

Please find the attached solution and let me know if it worked.

Write below line of code in its .htm page

<thtmlb:label id   = "process_label"
for  = "process_ddlb"
text = "Reason for Reversal" />
<thtmlb:dropdownListBox
id                = "process_ddlb"
width = "20%"
nameOfKeyColumn   =
"KEY"
nameOfValueColumn =
"VALUE"
table             = "<%= ZREVERSALREASON->REVERSAL_REASON_TAB %>"
selection         =
"//ZREVERSALREASON/REVREASON" />

Write below lines of code in its do_prepare_output method

IF iv_first_time = abap_true.

CLEAR me->ztyped_context->zreversalreason->reversal_reason_tab.
* Selecting all the entries from bill reversal reason table.
SELECT * FROM ztcs_rev_reasn_t
INTO TABLE lit_rev_reason.

LOOP AT lit_rev_reason INTO wa_rev_reason.

wa_line
-key   = wa_rev_reason-bcreason.
wa_line
-value = wa_rev_reason-reason_text.

* Appending all the values in the drop down table.
APPEND INITIAL LINE TO ztyped_context->zreversalreason->reversal_reason_tab.
APPEND wa_line TO ztyped_context->zreversalreason->reversal_reason_tab.
CLEAR : wa_rev_reason,
wa_line
.
ENDLOOP.
ENDIF.

let me know if any clarification is required.

Regards

Rahul

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question