I am implementing a requirement to make Sales Organization field as search criteria on BP Account
Main Search Screen(UI Comp: BP_HEAD_SEARCH).
I enhanced the structure CRMT_BUPA_IL_HEADER_SEARCH with SALES_ORG
(Component type CRMT_SALES_ORG).And added to UI configuration.
Result: Filed is not showing any F4 Search help and not giving any
relevant results with search term sales org id entered as free text.
Then I saw a [Wiki by Melanie|http://wiki.sdn.sap.com/wiki/display/CRM/Howtoaddanexistingfieldtoasearchpageofadifferent+component?showComments=true&showCommentArea=true#addcomment] and did the same steps according to the wiki.
In the BADI enhancement, modified the code according to SALES ORG. I am getting result list which does not related to the given search criteria of Sales Org.
I have check the code given in wiki and it seems to be search BP based on the sales office. However as I understand from your comment that you want to search BP based on the sales org. Let me know if my understanding is correct.
Let us assume the Org structure
O 50000001 ->orgunit
-->S 50000002 -> position
--> Shaik -> BP
if your requiremnet is to find the BP's assigned to orgunit '50000001' then use the following code inside your badi.
CALL FUNCTION 'RH_STRUC_GET'
ACT_OTYPE = 'O'
ACT_OBJID = '50000001'
ACT_WEGID = 'DISPORES'
RESULT_TAB = lt_result
RESULT_OBJEC = lt_objec
NO_PLVAR_FOUND = 1
NO_ENTRY_FOUND = 2
OTHERS = 3
Now you look into the internal table lt_result or lt_object and filter for OTYPE 'BP'. There you get the list of BP assigned to that particular sales org. If you would also like to get the BP's which are assigned to its sub org also then you need to change the import parameter ACT_WEGID to 'DISPO_BP'.
Hope this solves your problem. Please reward if the information is helpful.