2007 Nov 29 2:26 PM
Hi friends,
I have a requirement where I am giving material description as an import parameter in the function module. ( Material description could be a wild search -- say - Mat* ) I want a sub routine in the function module which should get all the materials from the database ( mara or makt..not sure ) for the user entered Material description.
I want this particular code to be written using a sub-routine using formal parameters inside this fm . Could any one send me the code for this.
Thanks in advance,
Vishnu.
use table MAKT and fetch matnr by passing maktx inside source code of function module....
2007 Nov 29 2:31 PM
Why don't you first try with somecode? And if you stuck up in between, come up with proper question.
Regards,
Naimesh Patel
2007 Nov 29 3:42 PM
Hi Naimesh,
I got the code.I am including all the global data as well as the sub-routine in the top include.Is it a good way of programming to include the sub-routines also in the top include.
Regards,
Vishnu.
2007 Nov 29 2:31 PM
use table MAKT and fetch matnr by passing maktx inside source code of function module....
2007 Nov 29 2:43 PM
Hello ,
Use BAPI_MATERIAL_GETLIST and Pass the Selection criteria for Material Description to the table parameter MATERIALSHORTDESCSEL. This is a table in which you will have to pass the data in range manners say for wild card search I CP Mat*.
The Output will be in the table MATNRLIST.
Regards
<b>Reward points if useful</b>
Saket Sharma
null
2007 Nov 29 3:05 PM
Hi Vishvanath,,
Please find the below code.
DATA : BEGIN OF itab OCCURS 0,
matnr LIKE makt-MATNR,
MAKTX LIKE makt-MAKTX,
END OF itab.
DATA : BEGIN OF itab1 OCCURS 0,
matnr LIKE makt-MATNR,
MAKTX LIKE makt-MAKTX,
END OF itab1.
data : a(5) type c value 'TEST'.
perform mat_no using a.
form mat_no using p_a.
data : lv_temp(4) type c.
select matnr maktx from makt into table itab.
loop at itab.
lv_temp = itab-maktx+0(4).
if lv_temp = p_a.
move itab to itab1.
APPEND ITAB1.
endif.
endloop.
loop at itab1.
write 😕 itab1.
endloop.
endform. " mat_no
Thanks.
Amjad.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |