EKBE & EKET
hi,
i´m working on a report using Logical DataBase
MEPOLDB.The problem i´m facing is that there are several entries of ekbe-menge for a single entry of eket-menge.
is there a relationship between ekbe-menge ekbe-bldat and eket-menge eket-sfldt?
Any help would be greatly appreciated.
Hi calsadillo,
the point is, it's quite normal that there are several entries in table EKBE for a single position of a purchase order. Table EKBE stores every goods-receipt movement and every invoice posted to one single position of a purchase order. So if you want to retrieve just one record from table EKBE, I think it's not possible.
But: depending on what you want to do, you could write some sort of
select shkzg sum(menge)
into corresponding fields of ekbe
from ekbe
where ebeln = ...
and ebelp = ...
group by vgabe
...and then you will have, for instance, two records: one for debit positions (shkzg = S), and one for credit positions (shkzg = H). Then you could say:
if ekbe-shkzg = 'H'.
ekbe-menge = ekbe-menge * ( -1 ).
endif.
...and continue with the summarization.
Please let us know if it helped. Best regards,
Alvaro
Similar Messages
-
In BDCP table I am not getting any entries for EKKO,EKPO,EKBE,EKET,EBAN
In BDCP table I am not getting any entries for EKKO,EKPO,EKBE,EKET,EBAN tables.
But there are entries for many other tables.
I have got objects for EKKO,EKPO,EKBE,EKET,EBAN tables from TCDOB tables.Hi Avishek,
Let me explain the meaning of Change pointers.
If you have entry in BDCP table for MARA, that means everytime a material is created in MARA table in one system, a corresponding Material is created in another system which is connected to the current system VIA ALE. and whenever you change that material in your source system, then the change is propagated to the target system also(If you have done the change pointer set up).
The you do not have entries for other tables becuase the configuration for change pointers is not done for those Objects(In your case the change pointers are not defined for Purchase Orders and hence no entries in BDCP table).
Regards,
Ravi kanth Talagana -
Lead time for Purchase Orders and Goods R. (EKBE-EKET)
Hi all,
has anyone already implemented a logic for calculating
the lead time between delivery date (EKET-EINDT) and the
goods receipt date (EKBE-BUDAT) for extraction to BW?
I have the problem, that i have more than one schedule line. There you cant link the GR (EKBE) to the relevant schedule line (EKET). How can i implement the FIFO solution (FirstinFirstout)?
Example:
EKET
DocNr_Pos__ETENR__Quantity____EINDT
6700___10__1_______100________20060601
6700___10__2_______300________20060701
EKBE
DocNr_Pos__Nr__Quantity__Budat
6700___10__1_____200_____20060603
6700___10__2_____200_____20060702
Result should be:
DocNr_Pos_ETENR__Quantity__Deliverydate__ZBUDAT(from ekbe)
6700___10__1_______100________20060601___20060603
6700___10__2_______300________20060701___20060702
20060702 therefor because the the full quantity arrived at
this date.
Thank you very much for your help or any codings, best regards
FrankHI Horny,
Can you use the Following Tables:
S039 - > LETZTABG - Date: last (i.e. most recent) goods issue
EKPO -> EBELN - Purchasing Document Number.
You can create View by using these two tables (Material Number is the Common) and uploade the data.
Hope this will be helpful for your question.
Thanks
Rajesh
Message was edited by:
rajesh -
Function module for getting ekko ekpo ekbe, eket data for material & plant
Hi experts,
I need to get data for me31l transactional data......for that i need ekbe purchasing document and
material documents based on given material and plant and posting date or crop.....
Please reply as soon as possible..
Thanks in advance
M PrasannaHi ,
Try this FM
ISIDE_PDI_PDOC_INFO_READ
Its get you all the purchase doc's info for creating outline agreement for the vendor..
check and let me know... -
Scheduling Agreement - Delivery schedule line number
Hi,
I am developing a report to show the Goods receipt postings for each delivery schedules of Schedule agreements.
I am not able to find Delivery Schedules line(EKET-ETENR) in Material document table(MSEG).
How do we exactly link the GR quantity to Scheduling agreement Delivery schedules.
We have line item number but not delivery schedules.
GR quantity may be posted to different delivery scheules and for some SAs when the MRP Runs it is positng randomly.
Is there function to find the link,
Searched EKBE, EKET, MSEG and other tables also.
Appreciate your help <offer removed by moderator>.
Satya
Edited by: Thomas Zloch on Jan 18, 2011 2:44 PMHi Shravan,
Thanks for answering, I checked those two tables EKEH, EKEK are release tables. We have some SAs without release documentation. I have to find the delivery schedules using the GR document to which delivery schedules the qty it is delivering.
It is not posting the qty from top of schedules, for some SAs it posted randomly.
Any other ideas or any function modules,
In BW it is possible using extractor but we need in R/3
Thanks,
Satya -
Hello experts
I want some interactive reports on purchase orders. also if u can give for purchase order reqisition.
thanx in advancedhi
see this sample report and use the tables
EKKO,EKPO,EKBE,EKET etc and prepare some other interactive reports
*& Report ZMM_PO_REPORT
REPORT ZMM_PO_REPORT message-Id yb
NO STANDARD PAGE HEADING
LINE-COUNT 60(1)
LINE-SIZE 230.
D A T A B A S E T A B L E S D E C L A R A T I O N
TABLES: lfa1, " Vendor Master
t161, " PO Doc Types
t024, " Purchase Groups
ekko. " PO Header
T Y P E S D E C L A R A T I O N S
Purchase Orders Main Structure
TYPES: BEGIN OF s_po,
ebeln TYPE ebeln, " PO No.
ebelp TYPE ebelp, " PO Item
bstyp TYPE bstyp, " PO Category
bukrs TYPE bukrs, " Company Code
bsart TYPE bbsrt, " PO Type
lifnr TYPE lifnr, " Vendor No
ekgrp TYPE bkgrp, " Purchase Group
waers TYPE waers, " Currency
bedat TYPE etbdt, " PO Date
txz01 TYPE txz01, " Material Text
werks TYPE ewerk, " Plant
lgort TYPE lgort_d, " Storage Location
matkl TYPE matkl, " Material Group
menge TYPE bamng, " PR Quantity
meins TYPE bamei, " UOM
bprme TYPE bbprm, " Price Unit
netpr TYPE netpr, " Net price
peinh TYPE peinh, " Price Unit UOM
pstyp TYPE pstyp, " Item Category
knttp TYPE knttp, " Account Assignment Category
END OF s_po.
Purchase Orders History Structure
TYPES: BEGIN OF s_account,
ebeln TYPE ebeln, " PO No.
ebelp TYPE ebelp, " PO Item
gjahr TYPE mjahr, " Fiscal Year
belnr TYPE mblnr, " PO Invoice No
menge TYPE menge_d, " PR Quantity
wrbtr TYPE wrbtr, " Price in Local Currency
dmbtr TYPE dmbtr, " Price in Foreign Currency
waers TYPE waers, " Currency
shkzg TYPE shkzg, " Dr/Cr Indicator
END OF s_account.
Purchase Orders History Structure(Item Sum)
TYPES: BEGIN OF s_inv_sum,
ebeln TYPE ebeln, " PO No.
ebelp TYPE ebelp, " PO Item
menge TYPE menge_d, " PR Quantity
wrbtr TYPE wrbtr, " Price in Foreign Currency
waers TYPE waers, " Currency
END OF s_inv_sum.
Purchase Orders Main Structure
TYPES: BEGIN OF s_rep,
lifnr TYPE lifnr, " Vendor No
ebeln TYPE ebeln, " PO No.
ebelp TYPE ebelp, " PO Item
bstyp TYPE bstyp, " PO Category
bsart TYPE bbsrt, " PO Type
ekgrp TYPE bkgrp, " Purchase Group
waers TYPE waers, " Currency
bedat TYPE etbdt, " PO Date
txz01 TYPE txz01, " Material Text
werks TYPE ewerk, " Plant
lgort TYPE lgort_d, " Storage Location
matkl TYPE matkl, " Material Group
menge TYPE bamng, " PR Quantity
meins TYPE bamei, " UOM
bprme TYPE bbprm, " Price Unit
netpr TYPE netpr, " Net price
peinh TYPE peinh, " Price Unit UOM
pstyp TYPE pstyp, " Item Category
knttp TYPE knttp, " Account Assignment Category
name1 TYPE name1, " Plant
orewr TYPE netpr, " To be Invoiced Price
curr TYPE waers, " Inv Doc Currency
END OF s_rep.
D A T A D E C L A R A T I O N S
DATA: gv_title1 TYPE sylisel, " Report title
gv_dial. " Color flag
C O N S T A N T S D E C L A R A T I O N S
CONSTANTS: c_x VALUE 'X', " Flag X
c_h VALUE 'H', " Debit
c_vgabe TYPE vgabe VALUE '2'. " Transaction Type
I N T E R N A L T A B L E S D E C L A R A T I O N S
DATA: i_po TYPE STANDARD TABLE OF s_po WITH HEADER LINE,
" Purchase Order
i_inv TYPE STANDARD TABLE OF s_inv_sum WITH HEADER LINE,
" PO Invoice Values
i_rep TYPE STANDARD TABLE OF s_rep WITH HEADER LINE,
" PO Invoice Values
i_ekbe TYPE STANDARD TABLE OF s_account WITH HEADER LINE.
" PO Invoice Values
S E L E C T I O N S C R E E N *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr MATCHCODE OBJECT kred,
s_ebeln FOR ekko-ebeln MATCHCODE OBJECT mekk,
s_bsart FOR t161-bsart,
s_ekgrp FOR t024-ekgrp,
s_bedat FOR ekko-bedat.
SELECTION-SCREEN END OF BLOCK b1.
I N I T I A L I Z A T I O N *
INITIALIZATION.
A T S E L E C T I O N - S C R E E N *
AT SELECTION-SCREEN.
Validate the screen fields
PERFORM validate_screen.
S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
Fetch main data
PERFORM fetch_data.
T O P - O F - P A G E *
TOP-OF-PAGE.
Header of the List
PERFORM header.
E N D - O F - P A G E *
Footer
END-OF-PAGE.
ULINE.
E N D - O F - S E L E C T I O N *
END-OF-SELECTION.
Display the Report Output data
PERFORM display_data.
At Line-Selection
AT LINE-SELECTION.
When double clicked on EBELN display the details of Purchase Doc
PERFORM line_sel.
*& Form validate_screen
Validation of Selection Screen fields
FORM validate_screen .
Validation of Vendor Number
CLEAR lfa1-lifnr.
IF NOT s_lifnr[] IS INITIAL.
SELECT lifnr UP TO 1 ROWS
INTO lfa1-lifnr
FROM lfa1
WHERE lifnr IN s_lifnr.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Invalid Vendor'(002).
ENDIF.
ENDIF.
Validation of PO Number
CLEAR ekko-ebeln.
IF NOT s_ebeln[] IS INITIAL.
SELECT ebeln UP TO 1 ROWS
INTO ekko-ebeln
FROM ekko
WHERE ebeln IN s_ebeln.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Invalid Document Number'(003).
ENDIF.
ENDIF.
Validation of PO Document Type
CLEAR t161-bsart.
IF NOT s_bsart[] IS INITIAL.
SELECT bsart UP TO 1 ROWS
INTO t161-bsart
FROM t161
WHERE bsart IN s_bsart.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Invalid Purchase Document Type'(004).
ENDIF.
ENDIF.
Validation of Purchasing Group
CLEAR t024-ekgrp.
IF NOT s_ekgrp[] IS INITIAL.
SELECT ekgrp UP TO 1 ROWS
INTO t024-ekgrp
FROM t024
WHERE ekgrp IN s_ekgrp.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Invalid Purchasing Group'(005).
ENDIF.
ENDIF.
ENDFORM. " validate_screen
*& Form fetch_data
Fetching the PO related data from Database Tables
FORM fetch_data .
CLEAR i_po.
REFRESH i_po.
SELECT a~ebeln " PO No.
b~ebelp " PO Item
a~bstyp " PO Category
a~bukrs " Company Code
a~bsart " PO Type
a~lifnr " Vendor No
a~ekgrp " Purchase Group
a~waers " Currency
a~bedat " PO Date
b~txz01 " Material Text
b~werks " Plant
b~lgort " Storage Location
b~matkl " Material Group
b~menge " PR Quantity
b~meins " UOM
b~bprme " Price Unit
b~netpr " Net price
b~peinh " Price Unit UOM
b~pstyp " Item Category
b~knttp " Account Assignment Category
INTO TABLE i_po
FROM ekko AS a JOIN ekpo AS b
ON a~ebeln = b~ebeln
WHERE a~ebeln IN s_ebeln AND
a~lifnr IN s_lifnr AND
a~ekgrp IN s_ekgrp AND
a~bsart IN s_bsart AND
a~bedat IN s_bedat.
SORT i_po BY ebeln ebelp.
break-point.
IF NOT i_po[] IS INITIAL.
Fetch the PO History/Invoice Details from EKBE Table
CLEAR i_ekbe.
REFRESH i_ekbe.
SELECT ebeln " PO No.
ebelp " PO Item
gjahr " Fiscal Year
belnr " PO Invoice No
menge " PR Quantity
wrbtr " Price in Local Currency
dmbtr " Price in Foreign Currency
waers " Currency
shkzg " Dr/Cr Indicator
INTO TABLE i_ekbe
FROM ekbe
FOR ALL ENTRIES IN i_po
WHERE ebeln = i_po-ebeln AND
ebelp = i_po-ebelp AND
vgabe = c_vgabe.
IF sy-subrc = 0.
SORT i_ekbe BY ebeln ebelp.
LOOP AT i_ekbe.
IF i_ekbe-shkzg = c_h.
i_ekbe-wrbtr = i_ekbe-wrbtr * -1.
ENDIF.
MODIFY i_ekbe.
ENDLOOP.
break-point.
Sum up the Item wise Invoice totals
LOOP AT i_ekbe.
AT END OF ebelp.
READ TABLE i_ekbe INDEX sy-tabix.
SUM.
MOVE-CORRESPONDING i_ekbe TO i_inv.
APPEND i_inv.
ENDAT.
CLEAR i_inv.
ENDLOOP.
SORT i_inv BY ebeln ebelp.
break-point.
ENDIF.
ENDIF.
Move the Vendor Name and Invoice Values to I_rep Internal Table
LOOP AT i_po.
MOVE-CORRESPONDING i_po TO i_rep.
CLEAR i_inv.
READ TABLE i_inv WITH KEY ebeln = i_po-ebeln
ebelp = i_po-ebelp.
IF sy-subrc = 0.
i_rep-orewr = ( i_po-menge - i_inv-menge ) * i_po-netpr.
i_rep-curr = i_inv-waers.
ELSE.
i_rep-orewr = i_po-menge * i_po-netpr.
i_rep-curr = i_po-waers.
ENDIF.
break-point.
Get the Vendor Name
CLEAR lfa1-name1.
SELECT SINGLE name1 FROM lfa1 INTO lfa1-name1
WHERE lifnr = i_po-lifnr.
IF sy-subrc = 0.
i_rep-name1 = lfa1-name1.
ENDIF.
APPEND i_rep.
CLEAR i_rep.
break-point.
ENDLOOP.
SORT i_rep BY lifnr ebeln ebelp.
DELETE i_rep WHERE orewr LE 0.
break-point.
ENDFORM. " fetch_data
*& Form display_data
Display the Report Output data
FORM display_data .
DATA: lv_flag, " New Flag
lv_rec TYPE i. " No of Records
CLEAR lv_rec.
IF i_rep[] IS INITIAL.
MESSAGE e000 WITH 'No Data found'(022).
ELSE.
LOOP AT i_rep.
Toggle Color
PERFORM toggle_color.
IF lv_flag <> space.
NEW-LINE.
ENDIF.
At New Purchase Document
AT NEW ebeln.
WRITE:/1 sy-vline, 2(10) i_rep-ebeln INTENSIFIED OFF.
lv_flag = c_x.
lv_rec = lv_rec + 1.
ENDAT.
WRITE: 1 sy-vline,
12 sy-vline,13(4) i_rep-bsart,
17 sy-vline,18(10) i_rep-lifnr,
28 sy-vline,29(35) i_rep-name1,
64 sy-vline,65(4) i_rep-ekgrp,
69 sy-vline,70(10) i_rep-bedat,
80 sy-vline,81(5) i_rep-ebelp,
86 sy-vline,87(40) i_rep-txz01,
127 sy-vline,128(9) i_rep-matkl,
137 sy-vline,138(1) i_rep-pstyp,
139 sy-vline,140(1) i_rep-knttp,
141 sy-vline,142(4) i_rep-werks,
146 sy-vline,147(4) i_rep-lgort,
151 sy-vline,152(13) i_rep-menge UNIT i_rep-meins,
165 sy-vline,166(3) i_rep-meins,
169 sy-vline,170(15) i_rep-netpr CURRENCY i_rep-waers,
185 sy-vline,186(4) i_rep-waers,
190 sy-vline,191(5) i_rep-peinh,
196 sy-vline,197(4) i_rep-bprme,
201 sy-vline,202(15) i_rep-orewr CURRENCY i_rep-curr,
217 sy-vline,218(4) i_rep-curr,
222 sy-vline,223(7) i_rep-bstyp centered,
230 sy-vline.
NEW-LINE.
hide: i_rep-ebeln.
ENDLOOP.
ULINE.
FORMAT COLOR OFF.
WRITE : /2 'Total Number of Purchasing Documents:'(025) COLOR 3,
lv_rec COLOR 3.
ENDIF.
ENDFORM. " display_data
*& Form header
Write the Report Header
FORM header .
FORMAT RESET.
header
WRITE:/1(230) 'LIST OF PURCHASE DOCUMENTS PER VENDOR'(006) CENTERED.
SKIP.
FORMAT COLOR COL_HEADING.
ULINE.
WRITE:/1 sy-vline,2(10) 'Pur.Doc.No'(006) CENTERED,
12 sy-vline,13(4) 'Type'(007),
17 sy-vline,18(10) 'Vendor'(008) CENTERED,
28 sy-vline,29(35) 'Name'(009) CENTERED,
64 sy-vline,65(4) 'PGrp'(010) CENTERED,
69 sy-vline,70(10) 'Doc.Date'(012) CENTERED,
80 sy-vline,81(5) 'Item'(011),
86 sy-vline,87(40) 'Material Short Text'(024) CENTERED,
127 sy-vline,128(9) 'Mat.Group'(013),
137 sy-vline,138(1) 'I',
139 sy-vline,140(1) 'A',
141 sy-vline,142(4) 'Plnt'(014),
146 sy-vline,147(4) 'SLoc'(015),
151 sy-vline,152(13) 'Quantity'(016) CENTERED,
165 sy-vline,166(3) 'UoM'(017),
169 sy-vline,170(15) 'Net Value'(018) CENTERED,
185 sy-vline,186(4) 'Curr'(019),
190 sy-vline,191(5) 'Per'(020),
196 sy-vline,197(4) 'Unit'(021),
201 sy-vline,202(15) 'To be Invoiced'(023) CENTERED,
217 sy-vline,218(4) 'Curr'(019),
222 sy-vline,223(7) 'Doc.Cat'(026),
230 sy-vline.
ULINE.
ENDFORM. " header
*& Form toggle_color
This routine alters the color of the records in the list
FORM toggle_color.
IF gv_dial = space.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
gv_dial = c_x.
ELSE.
FORMAT COLOR 1 INTENSIFIED OFF.
CLEAR gv_dial.
ENDIF.
ENDFORM. " toggle_color
*& Form LINE_SEL
*When double clicked on EBELN field display the details of Purchase Doc
FORM line_sel.
CASE sy-lsind.
WHEN '1'.
DATA: lv_field(20),
lv_value(10),
lv_bstyp like i_rep-bstyp.
clear: lv_bstyp,lv_value, lv_field.
GET CURSOR FIELD lv_field VALUE lv_value.
IF lv_field = 'I_REP-EBELN'.
IF NOT lv_value IS INITIAL.
READ LINE sy-index FIELD VALUE i_rep-bstyp
INTO lv_bstyp.
READ CURRENT LINE FIELD VALUE i_rep-bstyp INTO lv_bstyp.
if lv_bstyp = 'F'.
SET PARAMETER ID 'BES' FIELD lv_value.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
elseif ( lv_bstyp = 'K' or lv_bstyp = 'L' ).
SET PARAMETER ID 'VRT' FIELD lv_value.
CALL TRANSACTION 'ME33' AND SKIP FIRST SCREEN.
elseif lv_bstyp = 'A'.
SET PARAMETER ID 'ANF' FIELD lv_value.
CALL TRANSACTION 'ME43' AND SKIP FIRST SCREEN.
endif.
ENDIF.
ENDIF.
ENDCASE.
ENDFORM. " line_sel
Regards
Anji -
GR Service Doc Item Catory "D" not transfered to BW using 2lis_02_sgr
Hi Friends,
I have a problem using Standard Datasource (2LIS_02_SGR). When I extract data from R/3 system, some POs are not captured to BW but my bw loading everything working fine in Production.
When I cross check with R/3 system, POs which are under Service item categery'D" were not transfering to bw otherthan this rest all Goods receipt documents were transfering to BW.
Pls note: My datasource doesn't have any enhancement in R/3 system & no routines involved in BW as well.
Could you suggest how to get all existing POs from R/3 (EKBE, EKET) to bw using 2lis_02_sgr).
Thanks
SiriI beleive 2lis_02_sgr does not extract service lines.
you will find information of these lines in tables ESLH ESLL as well
I think the cube for these services is 0SRV_C01 and the extractor is 2LIS_02_S174 .
Please let me know if you get more info on this
rgds,
Sanjyot -
Making changes to date-related fields
Hi all,
Before i continue, i'd like to thank everyone who helped me develop my first ever ABAP program. However, i am now asked to make changes to it.
Criteria: The input field for PO Date (I_BEDAT) now has to become 2 separate input fields. The first field is where the user has to input the month that they wish to query (I_MONTH1 to I_MONTH2). The second field is where the user has to input the year that they wish to query (I_YEAR).
The following is what i have done so far, without any changes made yet. I'm still reading what the F1 help has to say before i do anything...but if anyone could give me a hint or an idea where to start with, please share it with me...thanks to all in advance
*& Report ZLPUPO100 *
*& Description : Delivery Evaluation Report *
REPORT ZLPUPO100 NO STANDARD PAGE HEADING LINE-SIZE 135 LINE-COUNT 65.
TABLES: EKKO,
EKPO,
EKBE,
EKET.
DATA: BEGIN OF ITAB OCCURS 0,
EBELN LIKE EKKO-EBELN, "Purchasing Document Number
EBELP LIKE EKPO-EBELP, "Item Number of Purchasing Document
EINDT LIKE EKET-EINDT, "Item delivery date
BUDAT LIKE EKBE-BUDAT, "Posting Date in the Document
END OF ITAB.
DATA: BEGIN OF WTAB OCCURS 0,
EBELN LIKE EKBE-EBELN, "Purchasing Document Number
EBELP LIKE EKBE-EBELP, "Item Number of Purchasing Document
* EINDT LIKE EKET-EINDT, "Item delivery date
BUDAT LIKE EKBE-BUDAT, "Posting Date in the Document
END OF WTAB.
DATA V_OVERDUE TYPE I.
DATA COUNT_OVERDUE TYPE I.
DATA COUNT_LINES TYPE I.
DATA V_PERCENTAGE TYPE P DECIMALS 9.
*& SELECTION-SCREEN
SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:
I_WERKS FOR EKPO-WERKS DEFAULT '6000' NO INTERVALS, "PLANT
I_BUKRS FOR EKKO-BUKRS DEFAULT 'GSPC' NO INTERVALS, "COMPANY CODE
I_EBELN FOR EKKO-EBELN DEFAULT, "PO NUMBER
I_LIFNR FOR EKKO-LIFNR, "VENDOR NUMBER
I_MATNR FOR EKPO-MATNR. "MATERIAL NUMBER
I_BEDAT FOR EKKO-BEDAT. "PO DATE
PARAMETERS I_MONTH(2) TYPE D. "YEAR
PARAMETERS I_YEAR(4) TYPE D DEFAULT SY-DATUM+0(4). "MONTH
SELECTION-SCREEN END OF BLOCK 1.
SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME TITLE TEXT-002.
PARAMETERS: P_ONET RADIOBUTTON GROUP RFMT DEFAULT 'X', "ON-TIME
P_ODUE RADIOBUTTON GROUP RFMT, "OVERDUE
P_ALLP RADIOBUTTON GROUP RFMT, "BOTH (SORT BY PO NO.)
P_ALLC RADIOBUTTON GROUP RFMT. "BOTH (SORT BY CATEGORY)
SELECTION-SCREEN END OF BLOCK 2.
*& START-OF-SELECTION
START-OF-SELECTION.
PERFORM WRITE_HEADER.
PERFORM SELECT_DATA.
END-OF-SELECTION.
*& FORM WRITE_HEADER
FORM WRITE_HEADER.
WRITE: /1 'REPORT:', SY-REPID,
118 'PAGE:', SY-PAGNO.
WRITE: /1 'DATE:', SY-DATUM,
54 'DELIVERY EVALUATION REPORT',
118 'USER:', SY-UNAME, 147 ' ' .
WRITE: / SY-ULINE(148).
ENDFORM.
*& SELECT_DATA
FORM SELECT_DATA.
*--> IF ON-TIME DELIVERY IS SELECTED
IF P_ONET EQ 'X'.
PERFORM WRITE_ONET.
*--> IF OVERDUE DELIVERY IS SELECTED
ELSEIF P_ODUE EQ 'X'.
PERFORM WRITE_ODUE.
*--> IF BOTH IS SELECTED, SORT BY PO NUMBER
ELSEIF P_ALLP EQ 'X'.
PERFORM WRITE_ALLP.
*--> IF BOTH IS SELECTED, SORT BY CATEGORY (+/-)
ELSE.
PERFORM WRITE_ONET.
PERFORM WRITE_ODUE.
ENDIF.
ENDFORM.
*& FORM WRITE_ONET
FORM WRITE_ONET.
SELECT A~EBELN B~EBELP C~EINDT
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM ( EKKO AS A
INNER JOIN EKPO AS B
ON B~EBELN = A~EBELN
INNER JOIN EKET AS C
ON C~EBELN = B~EBELN AND
C~EBELP = B~EBELP AND
C~ETENR = '1')
WHERE B~WERKS IN I_WERKS AND
B~LOEKZ = ' ' AND
A~BUKRS IN I_BUKRS AND
A~BSTYP = 'F' AND
A~EBELN IN I_EBELN AND
A~LIFNR IN I_LIFNR AND
B~MATNR IN I_MATNR AND
A~BEDAT IN I_BEDAT
ORDER BY A~EBELN B~EBELP.
*DELETE ADJACENT DUPLICATES FROM ITAB COMPARING ALL FIELDS.
SELECT EBELN EBELP BUDAT
INTO CORRESPONDING FIELDS OF TABLE WTAB
FROM EKBE
WHERE WERKS IN I_WERKS AND
EBELN IN I_EBELN AND
* EBELP = ITAB-EBELP AND
VGABE = '1' AND
BEWTP = 'E'
ORDER BY EBELN EBELP.
FORMAT COLOR 1.
WRITE: / SY-ULINE(86).
WRITE: /1 '|', 20 'EVALUATION REPORT FOR ON-TIME DELIVERY ITEMS',
86 '|'.
FORMAT COLOR OFF.
FORMAT COLOR 4.
WRITE: / SY-ULINE(86).
WRITE: /1 '|', 5 'PO No.',
14 '|', 16 'PO Item No.',
28 '|', 'PO Delivery Date',
47 '|', 'Actual Delivery',
65 '|', 'Overdue Days (+/-)',
86 '|'.
FORMAT COLOR OFF.
WRITE: / SY-ULINE(86).
NEW-LINE.
LOOP AT WTAB.
MOVE WTAB-BUDAT TO ITAB-BUDAT.
MODIFY ITAB TRANSPORTING BUDAT
WHERE EBELN = WTAB-EBELN AND
EBELP = WTAB-EBELP.
ENDLOOP.
LOOP AT ITAB.
IF NOT ITAB-BUDAT IS INITIAL.
*--> IF BUDAT CONTAINS A DATE
V_OVERDUE = ITAB-BUDAT - ITAB-EINDT.
ELSE.
*-- IF BUDAT DOES NOT CONTAIN A DATE
CLEAR V_OVERDUE.
ENDIF.
*--> DISPLAY ON-TIME ITEMS ONLY
* IF V_OVERDUE LE 0.
IF ITAB-BUDAT IS INITIAL.
DELETE ITAB.
ELSEIF ITAB-BUDAT > ITAB-EINDT.
DELETE ITAB.
ELSE.
WRITE: /1 '|', 3 ITAB-EBELN, "PO NO
14 '|', 19 ITAB-EBELP, "PO ITEM NO
28 '|', 33 ITAB-EINDT, "PO DELIVERY DATE
47 '|', 51 ITAB-BUDAT, "ACTUAL DELIVERY DATE
65 '|', V_OVERDUE, "OVERDUE DAYS
86 '|'.
* WRITE: / SY-ULINE(86).
ENDIF.
ENDLOOP.
WRITE: / SY-ULINE(86).
ENDFORM.
*& FORM WRITE_ODUE
FORM WRITE_ODUE.
SELECT A~EBELN B~EBELP C~EINDT
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM ( EKKO AS A
INNER JOIN EKPO AS B
ON B~EBELN = A~EBELN
INNER JOIN EKET AS C
ON C~EBELN = B~EBELN AND
C~EBELP = B~EBELP AND
C~ETENR = '1')
WHERE B~WERKS IN I_WERKS AND
B~LOEKZ = ' ' AND
A~BUKRS IN I_BUKRS AND
A~BSTYP = 'F' AND
A~EBELN IN I_EBELN AND
A~LIFNR IN I_LIFNR AND
B~MATNR IN I_MATNR AND
A~BEDAT IN I_BEDAT
ORDER BY A~EBELN B~EBELP.
*DELETE ADJACENT DUPLICATES FROM ITAB COMPARING ALL FIELDS.
SELECT EBELN EBELP BUDAT
INTO CORRESPONDING FIELDS OF TABLE WTAB
FROM EKBE
WHERE WERKS IN I_WERKS AND
EBELN IN I_EBELN AND
* EBELP = ITAB-EBELP AND
VGABE = '1' AND
BEWTP = 'E'
ORDER BY EBELN EBELP.
FORMAT COLOR 1.
WRITE: / SY-ULINE(86).
WRITE: /1 '|', 20 'EVALUATION REPORT FOR OVERDUE DELIVERY ITEMS',
86 '|'.
FORMAT COLOR OFF.
FORMAT COLOR 4.
WRITE: / SY-ULINE(86).
WRITE: /1 '|', 5 'PO No.',
14 '|', 16 'PO Item No.',
28 '|', 'PO Delivery Date',
47 '|', 'Actual Delivery',
65 '|', 'Overdue Days (+/-)',
86 '|'.
FORMAT COLOR OFF.
WRITE: / SY-ULINE(86).
NEW-LINE.
LOOP AT WTAB.
MOVE WTAB-BUDAT TO ITAB-BUDAT.
MODIFY ITAB TRANSPORTING BUDAT
WHERE EBELN = WTAB-EBELN AND
EBELP = WTAB-EBELP.
ENDLOOP.
LOOP AT ITAB.
ADD 1 TO COUNT_LINES.
ENDLOOP.
LOOP AT ITAB.
IF NOT ITAB-BUDAT IS INITIAL.
*--> IF BUDAT CONTAINS A DATE
V_OVERDUE = ITAB-BUDAT - ITAB-EINDT.
ELSE.
*-- IF BUDAT DOES NOT CONTAIN A DATE
CLEAR V_OVERDUE.
ENDIF.
*--> DISPLAY OVERDUE ITEMS ONLY
IF V_OVERDUE < 0.
* ADD 1 TO COUNT_OVERDUE.
DELETE ITAB.
ELSEIF ITAB-BUDAT = ITAB-EINDT.
DELETE ITAB.
ELSE.
ADD 1 TO COUNT_OVERDUE.
WRITE: /1 '|', 3 ITAB-EBELN, "PO NO
14 '|', 19 ITAB-EBELP, "PO ITEM NO
28 '|', 33 ITAB-EINDT, "PO DELIVERY DATE
47 '|', 51 ITAB-BUDAT, "ACTUAL DELIVERY DATE
65 '|', V_OVERDUE, "OVERDUE DAYS
86 '|'.
* WRITE: / SY-ULINE(86).
ENDIF.
ENDLOOP.
WRITE: / SY-ULINE(86).
NEW-LINE.
WRITE: /1 '|', 'Total Overdue Delivery Items: '.
FORMAT COLOR 3.
WRITE: COUNT_OVERDUE.
FORMAT COLOR OFF.
WRITE: 86 '|'.
COMPUTE V_PERCENTAGE = ( COUNT_OVERDUE * 100 ) / COUNT_LINES.
WRITE: /1 '|', 'Percentage (%) Over All Deliveries: '.
FORMAT COLOR 3.
WRITE: V_PERCENTAGE DECIMALS 2.
FORMAT COLOR OFF.
WRITE: 86 '|'.
WRITE: / SY-ULINE(86).
ENDFORM.
*& FORM WRITE_ALLP
FORM WRITE_ALLP.
SELECT A~EBELN B~EBELP C~EINDT
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM ( EKKO AS A
INNER JOIN EKPO AS B
ON B~EBELN = A~EBELN
INNER JOIN EKET AS C
ON C~EBELN = B~EBELN AND
C~EBELP = B~EBELP AND
C~ETENR = '1')
WHERE B~WERKS IN I_WERKS AND
B~LOEKZ = ' ' AND
A~BUKRS IN I_BUKRS AND
A~BSTYP = 'F' AND
A~EBELN IN I_EBELN AND
A~LIFNR IN I_LIFNR AND
B~MATNR IN I_MATNR AND
A~BEDAT IN I_BEDAT
ORDER BY A~EBELN B~EBELP.
*DELETE ADJACENT DUPLICATES FROM ITAB COMPARING ALL FIELDS.
SELECT EBELN EBELP BUDAT
INTO CORRESPONDING FIELDS OF TABLE WTAB
FROM EKBE
WHERE WERKS IN I_WERKS AND
EBELN IN I_EBELN AND
* EBELP = ITAB-EBELP AND
VGABE = '1' AND
BEWTP = 'E'
ORDER BY EBELN EBELP.
FORMAT COLOR 1.
WRITE: / SY-ULINE(86).
WRITE: /1 '|', 20 'EVALUATION REPORT FOR ALL DELIVERY ITEMS',
86 '|'.
FORMAT COLOR OFF.
FORMAT COLOR 4.
WRITE: / SY-ULINE(86).
WRITE: /1 '|', 5 'PO No.',
14 '|', 16 'PO Item No.',
28 '|', 'PO Delivery Date',
47 '|', 'Actual Delivery',
65 '|', 'Overdue Days (+/-)',
86 '|'.
FORMAT COLOR OFF.
WRITE: / SY-ULINE(86).
NEW-LINE.
LOOP AT WTAB.
MOVE WTAB-BUDAT TO ITAB-BUDAT.
MODIFY ITAB TRANSPORTING BUDAT
WHERE EBELN = WTAB-EBELN AND
EBELP = WTAB-EBELP.
ENDLOOP.
LOOP AT ITAB.
IF NOT ITAB-BUDAT IS INITIAL.
*--> IF BUDAT CONTAINS A DATE
V_OVERDUE = ITAB-BUDAT - ITAB-EINDT.
ELSE.
*-- IF BUDAT DOES NOT CONTAIN A DATE
CLEAR V_OVERDUE.
ENDIF.
*--> DISPLAY BOTH ON-TIME AND OVERDUE ITEMS
WRITE: /1 '|', 3 ITAB-EBELN, "PO NO
14 '|', 19 ITAB-EBELP, "PO ITEM NO
28 '|', 33 ITAB-EINDT, "PO DELIVERY DATE
47 '|', 51 ITAB-BUDAT, "ACTUAL DELIVERY DATE
65 '|', V_OVERDUE, "OVERDUE DAYS
86 '|'.
* WRITE: / SY-ULINE(86).
ENDLOOP.
WRITE: / SY-ULINE(86).
ENDFORM.Hi Bernard,
congratulations to your first ever ABAP program.
Looks pretty good. I assume your question refers to
the declaration of your both new fields.
The data type 'D' already automatically declares a field
as a character field of length 8. You should declare
I_MONTH as type C length 2 and I_YEAR as length 4.
Better yet: Let I_MONTH refer to the datatype MONTH and
declare it as a listbox-parameter
(like: I_MONTH type MONTH AS LISTBOX). This has the advantage of having allowed values in your parameter listbox, coming from SAP standard. Unfortunetaly there is nothing like that for year and it would probably lead to far to describe how to create a set of allowed values for this parameter on your own.
The second problem you might have is how to execute a proper selection on this. One of maybe 10 different ways to do that would be to leave the I_BEDAT selewct-option as it is but to hide it from the selection screen and fill it automatically with what you have in your both new parameters. Select-Options are stored internally as a table that you append a line to, as follows:
Fill the LOW-value (FROM-value in selection) with
the first day of the month:
CONCATENATE I_YEAR I_MONTH '01' TO I_BEDAT-LOW.
Fill a new date variable with the last day of the
month by (as above, I_BEDAT-LOW replaced by your
variable, I_MONTH incremented before by 1, subtract
1 from the readily concatenated date and you have the
last day of the month as result):
MOVE: NEW_DATE_VARIABLE TO I_BEDAT-HIGH,
'BT' TO I_BEDAT-OPTION, "(=Between)
'I' TO I_BEDAT-SIGN. "(=Inlusive)
APPEND I_BEDAT.
After that you can continue using the I_BEDAT-Selection
in your Selection as it is. -
PO OPEN QTY AT PARTICULAR DATE
Hi Experts
I need to check the open qty of purchase order bcoz i have to upload the PO from old system to new system.
so i want to get the Open Purchase order qty from particular date say 1st april .
so that i can upload the same into new System with upload programme.
Thanks
Pankaj AgarwalIf the legacy system is also a SAP system, you may refer to ME2* series reports (eg: ME2M, ME2N, etc).
As regards to open, it depends on the definition of open PO, so PO's which are not delivered, those delivered but not invoiced etc. So use the selection parameter eg: WE101 to get the relevant data.
If you wish to do the same at table level, then some of the tables which should help are EKKO,EKPO,EKBE,EKET,MSEG.
However if the legacy system is not a SAP system, then get in touch with the client's IT team to do the extraction.
Also do search in MM forum to find similar threads. -
These are my tables:
eban,
ekbe,
eket,
ekko,
ekpo,
likp,
makt,
mara,
marc,
marm,
mbew,
mdpb,
mdrs,
mvke,
plaf,
zapodata_mth,
s742,
t179t,
t460a,
zbw_eod,
zcopk,
zendbald,
zendproj,
zflashs,
zgblh,
zprdsched,
zschd,
vbbe,
t179.
The problem is, I need to do a report using all these tables... what's the best way to match them? Please advise and thanks in advance.Hi Pom,
Use the primary key relation between tables and retrieve the data using innerjoins and you can also use condition types.
Reward Points if helpful.
Regards,
Harini.S -
Hi gurus,
is there a field on the PO which can be used to put in a text on why the PO is late? We have a built a report to comapre the statistical devleiry dates from the PO and compare it with the posting date of the material document and then it determines by how many days is the PO late. Now the users also want some place on the PO where they can put the reason why the PO is late mostly in the text format so that this can also be shown on our report output. We have built the report on EKBE, EKET,EKKO, EKPO, MKPF tables
Thanks
Anushahi
u can us eany header text
also u can create a new text type for ur query
SPRO>Materials Management>Purchasing>Purchase Order>Texts for Purchase Orders>
here define Define Text Types for Header Texts and Define Copying Rules for Header Texts
now u can call this text in ur reports -
Duplicate records in the Results of SAP Query thru SQVI
Dear All,
I formed a query and joined EKKO, EKBE, EKET & EKES tbls to fetch information on the PO Item-Qty, Delivery Dt., Vendor's Confirmed qty, etc.
However, in the results I get repeated records.
Pls advise the possible reasons for above.
Rgds,Shekhar,
Using a join on these tables is illogical.
EKBE, EKET & EKES each have many-to-one relationships to EKKO. Joining all four tables will typically give you multiple output records with redundant data. Also, using straight inner joins will exclude certain data that you will certainly want to see.
Try instead using Logical Database MEPOLDB. It will sort most of these things out for you.
If you elect to use the logical database, beware of trying to use multiple selection criteria from the lower level tables (EKBE, EKET & EKES). You will not always get the results you expect. Better to only place EKKO fields as selection parameters. Save the other table fields for display.
Rgds,
DB49 -
REgd How to find appropriate data sourses for given tables in Inve Mngt
Experts!
M completely new to Inventory Mngt where i needto extract data from R/3,
they 've given me some tables, but i dont know how to find appropriate data
sourses for that tables
those are
MKPF,MSEG
EKKO,EKPO
EKBE,EKET
How to find right data sourses when table names given in any module??
pls guide me,
'll assign the points.
thanks
SrujanHi,
2LIS_03_BX is the initialization of your stocks; you'll need to perform the setup procedure for extracting this data.
Usually this DSource is used to bring the stocks positions at a given time; from this given time you'll then extract deltas from BF and UM so your stocks are always:
BX + BF(Delta) + UM(delta).
Hope this clears your doubts...
Olivier. -
Link between EKBE and EKET for the below scenario
Hi all
We have a requirement to display schedule line number(eket-etenr) for purchase order and for each history of quantities in table EKBE (ekbe-ebeln ,ekbe-ebelp). Please suggest how we can link these two tables,
As i need to display the eket-etenr upto the quantity confirmed on latest date..
The example is below for quantity 81.
If Purshase history is
EKET-menge EKET- etenr
81 --- 0001
5 -
0002
10 --- 0003
date move-typ EKBE-menge ***-sum ETENR
01/26/2004 101 10 10 0001
01/26/2004 101 10 20 0001
01/27/2004 101 20 40 0001
01/27/2004 101 20 60 0001
01/30/2005 101 10 70 0001
03/31/2005 101 1 71 0001
03/31/2005 101 10 81 0001
04/01/2005 101 9 90 0001
11/20/2006 102 -9 81 0001
06/04/2006 101 3 84 0002
06/05/2006 101 1 85 0002
06/06/2006 102 -1 -1 84 0002
06/07/2006 101 3 87 0003
06/08/2006 101 9 96 0003
We need to display EKET-ETENr for each ekbe entry whenever the quantity is delivered til that line.
Pleae suggest possible ways.
Regards,
Latha.Hi,
Pls chk this relations-
EKBE-> EKKO->based on EBELN
EKKO -> EKPO based on EBELN
EKPO->EKET based on EBELN, EBELP
First try to get the Purchase order numbers into EKKO from EKBE based on this get their itmes from EKPO from this we can get the EKET values based on both documnet number and theier items.
To get the history of the PO(EBELN) check this select statement -
SELECT
ebeln "Purchasing Document Number
ebelp "Item Number of Purchasing Document
gjahr "Financial year
vgabe "Transaction/event type, purchase order
belnr "Number of material document
bwart "Movement type
budat "Posting date in the document
menge "Quantity
wrbtr "Amount in document currency
waers "Currency Key
matnr "Material number
werks "plant
charg "Batch
FROM ekbe
INTO TABLE i_ekbe
WHERE gjahr IN s_gjahr AND
budat IN s_budat AND
werks = p_plant.
SORT i_ekbe BY ebeln gjahr matnr vgabe bwart.
if i_ekbe[] is not initial.
SELECT
ebeln "PO
lifnr "VENDOR
FROM ekko
INTO TABLE i_ekko
FOR ALL ENTRIES IN i_ekbe
WHERE ebeln = i_ekbe-ebeln.
endif.
SORT i_ekko BY ebeln.
if i_ekko[] is not intitial.
SELECT
ebeln "Purchasing Document Number
ebelp "Purchasing Document ITEM
matnr "Materail No.
menge "qty
meins "unit
umrez "Conversion factor "MOD-005
umren "conversion factor "MOD-005
FROM ekpo
INTO TABLE i_ekpo
FOR ALL ENTRIES IN i_ekko
WHERE ebeln = i_ekko-ebeln.
endif.
if i_ekpo[] is not initial.
SELECT *
FROM eket
INTO TABLE i_eket
FOR ALL ENTRIES IN i_ekpo
WHERE ebeln = i_ekpo-ebeln
AND ebelp = i_ekpo-ebelp.
endif.
Hope this solves your issue. Chanegethe WHERE conditions wherever necessarry as per your requiremnets.
Regards
Lekha -
Joing of EKKO, EKPO, EKET and EKBE
Hi Gurus,
We want to achieve two reports with the same query. the first report is the requirement to compare the persons who created the PO and the person who received the PO (migo material doc) were same or not? To achieve this we joined tables EKKO, EKBE and EKPO in the order same order. The report started giving out only those results where EKKO - ERNAM was equal to EKBE - ERNAM. This is fine. But now we have a new requirement to create a late PO deliveries report. The users want the actual dates when the receipts were received (mat doc receipts). Because ME2N, ME2M and ME2L only give whether they are late or not but they dont give by how many days they are late. anyways to achive the late deliveries report, i joined EKET table to the as the fourth table to the already existing previous three tables. But beucase of the EKKO -ERNAM = EKBE - ERNAM criteria we are getting the resutls onyly when they match. What needs to be doen so that the both the reports can be achived from this same infoset.
Thanks
AnmushaHi,
If the qns is just how to de-link the join, then select the join in table join view & click on delete join. But if the qns is then how to link these 2 tables, just link them based on document number. Then you will have to add few lines of abap.
But as i said it would be very simple to achieve this in a Z report than a infoset query, as it is more flexible. You will have to build in a OR condition, which says display the record if the name of creator & the person who posted the GR is same OR display the record if it meets your other criteria.
So i would strongly suggest go for a Z report & discuss with your abaper.
Regards,
Vivek
Maybe you are looking for
-
How do I set up a POP email account (not an LDAP account)
When I try to establish a new email account with my COX provider, the mail program defaults to an LDAP account. LDAP doesn't seem to allow me to leave my messages on the COX server after I have read and deleted them on my MACBook. The POP protocol al
-
Very High Pitched and Super Quiet beep/sound from DV6
They seem to make a new DV6 every year but This one is mine. I've had this notebook since September and its awesome. But there is a very annoying issue I have always had with it. When I'm using it in a very quiet environment I can hear it emit a high
-
CS5 hangs loading ExporterQuicktimeHost.Prm
Windows 7 Pro 64 bit. Any suggestions before I send more info?
-
Inventory control for waffer/die in substrate fabrication
Hello gurus, Looking for advice for inventory control of substrate fabrication. Fundamentally, how do we configure SAP such that 1 piece of a component (wafer) may yield different QTY's of sub-assemblies (sliced die), and plan MRP at the wafer level?
-
How to search folder by folder path
As subject, how can I search a folder in content server using folder path? Thanks