How to create prompt table dynamically for the specified field

1. In the record field properties mention the prompt table as %EdittableXX. Assign the view or record name based to the field based on the logic.

For example on my page  I have Businesss Unit and Project ID. If i click on the Project ID directly it needs show all the Project IDs. If I enter the Business Unit and then click on the project ID prompt then it should show projects realted to that business Unit. In this scenario you can assign view ps_project_all_vw to the prompt on rowinit of the Project ID.

DERIVED.EDITATTABLEXX =  ps_project_all_vw

On the fieldchange of Business Unit the code can be written to assign another view which has Business Unit as key and search key

DERIVED.EDITTABLE.XX = ps_project_bu_vw

2) You can use Dynamic view and SQL text as dynamic views.
In the above scenario create a dynamic view which shows all Project IDs and assign to Project ID field properties as prompt. On the FieldChange of Business Unit you can write the code as

PS_RECORD.FIELD.SQLText = "Select project_id from ps_project where business_unit = '" | PS_RECORD.BUSINESS_UNIT.value | "';