11-18-2009 12:12 PM
Hello Experts,
I have one requirement where if i give input sales org, distrubution chanel , division and sales office input
,it should give me all material in that sales org, distrubutibution and office.
i have one transaction V/ ld , in that transaction maintained material for sales org, dist chanel and sales office.
but if i see the material which stored in the structure KOMG.
How can i retrive that. how can i find structure KOMG relation to the database table.
Thanks in advance.
Best regards,
Zubera
11-18-2009 12:38 PM
Hi!!
Exuse me, what transaction again? I'm afraid u have typed a bit wrong code randomly.
11-18-2009 12:41 PM
11-18-2009 12:44 PM
Hi,
For finding out the material use table VBAK when you give sales org distribution channel and division it will give you the sales order no(vbeln).
Then in VBAP you can see for that VBELN all the MATNR(Material nos).
Regards,
Subhashini
11-18-2009 12:48 PM
Are you trying to find all materials for a sales org, Division? If so, I'd start with MVKE. KOMG looks like the possible fields for establishing routines in VOFM? Sometimes, the underlying tables for conditions are named like 'Annn'.
11-18-2009 12:50 PM
I want to retrive material from sales org, distrubution chanel,division and sales office.
11-18-2009 2:20 PM
you can get the materials for a sales org and distribution channel via table MVKE. you can then check those enries against the division on the material master, and against the sales office on TVKBZ (by sales org, dist channel and division).
you could create a whopping great join to do this in one statement, but it may be kind of slow.
11-18-2009 2:30 PM
11-18-2009 3:01 PM
11-18-2009 3:17 PM
here is a short example. it is not fully tested, and you should use AT YOUR OWN RISK.
i just rattled it off and did a quick check, but it appears to do what you want.
report ydk_test1
no standard page heading
line-size 80
line-count 65.
tables: mvke, mara, tvkbz.
types: begin of _material,
matnr type matnr,
vkorg type mvke-vkorg,
vtweg type mvke-vtweg,
spart type mara-spart,
vkbur type tvkbz-vkbur,
end of _material.
data: materials type standard table of _material,
material type _material.
select-options:
smatnr for mvke-matnr,
svkorg for mvke-vkorg,
svtweg for mvke-vtweg,
sspart for mara-spart,
svkbur for tvkbz-vkbur.
start-of-selection.
select mvke~matnr mvke~vkorg mvke~vtweg mara~spart
tvkbz~vkbur
into table materials
from mvke
inner join mara
on mara~matnr = mvke~matnr
inner join tvkbz
on tvkbz~vkorg = mvke~vkorg
and tvkbz~vtweg = mvke~vtweg
and tvkbz~spart = mara~spart
where mvke~matnr in smatnr
and mvke~vkorg in svkorg
and mvke~vtweg in svtweg
and mara~spart in sspart
and tvkbz~vkbur in svkbur.
break-point.
11-18-2009 3:47 PM