‎2008 Aug 29 6:34 AM
Hi All,
I have created a function module it is working fine by executing it self,when I am calling it into any program it is not working it means it is not fetching data from table I passed correct parameters I don't know what was the problem any one can help me in this.
Thanks®ds,
Sree.
‎2008 Aug 29 6:36 AM
Hi,
Check your program in debugging mode and see where have you done mistake.
Regards
Abhijeet
‎2008 Aug 29 6:37 AM
Hi ,
Please execute the program and check what is the data being passed to the FM , there can be cases where the conversion exit is not called.
In case your FM has date as parameters , please checj the format of that also
Regards
Arun
‎2008 Aug 29 6:37 AM
hi sree
it may be leading zeros or date format problem in importing parameters..
need some more inputs from your side
Regards
Deva
‎2008 Aug 29 6:54 AM
There is no leading zeros here I am giving my funtion module code.
*function zmm_vendor.
*"----
""Local Interface:
*" IMPORTING
*" REFERENCE(P_VENDOR) TYPE LFA1-LIFNR
*" TABLES
*" P_VENDOR_DATA STRUCTURE ZVENDOR_DATA
*"----
tables : lfa1,lfm1.
data flag(1) type c.
types : begin of ty_lfm1,
lifnr like lfm1-lifnr,
"ekorg LIKE lfm1-ekorg,
"erdat LIKE lfm1-erdat,
ernam like lfm1-ernam,
lfabc like lfm1-lfabc,
waers like lfm1-waers,
minbw like lfm1-minbw,
webre like lfm1-webre,
kalsk like lfm1-kalsk,
ekgrp like lfm1-ekgrp,
lipre like lfm1-lipre,
end of ty_lfm1.
types : begin of ty_lfa1,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
ort01 like lfa1-ort01,
ort02 like lfa1-ort02,
adrnr like lfa1-adrnr,
end of ty_lfa1.
types : begin of ty_adr6,
addrnumber like adr6-addrnumber,
smtp_addr like adr6-smtp_addr,
end of ty_adr6.
types : begin of ty_lfb1,
akont like lfb1-akont,
zwels like lfb1-zwels,
zterm like lfb1-zterm,
fdgrv like lfb1-fdgrv,
reprf like lfb1-reprf,
end of ty_lfb1.
types : begin of ty_display,
sel,
lifnr like lfm1-lifnr,
ekorg like lfm1-ekorg,
erdat like lfm1-erdat,
ernam like lfm1-ernam,
lfabc like lfm1-lfabc,
smtp_addr like adr6-smtp_addr,
waers like lfm1-waers,
minbw like lfm1-minbw,
webre like lfm1-webre,
kalsk like lfm1-kalsk,
ekgrp like lfm1-ekgrp,
lipre like lfm1-lipre,
name1 like lfa1-name1,
ort01 like lfa1-ort01,
ort02 like lfa1-ort02,
akont like lfb1-akont,
zwels like lfb1-zwels,
zterm like lfb1-zterm,
fdgrv like lfb1-fdgrv,
reprf like lfb1-reprf,
end of ty_display.
&----
INTERNAL TABLES DECLARATION
&----
data: t_lfm1 type standard table of ty_lfm1 with header line,
t_lfa1 type standard table of ty_lfa1 with header line,
t_display type standard table of ty_display with header line,
t_lfb1 type standard table of ty_lfb1 with header line,
t_adr6 type standard table of ty_adr6 with header line.
&----
WORK AREAS DECLARATION
&----
data: wa_lfm1 type ty_lfm1,
wa_lfa1 type ty_lfa1,
wa_adr6 type ty_adr6,
wa_lfb1 type ty_lfb1,
wa_display type ty_display.
select lifnr
ekorg
erdat
ernam
lfabc
waers
minbw
webre
kalsk
ekgrp
lipre from lfm1
into corresponding fields of table t_lfm1
where lifnr = p_vendor.
if t_lfm1[] is not initial.
select lifnr
name1
ort01
ort02
adrnr from lfa1
into corresponding fields of table t_lfa1
for all entries in t_lfm1
where lifnr = t_lfm1-lifnr.
endif.
if t_lfm1[] is not initial.
select addrnumber smtp_addr from adr6
into table t_adr6
for all entries in t_lfa1
where addrnumber = t_lfa1-adrnr.
endif.
if t_lfm1[] is not initial.
select akont
zwels
zterm
fdgrv
reprf from lfb1
into table t_lfb1
for all entries in t_lfm1
where lifnr = t_lfm1-lifnr.
endif.
loop at t_lfm1 into wa_lfm1.
move wa_lfm1-lifnr to t_display-lifnr.
"move wa_lfm1-ekorg to wa_display-ekorg.
" move wa_lfm1-erdat to wa_display-erdat.
move wa_lfm1-lfabc to t_display-lfabc.
move wa_lfm1-waers to t_display-waers.
move wa_lfm1-minbw to t_display-minbw.
move wa_lfm1-webre to t_display-webre.
move wa_lfm1-kalsk to t_display-kalsk.
move wa_lfm1-ekgrp to t_display-ekgrp.
move wa_lfm1-lipre to t_display-lipre.
"append wa_display to t_display.
read table t_lfa1 into wa_lfa1 index 1 .
if sy-subrc = 0.
move wa_lfa1-name1 to t_display-name1.
move wa_lfa1-ort01 to t_display-ort01.
move wa_lfa1-ort02 to t_display-ort02.
endif.
read table t_adr6 into wa_adr6 index 1 .
if sy-subrc = 0.
move wa_adr6-smtp_addr to t_display-smtp_addr.
endif.
read table t_lfb1 into wa_lfb1 index 1 .
if sy-subrc = 0.
move wa_lfb1-akont to t_display-akont.
move wa_lfb1-zwels to t_display-zwels.
move wa_lfb1-zterm to t_display-zterm.
move wa_lfb1-fdgrv to t_display-fdgrv.
move wa_lfb1-reprf to t_display-reprf.
endif.
append t_display.
exit.
"clear wa_display.
"clear t_display.
endloop.
delete adjacent duplicates from t_display comparing lifnr.
move t_display-lifnr to p_vendor_data-lifnr.
"move t_display-ekorg to P_VENDOR_DATA-ekorg.
" move t_display-erdat to P_VENDOR_DATA-erdat.
move t_display-lfabc to p_vendor_data-lfabc.
move t_display-waers to p_vendor_data-waers.
move t_display-minbw to p_vendor_data-minbw.
move t_display-webre to p_vendor_data-webre.
move t_display-kalsk to p_vendor_data-kalsk.
move t_display-ekgrp to p_vendor_data-ekgrp.
move t_display-lipre to p_vendor_data-lipre.
move t_display-name1 to p_vendor_data-name1.
move t_display-ort01 to p_vendor_data-ort01.
move t_display-ort02 to p_vendor_data-ort02.
move t_display-smtp_addr to p_vendor_data-smtp_addr.
move t_display-akont to p_vendor_data-akont.
move t_display-zwels to p_vendor_data-zwels.
move t_display-zterm to p_vendor_data-zterm.
move t_display-fdgrv to p_vendor_data-fdgrv.
move t_display-reprf to p_vendor_data-reprf.
append p_vendor_data.
endfunction.*
but after calling this into my program it is not working here is my program.
report ZTEST.
parameters : zvendor like lfm1-lifnr.
data : begin of ty_display occurs 0,
lifnr like lfm1-lifnr,
ekorg like lfm1-ekorg,
erdat like lfm1-erdat,
ernam like lfm1-ernam,
lfabc like lfm1-lfabc,
smtp_addr like adr6-smtp_addr,
waers like lfm1-waers,
minbw like lfm1-minbw,
webre like lfm1-webre,
kalsk like lfm1-kalsk,
ekgrp like lfm1-ekgrp,
lipre like lfm1-lipre,
name1 like lfa1-name1,
ort01 like lfa1-ort01,
ort02 like lfa1-ort02,
akont like lfb1-akont,
zwels like lfb1-zwels,
zterm like lfb1-zterm,
fdgrv like lfb1-fdgrv,
reprf like lfb1-reprf,
end of ty_display.
CALL FUNCTION 'ZMM_VENDOR'
EXPORTING
p_vendor = zvendor
tables
p_vendor_data = ty_display
.
loop at ty_display.
write : / ty_display-ort01.
endloop.
Thanks and Regds,
Sree.
‎2008 Aug 29 7:00 AM
in importing parameters you hav used
LFA1-LIFNR
similarly try with LFA1-LIFNR in parameter also
parameters : zvendor like LFA1-LIFNR.
just try i am not exact
Regards
Deva
‎2008 Aug 29 7:13 AM
Hi,
parameters : zvendor like lfm1-lifnr.
your declaring zvendor type lfm1-lifnr.
In function module import parameter p_vendor type LFA1-LIFNR.
I am not sure this is the exact problem.can u check it out abt this.
regards,
kishore.
‎2008 Aug 29 7:14 AM
‎2008 Aug 29 7:24 AM
Hi,
In Program instead of declaring internal table ty_dispaly can u declare internal table by using data dictionary strcture ZVENDOR_DATA.
Did you checked this one?
regards,
kishore.
‎2008 Aug 29 7:39 AM
‎2008 Aug 29 7:49 AM
Hi Shree,
have you done debugging..?
if not then first of all debug your program at FM and then go inside of FM, checking where the problem is..
I am sure after debugging you will sort out the proble..
Thanks n Regards,
Meet
‎2008 Aug 29 7:53 AM
Hi Meet,
Thank u for ur advise before posting thread I done all the excises my side still I failed to sortout the problem,if you have any idea please help me.
‎2008 Aug 29 8:04 AM
Hi Shree..
I am sure you have done proper debugging..
But In your case, your code looks perfect..
As you said your FM working fine, when run independently..
Then Please debug again your program, one by one step..
And find where the problem is..
may be you forget to check something while debugging...
So my advice is Debugging is the only solution for your problem...
Regards,
Meet
‎2008 Aug 29 6:40 AM
Hi,
Check wheather data type of your data and the import parameter for that table are same or not.
Then check wheather the table at all contain any data for these input parameter or not.
Do both in Debug mode.
reagrds,
anirban
‎2008 Aug 29 6:43 AM
Hi,
Hi ,
Please execute the program and check i think the data format is different .so first u will check the data which data type u pass
and put the debugging symbal in functional module and excute
it ,so u can easily u find it.
Thanks.
Ashok
‎2008 Aug 29 6:43 AM
Hi Sree,
Check the importing parameters. Check whether table which you are passing has data or not. Check for the initial condition of the table before passing the table into the function module.
Regards,
Chandra Sekhar
‎2008 Aug 29 6:50 AM
Function module before calling into program I am passing the same value there it is working.