‎2006 May 12 4:20 PM
Hi,
I have function module which searches the Sales Deal for the given parameters ( Agreement type & Customer No ). Could any boddy suggest how to use this function module for the search help. Since this function module has 2 input parameter so i do't know how to call it/handle it but i know that i need to call it assign it in "Search Help Exit" during creation of new search help or append the new search help in VMBO.
code for the function module is given below :
---
FUNCTION ZVF_SALES_DEAL.
*"----
""Local Interface:
*" IMPORTING
*" REFERENCE(BOART) LIKE T6B1-BOART
*" REFERENCE(KUNNR) LIKE KNVV-KUNNR OPTIONAL
*" TABLES
*" XKNUMA STRUCTURE ZVKNUMA
*"----
tables: t6b1, t6b2f, KONAIND.
ASSIGN kond_tab[] TO <cond_tab>.
ASSIGN kond_tab TO <cond_line>.
ASSIGN COMPONENT 'DATA' OF STRUCTURE <cond_line> TO <data> CASTING.
data: access_program like trdir-name,
t681 like t681,
tmc1t like tmc1t.
DATA: V_KNUMH LIKE A601-KNUMH,
V_KNUMA LIKE KONAIND-KNUMA.
select single * from T6B1 where boart eq boart.
if sy-subrc eq 0.
clear: t6b2f.
if kunnr ne ' '.
select * from t6b2f where KAPPL eq 'V' and
kobog eq t6b1-kobog and
kschl eq 'ZC20'.
CALL FUNCTION 'RV_T681_SELECT_AND_GENERATE'
EXPORTING
CAA_KVEWE = 'A'
CAA_KOTABNR = t6b2f-kotabnr
IMPORTING
CAA_T681 = t681
CAA_TMC1T = tmc1t
CAA_ACCESS_PROGRAM = access_program.
refresh : <cond_tab>.
clear: <cond_tab>, <cond_line>,V_KNUMA,V_KNUMH.
select * from (t681-KOTAB) APPENDING TABLE <cond_tab>
where KAPPL eq 'V' and
KSCHL eq 'ZC20' and
KUNWE eq kunnr and
KEXCL_D ne 'X'.
CLEAR: XKNUMA-KNUMA.
LOOP AT <cond_tab> INTO <cond_line>.
CALL FUNCTION 'SD_COND_RECORD_TO_NORM_RECORD'
EXPORTING
kvewe_i = 'A'
kotabnr_i = t6b2f-kotabnr
kotab_i = t681-kotab
condition_record = <data>
IMPORTING
knumh_o = V_knumH
knuma_o = V_KNUMA.
SELECT * FROM KONAIND WHERE KNUMH EQ V_KNUMH.
XKNUMA-KNUMA = KONAIND-KNUMA.
APPEND XKNUMA.
CLEAR XKNUMA.
ENDSELECT.
ENDLOOP.
ENDSELECT.
else.
select * from t6b2f where KAPPL eq 'V' and
kobog eq t6b1-kobog and
kschl eq 'ZC20'.
CALL FUNCTION 'RV_T681_SELECT_AND_GENERATE'
EXPORTING
CAA_KVEWE = 'A'
CAA_KOTABNR = t6b2f-kotabnr
IMPORTING
CAA_T681 = t681
CAA_TMC1T = tmc1t
CAA_ACCESS_PROGRAM = access_program.
refresh : <cond_tab>.
clear: <cond_tab>, <cond_line>,V_KNUMA,V_KNUMH.
select * from (t681-KOTAB) APPENDING TABLE <cond_tab>
where KAPPL eq 'V' and
KSCHL eq 'ZC20' and
KEXCL_D ne 'X'.
CLEAR: XKNUMA-KNUMA.
LOOP AT <cond_tab> INTO <cond_line>.
CALL FUNCTION 'SD_COND_RECORD_TO_NORM_RECORD'
EXPORTING
kvewe_i = 'A'
kotabnr_i = t6b2f-kotabnr
kotab_i = t681-kotab
condition_record = <data>
IMPORTING
knumh_o = V_knumH
knuma_o = V_KNUMA.
SELECT * FROM KONAIND WHERE KNUMH EQ V_KNUMH.
XKNUMA-KNUMA = KONAIND-KNUMA.
APPEND XKNUMA.
CLEAR XKNUMA.
ENDSELECT.
ENDLOOP.
ENDSELECT.
endif.
endif.
ENDFUNCTION.
-
Thanks,
‎2006 May 12 4:24 PM
‎2006 May 12 4:36 PM
I have done it in following steps
1-create elementary search help "Y_my_search_help and in search help exit give my function module "y_test_values".
if you do the same thing and create search help and assign your FM in it .it`ll work !!
Hope thisll give you idea!!
<b>P.S award the points.</b>
Good luck
Thanks
Saquib Khan
"Some are wise and some are otherwise"