SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Связь BSIK, BSAK c EKKO и EKPO



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
Сергей
Участник
Участник



Joined: 25 Oct 2007
Posts: 49

PostPosted: Mon Jan 14, 2008 1:32 pm    Post subject: Связь BSIK, BSAK c EKKO и EKPO Reply with quote

Коллеги, как связать таблицы BSIK и BSAK с ордером на закупку?
Back to top
View user's profile Send private message
Lord
Профессионал
Профессионал



Joined: 10 Sep 2007
Posts: 168

PostPosted: Mon Jan 14, 2008 4:54 pm    Post subject: Reply with quote

Правильно, в BSEG поле EBELN не заполнено, потому что согласно ноте
Note 152335 - Field EBELN in line layout variant for cust./vendor

Quote:
Since Release 3.0, several purchase orders can be offset in one invoice. As a result, different purchasing document numbers (BSEG-EBELN) can be contained in the different G/L account line items.


Попробуйте использовать таблицу история докуметов закупок EKBE.

Code:
DATA: lt_ekbe TYPE TABLE OF ekbe,
      ls_ekbe TYPE ekbe.
DATA: l_awkey TYPE bkpf-awkey,
      l_awtyp TYPE bkpf-awtyp.

DATA: BEGIN OF lt_doc OCCURS 0,
      bukrs TYPE bkpf-bukrs,
      belnr TYPE bkpf-belnr,
      gjahr TYPE bkpf-gjahr,
      END OF lt_doc.

PARAMETERS: p_ebeln TYPE ekko-ebeln.

SELECT belnr gjahr
FROM ekbe
INTO TABLE lt_ekbe
WHERE ebeln = p_ebeln
AND vgabe IN ('1', '2'). "1 - GR, 2 - IR

CHECK sy-subrc = 0.

SORT lt_ekbe.
DELETE ADJACENT DUPLICATES FROM lt_ekbe.

LOOP AT lt_ekbe INTO ls_ekbe.
  l_awkey+00(10) = ls_ekbe-belnr.
  l_awkey+10(10) = ls_ekbe-gjahr. "BELNR+YEAR

  IF ls_ekbe-vgabe = '1'.
    l_awtyp = 'MKPF'.
  ELSE.
    l_awtyp = 'RMRP'.
  ENDIF.

* Uses index BKPF~4 (4.7)
  SELECT SINGLE bukrs belnr gjahr "Accounting Doc Header
  FROM bkpf
  INTO lt_doc
  WHERE awtyp = l_awtyp
  AND awkey = l_awkey.
  IF sy-subrc = 0.
    APPEND lt_doc.
  ENDIF.
ENDLOOP.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.