Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Material Number

Former Member
0 Kudos

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

10 REPLIES 10

pepl
Active Participant
0 Kudos

Hi!!

Exuse me, what transaction again? I'm afraid u have typed a bit wrong code randomly.

Former Member
0 Kudos

transaction code :

V/LD.

Former Member
0 Kudos

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

Former Member
0 Kudos

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'.

Former Member
0 Kudos

I want to retrive material from sales org, distrubution chanel,division and sales office.

0 Kudos

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.

Former Member
0 Kudos

division which table i have to check?

0 Kudos

mara-spart

0 Kudos

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.

Former Member
0 Kudos

Thanks david for your code.

but it is not working.