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

Program for Vendor wise Material, Purchase Order stautus



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Thu Oct 11, 2007 11:34 pm    Post subject: Program for Vendor wise Material, Purchase Order stautus Reply with quote

Code:
REPORT  ZVENDOR_MAT_PURCHASSEORDER_STATUS.                                    .
TABLES : ekkn,ekko,EKPO,EKET,VBEP,LFA1.
 
TYPE-POOLS : slis, ICON.
 
DATA : DATE1 TYPE SY-DATUM.
 
data : begin of itab occurs 0,
 
      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'.
 
 elseif itab-BMENG > 10.
   ITAB-EMATN = 'UNDER FOLLOW-UP'.
 endif.
 
 
 SELECT SINGLE VBELN POSNR TDDAT
 FROM VBEP INTO (ITAB-VBELN1 , ITAB-POSNR1 , ITAB-TDDAT)
 WHERE VBELN = ITAB-VBELN AND
 POSNR = ITAB-VBELP.
 
 
 
 ITAB-LMENG = ITAB-TDDAT - DATE1.
 
 if itab-LMENG  < 0.
 
   ITAB-LABNR = 'OVER DUE'.
 
 elseif itab-LMENG ge 0 AND itab-LMENG le 10.
   ITAB-LABNR = 'CRITICAL'.
 
 elseif itab-LMENG > 10.
   ITAB-LABNR = 'UNDER FOLLOW-UP'.
 endif.
 
 
 IF ITAB-WAMNG LE 0 OR
    ITAB-LOEKZ = 'L' OR
    ITAB-LOEKZ = 'S'.
    ITAB-PLNUM = 'CLOSED'.
 ELSE.
    ITAB-PLNUM = 'OPEN'.
 ENDIF.
 
 SELECT SINGLE LIFNR NAME1
 FROM LFA1 INTO (ITAB-LIFNR1 , ITAB-NAME1)
 WHERE LIFNR = ITAB-LIFNR.
 
 
 MODIFY ITAB.
 
ENDLOOP.
 
 
 loop at itab.
   move-corresponding itab to it_final.
   append it_final.
 endloop.
 
 perform edit_mask.
 i_repid = sy-repid.
 PERFORM fieldcat.
 
 
 
 
 CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_callback_program      = i_repid
     i_callback_user_command = 'USER_COMMAND'
     it_fieldcat             = fcat
     i_save                  = 'A'
   TABLES
     t_outtab                = it_final
   EXCEPTIONS
     program_error           = 1
     OTHERS                  = 2.
 
 
 
*&---------------------------------------------------------------------*
*&      Form  fieldcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM fieldcat .
MOVE sy-repid TO i_repid.
 
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-decimals_out = 2.
ls_fcat-col_pos = 1.
ls_fcat-fieldname = 'KUNNR'.
ls_fcat-outputlen = 10.
ls_fcat-seltext_m = 'Sold to Party'.
ls_fcat-emphasize = 'C310'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
 
 ls_fcat-col_pos           =  6.
 ls_fcat-fieldname = 'LABNR'.
 ls_fcat-outputlen = 20.
 ls_fcat-seltext_m = 'Window Start Status'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C510'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  5.
 ls_fcat-fieldname = 'EMATN'.
 ls_fcat-outputlen = 15.
 ls_fcat-seltext_m = 'Window End Status'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C410'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  2.
 ls_fcat-fieldname = 'VBELN'.
 ls_fcat-outputlen = 10.
 ls_fcat-seltext_m = 'Sale Order'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C710'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  3.
 ls_fcat-fieldname = 'VBELP'.
 ls_fcat-outputlen = 5.
 ls_fcat-seltext_m = 'Item'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C710'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  4.
 ls_fcat-fieldname = 'EBELN'.
 ls_fcat-outputlen = 10.
 ls_fcat-seltext_m = 'PO Number'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C710'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  7.
 ls_fcat-fieldname = 'EBELP'.
 ls_fcat-outputlen = 5.
 ls_fcat-seltext_m = 'PO Item'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  8.
 ls_fcat-fieldname = 'EKGRP'.
 ls_fcat-outputlen = 3.
 ls_fcat-seltext_m = 'Pur.Group'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  9.
 ls_fcat-fieldname = 'BEDAT'.
 ls_fcat-outputlen = 10.
 ls_fcat-seltext_m = 'PO Doc.Date'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  10.
 ls_fcat-fieldname = 'EINDT'.
 ls_fcat-outputlen = 10.
 ls_fcat-seltext_m = 'PO Delivery Date'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  11.
 ls_fcat-fieldname = 'MATNR'.
 ls_fcat-outputlen = 10.
 ls_fcat-seltext_m = 'Material Number'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  12.
 ls_fcat-fieldname = 'TXZ01'.
 ls_fcat-outputlen = 15.
 ls_fcat-seltext_m = 'Description'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  13.
 ls_fcat-fieldname = 'NAME1'.
 ls_fcat-outputlen = 10.
 ls_fcat-seltext_m = 'Vendor'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C110'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  14.
 ls_fcat-fieldname = 'MENGE'.
 ls_fcat-outputlen = 10.
 ls_fcat-seltext_m = 'PO Quantity'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  15.
 ls_fcat-fieldname = 'WEMNG'.
 ls_fcat-outputlen = 10.
 ls_fcat-seltext_m = 'Quantity Recvd'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  16.
 ls_fcat-fieldname = 'WAMNG'.
 ls_fcat-outputlen = 10.
 ls_fcat-seltext_m = 'Bal Qty'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  17.
 ls_fcat-fieldname = 'MEINS'.
 ls_fcat-outputlen = 2.
 ls_fcat-seltext_m = 'OUn'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  18.
 ls_fcat-fieldname = 'NETPR'.
 ls_fcat-outputlen = 8.
 ls_fcat-seltext_m = 'NetPrice'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  19.
 ls_fcat-fieldname = 'TDDAT'.
 ls_fcat-outputlen = 15.
 ls_fcat-seltext_m = 'Window Start date'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  20.
 ls_fcat-fieldname = 'EDATU'.
 ls_fcat-outputlen = 10.
 ls_fcat-seltext_m = 'Window End date'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  21.
 ls_fcat-fieldname = 'PLNUM'.
 ls_fcat-outputlen = 10.
 ls_fcat-seltext_m = 'PO Status'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C610'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 ls_fcat-col_pos           =  22.
 ls_fcat-fieldname = 'WERKS'.
 ls_fcat-outputlen = 5.
 ls_fcat-seltext_m = 'Plant'.
 ls_fcat-tabname = 'IT_FINAL'.
 ls_fcat-emphasize = 'C210'.
 APPEND ls_fcat TO fcat.
 clear ls_fcat.
 
 
ENDFORM.                    " fieldcat
 
 
 
*&---------------------------------------------------------------------*
*&      Form  edit_mask
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM edit_mask .
loop at it_final.
 
   CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
     EXPORTING
       INPUT  = it_final-vbeln
     IMPORTING
       OUTPUT = it_final-vbeln.
 
Read table it_final.
*  modify it_final.
 
 endloop.
 
ENDFORM.                    " edit_mask
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 -> ММ 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 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.