Skip to Content
author's profile photo Former Member
Former Member

Select vendor :: Purchasing Organization & Company Code

Hi,

I need to select Vendor BUT with:

Purchasing Organization(EKORG) = 2000 and 4000

AND

Company Code(BUKRS) = 1000 and 2000

Which TABLES do I have to use?

This is what I have now:

  SELECT *
     FROM lfm1
     INTO TABLE ta_lfm1
     FOR ALL ENTRIES IN ta_lfa1
    WHERE lifnr EQ ta_lfa1-lifnr
    AND   ekorg IN ('2000', '4000').

tnx. Adibo.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 07:12 AM

    Hi!

    You'll need LFB1 also, which contains the BUKRS relevant data.

    LFA1 and LFM1 are fine already.

    Regards

    Tamá

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 07:41 AM

    Hi,

    You can try this piece of code.

    SELECT a~lifnr

    a~ekorg

    b~bukrs

    .................. Fields you need.

    FROM lfm1 AS a INNER JOIN lfb1AS b

    ON alifnr = blifnr

    INTO CORRESPONDING FIELDS OF TABLE ta_lfm1

    FOR ALL ENTRIES IN ta_lfa1

    WHERE a~lifnr = ta_lfa1-lifnr

    AND a~ekorg IN ( '2000' , '4000' )

    AND b~bukrs IN ( '1000' , '2000').

    Plz reward if useful.

    Thanks,

    Dhanashri

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 08:48 AM

    My Solution:

      SELECT
            lfa1~lifnr  lfa1~adrnr  lfa1~erdat  lfa1~stkzu  lfa1~gbort  lfa1~sperz  lfa1~profs  lfa1~stenr
            lfa1~land1  lfa1~mcod1  lfa1~ernam  lfa1~telbx  lfa1~gbdat  lfa1~scacd  lfa1~stgdl  lfa1~psofg
            lfa1~name1  lfa1~mcod2  lfa1~esrnr  lfa1~telf1  lfa1~sexkz  lfa1~sfrgr  lfa1~emnfr  lfa1~psois
            lfa1~name2  lfa1~mcod3  lfa1~konzs  lfa1~telf2  lfa1~kraus  lfa1~lzone  lfa1~lfurl  lfa1~pson1
            lfa1~name3  lfa1~anred  lfa1~ktokk  lfa1~telfx  lfa1~revdb  lfa1~xlfza  lfa1~j_1kfrepre lfa1~pson2
            lfa1~name4  lfa1~bahns  lfa1~kunnr  lfa1~teltx  lfa1~qssys  lfa1~dlgrp  lfa1~j_1kftbus  lfa1~pson3
            lfa1~ort01  lfa1~bbbnr  lfa1~lnrza  lfa1~telx1  lfa1~ktock  lfa1~fityp  lfa1~j_1kftind  lfa1~psovn
            lfa1~ort02  lfa1~bbsnr  lfa1~loevm  lfa1~xcpdk  lfa1~pfort  lfa1~stcdt  lfa1~confs  lfa1~psotl
            lfa1~pfach  lfa1~begru  lfa1~sperr  lfa1~xzemp  lfa1~werks  lfa1~regss  lfa1~updat  lfa1~psohs
            lfa1~pstl2  lfa1~brsch  lfa1~sperm  lfa1~vbund  lfa1~ltsna  lfa1~actss  lfa1~uptim  lfa1~psost
            lfa1~pstlz  lfa1~bubkz  lfa1~spras  lfa1~fiskn  lfa1~werkr  lfa1~stcd3  lfa1~nodel
            lfa1~regio  lfa1~datlt  lfa1~stcd1  lfa1~stceg  lfa1~plkal  lfa1~stcd4  lfa1~qssysdat
            lfa1~sortl  lfa1~dtams  lfa1~stcd2  lfa1~stkzn  lfa1~duefl  lfa1~ipisp  lfa1~podkzb
            lfa1~stras  lfa1~dtaws  lfa1~stkza  lfa1~sperq  lfa1~txjcd  lfa1~taxbs  lfa1~fisku
         INTO CORRESPONDING FIELDS OF TABLE ta_lfa1
         FROM lfa1
         INNER JOIN lfb1 ON
          lfb1~lifnr = lfa1~lifnr
         INNER JOIN lfm1 ON
          lfm1~lifnr = lfa1~lifnr
        WHERE lfa1~lifnr IN so_lifnr
          AND lfb1~bukrs IN ('1000', '2000')
          AND lfm1~ekorg IN ('2000', '4000').

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.