cancel
Showing results for 
Search instead for 
Did you mean: 

Default value for the drop down in HCM forms

Former Member
0 Kudos

Hi ,

I am using BAdi to populate the drop down for the field in the HCM forms

The field shows value when we click the drop down button .

Requirement : I want to have the default value in the form when it is displayed for the first time using BAdi .

Understanding : I know it can be done from the form side but that will not come dynamically .

Please give your input on this .

Thanks

-Om

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hey Om,

What I have done for passing default values from the backend to the form is binding the fieldname to the dropdown. The fieldname is the same as the name you use to populate the dropdown... So, the binding for the form field is:

$record.<FORM_FIELD>.DATA[*].FIELD

and the binding for the Item values is:

$record.sap-vhlist.<FORM_FIELD>\.DATA\.FIELD.item[*]

Hope this helps...

Cheers,

Kevin

Former Member
0 Kudos

Hi Kevin ,

This is working for me but what i need is little different from this .

I am able to get the default and the drop down value only if i don't declare the field as special field

but i have to use the value of this field in the BAdi to retrieve other values based on this then i need to make it as a special field .

If i declare the field as special field then i can am getting the drop down and at the same time value in the backend but no default value .

  • Set Default value only

DATA: lds_service_fields TYPE REF TO hrasr00gensrv_dataset_init.

READ TABLE service fields REFERENCE INTO lds_service_fields

WITH KEY fieldname = lv_tdate

CHECK sy-subrc = 0.

lds_service_fields->fieldvalue = '01012008 ' .

This code is getting executed in both the case whether i declare the lv_tdate as service field or special field

but if i declare lv_tdate as special field then no value bind to this will be displayed .

At the same time if i declare this as service field then the default value is populated and the drop down too but the value after getting selected from the drop down is not fetched .

Please let me know if u need any more details .

Thanks ,

- Om

Former Member
0 Kudos

Hey Om,

When you define a field as a Special Field, and populate it, you can change the value, but you can never clear the field. If you need to reference the field when you call other Operations (making an assumption here), add the field to the field group associated to the operation being called. This way, you don't have to make the field special.

Hope this helps...

Cheers,

Kevin

Former Member
0 Kudos

Hi Kevin ,

This solution really worked for me ..

Thanks a lot man for looking into it . This was really a good work .

Thanks

- Om

Answers (0)