VBELN like ekkn-VBELN, "SALE ORDER
VBELP LIKE EKKN-VBELP, "LINE ITEM
BEDAT LIKE EKKO-BEDAT, "DOCUMENT DATE
KUNNR LIKE VBAK-KUNNR, "SOLD TO PARTY
VBELN1 like VBEP-VBELN, "SALE ORDER1
POSNR1 LIKE VBEP-POSNR, "LINE ITEM
EDATU LIKE VBEP-EDATU, "END DATE
EMATN LIKE EKPO-EMATN, "STATUS
BMENG LIKE VBEP-BMENG, "DAYS
TDDAT LIKE VBEP-TDDAT, "START DATE
LMENG LIKE VBEP-LMENG, "DAYS -START DATE
LABNR LIKE EKPO-LABNR, "STATUS
PLNUM LIKE VBEP-PLNUM, "OVERALL STATUS
EKGRP like ekko-EKGRP, "PURCHASING GROUP
EBELN LIKE EKKN-EBELN, "PO NO
EBELP like ekkn-EBELP, "LINE ITEM
EINDT LIKE EKET-EINDT, "DELIVERY DATE
MATNR LIKE EKPO-MATNR, "MATERIAL NUMBER
TXZ01 LIKE EKPO-TXZ01, "MATERIAL TEXT
LIFNR LIKE EKKO-LIFNR, "VENDOR
MENGE LIKE EKPO-MENGE, "QUANTITY
WEMNG LIKE EKET-WEMNG, "GR QTY
WAMNG LIKE EKET-WAMNG, "BAL QTY
MEINS LIKE EKPO-MEINS, "OUn
NETPR LIKE EKPO-NETPR, "PRICE
LOEKZ LIKE EKPO-LOEKZ, "DELETED
LIFNR1 LIKE LFA1-LIFNR, "VENDOR
NAME1 LIKE LFA1-NAME1, "VENDOR NAME
WERKS LIKE EKPO-WERKS, "PLANT
end of itab.
DATA : BEGIN OF it_final OCCURS 0,
KUNNR LIKE VBAK-KUNNR, "SOLD TO PARTY
LABNR LIKE EKPO-LABNR, "STATUS
EMATN LIKE EKPO-EMATN, "STATUS
VBELN like ekkn-VBELN, "SALE ORDER
VBELP LIKE EKKN-VBELP, "LINE ITEM
BEDAT LIKE EKKO-BEDAT, "DOCUMENT DATE
EDATU LIKE VBEP-EDATU, "END DATE
TDDAT LIKE VBEP-TDDAT, "START DATE
PLNUM LIKE VBEP-PLNUM, "OVERALL STATUS
EKGRP like ekko-EKGRP, "PURCHASING GROUP
EBELN LIKE EKKN-EBELN, "PO NO
EBELP like ekkn-EBELP, "LINE ITEM
EINDT LIKE EKET-EINDT, "DELIVERY DATE
MATNR LIKE EKPO-MATNR, "MATERIAL NUMBER
TXZ01 LIKE EKPO-TXZ01, "MATERIAL TEXT
NAME1 LIKE LFA1-NAME1, "VENDOR NAME
MENGE LIKE EKPO-MENGE, "QUANTITY
WEMNG LIKE EKET-WEMNG, "GR QTY
WAMNG LIKE EKET-WAMNG, "BAL QTY
MEINS LIKE EKPO-MEINS, "OUn
NETPR LIKE EKPO-NETPR, "PRICE
WERKS LIKE EKPO-WERKS, "PLANT
END OF it_final.
DATA: color TYPE TABLE OF lvc_s_scol WITH HEADER LINE,
st_layout TYPE slis_layout_alv.
DATA : fcat TYPE slis_t_fieldcat_alv,
ls_fcat LIKE LINE OF fcat,
fheader TYPE TABLE OF slis_listheader WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0.
DATA :i_repid LIKE sy-repid,
gs_layout TYPE slis_layout_alv,
week type n.
SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: zso FOR ekkn-vbeln.
SELECT-OPTIONS: zpgr FOR ekko-EKGRP.
SELECT-OPTIONS: ZPL FOR EKPO-WERKS.
SELECTION-SCREEN END OF BLOCK bk1.
gs_layout-colwidth_optimize = 'X'.
select A~VBELN
A~VBELP
A~EBELN
A~EBELP
B~MATNR
B~TXZ01
B~MENGE
B~MEINS
B~NETPR
B~WERKS
B~LOEKZ
C~EINDT
C~WEMNG
D~EKGRP
D~LIFNR
D~BEDAT
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM EKKN AS A
INNER JOIN EKPO AS B ON A~EBELN = B~EBELN
AND A~EBELP = B~EBELP
INNER JOIN EKET AS C ON A~EBELN = C~EBELN
AND A~EBELP = C~EBELP
INNER JOIN EKKO AS D ON A~EBELN = D~EBELN
WHERE A~VBELN IN ZSO
AND D~EKGRP IN ZPGR
AND B~WERKS IN ZPL.
LOOP AT ITAB.
ITAB-WAMNG = ITAB-MENGE - ITAB-WEMNG.
SELECT SINGLE VBELN KUNNR
FROM VBAK INTO (ITAB-VBELN , ITAB-KUNNR )
WHERE VBELN = ITAB-VBELN.
SELECT SINGLE VBELN EDATU
FROM VBEP INTO (ITAB-VBELN , ITAB-EDATU)
WHERE VBELN = ITAB-VBELN.
DATE1 = SY-DATUM.
ITAB-BMENG = ITAB-EDATU - DATE1.
if itab-BMENG < 0.
ITAB-EMATN = 'OVER DUE'.
elseif itab-BMENG ge 0 AND itab-BMENG le 10.
ITAB-EMATN = 'CRITICAL'.
*&---------------------------------------------------------------------*
*& Form fieldcat
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fieldcat .
MOVE sy-repid TO i_repid.
*&---------------------------------------------------------------------*
*& Form edit_mask
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM edit_mask .
loop at it_final.
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 cannot 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.