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

reg table relation BSIK and BSAK to EKKO and EKPO tables

hi all,

can u plz let me know how to relate BSIK and BSAK with the corresponding POs??

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 02:01 PM

    Try this:

      SELECT belnr gjahr
        FROM ekbe
        INTO TABLE ekbe_int
        UP TO 100 ROWS
        WHERE ebeln = ebeln
        AND vgabe IN ('1', '2').                      "1 - GR, 2 - IR
    
      CHECK sy-subrc = 0.
    
      SORT ekbe_int.
      DELETE ADJACENT DUPLICATES FROM ekbe_int.
    
      LOOP AT ekbe_int INTO ekbe_wa.
        v_objectkey+00(10) = ekbe_wa-belnr.
        v_objectkey+10(10) = ekbe_wa-gjahr.           "BELNR+YEAR
    
        IF ekbe_wa-vgabe = '1'.
          v_reference = 'MKPF'.
        ELSE.
          v_reference = 'RMRP'.
        ENDIF.
    
    * Uses index BKPF~4 (4.7)
        SELECT SINGLE bukrs belnr gjahr               "Accounting Doc Header
          FROM bkpf
          INTO doc_int
          WHERE awtyp =  v_reference
            AND awkey =  v_objectkey.
        IF sy-subrc = 0.
          APPEND doc_int.
        ENDIF.
      ENDLOOP.
    

    This will give you the document header. You can easily get anything else you need from BSEG.

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 11, 2007 at 01:36 PM

    There was an OSS note on this subject, since purchase invoice allow multiple purchase order in a single invoice this data is no longer written in vendor item (BSEG) of the financial document. So you need to read the other items of the document (general ledger) to get the purchase order(s) linked. Another way could be via table EKBE order history which has the BELNR field too.

    (Note" target="_blank">https://service.sap.com/sap/support/notes/152335">Note 152335 - Field EBELN in line layout variant for cust./vendor)

    Regards

    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.