Go on link..

link us with ...

Thursday, December 30, 2010

Local PO Details

REPORT ZVVF_MR054_PO_DTLS NO STANDARD PAGE HEADING LINE-SIZE 246
MESSAGE-ID ZMM .
*---------------------------------------------------------------------*
* *
* MODULE : Material Management *
* *
*---------------------------------------------------------------------*
* Objective : Local PO Details *
* *
* *
* Program : Update Tables ( ) Download Data ( ) Outputs List (X)*
* Technical Specs No : *
* Date Created : *
* Author : *
* Location : *
* LDB : *
*---------------------------------------------------------------------*
*---------------------------------------------------------------------**
* Type-pools
*----------------------------------------------------------------------*
TYPE-POOLS : SLIS.

*---------------------------------------------------------------------*
* Tables *
*---------------------------------------------------------------------*
TABLES: EKKO, "PURCHASING DOC. HEADER
EKPO, "PURCHASING DOC. ITEM
MAKT, "MATERIAL DISCRIPTION
LFA1, "VENDOR MASTER
KONV, "CONDITION (TRANSECTION DATA - CLUSTER TABLE)
T001. "Company Codes

*---------------------------------------------------------------------*
* Types Begin with TY_ *
*---------------------------------------------------------------------*
TYPES: BEGIN OF TY_DISPLAY ,
SRNUM TYPE I,
BSART LIKE EKKO-BSART, "PO Document Type
EBELN LIKE EKKO-EBELN, "PO No.
AEDAT LIKE EKKO-AEDAT, "PO Date
EKGRP LIKE EKKO-EKGRP, "PO Group
LIFNR LIKE EKKO-LIFNR, "Vendor No.
NAME1 LIKE LFA1-NAME1, "Vendor Name
LIFN2 LIKE EKPA-LIFN2, "Broker No.
BNAME1 LIKE LFA1-NAME1, "Broker Name
EBELP LIKE EKPO-EBELP, "Line Item
LOEKZ(7) TYPE C, "Item Status
MATNR LIKE EKPO-MATNR, "Material Number
MAKTX LIKE MAKT-MAKTX, "Material Desc
MENGE LIKE EKPO-MENGE, "PO Quantity
NETWR LIKE EKPO-NETWR, "Net Price
MWSKZ LIKE EKPO-MWSKZ, "Tax Code

EXC LIKE KONV-KWERT,
ECESS LIKE KONV-KWERT,

ZJIP5 LIKE KONV-KWERT,
ZJIP7 LIKE KONV-KWERT,
ZJIP6 LIKE KONV-KWERT,
ZJIP8 LIKE KONV-KWERT,

ZJSRT LIKE KONV-KWERT,
ZJEC3 LIKE KONV-KWERT,

OTHTAX LIKE KONV-KWERT,

FREIGHT LIKE KONV-KWERT,
ZCOM LIKE KONV-KWERT,
ZHAN LIKE KONV-KWERT,
ZICH LIKE KONV-KWERT,
ZIST LIKE KONV-KWERT,
ZAPMC LIKE KONV-KWERT,
ZINS LIKE KONV-KWERT,
ZSUP LIKE KONV-KWERT,
ZMIS LIKE KONV-KWERT,
ZPKCHG LIKE KONV-KWERT,
ZFHCHG LIKE KONV-KWERT,
ZEXP LIKE KONV-KWERT,
ZOCM LIKE KONV-KWERT,
EFFWR LIKE EKPO-EFFWR,
END OF TY_DISPLAY.

TYPES: BEGIN OF TY_EKKO ,
BSART LIKE EKKO-BSART,
EBELN LIKE EKKO-EBELN,
EBELP LIKE KONV-KPOSN,
AEDAT LIKE EKKO-AEDAT,
BEDAT LIKE EKKO-BEDAT,
EKORG LIKE EKKO-EKORG,
EKGRP LIKE EKKO-EKGRP,
LIFNR LIKE EKKO-LIFNR,
LIFN2 LIKE EKPA-LIFN2,
KNUMV LIKE EKKO-KNUMV,
BUKRS LIKE EKKO-BUKRS,
WAERS LIKE EKKO-WAERS,
WERKS LIKE EKPO-WERKS,
MATNR LIKE EKPO-MATNR,
MATKL LIKE EKPO-MATKL,
MWSKZ LIKE EKPO-MWSKZ,
MEINS LIKE EKPO-MEINS,
MENGE LIKE EKPO-MENGE,
MTART LIKE EKPO-MTART,
LOEKZ LIKE EKPO-LOEKZ,
NETWR LIKE EKPO-NETWR,
EFFWR LIKE EKPO-EFFWR,
KZWI6 LIKE EKPO-KZWI6,
KZWI4 LIKE EKPO-KZWI4,
ZSUM LIKE KONV-KWERT,
ZASUM LIKE KONV-KWERT,
NAME1 LIKE LFA1-NAME1,
BNAME1 LIKE LFA1-NAME1,
MAKTX LIKE MAKT-MAKTX,
LAND1 LIKE T001-LAND1,
END OF TY_EKKO.

TYPES: BEGIN OF TY_KONV,
KNUMV LIKE KONV-KNUMV,
KPOSN LIKE KONV-KPOSN,
KSCHL LIKE KONV-KSCHL,
KBETR LIKE KONV-KBETR,
KWERT LIKE KONV-KWERT,
END OF TY_KONV.

TYPES: BEGIN OF TY_KWERT,
KNUMV LIKE KONV-KNUMV,
KPOSN LIKE KONV-KPOSN,
KWERT1 LIKE KONV-KWERT,
KWERT2 LIKE KONV-KWERT,
KWERT3 LIKE KONV-KWERT,
KWERT4 LIKE KONV-KWERT,
KWERT LIKE KONV-KWERT,
KBETR LIKE KONV-KBETR,
ZFA1 LIKE KONV-KWERT,
ZCOM LIKE KONV-KWERT,
ZHAN LIKE KONV-KWERT,
ZICH LIKE KONV-KWERT,
ZIST LIKE KONV-KWERT,
ZAPM LIKE KONV-KWERT,
ZINS LIKE KONV-KWERT,
ZOCM LIKE KONV-KWERT,
ZPCK LIKE KONV-KWERT,
ZFCH LIKE KONV-KWERT,
ZMIS LIKE KONV-KWERT,
ZSUP LIKE KONV-KWERT,
ZSUM1 LIKE KONV-KWERT,
END OF TY_KWERT.

TYPES : BEGIN OF TY_MAKT,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
END OF TY_MAKT.

TYPES : BEGIN OF TY_T001,
LAND1 LIKE T001-LAND1,
BUKRS LIKE T001-BUKRS,
END OF TY_T001.

TYPES : BEGIN OF TY_EKPA,
LIFN2 LIKE EKPA-LIFN2,
EBELN LIKE EKPA-EBELN,
END OF TY_EKPA.

**---------------------------------------------------------------------*
* Constants Begin with C_
**---------------------------------------------------------------------*
*--- For ALV ----*
CONSTANTS: C_TOP_OF_PAGE_DB TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE_DB'.

*---------------------------------------------------------------------*
* Internal tables Begin with IT_ *
*---------------------------------------------------------------------*
*--- For ALV ----*
DATA: IT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
IT_EVENTS TYPE SLIS_T_EVENT,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
*---------------*
DATA : IT_DISPLAY TYPE STANDARD TABLE OF TY_DISPLAY WITH HEADER LINE.
DATA : IT_EKKO TYPE STANDARD TABLE OF TY_EKKO WITH HEADER LINE.
DATA : IT_KONV TYPE STANDARD TABLE OF TY_KONV WITH HEADER LINE.
DATA : IT_KWERT TYPE STANDARD TABLE OF TY_KWERT WITH HEADER LINE.
DATA : IT_LFA1 TYPE STANDARD TABLE OF LFA1 WITH HEADER LINE.

DATA : IT_XKOMV TYPE TABLE OF KOMV WITH HEADER LINE.
DATA : IT_TAXCOM TYPE TABLE OF TAXCOM WITH HEADER LINE.


DATA : IT_MAKT TYPE STANDARD TABLE OF TY_MAKT WITH HEADER LINE.
DATA : IT_T001 TYPE STANDARD TABLE OF TY_T001 WITH HEADER LINE.
DATA : IT_EKPA TYPE STANDARD TABLE OF TY_EKPA WITH HEADER LINE.



*---------------------------------------------------------------------*
* Work Area Begin with WA_ *
*---------------------------------------------------------------------*
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV. " For ALV
DATA : WA_DISPLAY LIKE LINE OF IT_DISPLAY.
DATA : WA_EKKO LIKE LINE OF IT_EKKO.
DATA : WA_KONV LIKE LINE OF IT_KONV.
DATA : WA_KWERT LIKE LINE OF IT_KWERT.
DATA : WA_MATNR LIKE ZVVF_MT006_MATNR.

*---------------------------------------------------------------------*
* Data Begin with W_ *
*---------------------------------------------------------------------*
DATA : W_REPID LIKE SY-REPID, " For ALV
W_TEMP LIKE EKPO-MATNR.

**---------------------------------------------------------------------*
* RANGES
**---------------------------------------------------------------------*
RANGES: R_KONV FOR KONV-KSCHL.
**---------------------------------------------------------------------*
* Select Options Begin with SO_
**---------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK MAIN WITH FRAME TITLE TEXT-023.
SELECT-OPTIONS : SO_LIFNR FOR EKKO-LIFNR.
SELECT-OPTIONS : SO_EKORG FOR EKKO-EKORG OBLIGATORY .
SELECT-OPTIONS : SO_WERKS FOR EKPO-WERKS OBLIGATORY.
SELECT-OPTIONS : SO_EBELN FOR EKKO-EBELN.
SELECT-OPTIONS : SO_AEDAT FOR EKKO-AEDAT OBLIGATORY.
SELECT-OPTIONS : SO_EKGRP FOR EKKO-EKGRP.
SELECT-OPTIONS : SO_BSART FOR EKKO-BSART.
SELECT-OPTIONS : SO_MATKL FOR EKPO-MATKL.
SELECT-OPTIONS : SO_MATNR FOR EKPO-MATNR.
SELECTION-SCREEN END OF BLOCK MAIN.

*---------------------------------------------------------------------
** INITIALIZATION
*---------------------------------------------------------------------
INITIALIZATION.
W_REPID = SY-REPID.
PERFORM F001_APPEND_RANGE.

*---------------------------------------------------------------------*
* At selection-screen *
*---------------------------------------------------------------------*
AT SELECTION-SCREEN .
IF SO_BSART-LOW = 'ZI' OR SO_BSART-HIGH = 'ZI'.
MESSAGE E134.
ENDIF.
***********************************************************************
* S T A R T O F S E L E C T I O N *
***********************************************************************
START-OF-SELECTION.
PERFORM F002_EKKO_DATA.

IF SY-SUBRC = 0.
PERFORM F003_KONV_DATA.
ELSE.
MESSAGE E005.
ENDIF.

*---------------------------------------------------------------------*
* END-OF-SELECTION *
*---------------------------------------------------------------------*
END-OF-SELECTION.
PERFORM F005_POPULATE_DATA.

PERFORM FIELDCAT_INIT USING IT_FIELDCAT[].
PERFORM EVENTTAB_BUILD USING IT_EVENTS[].
PERFORM COMMENT_BUILD USING IT_LIST_TOP_OF_PAGE[].
PERFORM LAYOUT_BUILD USING WA_LAYOUT.
PERFORM WRITE_ALV_GRID.


*&---------------------------------------------------------------------*
*& Form F001_APPEND_RANGE
*&---------------------------------------------------------------------*
FORM F001_APPEND_RANGE .
R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZFA1'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZFB1'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZFC1'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZCOM'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZHAN'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZICH'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZIST'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZAPM'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZAM1'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZAM2'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZINS'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZSUP'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZMIS'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZPC1'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZPC2'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZFH1'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZFH2'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZEXP'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

R_KONV-SIGN = 'I'.
R_KONV-OPTION = 'EQ'.
R_KONV-LOW = 'ZOCM'.
R_KONV-HIGH = ' '.
APPEND R_KONV.

ENDFORM. " F001_APPEND_RANGE
*&---------------------------------------------------------------------*
*& Form FIELDCAT_INIT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_IT_FIELDCAT[] text
*----------------------------------------------------------------------*
FORM FIELDCAT_INIT USING P_IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA : WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA :W_POS TYPE I VALUE 0.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'SRNUM'.
WA_FIELDCAT-SELTEXT_M = 'Sr.No.'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'BSART'.
WA_FIELDCAT-SELTEXT_M = 'Document type'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO No.'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'EBELP'.
WA_FIELDCAT-SELTEXT_M = 'PO Item'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'AEDAT'.
WA_FIELDCAT-SELTEXT_M = 'PO Date'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'EKGRP'.
WA_FIELDCAT-SELTEXT_M = 'Purchasing Group'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'LIFNR'.
WA_FIELDCAT-SELTEXT_M = 'Vendor'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'NAME1'.
WA_FIELDCAT-SELTEXT_M = 'Vendor Name'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'LIFN2'.
WA_FIELDCAT-SELTEXT_M = 'Broker'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-NO_ZERO = 'X'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'BNAME1'.
WA_FIELDCAT-SELTEXT_M = 'Broker Name'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.



W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'LOEKZ'.
WA_FIELDCAT-SELTEXT_M = 'Item Status'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-SELTEXT_M = 'Material'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'MAKTX'.
WA_FIELDCAT-SELTEXT_M = 'Material Description'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '40'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'MENGE'.
WA_FIELDCAT-SELTEXT_M = 'Quantity'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'NETWR'.
WA_FIELDCAT-SELTEXT_M = 'Net Price'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'MWSKZ'.
WA_FIELDCAT-SELTEXT_M = 'TaxCode'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'EXC'.
WA_FIELDCAT-SELTEXT_M = 'Excise Duty'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ECESS'.
WA_FIELDCAT-SELTEXT_M = 'Ecess on Excise Duty'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZJIP5'.
WA_FIELDCAT-SELTEXT_M = 'VAT RM Setoff'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZJIP7'.
WA_FIELDCAT-SELTEXT_M = 'VAT CG Setoff'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZJIP6'.
WA_FIELDCAT-SELTEXT_M = 'VAT RM Non-Deductible'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZJIP8'.
WA_FIELDCAT-SELTEXT_M = 'VAT CG Non-Deductible'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZJSRT'.
WA_FIELDCAT-SELTEXT_M = 'Service Tax'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZJEC3'.
WA_FIELDCAT-SELTEXT_M = 'Ecess on Service Tax'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'OTHTAX'.
WA_FIELDCAT-SELTEXT_M = 'Other Taxes'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'FREIGHT'.
WA_FIELDCAT-SELTEXT_M = 'Freight'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZCOM'.
WA_FIELDCAT-SELTEXT_M = 'Commission Charges'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZHAN'.
WA_FIELDCAT-SELTEXT_M = 'Handling Charges'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZICH'.
WA_FIELDCAT-SELTEXT_M = 'Inspection Charges'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZIST'.
WA_FIELDCAT-SELTEXT_M = 'Installation Charges'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZAPMC'.
WA_FIELDCAT-SELTEXT_M = 'APMC Charges'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZINS'.
WA_FIELDCAT-SELTEXT_M = 'Insurance'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZSUP'.
WA_FIELDCAT-SELTEXT_M = 'Supervision Charges'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZMIS'.
WA_FIELDCAT-SELTEXT_M = 'Miscellaneous Charges'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZPKCHG'.
WA_FIELDCAT-SELTEXT_M = 'Packing Charges'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZFHCHG'.
WA_FIELDCAT-SELTEXT_M = 'Forwarding Charges'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZEXP'.
WA_FIELDCAT-SELTEXT_M = 'Export Fees'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'ZOCM'.
WA_FIELDCAT-SELTEXT_M = 'Octroi'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

W_POS = W_POS + 1.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-TABNAME = 'IT_DISPLAY'.
WA_FIELDCAT-FIELDNAME = 'EFFWR'.
WA_FIELDCAT-SELTEXT_M = 'Total Value'.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-EMPHASIZE = 'C410'.
WA_FIELDCAT-OUTPUTLEN = '15'.
APPEND WA_FIELDCAT TO P_IT_FIELDCAT.

ENDFORM. " FIELDCAT_INIT
*&---------------------------------------------------------------------*
*& Form EVENTTAB_BUILD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_IT_EVENTS[] text
*----------------------------------------------------------------------*
FORM EVENTTAB_BUILD USING P_IT_EVENTS TYPE SLIS_T_EVENT.
DATA: WA_EVENT TYPE SLIS_ALV_EVENT.
DATA: C_TOP_OF_PAGE TYPE SLIS_FORMNAME.

C_TOP_OF_PAGE = C_TOP_OF_PAGE_DB.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = P_IT_EVENTS.
READ TABLE P_IT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO WA_EVENT.
IF SY-SUBRC <> 0.
MOVE C_TOP_OF_PAGE TO WA_EVENT-FORM.
APPEND WA_EVENT TO P_IT_EVENTS.
ELSE.
MOVE C_TOP_OF_PAGE TO WA_EVENT-FORM.
MODIFY P_IT_EVENTS FROM WA_EVENT INDEX SY-TABIX .
ENDIF.

ENDFORM. " EVENTTAB_BUILD
*&---------------------------------------------------------------------*
*& Form COMMENT_BUILD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_IT_LIST_TOP_OF_PAGE[] text
*----------------------------------------------------------------------*
FORM COMMENT_BUILD USING P_IT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: WA_LINE TYPE SLIS_LISTHEADER.
CLEAR WA_LINE.

WA_LINE-TYP = 'H'.
WA_LINE-INFO = 'VVF LTD. Mumbai'.
APPEND WA_LINE TO P_IT_LIST_TOP_OF_PAGE.

WA_LINE-TYP = 'H'.
WA_LINE-INFO = SY-ULINE.
APPEND WA_LINE TO P_IT_LIST_TOP_OF_PAGE.

WA_LINE-TYP = 'H'.
WA_LINE-INFO = 'Local Purchase Order Details'.
APPEND WA_LINE TO P_IT_LIST_TOP_OF_PAGE.

ENDFORM. " COMMENT_BUILD
*&---------------------------------------------------------------------*
*& Form LAYOUT_BUILD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_LAYOUT text
*----------------------------------------------------------------------*
FORM LAYOUT_BUILD USING P_WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
P_WA_LAYOUT-ZEBRA = 'X'.
P_WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
* P_WA_LAYOUT-NO_TOTALLINE = 'X'.

ENDFORM. " LAYOUT_BUILD
*&---------------------------------------------------------------------*
*& Form WRITE_ALV_GRID
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM WRITE_ALV_GRID .

SORT IT_DISPLAY BY EBELN EBELP.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_REPID
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_CALLBACK_TOP_OF_PAGE = C_TOP_OF_PAGE_DB
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT[]
IT_EVENTS = IT_EVENTS[]
I_SAVE = 'A'
TABLES
T_OUTTAB = IT_DISPLAY
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

ENDFORM. " WRITE_ALV_GRID

*&--------------------------------------------------------------------*
*& Form TOP_OF_PAGE_DB
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM TOP_OF_PAGE_DB.
*
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LIST_TOP_OF_PAGE
I_LOGO = ' '.
ENDFORM. "top_of_page_db


*&--------------------------------------------------------------------*
*& Form convert_format
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->W_TEMP text
*---------------------------------------------------------------------*
FORM CONVERT_FORMAT CHANGING
W_TEMP.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = W_TEMP
IMPORTING
OUTPUT = W_TEMP.
ENDFORM . "CONVERT_FORMAT
*&---------------------------------------------------------------------*
*& Form F002_EKKO_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM F002_EKKO_DATA .
SELECT
EKKO~BSART
EKKO~EBELN
EKKO~AEDAT
EKKO~BEDAT
EKKO~EKORG
EKKO~EKGRP
EKKO~LIFNR
EKKO~KNUMV
EKKO~BUKRS
EKKO~WAERS

EKPO~EBELP
EKPO~WERKS
EKPO~MATNR
EKPO~MATKL
EKPO~MWSKZ
EKPO~MEINS
EKPO~MENGE
EKPO~MTART
EKPO~NETWR
EKPO~EFFWR
EKPO~LOEKZ
EKPO~KZWI6
EKPO~KZWI4

LFA1~NAME1
* MAKT~MAKTX
T001~LAND1
*
* EKPA~LIFN2
*
INTO CORRESPONDING FIELDS OF TABLE IT_EKKO
FROM EKKO INNER JOIN EKPO
ON EKKO~EBELN = EKPO~EBELN
INNER JOIN LFA1
ON EKKO~LIFNR = LFA1~LIFNR
* INNER JOIN MAKT
* ON EKPO~MATNR = MAKT~MATNR
INNER JOIN T001
ON EKPO~BUKRS = T001~BUKRS
* INNER JOIN EKPA
* ON EKKO~EBELN = EKPA~EBELN
* AND PARVW = 'BR'

WHERE EKKO~LIFNR IN SO_LIFNR
AND EKKO~EKORG IN SO_EKORG
AND EKKO~EBELN IN SO_EBELN
AND EKKO~AEDAT IN SO_AEDAT
AND EKKO~EKGRP IN SO_EKGRP
AND EKKO~BSART IN SO_BSART
AND EKKO~BSART <> 'ZI'
AND EKPO~WERKS IN SO_WERKS
AND EKPO~MATNR IN SO_MATNR
AND EKPO~MATKL IN SO_MATKL.
* AND MAKT~SPRAS = SY-LANGU.
** AND EKPO~EBELP = EKPA~EBELP AND PARVW = 'BR'.

SELECT MATNR MAKTX FROM MAKT
INTO CORRESPONDING FIELDS OF TABLE IT_MAKT
FOR ALL ENTRIES IN IT_EKKO
WHERE MATNR = IT_EKKO-MATNR AND
SPRAS = SY-LANGU.


SELECT EBELN LIFN2 FROM EKPA
INTO CORRESPONDING FIELDS OF TABLE IT_EKPA
FOR ALL ENTRIES IN IT_EKKO
WHERE EBELN = IT_EKKO-EBELN.

CLEAR WA_EKKO.

LOOP AT IT_EKKO INTO WA_EKKO.
READ TABLE IT_MAKT WITH KEY MATNR = WA_EKKO-MATNR.
IF SY-SUBRC = 0.
WA_EKKO-MAKTX = IT_MAKT-MAKTX.
ENDIF.

READ TABLE IT_EKPA WITH KEY EBELN = WA_EKKO-EBELN.
IF SY-SUBRC = 0.
WA_EKKO-LIFN2 = IT_EKPA-LIFN2.
ENDIF.
MODIFY IT_EKKO FROM WA_EKKO.
ENDLOOP.



SELECT LIFNR NAME1
FROM LFA1
INTO CORRESPONDING FIELDS OF TABLE IT_LFA1
FOR ALL ENTRIES IN IT_EKKO
WHERE LIFNR = IT_EKKO-LIFN2.

ENDFORM. " F002_EKKO_DATA
*&---------------------------------------------------------------------*
*& Form F003_KONV_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM F003_KONV_DATA.
SELECT KNUMV KPOSN KSCHL KWERT FROM KONV
INTO CORRESPONDING FIELDS OF TABLE IT_KONV
FOR ALL ENTRIES IN IT_EKKO
WHERE KNUMV = IT_EKKO-KNUMV AND KPOSN = IT_EKKO-EBELP
AND KSCHL IN R_KONV.

ENDFORM. " F003_KONV_DATA
*&---------------------------------------------------------------------*
*& Form F005_POPULATE_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM F005_POPULATE_DATA .
LOOP AT IT_EKKO INTO WA_EKKO WHERE MWSKZ NE ' '.

CLEAR WA_DISPLAY.
WA_DISPLAY-SRNUM = SY-TABIX.
WA_DISPLAY-BSART = WA_EKKO-BSART.
WA_DISPLAY-EBELN = WA_EKKO-EBELN.
WA_DISPLAY-AEDAT = WA_EKKO-AEDAT .
WA_DISPLAY-EKGRP = WA_EKKO-EKGRP .
WA_DISPLAY-LIFNR = WA_EKKO-LIFNR .
WA_DISPLAY-NAME1 = WA_EKKO-NAME1.
WA_DISPLAY-EBELP = WA_EKKO-EBELP .
IF WA_EKKO-LOEKZ = 'L'.
WA_DISPLAY-LOEKZ = 'Deleted'.
ENDIF.
* WA_DISPLAY-LOEKZ = WA_EKKO-LOEKZ.
WA_DISPLAY-MATNR = WA_EKKO-MATNR.
WA_DISPLAY-MAKTX = WA_EKKO-MAKTX.
WA_DISPLAY-MENGE = WA_EKKO-MENGE.
WA_DISPLAY-NETWR = WA_EKKO-NETWR.
WA_DISPLAY-MWSKZ = WA_EKKO-MWSKZ.
WA_DISPLAY-EFFWR = WA_EKKO-EFFWR.

READ TABLE IT_LFA1 WITH KEY LIFNR = WA_EKKO-LIFN2.
IF SY-SUBRC = 0.
ENDIF.
* PACK WA_EKKO-LIFN2 TO WA_EKKO-LIFN2.
IF WA_EKKO-LIFNR NE WA_EKKO-LIFN2.
WA_DISPLAY-LIFN2 = WA_EKKO-LIFN2.
WA_DISPLAY-BNAME1 = IT_LFA1-NAME1.
ENDIF.

* CALCULATE TAXES
IT_TAXCOM-BUKRS = WA_EKKO-BUKRS.
IT_TAXCOM-BUDAT = WA_EKKO-BEDAT.
IT_TAXCOM-BLDAT = WA_EKKO-BEDAT.
IT_TAXCOM-WAERS = WA_EKKO-WAERS.
IT_TAXCOM-KPOSN = WA_EKKO-EBELP.
IT_TAXCOM-MWSKZ = WA_EKKO-MWSKZ.
IT_TAXCOM-WRBTR = WA_EKKO-NETWR.
IT_TAXCOM-XMWST = 'X'.
IT_TAXCOM-LIFNR = WA_EKKO-LIFNR.
IT_TAXCOM-MATNR = WA_EKKO-MATNR.
IT_TAXCOM-WERKS = WA_EKKO-WERKS.
IT_TAXCOM-MEINS = WA_EKKO-MEINS.
IT_TAXCOM-MGLME = WA_EKKO-MENGE.
IT_TAXCOM-EBELN = WA_EKKO-EBELN.
IT_TAXCOM-EBELP = WA_EKKO-EBELP.

CALL FUNCTION 'J_1I4_SET_KWERT'
EXPORTING
KWERT = WA_EKKO-KZWI6
ALT_KWERT = WA_EKKO-KZWI4.

APPEND IT_TAXCOM.

CALL FUNCTION 'CALCULATE_TAX_ITEM'
EXPORTING
I_TAXCOM = IT_TAXCOM
TABLES
T_XKOMV = IT_XKOMV
EXCEPTIONS
MWSKZ_NOT_DEFINED = 1
MWSKZ_NOT_FOUND = 2
MWSKZ_NOT_VALID = 3
STEUERBETRAG_FALSCH = 4
COUNTRY_NOT_FOUND = 5
OTHERS = 6.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

LOOP AT IT_XKOMV WHERE KPOSN = WA_EKKO-EBELP.
CASE IT_XKOMV-KSCHL.
WHEN 'JMO1'.
WA_DISPLAY-EXC = WA_DISPLAY-EXC + IT_XKOMV-KWERT.
WHEN 'JMO2'.
WA_DISPLAY-EXC = WA_DISPLAY-EXC + IT_XKOMV-KWERT.
WHEN 'JEC1'.
WA_DISPLAY-ECESS = WA_DISPLAY-ECESS + IT_XKOMV-KWERT.
WHEN 'JEC2'.
WA_DISPLAY-ECESS = WA_DISPLAY-ECESS + IT_XKOMV-KWERT.
WHEN 'JIP5'.
WA_DISPLAY-ZJIP5 = IT_XKOMV-KWERT.
WHEN 'JIP7'.
WA_DISPLAY-ZJIP7 = IT_XKOMV-KWERT.
WHEN 'JIP6'.
WA_DISPLAY-ZJIP6 = IT_XKOMV-KWERT.
WHEN 'JIP8'.
WA_DISPLAY-ZJIP8 = IT_XKOMV-KWERT.
WHEN 'JSRT'.
WA_DISPLAY-ZJSRT = IT_XKOMV-KWERT.
WHEN 'JEC3'.
WA_DISPLAY-ZJEC3 = IT_XKOMV-KWERT.
WHEN 'JIP1'.
WA_DISPLAY-OTHTAX = WA_DISPLAY-OTHTAX + IT_XKOMV-KWERT.
WHEN 'JIP2'.
WA_DISPLAY-OTHTAX = WA_DISPLAY-OTHTAX + IT_XKOMV-KWERT.
WHEN 'JIP3'.
WA_DISPLAY-OTHTAX = WA_DISPLAY-OTHTAX + IT_XKOMV-KWERT.
WHEN 'ZSUR'.
WA_DISPLAY-OTHTAX = WA_DISPLAY-OTHTAX + IT_XKOMV-KWERT.
WHEN 'ZTOT'.
WA_DISPLAY-OTHTAX = WA_DISPLAY-OTHTAX + IT_XKOMV-KWERT.
WHEN 'ZRST'.
WA_DISPLAY-OTHTAX = WA_DISPLAY-OTHTAX + IT_XKOMV-KWERT.
WHEN 'JIP4'.
WA_DISPLAY-OTHTAX = WA_DISPLAY-OTHTAX + IT_XKOMV-KWERT.
ENDCASE.
ENDLOOP.
CLEAR :IT_XKOMV,IT_TAXCOM.
REFRESH :IT_XKOMV,IT_TAXCOM.
*END OF CALCULATE TAXES

READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZFA1'.
IF SY-SUBRC = 0.
WA_DISPLAY-FREIGHT = WA_DISPLAY-FREIGHT + WA_KONV-KWERT.
ENDIF.
READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZFB1'.
IF SY-SUBRC = 0.
WA_DISPLAY-FREIGHT = WA_DISPLAY-FREIGHT + WA_KONV-KWERT.
ENDIF.
READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZFC1'.
IF SY-SUBRC = 0.
WA_DISPLAY-FREIGHT = WA_DISPLAY-FREIGHT + WA_KONV-KWERT.
ENDIF.

READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZCOM'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZCOM = WA_KONV-KWERT.
ENDIF.

READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZHAN'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZHAN = WA_KONV-KWERT.
ENDIF.

READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZICH'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZICH = WA_KONV-KWERT.
ENDIF.

READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZIST'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZIST = WA_KONV-KWERT.
ENDIF.

READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZAPM'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZAPMC = WA_DISPLAY-ZAPMC + WA_KONV-KWERT.
ENDIF.
READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZAM1'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZAPMC = WA_DISPLAY-ZAPMC + WA_KONV-KWERT.
ENDIF.
READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZAM2'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZAPMC = WA_DISPLAY-ZAPMC + WA_KONV-KWERT.
ENDIF.

READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZINS'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZINS = WA_KONV-KWERT.
ENDIF.

READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZSUP'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZSUP = WA_KONV-KWERT.
ENDIF.

READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZMIS'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZMIS = WA_KONV-KWERT.
ENDIF.

READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZPC1'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZPKCHG = WA_DISPLAY-ZPKCHG + WA_KONV-KWERT.
ENDIF.
READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZPC2'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZPKCHG = WA_DISPLAY-ZPKCHG + WA_KONV-KWERT.
ENDIF.

READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZFH1'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZFHCHG = WA_DISPLAY-ZFHCHG + WA_KONV-KWERT.
ENDIF.
READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZFH2'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZFHCHG = WA_DISPLAY-ZFHCHG + WA_KONV-KWERT.
ENDIF.

READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZEXP'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZEXP = WA_KONV-KWERT.
ENDIF.

READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_EKKO-KNUMV
KPOSN = WA_EKKO-EBELP KSCHL = 'ZOCM'.
IF SY-SUBRC = 0.
WA_DISPLAY-ZOCM = WA_KONV-KWERT.
ENDIF.

PERFORM CONVERT_FORMAT CHANGING
WA_DISPLAY-LIFNR.
PERFORM CONVERT_FORMAT CHANGING
WA_DISPLAY-MATNR.

APPEND WA_DISPLAY TO IT_DISPLAY.

SORT IT_DISPLAY ASCENDING BY EBELN EBELP.

DELETE ADJACENT DUPLICATES FROM IT_DISPLAY COMPARING EBELN EBELP.

CLEAR : WA_DISPLAY,WA_KWERT,IT_TAXCOM.

ENDLOOP.
ENDFORM. " F005_POPULATE_DATA

No comments:

link us...

For Visitors

if you want to publish or Add something on ERP, SAP , SAP FUNCTIONAL, SAP ABAP then mail us along with your email-id. contain must be yours

email-id :- avinashkr_raj@yahoo.com(any email)

email-id :- avinaskr_raj.abap@blogger.com ( use only gmail)