Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

REPORT zmpopr01 NO STANDARD PAGE HEADING

MESSAGE-ID z1* LINE-SIZE 1023LINE-COUNT 64(1).* LINE-COUNT 80(3) LINE-SIZE 700.*&---------------------------------------------------------------------*

*& DECLARATION

*&---------------------------------------------------------------------*TYPE-POOLS : slis.

DATA: bdcdata_wa TYPE bdcdata,

bdcdata_tab TYPE TABLE OF bdcdata.

DATA opt TYPE ctu_params.

DATA l_func(22).* TablesTABLES: ekko, "Purchasing Document Header

ekpo, "Purchasing Document Item

lfa1, "Vendor Master (General Section)

eban, " Purchase Requisition

mara, "General Material Data

vbep, "Sales Document: Schedule Line Data

vbak, "Sales Document: Header Data

t024, "Purchasing Groups

t001w, "Plants/Branches

eket, "Scheduling Agreement Schedule Lines

zpoview, "Purchase Order View

zpoprview,

ekkn,

ekbe,

bseg,

vbsegk,

cdhdr,

bsak.

DATA: t_event TYPE slis_t_event WITH HEADER LINE.

DATA: g_repid LIKE sy-repid.

DATA: gs_variant LIKE disvariant,

g_save.

*DATA : fc TYPE slis_fieldcat_alv OCCURS 0 WITH HEADER LINE,

DATA: fc TYPE slis_t_fieldcat_alv ,

pt_fc TYPE slis_fieldcat_alv,

fc1 TYPE slis_fieldcat_alv OCCURS 0 WITH HEADER LINE,

gs_layout TYPE slis_layout_alv,

gt_events TYPE slis_t_event,

gt_list_top_of_page TYPE slis_t_listheader,

gt_list_top_of_page1 TYPE slis_t_listheader,

sl TYPE slis_keyinfo_alv .

DATA : lfc TYPE slis_fieldcat_alv OCCURS 0 WITH HEADER LINE.

DATA : r_ucomm LIKE sy-ucomm.

DATA : rs_selfield TYPE slis_selfield.

DATA : w_callback_ucomm TYPE slis_formname.

DATA : l2 LIKE sy-datum.

* Internal table for storing PR Data

DATA: BEGIN OF idata1 OCCURS 0.

INCLUDE STRUCTURE eban.

DATA: END OF idata1.

* Internal table for storing PO History Data

DATA: BEGIN OF idata OCCURS 0.

INCLUDE STRUCTURE ekbes.

DATA: END OF idata.

* Internal table for storing PO History Data dates

DATA: BEGIN OF idata2 OCCURS 0.

INCLUDE STRUCTURE ekbe.

DATA: END OF idata2.

* Internal table for storing purchasing View data

DATA: BEGIN OF izpoview OCCURS 0.

INCLUDE STRUCTURE zpoview.

DATA: END OF izpoview.

DATA : l_reval TYPE p DECIMALS 2.

DATA: BEGIN OF itab OCCURS 0,

banfn LIKE eban-banfn,

badat LIKE eban-erdat,

bsart LIKE eban-bsart,

statu LIKE eban-statu,

bnfpo LIKE eban-bnfpo,

ekgrp LIKE eban-ekgrp,

frgdt LIKE eban-frgdt,

erdat LIKE eban-erdat,

bedat LIKE ekko-bedat,

matnr LIKE mara-matnr, "(18),

txz01 LIKE eban-txz01,

bstnk LIKE vbak-bstnk,

prval(20),

kunnr(15),

eknam LIKE t024-eknam,

ebeln LIKE ekko-ebeln,

ebelp LIKE ekpo-ebelp,

evers LIKE ekpo-evers,

evtxt LIKE t027b-evtxt,

aedat LIKE ekko-aedat,

lifnr LIKE lfa1-lifnr,

name1 LIKE lfa1-name1,

eindt LIKE eket-eindt,

menge(15),

zterm LIKE ekko-zterm,

inco1 LIKE ekko-inco1,

wemng(15),

grdat LIKE ekbe-cpudt,

meins LIKE eban-meins,

matkl LIKE eban-matkl,

afnam LIKE eban-afnam,

bname(20)," LIKE vbak-bname,

kdatb LIKE ekko-kdatb,

kdate LIKE ekko-kdate,

_pddat LIKE ekko-aedat,

frgke TYPE ekko-frgke,

netpr(16),

waers LIKE ekko-waers,

poval(20),

grval(20),

irval(20),

reval(20),

remng(20),

sakto LIKE ekkn-sakto,

kostl LIKE ekkn-kostl,

werks LIKE ekpo-werks,

bednr LIKE ekpo-bednr,

belnr LIKE ekbe-belnr,

buzei LIKE ekbe-buzei,

gjahr LIKE ekbe-gjahr,

dmbtr LIKE ekbe-dmbtr,

bewtp LIKE ekbe-bewtp,

due_dt LIKE sy-datum,

dmbtr1 LIKE ekbe-dmbtr, "Inv Parked Value

due_dt1 LIKE sy-datum, "paymt due dt, park invoice

due_dt2 LIKE sy-datum, "paymt effected date

dmbtr2 LIKE bsak-dmbtr, "paymt effected value(clearing amt)

laps1(6) TYPE c,

laps2(6) TYPE c,

laps3(8) TYPE c,

laps4(13) TYPE c,

END OF itab.

DATA: l3 LIKE sy-datum.

DATA : BEGIN OF it_down OCCURS 0,

banfn(18),

badat(10),

bsart(10),

statu(10),

bnfpo(10),

matkl(10),

matnr(18),

txz01(35),

prval(20),

ekgrp(10),

eknam(40),

bname(40),

sakto(15),

kostl(10),

bednr(20),

werks(10),

ebeln(15),

ebelp(10),

aedat(10),

name1(40),

eindt(10),

menge(20),

zterm(10),

inco1(10),

evers(10),

evtxt(30),

netpr(20),

waers(10),

poval(20),

wemng(20),

grdat(10),

meins(10),

grval(20),

irval(20),

reval(20),

remng(20),

dmbtr(20),

due_dt(10),

dmbtr1(20),

due_dt1(10),

dmbtr2(20),

END OF it_down.

DATA : BEGIN OF it_down1 OCCURS 0,

banfn(20),

bnfpo(10) ,

ekgrp(10),

frgdt(10),

erdat(10),

ebeln(20),

ebelp(10),

aedat(10),

_pddat(10),

laps1(10),

prval(20),

eindt(10),

inco1(10),

grdat(10),

laps2(10),

due_dt(10),

due_dt2(10),

laps3(10),

laps4(20),

END OF it_down1.

* Internal table for storing the Header fields for download

DATA: BEGIN OF header1 OCCURS 0,

name(50),

END OF header1.

* Grid Related Internal Table

*DATA: itab2 TYPE STANDARD TABLE OF zpopr1.

*DATA: itab2 LIKE zpopr1 OCCURS 0 WITH HEADER LINE.

*DATA: itab2_wa LIKE zpopr1.

DATA: BEGIN OF itab2 OCCURS 0,

banfn LIKE zpopr1-banfn,

badat LIKE zpopr1-badat,

bsart LIKE zpopr1-bsart,

statu LIKE zpopr1-statu,

bnfpo LIKE zpopr1-bnfpo,

matkl LIKE zpopr1-matkl,

matnr LIKE zpopr1-matnr,

txz01 LIKE zpopr1-txz01,

prval LIKE zpopr1-prval,

ekgrp LIKE zpopr1-ekgrp,

eknam LIKE zpopr1-eknam,

bname LIKE zpopr1-bname,

sakto LIKE zpopr1-sakto,

kostl LIKE zpopr1-kostl,

bednr LIKE zpopr1-bednr,

werks LIKE zpopr1-werks,

ebeln LIKE zpopr1-ebeln,

ebelp LIKE zpopr1-ebelp,

aedat LIKE zpopr1-aedat,

name1 LIKE zpopr1-name1,

eindt LIKE zpopr1-eindt,

menge LIKE zpopr1-menge,

zterm LIKE zpopr1-zterm,

inco1 LIKE zpopr1-inco1,

evers LIKE zpopr1-evers,

evtxt LIKE zpopr1-evtxt,

netpr LIKE zpopr1-netpr,

waers LIKE zpopr1-waers,

poval LIKE zpopr1-poval,

wemng LIKE zpopr1-wemng,

grdat LIKE zpopr1-grdat,

meins LIKE zpopr1-meins,

grval LIKE zpopr1-grval,

irval LIKE zpopr1-irval,

reval LIKE zpopr1-reval,

remng LIKE zpopr1-remng,

dmbtr LIKE zpopr1-dmbtr,

due_dt LIKE zpopr1-due_dt,

dmbtr1 LIKE zpopr1-dmbtr1,

due_dt1 LIKE zpopr1-due_dt1,

dmbtr2 LIKE zpopr1-dmbtr2,

END OF itab2.

DATA: BEGIN OF iout OCCURS 0,

banfn LIKE zpopr1-banfn,

badat LIKE zpopr1-badat,

bsart LIKE zpopr1-bsart,

statu LIKE zpopr1-statu,

bnfpo LIKE zpopr1-bnfpo,

matkl LIKE zpopr1-matkl,

matnr LIKE zpopr1-matnr,

txz01 LIKE zpopr1-txz01,

prval LIKE zpopr1-prval,

ekgrp LIKE zpopr1-ekgrp,

eknam LIKE zpopr1-eknam,

bname LIKE zpopr1-bname,

sakto LIKE zpopr1-sakto,

kostl LIKE zpopr1-kostl,

bednr LIKE zpopr1-bednr,

werks LIKE zpopr1-werks,

ebeln LIKE zpopr1-ebeln,

ebelp LIKE zpopr1-ebelp,

aedat LIKE zpopr1-aedat,

name1 LIKE zpopr1-name1,

eindt LIKE zpopr1-eindt,

menge LIKE zpopr1-menge,

zterm LIKE zpopr1-zterm,

inco1 LIKE zpopr1-inco1,

evers LIKE zpopr1-evers,

evtxt LIKE zpopr1-evtxt,

netpr LIKE zpopr1-netpr,

waers LIKE zpopr1-waers,

poval LIKE zpopr1-poval,

wemng LIKE zpopr1-wemng,

grdat LIKE zpopr1-grdat,

meins LIKE zpopr1-meins,

grval LIKE zpopr1-grval,

irval LIKE zpopr1-irval,

reval LIKE zpopr1-reval,

remng LIKE zpopr1-remng,

dmbtr LIKE zpopr1-dmbtr,

due_dt LIKE zpopr1-due_dt,

dmbtr1 LIKE zpopr1-dmbtr1,

due_dt1 LIKE zpopr1-due_dt1,

dmbtr2 LIKE zpopr1-dmbtr2,

END OF iout.

DATA: gpoval LIKE ekpo-netwr,

ggrval LIKE ekpo-netwr,

gprval LIKE ekpo-netwr,

lin TYPE i.

DATA : s_statu LIKE eban-statu.

*&---------------------------------------------------------------------*

*& SELECTION SCREEN

*&---------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK tt WITH FRAME TITLE text-t02.

SELECT-OPTIONS:

* s_statu FOR eban-statu,

s_banfn FOR eban-banfn,

s_bednr FOR eban-bednr.

PARAMETERS: all_pr RADIOBUTTON GROUP xsel DEFAULT 'X',

non_ss RADIOBUTTON GROUP xsel,

ss_pr RADIOBUTTON GROUP xsel.

SELECTION-SCREEN END OF BLOCK tt.

SELECTION-SCREEN BEGIN OF BLOCK ss WITH FRAME TITLE text-t03.

PARAMETERS: p_yes AS CHECKBOX.

PARAMETERS: p_sum AS CHECKBOX.

PARAMETERS : p_grd RADIOBUTTON GROUP r1.

PARAMETERS : p_lst RADIOBUTTON GROUP r1 DEFAULT 'X'.

SELECTION-SCREEN END OF BLOCK ss.

DATA: rceko LIKE sy-subrc,

rcwrk LIKE sy-subrc.

SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.

SELECT-OPTIONS:

s_matnr FOR mara-matnr ,

s_matkl FOR mara-matkl, "Material Group

s_ekorg FOR ekko-ekorg DEFAULT 'SA02',"SBTP00237 MOD. IN 4/4/2005

s_ekgrp FOR ekko-ekgrp,

s_werks FOR ekpo-werks,

s_ebeln FOR ekko-ebeln,

s_aedat FOR ekko-aedat,

s_lifnr FOR ekko-lifnr,

s_zterm FOR ekko-zterm,

s_inco1 FOR ekko-inco1,

s_evers FOR ekpo-evers,

s_eindt FOR eket-eindt.

SELECTION-SCREEN END OF BLOCK a.

RANGES: r_werks FOR eban-werks.

* check user input field

*AT SELECTION-SCREEN ON s_werks.

*

* SELECT SINGLE werks FROM t001w INTO (t001w-werks)

* WHERE werks IN s_werks.

* IF sy-subrc NE 0.

* MESSAGE e002.

* ENDIF.

* PERFORM check_plant_auth.

*TOP-OF-PAGE.

* PERFORM top_of_page.

*END-OF-SELECTION.

*INITIALIZATION.

* REFRESH: itab,idata1,izpoview.

* CLEAR : itab,idata1,izpoview.

*&---------------------------------------------------------------------*

*& START OF SELECTION

*&---------------------------------------------------------------------*

START-OF-SELECTION.

s_statu = 'B'.

* Get PR data

PERFORM get_pr_data.

* Get the details information

PERFORM get_details.

*END-OF-SELECTION.

*PERFORM TRANS_PARA." not required use it if necessary

* IF p_yes EQ 'X'.

** Download the contents

* PERFORM download_details.

* ELSE.

SORT itab.

SORT itab2.

DELETE ADJACENT DUPLICATES FROM itab.

DELETE ADJACENT DUPLICATES FROM itab2.

* IF p_sum = 'X'.

* PERFORM display_details1.

* ELSE.

LOOP AT itab2.

MOVE-CORRESPONDING itab2 TO iout.

APPEND iout.

ENDLOOP.

CLEAR iout.

PERFORM display_grid TABLES iout.

* ENDIF.

*ENDIF.

*&---------------------------------------------------------------------*

*& Form GET_PR_DATA

*&---------------------------------------------------------------------*

FORM get_pr_data.

SELECT * FROM eban INTO TABLE idata1 WHERE matnr IN s_matnr AND

matkl IN s_matkl AND

ebeln IN s_ebeln AND

werks IN s_werks AND

statu EQ s_statu AND

banfn IN s_banfn AND

bednr IN s_bednr AND

* ekorg IN s_ekorg AND

loekz NOT IN ('X','L').

SORT idata1.

DELETE ADJACENT DUPLICATES FROM idata1.

* SBTP00237 changes 02 April 2005 started

LOOP AT idata1.

CLEAR: rceko,

rcwrk.

AUTHORITY-CHECK OBJECT 'M_BEST_EKO'

ID 'ACTVT' FIELD '03'

ID 'EKORG' FIELD idata1-ekorg.

rceko = sy-subrc.

AUTHORITY-CHECK OBJECT 'M_BEST_WRK'

ID 'ACTVT' FIELD '03'

ID 'WERKS' FIELD idata1-werks.

rcwrk = sy-subrc.

IF ( rceko NE 0 ) OR ( rcwrk NE 0 ).

DELETE idata1.

ENDIF.

ENDLOOP.

IF non_ss EQ 'X'.

PERFORM non_information.

ELSEIF ss_pr EQ 'X'.

PERFORM ss_information.

ENDIF.

* SBTP00237 changes 02 April 2005 ended

ENDFORM. " GET_PR_DATA

*&---------------------------------------------------------------------*

*& Form GET_DETAILS

*&---------------------------------------------------------------------*

FORM get_details.

DATA: lcnt TYPE n,

lmatnr LIKE mara-matnr.

REFRESH: itab,itab2.

CLEAR: idata1,lmatnr.

LOOP AT idata1.

CLEAR zpoprview.

* SELECT * FROM zpoprview WHERE

** aedat IN s_aedat AND

* lifnr IN s_lifnr AND

* ekgrp IN s_ekgrp AND

* zterm IN s_zterm AND

* inco1 IN s_inco1 AND

** evers IN s_evers AND

* ekorg IN s_ekorg AND

* eindt IN s_eindt AND

* ebeln = idata1-ebeln AND

* ebelp = idata1-ebelp AND

* matnr = idata1-matnr AND

* werks = idata1-werks AND

* bstyp = 'F' AND

* loekz NOT IN ('X','L') .

* This is CC_2977 changes started.

* What i did is only putting the fields in the same order of the View.

SELECT * FROM zpoprview WHERE

* aedat IN s_aedat AND

ebeln = idata1-ebeln AND

ebelp = idata1-ebelp AND

matnr = idata1-matnr AND

werks = idata1-werks AND

lifnr IN s_lifnr AND

ekgrp IN s_ekgrp AND

zterm IN s_zterm AND

inco1 IN s_inco1 AND

bstyp = 'F' AND

* evers IN s_evers AND

loekz NOT IN ('X','L') AND

eindt IN s_eindt.

* This i CC_2977 changes ended.

itab-banfn = idata1-banfn.

itab-badat = idata1-badat.

itab-bsart = idata1-bsart.

itab-statu = idata1-statu.

itab-ekgrp = idata1-ekgrp.

itab-frgdt = idata1-frgdt.

itab-erdat = idata1-erdat.

itab-bedat = idata1-bedat.

itab-bnfpo = idata1-bnfpo.

* WRITE idata1-matnr TO lmatnr.

itab-matnr = idata1-matnr.

itab-meins = idata1-meins.

itab-matkl = idata1-matkl.

itab-afnam = idata1-afnam.

itab-bname = idata1-afnam.

itab-txz01 = idata1-txz01.

itab-ebeln = idata1-ebeln.

itab-ebelp = idata1-ebelp.

* itab-_pddat = idata1-_pddat.

itab-zterm = zpoprview-zterm.

itab-inco1 = zpoprview-inco1.

itab-evers = zpoprview-evers.

itab-aedat = zpoprview-aedat.

itab-eindt = zpoprview-eindt.

itab-menge = zpoprview-menge.

itab-wemng = zpoprview-wemng.

itab-netpr = zpoprview-netpr.

itab-waers = zpoprview-waers.

itab-kdatb = zpoprview-kdatb.

itab-kdate = zpoprview-kdate.

itab-bednr = zpoprview-bednr.

itab-werks = zpoprview-werks.

**** ADDED BY DURRAIZ TO ADD SHIPPMENT DESCRIPTION."DS1K949567

SELECT SINGLE evtxt FROM t027b INTO itab-evtxt

WHERE evers = itab-evers

AND spras = 'E'.

PERFORM get_grir_values USING itab-ebeln itab-ebelp.

PERFORM get_gr_date USING itab-ebeln itab-ebelp

CHANGING itab-grdat.

* SORT idata2 BY budat DESCENDING.

* LOOP AT idata2.

* lcnt = lcnt + 1.

* IF lcnt = 1.

* itab-grdat = idata2-cpudt.

* ENDIF.

* ENDLOOP.

IF itab-wemng = 0.

CLEAR itab-grdat.

ENDIF.

*****for vendor no and vendor date

SELECT SINGLE * FROM lfa1 WHERE lifnr = zpoprview-lifnr.

IF sy-subrc = 0.

itab-name1 = lfa1-name1.

itab-lifnr = lfa1-lifnr.

ENDIF.

PERFORM get_paymt_effected_date.

******end of code "DS1K949567

**** Get PO Release Date

PERFORM get_cdhdr_data.

*****LAPSE CALCULATION

PERFORM check_lapse.

IF idata1-peinh IS INITIAL. idata1-peinh = 1. ENDIF.

IF zpoprview-peinh IS INITIAL. zpoprview-peinh = 1. ENDIF.

gprval = idata1-preis * idata1-menge / idata1-peinh.

itab-prval = gprval.

CLEAR gprval.

IF zpoprview-waers EQ 'SAR'.

gpoval = zpoprview-netpr * zpoprview-menge / zpoprview-peinh .

itab-poval = gpoval.

CLEAR gpoval.

ELSE.

gpoval = ( zpoprview-netpr * zpoprview-wkurs ) * zpoprview-menge

/ zpoprview-peinh.

itab-poval = gpoval.

CLEAR gpoval.

ENDIF.

SELECT SINGLE * FROM lfa1 WHERE lifnr = zpoprview-lifnr.

IF sy-subrc = 0.

itab-name1 = lfa1-name1.

itab-lifnr = lfa1-lifnr.

ENDIF.

SELECT SINGLE * FROM t024 WHERE ekgrp = zpoprview-ekgrp.

IF sy-subrc = 0.

itab-eknam = t024-eknam.

ENDIF.

* PERFORM get_grir_values USING itab-ebeln itab-ebelp."DS1K949567

PERFORM get_so_data.

LOOP AT idata.

IF NOT ( idata-wemng IS INITIAL AND idata-remng IS INITIAL ).

IF NOT ( idata-wewrt IS INITIAL OR idata-rewrt IS INITIAL ) .

itab-grval = idata-rewrt.

itab-irval = idata-rewrt.

itab-remng = idata-remng.

ELSE.

itab-grval = idata-wewrt.

itab-irval = idata-rewrt.

itab-remng = idata-remng.

ENDIF.

ENDIF.

ENDLOOP.

* SORT idata2 BY budat DESCENDING."commented by durraiz"DS1K949567

* LOOP AT idata2.

* lcnt = lcnt + 1.

* IF lcnt = 1.

* itab-grdat = idata2-cpudt.

* ENDIF.

* ENDLOOP.

CASE itab-kunnr.

WHEN '0000000101'.

itab-kunnr = '101-HADEED'.

WHEN '0000000102'.

itab-kunnr = '102-HADEED'.

WHEN '0000000201'.

itab-kunnr = '201-PK'.

WHEN '0000000202'.

itab-kunnr = '202-PK'.

WHEN '0000000601'.

itab-kunnr = '601-IBN HAYYAN'.

WHEN '0000000602'.

itab-kunnr = '602-IBN HAYYAN'.

WHEN '0000000701'.

itab-kunnr = '701-IBN BAYTAR'.

WHEN '0000000702'.

itab-kunnr = '702-IBN BAYTAR'.

WHEN '0000000801'.

itab-kunnr = '801-GAS JU'.

WHEN '0000000802'.

itab-kunnr = '802-GAS JU'.

WHEN '0000000881'.

itab-kunnr = '881-GAS YAN'.

WHEN '0000000882'.

itab-kunnr = '882-GAS YAN'.

WHEN '0000000901'.

itab-kunnr = '901-IBN ZAHR'.

WHEN '0000000902'.

itab-kunnr = '902-IBN ZAHR'.

WHEN '0000001101'.

itab-kunnr = '1101-SADAF'.

WHEN '0000001102'.

itab-kunnr = '1102-SADAF'.

WHEN '0000001301'.

itab-kunnr = '1301-KEMYA'.

WHEN '0000001302'.

itab-kunnr = '1302-KEMYA'.

WHEN '0000001401'.

itab-kunnr = '1401-SHARQ'.

WHEN '0000001402'.

itab-kunnr = '1402-SHARQ'.

WHEN '0000001501'.

itab-kunnr = '1501-AR-RAZI'.

WHEN '0000001502'.

itab-kunnr = '1502-AR-RAZI'.

WHEN '0000001600'.

itab-kunnr = '1600-IBN SINA'.

WHEN '0000001602'.

itab-kunnr = '1602-IBN SINA'.

WHEN '0000001701'.

itab-kunnr = '1701-SAMAD'.

WHEN '0000001702'.

itab-kunnr = '1702-SAMAD'.

WHEN '0000001801'.

itab-kunnr = '1801-SAFCO-J'.

WHEN '0000001802'.

itab-kunnr = '1802-SAFCO-J'.

WHEN '0000001881'.

itab-kunnr = '1881-SAFCO-D'.

WHEN '0000001882'.

itab-kunnr = '1882-SAFCO-D'.

ENDCASE.

IF itab-bstnk = ' '.

itab-bstnk = 'MRP'.

itab-kunnr = 'MRP'.

ENDIF.

l_reval = itab-poval - itab-irval.

itab-reval = l_reval.

***syedi 24042004

SELECT SINGLE * FROM ekkn WHERE ebeln = itab-ebeln AND

ebelp = itab-ebelp.

IF sy-subrc = 0.

itab-sakto = ekkn-sakto.

itab-kostl = ekkn-kostl.

ENDIF.

* IF itab-poval = 0.

* CONTINUE.

* ENDIF.

* IF itab-poval IS INITIAL.

* CONTINUE.

* ENDIF.

* IF itab-poval = '0.00'.

* CONTINUE.

* ENDIF.

*** Get the IR value in Local Currency

PERFORM get_ir_value.

*** Get the invoice parked value

PERFORM get_inv_park_value.

*** Get Payment Effected Value

PERFORM get_paymt_effected.

*** Get Payment Effected Date

PERFORM get_paymt_effected_date.

**** Get PO Release Date

* PERFORM get_cdhdr_data.

* IF itab-aedat IN s_aedat.

* IF itab-matnr <= '0'.itab-matnr = ' '.ENDIF.

* MOVE-CORRESPONDING itab TO itab2_wa.

* itab2_wa-dmbtr = itab2_wa-irval.

* APPEND itab2_wa TO itab2.

* CLEAR itab2_wa.

*

* APPEND itab.

* CLEAR: itab.

* ENDIF.

IF itab-aedat IN s_aedat.

IF itab-matnr <= '0'.itab-matnr = ' '.ENDIF.

MOVE-CORRESPONDING itab TO itab2.

itab2-dmbtr = itab2-irval.

APPEND itab2.

CLEAR itab2.

APPEND itab.

CLEAR: itab.

ENDIF.

REFRESH: idata,idata2.

CLEAR: idata,idata2,lcnt,bsak,bseg,vbsegk .

* CLEAR : itab,itab2_wa.

CLEAR itab.

ENDSELECT.

ENDLOOP.

ENDFORM. " GET_DETAILS

*&---------------------------------------------------------------------*

*& Form GET_SO_DATA

*&---------------------------------------------------------------------*

FORM get_so_data.

SELECT SINGLE * FROM vbep WHERE

banfn = idata1-banfn.

IF sy-subrc = 0.

SELECT SINGLE * FROM vbak WHERE

vbeln = vbep-vbeln.

IF sy-subrc = 0.

itab-bstnk = vbak-bstnk .

itab-kunnr = vbak-kunnr .

itab-bname = vbak-bname.

ENDIF.

ENDIF.

ENDFORM. " GET_SO_DATA

*&---------------------------------------------------------------------*

*& Form GET_GRIR_VALUES

*&---------------------------------------------------------------------*

FORM get_grir_values USING p_itab_ebeln

p_itab_ebelp.

CALL FUNCTION 'ME_READ_HISTORY'

EXPORTING

ebeln = p_itab_ebeln

ebelp = p_itab_ebelp

webre = ' '

* I_BYPASSING_BUFFER =

* I_REFRESH_BUFFER =

TABLES

xekbe = idata2

xekbes = idata

* XEKBEZ =

* XEKBNK =

* XEKBZ =

.

DELETE idata2 WHERE vgabe = '2'.

DELETE idata WHERE lvgdt = '00000000'.

ENDFORM. " GET_GRIR_VALUES

*&---------------------------------------------------------------------*

*& Form DOWNLOAD_DETAILS

*&---------------------------------------------------------------------*

FORM download_details.

PERFORM append_legends.

SORT itab.

DELETE ADJACENT DUPLICATES FROM itab.

IF p_sum NE 'X'.

LOOP AT itab.

MOVE-CORRESPONDING itab TO it_down.

APPEND it_down.

CLEAR it_down.

ENDLOOP.

CALL FUNCTION 'DOWNLOAD'

EXPORTING

filename = ' '

filetype = 'DAT'

TABLES

data_tab = it_down

fieldnames = header1

EXCEPTIONS

invalid_filesize = 1

invalid_table_width = 2

invalid_type = 3

no_batch = 4

unknown_error = 5

gui_refuse_filetransfer = 6

customer_error = 7

OTHERS = 8.

IF sy-subrc <> 0.

MESSAGE e000(zz) WITH sy-subrc 'error in download'.

ENDIF.

ELSE.

LOOP AT itab.

MOVE-CORRESPONDING itab TO it_down1.

APPEND it_down1.

CLEAR it_down1.

ENDLOOP.

CALL FUNCTION 'DOWNLOAD'

EXPORTING

filename = ' '

filetype = 'DAT'

TABLES

data_tab = it_down1

fieldnames = header1

EXCEPTIONS

invalid_filesize = 1

invalid_table_width = 2

invalid_type = 3

no_batch = 4

unknown_error = 5

gui_refuse_filetransfer = 6

customer_error = 7

OTHERS = 8.

IF sy-subrc <> 0.

MESSAGE e000(zz) WITH sy-subrc 'error in download'.

ENDIF.

ENDIF.

ENDFORM. " DOWNLOAD_DETAILS

*&---------------------------------------------------------------------*

*& Form DISPLAY_GRID

*&---------------------------------------------------------------------*

FORM display_grid TABLES itab STRUCTURE iout.

TYPE-POOLS: slis.

DATA: s_repid LIKE sy-repid ,

v_vari LIKE disvariant ,

ps_layout TYPE slis_layout_alv ,

pt_fieldcat TYPE slis_t_fieldcat_alv ,

pt_hlp_fieldcat TYPE slis_fieldcat_alv .

s_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = s_repid

i_internal_tabname = 'IOUT'

i_inclname = s_repid

CHANGING

ct_fieldcat = pt_fieldcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

IF sy-subrc NE 0.

EXIT.

ENDIF.

*CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

* EXPORTING

* i_program_name = g_repid

* i_internal_tabname = 'ITAB2'

* i_inclname = g_repid

* CHANGING

* ct_fieldcat = fc

* EXCEPTIONS

* inconsistent_interface = 1

* program_error = 2

* OTHERS = 3.

* IF sy-subrc NE 0.

* EXIT.

* ENDIF.

LOOP AT pt_fieldcat INTO pt_hlp_fieldcat.

CLEAR: pt_hlp_fieldcat-key.

CASE pt_hlp_fieldcat-fieldname.

WHEN 'BANFN'.

pt_hlp_fieldcat-reptext_ddic = 'PR Number'.

pt_hlp_fieldcat-seltext_l = 'PR Number'.

pt_hlp_fieldcat-seltext_m = 'PR Number'.

pt_hlp_fieldcat-seltext_s = 'PR Number'.

WHEN 'BADAT'.

pt_hlp_fieldcat-reptext_ddic = 'Name'.

pt_hlp_fieldcat-seltext_l = 'Name'.

pt_hlp_fieldcat-seltext_m = 'Name'.

pt_hlp_fieldcat-seltext_s = 'Name'.

WHEN 'BSART'.

pt_hlp_fieldcat-reptext_ddic = 'Material'.

pt_hlp_fieldcat-seltext_l = 'Material'.

pt_hlp_fieldcat-seltext_m = 'Material'.

pt_hlp_fieldcat-seltext_s = 'Material'.

WHEN 'STATU'.

pt_hlp_fieldcat-reptext_ddic = 'Description'.

pt_hlp_fieldcat-seltext_l = 'Description'.

pt_hlp_fieldcat-seltext_m = 'Description'.

pt_hlp_fieldcat-seltext_s = 'Description'.

WHEN 'BNFPO'.

pt_hlp_fieldcat-reptext_ddic = 'UoM'.

pt_hlp_fieldcat-seltext_l = 'UoM'.

pt_hlp_fieldcat-seltext_m = 'UoM'.

pt_hlp_fieldcat-seltext_s = 'UoM'.

WHEN 'MATKL'.

pt_hlp_fieldcat-reptext_ddic = 'Unrestricted Use Qty'.

pt_hlp_fieldcat-seltext_l = 'Unrestricted Use Qty'.

pt_hlp_fieldcat-seltext_m = 'Unrestricted Use Qty'.

pt_hlp_fieldcat-seltext_s = 'Unrestricted Use Qty'.

WHEN 'MATNR'.

pt_hlp_fieldcat-reptext_ddic = 'Sales Order Qty'.

pt_hlp_fieldcat-seltext_l = 'Sales Order Qty'.

pt_hlp_fieldcat-seltext_m = 'Sales Order Qty'.

pt_hlp_fieldcat-seltext_s = 'Sales Order Qty'.

WHEN 'TXZ01'.

pt_hlp_fieldcat-reptext_ddic = 'Schd For Delivery Qty'.

pt_hlp_fieldcat-seltext_l = 'Schd For Delivery Qty'.

pt_hlp_fieldcat-seltext_m = 'Schd For Delivery Qty'.

pt_hlp_fieldcat-seltext_s = 'Schd For Delivery Qty'.

WHEN 'PRVAL'.

pt_hlp_fieldcat-reptext_ddic = 'Open Order Qty'.

pt_hlp_fieldcat-seltext_l = 'Open Order Qty'.

pt_hlp_fieldcat-seltext_m = 'Open Order Qty'.

pt_hlp_fieldcat-seltext_s = 'Open Order Qty'.

WHEN 'EKGRP'.

pt_hlp_fieldcat-reptext_ddic = 'Open Order Qty w/Nomination'.

pt_hlp_fieldcat-seltext_l = 'Open Order Qty w/Nomination'.

pt_hlp_fieldcat-seltext_m = 'Open Order Qty w/Nomination'.

pt_hlp_fieldcat-seltext_s = 'Open Order Qty w/Nomination'.

WHEN 'EKNAM'.

pt_hlp_fieldcat-reptext_ddic = 'Open Order Qty w/o Nomination'.

pt_hlp_fieldcat-seltext_l = 'Open Order Qty w/o Nomination'.

pt_hlp_fieldcat-seltext_m = 'Open Order Qty w/o Nomination'.

pt_hlp_fieldcat-seltext_s = 'Open Order Qty w/o Nomination'.

WHEN 'BNAME'.

pt_hlp_fieldcat-reptext_ddic = 'Free Stock Qty'.

pt_hlp_fieldcat-seltext_l = 'Free Stock Qty'.

pt_hlp_fieldcat-seltext_m = 'Free Stock Qty'.

pt_hlp_fieldcat-seltext_s = 'Free Stock Qty'.

WHEN 'SAKTO'.

pt_hlp_fieldcat-reptext_ddic = 'Free Stock Qty w/Nomination'.

pt_hlp_fieldcat-seltext_l = 'Free Stock Qty w/Nomination'.

pt_hlp_fieldcat-seltext_m = 'Free Stock Qty w/Nomination'.

pt_hlp_fieldcat-seltext_s = 'Free Stock Qty w/Nomination'.

WHEN 'KOSTL'.

pt_hlp_fieldcat-reptext_ddic = 'Free Stock Qty w/o Nomination'.

pt_hlp_fieldcat-seltext_l = 'Free Stock Qty w/o Nomination'.

pt_hlp_fieldcat-seltext_m = 'Free Stock Qty w/o Nomination'.

pt_hlp_fieldcat-seltext_s = 'Free Stock Qty w/o Nomination'.

WHEN 'POVAL'.

pt_hlp_fieldcat-reptext_ddic = 'Plant'.

pt_hlp_fieldcat-seltext_l = 'Plant'.

pt_hlp_fieldcat-seltext_m = 'Plant'.

pt_hlp_fieldcat-seltext_s = 'Plant'.

WHEN 'WEMNG'.

pt_hlp_fieldcat-reptext_ddic = 'Name'.

pt_hlp_fieldcat-seltext_l = 'Name'.

pt_hlp_fieldcat-seltext_m = 'Name'.

pt_hlp_fieldcat-seltext_s = 'Name'.

WHEN 'GRDAT'.

pt_hlp_fieldcat-reptext_ddic = 'Material'.

pt_hlp_fieldcat-seltext_l = 'Material'.

pt_hlp_fieldcat-seltext_m = 'Material'.

pt_hlp_fieldcat-seltext_s = 'Material'.

WHEN 'MEINS'.

pt_hlp_fieldcat-reptext_ddic = 'Description'.

pt_hlp_fieldcat-seltext_l = 'Description'.

pt_hlp_fieldcat-seltext_m = 'Description'.

pt_hlp_fieldcat-seltext_s = 'Description'.

WHEN 'GRVAL'.

pt_hlp_fieldcat-reptext_ddic = 'UoM'.

pt_hlp_fieldcat-seltext_l = 'UoM'.

pt_hlp_fieldcat-seltext_m = 'UoM'.

pt_hlp_fieldcat-seltext_s = 'UoM'.

WHEN 'IRVAL'.

pt_hlp_fieldcat-reptext_ddic = 'Unrestricted Use Qty'.

pt_hlp_fieldcat-seltext_l = 'Unrestricted Use Qty'.

pt_hlp_fieldcat-seltext_m = 'Unrestricted Use Qty'.

pt_hlp_fieldcat-seltext_s = 'Unrestricted Use Qty'.

WHEN 'REVAL'.

pt_hlp_fieldcat-reptext_ddic = 'Sales Order Qty'.

pt_hlp_fieldcat-seltext_l = 'Sales Order Qty'.

pt_hlp_fieldcat-seltext_m = 'Sales Order Qty'.

pt_hlp_fieldcat-seltext_s = 'Sales Order Qty'.

WHEN 'REMNG'.

pt_hlp_fieldcat-reptext_ddic = 'Schd For Delivery Qty'.

pt_hlp_fieldcat-seltext_l = 'Schd For Delivery Qty'.

pt_hlp_fieldcat-seltext_m = 'Schd For Delivery Qty'.

pt_hlp_fieldcat-seltext_s = 'Schd For Delivery Qty'.

WHEN 'DMBTR'.

pt_hlp_fieldcat-reptext_ddic = 'Open Order Qty'.

pt_hlp_fieldcat-seltext_l = 'Open Order Qty'.

pt_hlp_fieldcat-seltext_m = 'Open Order Qty'.

pt_hlp_fieldcat-seltext_s = 'Open Order Qty'.

WHEN 'DUE_DT'.

pt_hlp_fieldcat-reptext_ddic = 'Open Order Qty w/Nomination'.

pt_hlp_fieldcat-seltext_l = 'Open Order Qty w/Nomination'.

pt_hlp_fieldcat-seltext_m = 'Open Order Qty w/Nomination'.

pt_hlp_fieldcat-seltext_s = 'Open Order Qty w/Nomination'.

WHEN 'DMBTR1'.

pt_hlp_fieldcat-reptext_ddic = 'Open Order Qty w/o Nomination'.

pt_hlp_fieldcat-seltext_l = 'Open Order Qty w/o Nomination'.

pt_hlp_fieldcat-seltext_m = 'Open Order Qty w/o Nomination'.

pt_hlp_fieldcat-seltext_s = 'Open Order Qty w/o Nomination'.

WHEN 'DMBTR2'.

pt_hlp_fieldcat-reptext_ddic = 'Free Stock Qty'.

pt_hlp_fieldcat-seltext_l = 'Free Stock Qty'.

pt_hlp_fieldcat-seltext_m = 'Free Stock Qty'.

pt_hlp_fieldcat-seltext_s = 'Free Stock Qty'.

ENDCASE.

IF pt_hlp_fieldcat-fieldname NE space.

MODIFY pt_fieldcat FROM pt_hlp_fieldcat INDEX sy-tabix.

ELSE.

DELETE pt_fieldcat INDEX sy-tabix.

ENDIF.

ENDLOOP.

* IF p_grd EQ 'X'.

* l_func = 'REUSE_ALV_GRID_DISPLAY'.

* ELSE.

* l_func = 'REUSE_ALV_LIST_DISPLAY'.

* ENDIF.

* PERFORM fieldcat.

* PERFORM eventtab_build.

* IF p_grd EQ 'X'.

* PERFORM comment_build CHANGING gt_list_top_of_page.

* ENDIF.

*

* CALL FUNCTION l_func

* EXPORTING

* i_callback_program = g_repid

* i_callback_user_command = 'USER_COMMAND'

* i_structure_name = 'ZPOPR1'

* is_layout = gs_layout

* it_fieldcat = fc[]

* i_save = g_save

* is_variant = gs_variant

* it_events = gt_events[]

* TABLES

* t_outtab = itab2

* EXCEPTIONS

* program_error = 1

* OTHERS = 2.

CLEAR ps_layout.

ps_layout-box_tabname = 'I_TAB'.

v_vari-report = s_repid.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = s_repid

is_layout = ps_layout

it_fieldcat = pt_fieldcat

i_save = 'A'

is_variant = v_vari

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

WRITE: / sy-subrc, 'Error'.

ENDIF.

ENDFORM.

*&---------------------------------------------------------------------

*& Form TRANS_PARA

*&---------------------------------------------------------------------

FORM trans_para.

DATA: mmatnr LIKE mara-matnr.

DATA: fmat(18), mmat(11), str1(7).

* CLEAR itab2_wa.

* mmat = '00000000000'.

* LOOP AT itab2 INTO itab2_wa.

* itab2_wa-dmbtr = itab2_wa-irval." added by durraiz

* str1 = itab2_wa-matnr+2(7).

* CONCATENATE mmat str1 INTO fmat.

* itab2_wa-matnr = fmat.

* MODIFY itab2 FROM itab2_wa.

* ENDLOOP.

CLEAR itab2.

mmat = '00000000000'.

LOOP AT itab2.

itab2-dmbtr = itab2-irval." added by durraiz

str1 = itab2-matnr+2(7).

CONCATENATE mmat str1 INTO fmat.

itab2-matnr = fmat.

MODIFY itab2 INDEX sy-tabix.

ENDLOOP.

ENDFORM. " TRANS_PARA

*&---------------------------------------------------------------------*

*& Form APPEND_LEGENDS FOR TEXT FILE

*&---------------------------------------------------------------------*

FORM append_legends.

CLEAR it_down.

it_down-banfn = 'PR No. '.

it_down-badat = 'PR Date'.

it_down-bsart = 'Doc Typ'.

it_down-statu = 'Status'.

it_down-bnfpo = 'PR Item'.

it_down-ekgrp = 'Pur Grp'.

* IT_DOWN-frgdt = 'PR Rel Dt'.

* IT_DOWN-erdat = 'last Ch Dt'.

* IT_DOWN-bedat = 'PO Date'.

it_down-matnr = 'Mat No.'.

it_down-txz01 = 'Material'.

* IT_DOWN-bstnk = 'Cus PO No'.

it_down-prval = 'PR Value'.

* IT_DOWN-kunnr = 'Buyer Name'.

it_down-eknam = 'Pur Grp'.

it_down-ebeln = 'PO No.'.

it_down-ebelp = 'PO Item'.

it_down-evers = 'Shp Inst'.

it_down-evtxt = 'Shipping instructions Description'.

it_down-aedat = 'PO Cr Dt'.

* IT_DOWN-lifnr = 'Vendor No.'.

it_down-name1 = 'Vendor Name'.

it_down-eindt = 'Item del dt'.

it_down-menge = 'Quantity'.

it_down-zterm = 'Terms of payment'.

it_down-inco1 = 'IncoTerms'.

it_down-wemng = 'wemng'.

it_down-grdat = 'GR Date'.

it_down-meins = 'UOM'.

it_down-matkl = 'Material Group'.

* IT_DOWN-AFNAM = 'Requisitioner'.

it_down-bname = 'Requisitioner '.

* IT_DOWN-kdatb = 'St Val Dt'.

* IT_DOWN-kdate = 'End VAl Dt'.

* IT_DOWN-_pddat = 'Actual PO Dt'.

* IT_DOWN-frgke = 'Release indicator'.

it_down-netpr = 'Net Price'.

it_down-poval = 'PO Value'.

it_down-grval = 'GR Value'.

it_down-irval = 'IR Value'.

it_down-reval = ' Rem Val'.

it_down-remng = 'Inv Qty'.

it_down-sakto = 'GL Acct'.

it_down-kostl = 'Cost Center'.

it_down-werks = 'Plant'.

it_down-bednr = 'Tracking No'.

* IT_DOWN-belnr = 'Material Doc'.

* IT_DOWN-buzei = 'Item Mat Doc'.

* IT_DOWN-gjahr = 'Year'.

it_down-dmbtr = 'IR amount'.

* IT_DOWN-bewtp = 'PO History'.

it_down-due_dt = 'Due Dt'.

it_down-dmbtr1 = 'Inv Prk Val'.

it_down-due_dt1 = 'Due Dt'.

* IT_DOWN-due_dt2 = 'PayDue Dt'.

it_down-dmbtr2 = 'PayDue Val'.

* IT_DOWN-laps1 = 'Lapse1'.

* IT_DOWN-laps2 = 'Lapse2'.

* IT_DOWN-laps3 = 'Lapse3'.

* IT_DOWN-laps4 = 'Lapse4'.

APPEND it_down.CLEAR it_down.

it_down1-banfn = 'PR No. '.

it_down1-bnfpo = 'PR Item'.

it_down1-ekgrp = 'Pur Grp'.

it_down1-frgdt = 'PR Rel Dt'.

it_down1-erdat = 'last Ch Dt'.

it_down1-prval = 'PR Value'.

it_down1-ebeln = 'PO No.'.

it_down1-ebelp = 'PO Item'.

it_down1-aedat = 'PO Cr Dt'.

it_down1-eindt = 'Item del dt'.

it_down1-inco1 = 'IncoTerms'.

it_down1-grdat = 'GR Date'.

it_down1-_pddat = 'Actual PO Dt'.

it_down1-due_dt = 'Due Dt'.

it_down1-due_dt2 = 'PayDue Dt'.

it_down1-laps1 = 'Lapse(PR-PO)'.

it_down1-laps2 = 'Lapse(PO-GR)'.

it_down1-laps3 = 'Lapse(GR-Payment)'.

it_down1-laps4 = 'Total Lapse(PR-Payment)'.

APPEND it_down1.CLEAR it_down1.

ENDFORM. " APPEND_LEGENDS

*&---------------------------------------------------------------------*

*& Form check_plant_auth

*&---------------------------------------------------------------------*

FORM check_plant_auth.

DATA: ptab LIKE t001w OCCURS 1 WITH HEADER LINE.

SELECT * FROM t001w

INTO CORRESPONDING FIELDS OF TABLE ptab

WHERE werks IN s_werks.

** Now clear swerks and refill it again according to authorization

*clear s_werks.

*refresh s_werks.

LOOP AT ptab.

* Checking Authorization at plant level

AUTHORITY-CHECK OBJECT 'M_BANF_WRK'

ID 'ACTVT' FIELD '03' "should it be dummy???

ID 'WERKS' FIELD ptab-werks.

IF sy-subrc <> 0.

* WRITE:/ 'YOU DO NOT HAVE AUTHORIZATION FOR PLANT',ptab-werks.

MESSAGE e034 WITH ptab-werks.

ENDIF.

ENDLOOP.

ENDFORM. " check_plant_auth

*&---------------------------------------------------------------------*

*& Form NON_INFORMATION

*&---------------------------------------------------------------------*

FORM non_information.

DELETE idata1 WHERE bsart = 'ZZSS'.

ENDFORM. " NON_INFORMATION

*&---------------------------------------------------------------------*

*& Form SS_INFORMATION

*&---------------------------------------------------------------------*

FORM ss_information.

DELETE idata1 WHERE bsart <> 'ZZSS'.

ENDFORM. " SS_INFORMATION

*&---------------------------------------------------------------------*

*& Form GET_IR_VALUE

*&---------------------------------------------------------------------*

FORM get_ir_value.

* DATA:l_due_date LIKE sy-datum.

SELECT dmbtr belnr buzei gjahr INTO

(ekbe-dmbtr,ekbe-belnr,ekbe-buzei,ekbe-gjahr)

FROM ekbe WHERE ebeln = itab-ebeln

AND ebelp = itab-ebelp

AND bewtp = 'Q'.

***********added by durraiz "DS1K949567

SELECT SINGLE bukrs gjahr zfbdt zbd1t INTO

(bseg-bukrs,bseg-gjahr,bseg-zfbdt,bseg-zbd1t)

FROM bseg WHERE bukrs = '1000' AND

belnr = ekbe-belnr AND

gjahr = ekbe-gjahr.

******" CHANGED BECAUSE ALL THE FIELDS SHOULD

********HAVE DUE DATE IN A PO WITH MUL* LINE ITEM

* buzei = ekbe-buzei.

* ebeln = itab-ebeln and

* ebelp = itab-ebelp.

itab-due_dt = bseg-zfbdt + bseg-zbd1t.

itab-belnr = ekbe-belnr.

itab-buzei = ekbe-buzei.

itab-gjahr = ekbe-gjahr.

itab-dmbtr = itab-dmbtr + ekbe-dmbtr.

**********added by durraiz "DS1K949567

ENDSELECT.

ENDFORM. " GET_IR_VALUE

*&---------------------------------------------------------------------*

*& Form get_inv_park_value

*&---------------------------------------------------------------------*

FORM get_inv_park_value.

SELECT dmbtr belnr buzei gjahr INTO

(ekbe-dmbtr,ekbe-belnr,ekbe-buzei,ekbe-gjahr)

FROM ekbe WHERE ebeln = itab-ebeln

AND ebelp = itab-ebelp

AND bewtp = 'T'.

itab-belnr = ekbe-belnr.

itab-buzei = ekbe-buzei.

itab-gjahr = ekbe-gjahr.

****added by durraiz "DS1K949567

SELECT SINGLE dmbtr gjahr zfbdt zbd1t INTO

(vbsegk-dmbtr,vbsegk-gjahr,vbsegk-zfbdt,vbsegk-zbd1t)

FROM vbsegk WHERE ausbk = '1000' AND

belnr = ekbe-belnr AND

gjahr = ekbe-gjahr AND

buzei = ekbe-buzei.

IF sy-subrc EQ 0.

itab-due_dt1 = vbsegk-zfbdt + vbsegk-zbd1t.

itab-dmbtr1 = itab-dmbtr1 + vbsegk-dmbtr.

ENDIF.

* itab-dmbtr1 = itab-dmbtr1 + ekbe-dmbtr.

****added by durraiz "DS1K949567

ENDSELECT.

ENDFORM. " get_inv_park_value

*&---------------------------------------------------------------------*

*& Form get_paymt_effected

*&---------------------------------------------------------------------*

FORM get_paymt_effected.

SELECT dmbtr belnr buzei gjahr INTO

(ekbe-dmbtr,ekbe-belnr,ekbe-buzei,ekbe-gjahr)

FROM ekbe WHERE ebeln = itab-ebeln

AND ebelp = itab-ebelp

AND bewtp = 'Q'.

SELECT SINGLE dmbtr INTO bsak-dmbtr FROM bsak

WHERE belnr = ekbe-belnr AND

lifnr = itab-lifnr AND

buzei = ekbe-buzei AND

bukrs = '1000' AND

gjahr = ekbe-gjahr.

* and "DS1K949567

* ebeln = itab-ebeln and "DS1K949567

* ebelp = itab-ebelp."DS1K949567

IF sy-subrc = 0.

itab-dmbtr2 = itab-dmbtr2 + bsak-dmbtr.

ENDIF.

ENDSELECT.

ENDFORM. " get_paymt_effected

*&---------------------------------------------------------------------*

*& Form get_paymt_effected_date

*&---------------------------------------------------------------------*

FORM get_paymt_effected_date.

SELECT dmbtr belnr buzei gjahr INTO

(ekbe-dmbtr,ekbe-belnr,ekbe-buzei,ekbe-gjahr)

FROM ekbe WHERE ebeln = itab-ebeln

AND ebelp = itab-ebelp

AND bewtp = 'Q'.

SELECT SINGLE augdt INTO bsak-augdt FROM bsak

WHERE belnr = ekbe-belnr AND

lifnr = itab-lifnr AND

* buzei = ekbe-buzei and

bukrs = '1000' AND

gjahr = ekbe-gjahr AND

augdt > '00000000'.

** ebeln = itab-ebeln and

** ebelp = itab-ebelp.

IF sy-subrc = 0.

itab-due_dt2 = bsak-augdt.

ENDIF.

ENDSELECT.

ENDFORM. " get_paymt_effected

*&------------------------------------*

*& Form display_details1 *

*&------------------------------------*

FORM display_details1.

IF p_grd EQ 'X'.

l_func = 'REUSE_ALV_GRID_DISPLAY'.

ELSE.

l_func = 'REUSE_ALV_LIST_DISPLAY'.

ENDIF.

PERFORM fieldcat1.

PERFORM eventtab_build.

IF p_grd EQ 'X'.

PERFORM comment_build CHANGING gt_list_top_of_page.

ENDIF.

CALL FUNCTION l_func

EXPORTING

i_callback_program = g_repid

i_callback_user_command = 'USER_COMMAND'

* I_STRUCTURE_NAME = 'ZPOPR1'

is_layout = gs_layout

it_fieldcat = fc1[]

i_save = g_save

is_variant = gs_variant

it_events = gt_events[]

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2.

.

IF sy-subrc <> 0.

ENDIF.

CLEAR l_func.

ENDFORM. " display_details1

*--------------------------------*

* Form Get_Cdhdr_data *

*--------------------------------*

FORM get_cdhdr_data.

* LOOP AT itab.

IF itab-frgke NE 'X'.

SELECT udate

FROM cdhdr

INTO cdhdr-udate

WHERE objectclas = 'EINKBELEG'

AND objectid = itab-ebeln

AND tcode = 'ME28'

ORDER BY udate DESCENDING.

ENDSELECT.

IF sy-subrc = 0.

MOVE cdhdr-udate TO itab-_pddat.

* MODIFY itab TRANSPORTING _pddat.

ENDIF.

ENDIF.

* ENDLOOP.

ENDFORM.

*&---------------------------------------------------------------------*

*& Form GET_GR_DATE

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* <--P_ITAB_GRDAT text

*----------------------------------------------------------------------*

FORM get_gr_date USING p_itab_ebeln p_itab_ebelp

CHANGING p_itab_grdat.

SELECT SINGLE cpudt FROM ekbe INTO p_itab_grdat

WHERE ebeln = p_itab_ebeln

AND ebelp = p_itab_ebelp

AND bewtp = 'E'.

IF sy-subrc <> 0.

CLEAR p_itab_grdat.

ENDIF.

ENDFORM. " GET_GR_DATE

*&---------------------------------------------------------------------*

*& Form FIELDCAT

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM fieldcat.

** Store report name

g_repid = sy-repid.

gs_variant-report = g_repid.

g_save = 'A'.

*

** Create Fieldcatalogue from internal table

* CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

* EXPORTING

* i_program_name = g_repid

* i_internal_tabname = 'ITAB2'

* i_inclname = g_repid

* CHANGING

* ct_fieldcat = fc[]

* EXCEPTIONS

* inconsistent_interface = 1

* program_error = 2

* OTHERS = 3.

*

* IF sy-subrc <> 0.

* WRITE: /

* 'Returncode',

* sy-subrc,

* 'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.

* ENDIF.

*----------------------------------------------------------

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = g_repid

i_internal_tabname = 'ITAB2'

i_inclname = g_repid

CHANGING

ct_fieldcat = fc

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

IF sy-subrc NE 0.

EXIT.

ENDIF.

LOOP AT fc INTO pt_fc.

CLEAR: pt_fc-key.

CASE pt_fc-fieldname.

WHEN 'BANFN'.

pt_fc-reptext_ddic = 'PR Number'.

pt_fc-seltext_l = 'PR Number'.

pt_fc-seltext_m = 'PR Number'.

pt_fc-seltext_s = 'PR Number'.

WHEN 'BADAT'.

pt_fc-reptext_ddic = 'Name'.

pt_fc-seltext_l = 'Name'.

pt_fc-seltext_m = 'Name'.

pt_fc-seltext_s = 'Name'.

WHEN 'BSART'.

pt_fc-reptext_ddic = 'Material'.

pt_fc-seltext_l = 'Material'.

pt_fc-seltext_m = 'Material'.

pt_fc-seltext_s = 'Material'.

WHEN 'STATU'.

pt_fc-reptext_ddic = 'Description'.

pt_fc-seltext_l = 'Description'.

pt_fc-seltext_m = 'Description'.

pt_fc-seltext_s = 'Description'.

WHEN 'BNFPO'.

pt_fc-reptext_ddic = 'UoM'.

pt_fc-seltext_l = 'UoM'.

pt_fc-seltext_m = 'UoM'.

pt_fc-seltext_s = 'UoM'.

WHEN 'MATKL'.

pt_fc-reptext_ddic = 'Unrestricted Use Qty'.

pt_fc-seltext_l = 'Unrestricted Use Qty'.

pt_fc-seltext_m = 'Unrestricted Use Qty'.

pt_fc-seltext_s = 'Unrestricted Use Qty'.

WHEN 'MATNR'.

pt_fc-reptext_ddic = 'Sales Order Qty'.

pt_fc-seltext_l = 'Sales Order Qty'.

pt_fc-seltext_m = 'Sales Order Qty'.

pt_fc-seltext_s = 'Sales Order Qty'.

WHEN 'TXZ01'.

pt_fc-reptext_ddic = 'Schd For Delivery Qty'.

pt_fc-seltext_l = 'Schd For Delivery Qty'.

pt_fc-seltext_m = 'Schd For Delivery Qty'.

pt_fc-seltext_s = 'Schd For Delivery Qty'.

WHEN 'PRVAL'.

pt_fc-reptext_ddic = 'Open Order Qty'.

pt_fc-seltext_l = 'Open Order Qty'.

pt_fc-seltext_m = 'Open Order Qty'.

pt_fc-seltext_s = 'Open Order Qty'.

WHEN 'EKGRP'.

pt_fc-reptext_ddic = 'Open Order Qty w/Nomination'.

pt_fc-seltext_l = 'Open Order Qty w/Nomination'.

pt_fc-seltext_m = 'Open Order Qty w/Nomination'.

pt_fc-seltext_s = 'Open Order Qty w/Nomination'.

WHEN 'EKNAM'.

pt_fc-reptext_ddic = 'Open Order Qty w/o Nomination'.

pt_fc-seltext_l = 'Open Order Qty w/o Nomination'.

pt_fc-seltext_m = 'Open Order Qty w/o Nomination'.

pt_fc-seltext_s = 'Open Order Qty w/o Nomination'.

WHEN 'BNAME'.

pt_fc-reptext_ddic = 'Free Stock Qty'.

pt_fc-seltext_l = 'Free Stock Qty'.

pt_fc-seltext_m = 'Free Stock Qty'.

pt_fc-seltext_s = 'Free Stock Qty'.

WHEN 'SAKTO'.

pt_fc-reptext_ddic = 'Free Stock Qty w/Nomination'.

pt_fc-seltext_l = 'Free Stock Qty w/Nomination'.

pt_fc-seltext_m = 'Free Stock Qty w/Nomination'.

pt_fc-seltext_s = 'Free Stock Qty w/Nomination'.

WHEN 'KOSTL'.

pt_fc-reptext_ddic = 'Free Stock Qty w/o Nomination'.

pt_fc-seltext_l = 'Free Stock Qty w/o Nomination'.

pt_fc-seltext_m = 'Free Stock Qty w/o Nomination'.

pt_fc-seltext_s = 'Free Stock Qty w/o Nomination'.

WHEN 'POVAL'.

pt_fc-reptext_ddic = 'Plant'.

pt_fc-seltext_l = 'Plant'.

pt_fc-seltext_m = 'Plant'.

pt_fc-seltext_s = 'Plant'.

WHEN 'WEMNG'.

pt_fc-reptext_ddic = 'Name'.

pt_fc-seltext_l = 'Name'.

pt_fc-seltext_m = 'Name'.

pt_fc-seltext_s = 'Name'.

WHEN 'GRDAT'.

pt_fc-reptext_ddic = 'Material'.

pt_fc-seltext_l = 'Material'.

pt_fc-seltext_m = 'Material'.

pt_fc-seltext_s = 'Material'.

WHEN 'MEINS'.

pt_fc-reptext_ddic = 'Description'.

pt_fc-seltext_l = 'Description'.

pt_fc-seltext_m = 'Description'.

pt_fc-seltext_s = 'Description'.

WHEN 'GRVAL'.

pt_fc-reptext_ddic = 'UoM'.

pt_fc-seltext_l = 'UoM'.

pt_fc-seltext_m = 'UoM'.

pt_fc-seltext_s = 'UoM'.

WHEN 'IRVAL'.

pt_fc-reptext_ddic = 'Unrestricted Use Qty'.

pt_fc-seltext_l = 'Unrestricted Use Qty'.

pt_fc-seltext_m = 'Unrestricted Use Qty'.

pt_fc-seltext_s = 'Unrestricted Use Qty'.

WHEN 'REVAL'.

pt_fc-reptext_ddic = 'Sales Order Qty'.

pt_fc-seltext_l = 'Sales Order Qty'.

pt_fc-seltext_m = 'Sales Order Qty'.

pt_fc-seltext_s = 'Sales Order Qty'.

WHEN 'REMNG'.

pt_fc-reptext_ddic = 'Schd For Delivery Qty'.

pt_fc-seltext_l = 'Schd For Delivery Qty'.

pt_fc-seltext_m = 'Schd For Delivery Qty'.

pt_fc-seltext_s = 'Schd For Delivery Qty'.

WHEN 'DMBTR'.

pt_fc-reptext_ddic = 'Open Order Qty'.

pt_fc-seltext_l = 'Open Order Qty'.

pt_fc-seltext_m = 'Open Order Qty'.

pt_fc-seltext_s = 'Open Order Qty'.

WHEN 'DUE_DT'.

pt_fc-reptext_ddic = 'Open Order Qty w/Nomination'.

pt_fc-seltext_l = 'Open Order Qty w/Nomination'.

pt_fc-seltext_m = 'Open Order Qty w/Nomination'.

pt_fc-seltext_s = 'Open Order Qty w/Nomination'.

WHEN 'DMBTR1'.

pt_fc-reptext_ddic = 'Open Order Qty w/o Nomination'.

pt_fc-seltext_l = 'Open Order Qty w/o Nomination'.

pt_fc-seltext_m = 'Open Order Qty w/o Nomination'.

pt_fc-seltext_s = 'Open Order Qty w/o Nomination'.

WHEN 'DMBTR2'.

pt_fc-reptext_ddic = 'Free Stock Qty'.

pt_fc-seltext_l = 'Free Stock Qty'.

pt_fc-seltext_m = 'Free Stock Qty'.

pt_fc-seltext_s = 'Free Stock Qty'.

ENDCASE.

IF pt_fc-fieldname NE space.

MODIFY fc FROM pt_fc INDEX sy-tabix.

ELSE.

DELETE fc INDEX sy-tabix.

ENDIF.

ENDLOOP.

ENDFORM. " FIELDCAT

*&---------------------------------------------------------------------*

*& Form EVENTTAB_BUILD

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* <--P_GT_EVENTS text

*----------------------------------------------------------------------*

FORM eventtab_build .

t_event-name = 'TOP_OF_PAGE'.

t_event-form = 'TOP_OF_PAGE'.

APPEND t_event TO gt_events.

ENDFORM. " EVENTTAB_BUILD

*&--------------------------------------------------------------------*

*& Form TOP_OF_PAGE

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

FORM top_of_page.

IF p_grd = 'X'.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = gt_list_top_of_page.

ELSE.

IF p_sum = 'X'.

* set pf-status ''.

PERFORM header-display1.

ELSE.

PERFORM header-display.

ENDIF.

ENDIF.

ENDFORM. "TOP_OF_PAGE

*&--------------------------------------------------------------------*

*& Form user_command

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

* -->R_UCOMM text

* -->RS_SELFIELDtext

*---------------------------------------------------------------------*

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN '&IC1'.

**---------------------------------------------------------------***.

**--------------- when PR no is clicked display PR document----***.

**---------------------------------------------------------------***.

IF rs_selfield-fieldname = 'BANFN' .

SET PARAMETER ID 'BAN' FIELD rs_selfield-value.

CALL TRANSACTION 'ME53N' AND SKIP FIRST SCREEN.

ENDIF.

**---------------------------------------------------------------***.

**--when PO no is clicked display PO or Contracts or Scheduled-***.

**---------------------------------------------------------------***.

IF rs_selfield-fieldname = 'EBELN'.

SET PARAMETER ID 'BES' FIELD rs_selfield-value.

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

ENDFORM. "user_command

*&---------------------------------------------------------------------*

*& Form FIELDCAT1

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM fieldcat1.

g_repid = sy-repid.

gs_variant-report = g_repid.

g_save = 'A'.

CLEAR fc1.

fc1-fieldname = 'BANFN'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'PR Number'.

fc1-outputlen = 12.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'BNFPO'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'PR Item'.

fc1-outputlen = 6.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'EKGRP'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'PR Pur Grp'.

fc1-outputlen = 10.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'FRGDT'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'PR Rel Dt'.

fc1-outputlen = 10.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'ERDAT'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'PR Ch Dt'.

fc1-outputlen = 10.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'EBELN'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'PO Number'.

fc1-outputlen = 12.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'EBELP'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'PO Item.'.

fc1-outputlen = 6.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'AEDAT'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'PO Cr.Dt'.

fc1-outputlen = 10.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = '_PDDAT'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'PO Rel Dt'.

fc1-outputlen = 10.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'LAPS1'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'Lapse(PR-PO)'.

fc1-outputlen = 12.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'PRVAL'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'PO Value'.

fc1-outputlen = 16.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'EINDT'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'PO Del Dt'.

fc1-outputlen = 10.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'INCO1'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'Incoterms'.

fc1-outputlen = 10.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'GRDAT'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'GR Date'.

fc1-outputlen = 10.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'LAPS2'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'Lapse(PO-GR)'.

fc1-outputlen = 12.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'DUE_DT'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'Pyt Due Dt'.

fc1-outputlen = 10.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'DUE_DT2'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'Pyt Effected Dt'.

fc1-outputlen = 10.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'LAPS3'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'Lapse(GR-Payment)'.

fc1-outputlen = 17.

APPEND fc1.

CLEAR fc1.

fc1-fieldname = 'LAPS4'.

fc1-tabname = 'ITAB'.

fc1-seltext_l = 'Tot Lapse(PR-Payment)'.

fc1-outputlen = 21.

APPEND fc1.

ENDFORM. " FIELDCAT1

*&-------------------------------*

*& Form header-display1 *

*&-------------------------------*

FORM header-display1.

ULINE.

FORMAT COLOR COL_HEADING INTENSIFIED.

WRITE:/01 'Report ID:',sy-repid,

58 'SABIC SERVICES LIMITED',

128 'Date:',sy-datum.

WRITE:/01 'User ID:',sy-uname,

51 'Purchase Details Executive Summary',

128 'Time:',sy-uzeit,' '.

ULINE.

ENDFORM. " header-display1

*&---------------------------------------------------------------------*

*& Form HEADER-DISPLAY

*&---------------------------------------------------------------------*

FORM header-display.

ULINE.

WRITE:/01 'Report ID:',sy-repid,

40 'SABIC SERVICES LIMITED',

115 'Date:',sy-datum.

WRITE:/40 'Purchase Details',

115 'Time:',sy-uzeit.

ULINE.

ENDFORM. " HEADER-DISPLAY

*&---------------------------------------------------------------------*

*& Form COMMENT_BUILD

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* <--P_GT_LIST_TOP_OF_PAGE text

*----------------------------------------------------------------------*

FORM comment_build CHANGING gt_top_of_page TYPE slis_t_listheader.

DATA: gs_line TYPE slis_listheader.

DATA: l_h1(60) TYPE c.

DATA: l_h2(60).

DATA: l_h3(60).

DATA: l_h4(60).

l_h1 = 'SABIC SERVICES LIMITED'.

l_h2 = 'PURCHASE DETAILS'.

CLEAR gs_line.

gs_line-typ = 'H'.

gs_line-key = '35'.

gs_line-info = l_h1.

APPEND gs_line TO gt_top_of_page.

CLEAR gs_line.

gs_line-typ = 'H'.

gs_line-key = '20'.

gs_line-info = l_h2.

APPEND gs_line TO gt_top_of_page.

CLEAR gs_line.

ENDFORM. " COMMENT_BUILD

*&---------------------------------------------------------------------*

*& Form CHECK_LAPSE

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM check_lapse.

DATA: l_date LIKE sy-datum.

***-------IF PO REL DATE IS NOT THERE TAKE PO CR DATE-----------****

IF itab-_pddat <= '00000000'.

l_date = itab-aedat. "OR BEDAT (CREATION DATE)

ELSE.

l_date = itab-_pddat.

ENDIF.

***-------LAPSE 1 PO-PR DATE------------------------------------****

IF itab-statu = 'A'.

itab-laps1 = sy-datum - itab-erdat.

ELSEIF itab-statu = 'B'.

itab-laps1 = l_date - itab-erdat.

ELSEIF itab-statu = 'N'.

itab-laps1 = sy-datum - itab-erdat.

ENDIF.

***-------LAPSE 2 GR-PO DATE------------------------------------****

IF itab-grdat <= '00000000'.

l2 = sy-datum.

itab-laps2 = l2 - l_date.

ELSEIF itab-grdat NE '00000000'.

itab-laps2 = itab-grdat - l_date.

ENDIF.

CLEAR l_date.

***-------LAPSE 3 PAYMENT-GR DATE-------------------------------****

IF itab-due_dt2 <= '00000000'. " IF PAYMENT DATE IS NOT THERE

IF itab-grdat = '00000000'. " IF GR DATE IS NOT THERE

l3 = '00000000'.

ELSE.

l3 = sy-datum." DUE DATE EQ TO SY-DATUM

ENDIF.

ELSE.

l3 = itab-due_dt2.

IF itab-grdat = '00000000'.

l3 = '00000000'.

ELSE.

ENDIF.

ENDIF.

itab-laps3 = l3 - itab-grdat.

CLEAR l3.

***-------LAPSE 4 PAYMENT- PR DATE-----------------------------****

IF itab-due_dt2 <= '00000000'. " IF PAYMENT DATE IS NOT THERE

IF itab-erdat = '00000000'. " IF PR DATE IS NOT THERE

l3 = '00000000'.

ELSE.

l3 = sy-datum." DUE DATE EQ TO SY-DATUM

ENDIF.

ELSE.

l3 = itab-due_dt2.

IF itab-erdat = '00000000'.

l3 = '00000000'.

ELSE.

ENDIF.

ENDIF.

itab-laps4 = l3 - itab-erdat. "itab-frgdt.

CLEAR : l3 , l2.

*****changed by durraiz*********************"DS1K949567

ENDFORM. " CHECK_LAPSE

  • No labels

1 Comment

  1. Guest

    Hi Aveek,

    thanks for sharing with us your code. Could you please add some information on the custom elements such as zpoview and zpoprview.

    Thanks in advance

    Best regards

    Torsten

    *zpoview, "Purchase Order View
    *zpoprview,