Você está na página 1de 37

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

*
*& Report ZMM_PCR
*&
*&---------------------------------------------------------------------
*
*&
*&
*&---------------------------------------------------------------------
*

REPORT zmm_pcr NO STANDARD PAGE HEADING LINE-SIZE 76


LINE-COUNT 68.
*&
*&---------------------------------------------------------------------
*
*& TITLE...... Price Comparision Report.
* AUTHOR........ SOMA DEY
* FUNCTIONAL....
* CHANGES MADE ..
* DATE WRITTEN.. 10-MAY 2008.
* RELEASE 6.0
* USED BY....... < user or usergroups >
* RUN MODE.....(WHETHER THE REPORT WILL BE RUN IN BATCH OR ON-LINE.)
* PROGRAM TYPE.. EXECUTABLE PROGRAM
* DEV.CLASS..... ZMM
* LOGICAL DB...
* CHANGE HISTORY
*REQUEST NO DPDK900292
*&
*&---------------------------------------------------------------------
*

*&---------------------------------------------------------------------
*
*& Tables Declaration
*&---------------------------------------------------------------------
*
TABLES : ekko, " Purchasing Document Header
ekpo, " Purchasing Document Item
eket, " Scheduling Agreement Schedule Lines
eban, " Purchase Requisition
a016, " Contract Item
konp, " Conditions (Item)
lfa1, " Vendor Master (General Section)
zmmsignature. " designation selection for signature
*&---------------------------------------------------------------------
*
*& Global Data and Internal Tables Declaration
*&---------------------------------------------------------------------
*
*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<
DATA: banfn LIKE eket-banfn,
l_netpr LIKE ekpo-netpr,
sl(4),
l_lifnr(10),
indicator(10),
slno(4),
l_menge(13),
l_rfq LIKE thead-tdname,
slno1(4),
strln(3),
strln1(3),
p_rfq LIKE thead-tdname,
flag(1),
flag1(1),
flag2(1),
l_verpr(15),
netpr LIKE ekpo-netpr,
ktmng LIKE ekpo-ktmng,
tax(32),
kbetr(11),
p_matnr LIKE thead-tdname,
flg(1),
flg1(1),
flg2(1).

DATA: fm_name TYPE rs38l_fnam.


DATA : char28 LIKE thead-tdname.
DATA : item LIKE stxh-tdname,
name LIKE thead-tdname,
name1 LIKE thead-tdname,
l_banfn LIKE thead-tdname,
balance LIKE ekpo-netpr.
*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<
DATA: tlines1 LIKE TABLE OF tline WITH HEADER LINE.
DATA: tlines2 LIKE TABLE OF tline WITH HEADER LINE.
DATA: tlines3 LIKE TABLE OF tline WITH HEADER LINE.
DATA: tlines4 LIKE TABLE OF tline WITH HEADER LINE.
DATA: tlines5 LIKE TABLE OF tline WITH HEADER LINE.
DATA: tlines6 LIKE TABLE OF tline WITH HEADER LINE.
DATA: tlines7 LIKE TABLE OF tline WITH HEADER LINE.
DATA: tlines8 LIKE TABLE OF tline WITH HEADER LINE.
DATA: BEGIN OF t_ekko OCCURS 0,
ebeln LIKE ekko-ebeln,
submi LIKE ekko-submi,
lifnr LIKE ekko-lifnr,
name1 LIKE lfa1-name1,
aedat LIKE ekko-aedat,
angdt LIKE ekko-angdt,
kdatb LIKE ekko-kdatb,
kdate LIKE ekko-kdate,
unsez LIKE ekko-unsez,
bedat LIKE ekko-bedat,
END OF t_ekko.

DATA: BEGIN OF t_eket OCCURS 0,


ebeln LIKE eket-ebeln,
ebelp LIKE eket-ebelp,
banfn LIKE eket-banfn,
bnfpo LIKE eket-bnfpo,
menge LIKE eket-menge,
lifnr LIKE ekko-lifnr,
submi LIKE ekko-submi,
* submi LIKE ekko-submi,
* lifnr LIKE ekko-lifnr,
name1 LIKE lfa1-name1,
aedat LIKE ekko-aedat,
matnr LIKE eban-matnr,
txz01 LIKE eban-txz01,
afnam LIKE eban-afnam,
werks LIKE eban-werks,
preis LIKE eban-preis,
bednr LIKE eban-bednr,
budget_amount LIKE zmmbudget-budget_amount,
netwr LIKE ekpo-netwr,
netpr LIKE ekpo-netpr,
angdt LIKE ekko-angdt,
total LIKE konv-kbetr,
kdatb LIKE ekko-kdatb,
kdate LIKE ekko-kdate,
verpr LIKE mbew-verpr,
badat LIKE eban-badat,
bedat LIKE ekko-bedat,
lmaktx1 LIKE zmakt-lmaktx1,
unsez LIKE ekko-unsez,
END OF t_eket.

DATA : t_eket1 LIKE t_eket OCCURS 0 WITH HEADER LINE,


t_final LIKE t_eket OCCURS 0 WITH HEADER LINE.

*DATA: BEGIN OF t_eket1 OCCURS 0,


* ebeln LIKE eket-ebeln,
* ebelp LIKE eket-ebelp,
* banfn LIKE eket-banfn,
* bnfpo LIKE eket-bnfpo,
* menge LIKE eket-menge,
* lifnr LIKE ekko-lifnr,
* submi LIKE ekko-submi,
** submi LIKE ekko-submi,
** lifnr LIKE ekko-lifnr,
* name1 LIKE lfa1-name1,
* aedat LIKE ekko-aedat,
* matnr LIKE eban-matnr,
* txz01 LIKE eban-txz01,
* afnam LIKE eban-afnam,
* werks LIKE eban-werks,
* preis LIKE eban-preis,
* bednr LIKE eban-bednr,
* budget_amount LIKE zmmbudget-budget_amount,
* netwr LIKE ekpo-netwr,
* netpr LIKE ekpo-netpr,
* angdt LIKE ekko-angdt,
* total LIKE konv-kbetr,
* kdatb LIKE ekko-kdatb,
* kdate LIKE ekko-kdate,
* verpr like mbew-verpr,
* END OF t_eket1.
*
*DATA: BEGIN OF t_final OCCURS 0,
* ebeln LIKE eket-ebeln,
* ebelp LIKE eket-ebelp,
* banfn LIKE eket-banfn,
* bnfpo LIKE eket-bnfpo,
* menge LIKE eket-menge,
* lifnr LIKE ekko-lifnr,
* submi LIKE ekko-submi,
** submi LIKE ekko-submi,
** lifnr LIKE ekko-lifnr,
* name1 LIKE lfa1-name1,
* aedat LIKE ekko-aedat,
* matnr LIKE eban-matnr,
* txz01 LIKE eban-txz01,
* afnam LIKE eban-afnam,
* werks LIKE eban-werks,
* preis LIKE eban-preis,
* bednr LIKE eban-bednr,
* budget_amount LIKE zmmbudget-budget_amount,
* netwr LIKE ekpo-netwr,
* netpr LIKE ekpo-netpr,
* angdt LIKE ekko-angdt,
* total LIKE konv-kbetr,
* kdatb LIKE ekko-kdatb,
* kdate LIKE ekko-kdate,
* verpr like mbew-verpr,
* END OF t_final.

DATA: BEGIN OF t_eban OCCURS 0,


banfn LIKE eban-banfn,
bnfpo LIKE eban-bnfpo,
matnr LIKE eban-matnr,
txz01 LIKE eban-txz01,
afnam LIKE eban-afnam,
werks LIKE eban-werks,
preis LIKE eban-preis,
bednr LIKE eban-bednr,
badat LIKE eban-badat,
budget_amount LIKE zmmbudget-budget_amount,
netwr LIKE ekpo-netwr,
netpr LIKE ekpo-netpr,
verpr LIKE mbew-verpr,
lmaktx1 LIKE zmakt-lmaktx1,
bsart LIKE eban-bsart,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
END OF t_eban.

*DATA: BEGIN OF t_a016 OCCURS 0,


* evrtn LIKE a016-evrtn,
* knumh LIKE a016-knumh,
* END OF t_a016.
*
*DATA: BEGIN OF t_konp OCCURS 0,
* knumh LIKE konp-knumh,
* kschl LIKE konp-kschl,
* kbetr LIKE konp-kbetr,
* END OF t_konp.

DATA: BEGIN OF t_ekko1 OCCURS 0,


bednr LIKE eban-bednr,
ebeln LIKE ekko-ebeln,
ebelp LIKE ekpo-ebelp,
netpr LIKE ekpo-netpr,
badat LIKE eban-badat,
END OF t_ekko1.

DATA: BEGIN OF t_ekpo OCCURS 0,


bednr LIKE eban-bednr,
ebeln LIKE ekko-ebeln,
ebelp LIKE ekpo-ebelp,
netpr LIKE ekpo-netpr,
badat LIKE eban-badat,
END OF t_ekpo.
DATA: BEGIN OF t_a016 OCCURS 0,
evrtn LIKE a016-evrtn,
knumh LIKE a016-knumh,
evrtp LIKE a016-evrtp,
END OF t_a016.

DATA : BEGIN OF t_konp OCCURS 0,


knumh LIKE konp-knumh,
kopos LIKE konp-kopos,
kbetr LIKE konp-kbetr,
kschl LIKE konp-kschl,
ebeln LIKE ekko-ebeln,
ebelp LIKE ekpo-ebelp,
matnr LIKE eban-matnr,
bnfpo LIKE eban-bnfpo,
vtext LIKE t685t-vtext,
lifnr LIKE ekko-lifnr,
END OF t_konp.

DATA: BEGIN OF t_sign OCCURS 0,


designation LIKE zmmsignature-designation,
chkbx(1),

END OF t_sign.
*******************************************************************
* SELECTION SCREEN

PARAMETERS: submi LIKE ekko-submi OBLIGATORY.


SELECT-OPTIONS: ebeln FOR ekko-ebeln,
matnr FOR eban-matnr,
lifnr FOR lfa1-lifnr..
***********************************************************************
**

START-OF-SELECTION.

PERFORM get_signature.
PERFORM get_data.
PERFORM display_sign.

*&*******************************************************************&
*& End Of Selection *&
*&*******************************************************************&

END-OF-SELECTION.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'SELECT'.
PERFORM check.
PERFORM display_data.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
EXIT.
ENDCASE.
*&---------------------------------------------------------------------
*
*& Form get_data
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------
*

FORM get_data .
SELECT ebeln submi lifnr aedat angdt kdatb kdate bsart unsez bedat
FROM ekko
INTO CORRESPONDING FIELDS OF TABLE t_ekko
WHERE submi = submi
AND ebeln IN ebeln
AND lifnr IN lifnr
AND bsart = 'AN'.

IF sy-subrc <> 0.
MESSAGE e999(zmm) WITH text-003.
ENDIF.

LOOP AT t_ekko.
SELECT SINGLE name1 FROM lfa1
INTO t_ekko-name1
WHERE lifnr = t_ekko-lifnr.
MODIFY t_ekko TRANSPORTING name1.
ENDLOOP.

LOOP AT t_ekko.
SELECT ebeln ebelp banfn bnfpo menge
FROM eket
APPENDING CORRESPONDING FIELDS OF TABLE t_eket
WHERE ebeln = t_ekko-ebeln.
ENDLOOP.

LOOP AT t_eket.
CLEAR netpr.
CLEAR ktmng.

SELECT SINGLE netpr ktmng FROM ekpo INTO (netpr, ktmng)


WHERE ebeln = t_eket-ebeln
AND ebelp = t_eket-ebelp.
t_eket-netwr = netpr * ktmng.
MODIFY t_eket TRANSPORTING netwr.

LOOP AT t_ekko WHERE ebeln = t_eket-ebeln.


MOVE-CORRESPONDING t_ekko TO t_eket.
MODIFY t_eket TRANSPORTING submi lifnr name1 aedat angdt kdatb
kdate unsez bedat.
ENDLOOP.
ENDLOOP.

LOOP AT t_eket.
* SELECT banfn bnfpo matnr txz01 afnam werks preis bednr badat
* FROM eban
* APPENDING CORRESPONDING FIELDS OF TABLE t_eban
* WHERE banfn = t_eket-banfn
* AND bnfpo = t_eket-bnfpo.

SELECT banfn bnfpo matnr txz01 afnam werks bednr ebeln ebelp
FROM ekpo
APPENDING CORRESPONDING FIELDS OF TABLE t_eban
WHERE ebeln = t_eket-ebeln
AND ebelp = t_eket-ebelp.
* and matnr in matnr.

ENDLOOP.

LOOP AT t_eban.
SELECT ebeln ebelp bednr badat FROM eban
APPENDING CORRESPONDING FIELDS OF TABLE t_ekko1
WHERE bednr = t_eban-bednr.

SELECT SINGLE verpr


FROM mbew
INTO t_eban-verpr
WHERE matnr = t_eban-matnr.
MODIFY t_eban TRANSPORTING verpr.

SELECT SINGLE lmaktx1 FROM zmakt


INTO t_eban-lmaktx1
WHERE matnr = t_eban-matnr.
MODIFY t_eban TRANSPORTING lmaktx1.
ENDLOOP.

LOOP AT t_ekko1.
SELECT SINGLE netpr FROM ekpo
INTO t_ekko1-netpr
WHERE ebeln = t_ekko1-ebeln
AND ebelp = t_ekko1-ebelp.
MODIFY t_ekko1 TRANSPORTING netpr.
ENDLOOP.

LOOP AT t_eban.
LOOP AT t_ekko1 WHERE bednr = t_eban-bednr.
l_netpr = l_netpr + t_ekko1-netpr.

ENDLOOP.
t_eban-netpr = l_netpr.
MODIFY t_eban TRANSPORTING netpr.
CLEAR l_netpr.
ENDLOOP.

LOOP AT t_eban.
SELECT SINGLE budget_amount
FROM zmmbudget
INTO t_eban-budget_amount
WHERE budget_no = t_eban-bednr.
MODIFY t_eban TRANSPORTING budget_amount.
ENDLOOP.

LOOP AT t_eket.
l_banfn = t_eket-banfn.

select single badat from eban


into t_eket-badat
where banfn = t_eket-banfn
and bnfpo = t_eket-bnfpo.
modify t_eket TRANSPORTING badat.

LOOP AT t_eban WHERE ebeln = t_eket-ebeln


AND ebelp = t_eket-ebelp.

MOVE-CORRESPONDING t_eban TO t_eket.


MODIFY t_eket TRANSPORTING matnr txz01 afnam werks bednr budget_
amount netpr verpr lmaktx1 .
ENDLOOP.
ENDLOOP.

LOOP AT t_eket.
SELECT evrtn evrtp knumh FROM a016
APPENDING CORRESPONDING FIELDS OF TABLE t_a016
WHERE evrtn = t_eket-ebeln
AND evrtp = t_eket-ebelp.
ENDLOOP.

LOOP AT t_a016.
SELECT knumh kbetr kschl kopos
FROM konp
APPENDING CORRESPONDING FIELDS OF TABLE t_konp
WHERE knumh = t_a016-knumh
AND kbetr <> 0.

* AND kschl <> 'PRSX'.


ENDLOOP.

DELETE t_konp WHERE kschl = 'P000'


OR kschl = 'P001'
OR kschl = 'PRSX'.

LOOP AT t_konp.
flg2 = 1.
SELECT SINGLE vtext FROM t685t INTO t_konp-vtext
WHERE spras = 'EN'
AND kschl = t_konp-kschl.
MODIFY t_konp TRANSPORTING vtext.

LOOP AT t_a016 WHERE knumh = t_konp-knumh.


t_konp-ebeln = t_a016-evrtn.
t_konp-ebelp = t_a016-evrtp.

ENDLOOP.
MODIFY t_konp TRANSPORTING ebeln ebelp.
ENDLOOP.

* LOOP AT t_konp.
* SELECT SINGLE vtext
* FROM t685t
* INTO t_konp-vtext
* WHERE kschl = t_konp-kschl.
* MODIFY t_konp TRANSPORTING vtext.
* ENDLOOP.

LOOP AT t_eket.
LOOP AT t_konp WHERE ebeln = t_eket-ebeln
AND ebelp = t_eket-ebelp.
t_konp-matnr = t_eket-matnr.
t_konp-bnfpo = t_eket-bnfpo.
t_konp-lifnr = t_eket-lifnr.
MODIFY t_konp TRANSPORTING matnr bnfpo lifnr.
ENDLOOP.
ENDLOOP.

LOOP AT t_eket.
LOOP AT t_konp WHERE ebeln = t_eket-ebeln
AND ebelp = t_eket-ebelp.

t_eket-total = t_eket-total + t_konp-kbetr.

ENDLOOP.
MODIFY t_eket TRANSPORTING total.
ENDLOOP.
IF matnr-low <> ''.
LOOP AT t_eket WHERE matnr IN matnr.
MOVE-CORRESPONDING t_eket TO t_eket1.
APPEND t_eket1.
ENDLOOP.

ELSE.
t_eket1[] = t_eket[].

*delete t_eket where matnr <> matnr.


ENDIF.

t_final[] = t_eket1[].
* t_final[] = t_eket[].

* SORT t_eket1 ASCENDING BY banfn bnfpo.


* SORT t_final ASCENDING BY banfn bnfpo.
*

ENDFORM. " get_data


*&---------------------------------------------------------------------
*
*& Form display_data
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------
*
FORM display_data .

**********************************************
* PF STATUS

SET PF-STATUS 'ZMENU'.

**********************************************

**********************************************
* HEADING
**********************************************
WRITE: /60 sy-pagno.

WRITE: /30 'DPSC LIMITED' .


ULINE : /28(20).
SKIP.
WRITE: /25 'Purchase Committee Report'.
ULINE : /23(35).
SKIP.
WRITE : /4 'PCR NO.',
14 t_ekko-unsez,
60 sy-datum.
SKIP 2.

***change
PERFORM read_purpose.
WRITE: /4 'Purpose & Necessity: ' INTENSIFIED OFF .
ULINE : /4(20).

LOOP AT tlines5.

WRITE: /4 tlines5-tdline.

ENDLOOP.
***change
SKIP 2.

* FORMAT COLOR = 4.
WRITE: /2 'ENQUIRY NO' INTENSIFIED OFF ,
20 t_eket-submi,
32 'DATE' INTENSIFIED OFF ,
40 t_eket-bedat,
52 'DUE DATE' INTENSIFIED OFF ,
66 t_eket-angdt.
* 66 t_eket-kdate.

WRITE: /2 'REFERENCE INDENT NO :' INTENSIFIED OFF ,


25 t_eket-banfn,
40 'INDENT DATE ' INTENSIFIED OFF ,
55 t_eket-badat.

SKIP 2.

WRITE: /2 'ENQUIRY SENT INFORMATION'.

ULINE:/2(75).
*format color = 6.

WRITE: /2 sy-vline,
3 'SL',
6 sy-vline,
7 'VENDOR',
25 sy-vline,
26 'VENDOR CODE',
38 sy-vline,
39 'RFQ NUMBER',
50 sy-vline,
51 'Reg/One time',
64 sy-vline,
65 'RFQ DATE',
76 sy-vline.

WRITE: /2 sy-vline,
3 '',
6 sy-vline,
7 '',
25 sy-vline,
26 '',
38 sy-vline,
39 '',
50 sy-vline,
51 'Vendor',
64 sy-vline,
65 '',
76 sy-vline.
*format color off.
ULINE : /2(75).
SORT t_eket1 ASCENDING BY ebeln ebelp.

LOOP AT t_eket1.
ON CHANGE OF t_eket1-lifnr.
* l_banfn = t_eket1-banfn.
* LOOP AT t_eket.
sl = sl + 1.
l_lifnr = t_eket1-lifnr.
SHIFT l_lifnr LEFT DELETING LEADING 0.
IF l_lifnr+4(1) = 1 OR l_lifnr+4(1) = 2.
indicator = 'REG'.
ELSE .
indicator = 'ONE TIME'.
ENDIF.
WRITE: /2 sy-vline,
3 sl,
6 sy-vline,
7 t_eket1-name1+0(17),
25 sy-vline,
26 t_eket1-lifnr,
38 sy-vline,
39 t_eket1-ebeln,
50 sy-vline,
51 indicator,
64 sy-vline,
65 t_eket1-aedat,
76 sy-vline.

WRITE: /2 sy-vline,
3 '',
6 sy-vline,
7 t_eket1-name1+17(18),
25 sy-vline,
26 '',
38 sy-vline,
39 '',
50 sy-vline,
51 '',
64 sy-vline,
65 '',
76 sy-vline.

ULINE : /2(75).

ENDON.
ENDLOOP.

* SKIP .
*
* PERFORM read_purpose.
* WRITE: /4 'Purpose & Necessity:'.
* ULINE : /2(22).
*
* LOOP AT tlines5.
*
* WRITE: /4 tlines5-tdline.
*
* ENDLOOP.
SKIP 2.

*************************************************
* ITEM WISE ANALYSIS
**************************************************

WRITE : /2 'ITEM WISE ANALYSIS'.


ULINE:/2(18).

SORT t_eket1 ASCENDING BY banfn bnfpo.


SORT t_final ASCENDING BY banfn bnfpo.

LOOP AT t_eket1.
IF sy-linno GE '60'.
NEW-PAGE.
WRITE :/60 sy-pagno.

ENDIF.

* LOOP AT t_eket.
ON CHANGE OF t_eket1-matnr OR t_eket1-bnfpo.
CONCATENATE t_eket1-banfn t_eket1-bnfpo INTO name.
ULINE:/2(79).

WRITE: /2 sy-vline,
3 'MATERIAL NO' ,
11 sy-vline,
12 t_eket1-matnr,
32 sy-vline,
33 'Reqsnr' ,
43 sy-vline,
44 t_eket1-afnam,
60 sy-vline,
61 'Plant' ,
68 sy-vline,
69 t_eket1-werks,
76 sy-vline.
ULINE:/2(79).
PERFORM material.

* WRITE: /2 sy-vline,
* 3 'Material' ,
* 11 sy-vline,
* 12 t_eket1-txz01+0(20),
* 32 sy-vline,
* 33 'Item Code' ,
* 43 sy-vline,
* 44 t_eket1-matnr,
* 60 sy-vline,
* 61 'Reqsnr' ,
* 68 sy-vline,
* 69 t_eket1-afnam,
* 76 sy-vline.
LOOP AT tlines8.

WRITE: /2 sy-vline,
3 tlines8-tdline+0(73) ,

76 sy-vline.

WRITE: /2 sy-vline,
3 tlines8-tdline+73(59) ,

76 sy-vline.

ENDLOOP.

ULINE:/2(79).

WRITE: /2 sy-vline,
76 sy-vline.

ULINE:/2(79).
l_menge = t_eket1-menge.
SHIFT l_menge LEFT DELETING LEADING space.
WRITE: /2 sy-vline,
3 'QTY' ,
7 sy-vline,
8 l_menge,
16 sy-vline,
* 15 'QTY' ,
* 19 sy-vline,
* 20 l_menge,
* 28 sy-vline,
*****change 22.07.08
17 'Current MOV Price' ,
36 sy-vline.
* 47 t_eket1-preis.
IF t_eket1-verpr <> 1.
l_verpr = t_eket1-verpr.
SHIFT l_verpr LEFT DELETING LEADING space.
WRITE : 37 l_verpr.
ELSE.
l_verpr = 0.
SHIFT l_verpr LEFT DELETING LEADING space.
WRITE: 37 l_verpr.
ENDIF.
WRITE: 52 sy-vline,
53 'Budget CD' ,
63 sy-vline,
64 t_eket1-bednr,
76 sy-vline.

ULINE:/2(79).

WRITE: /2 sy-vline,
76 sy-vline.

ULINE:/2(79).

WRITE: /2 sy-vline,
3 'Budget Allocation' ,
21 sy-vline,
22 t_eket1-budget_amount,
38 sy-vline,
*****change 22.07.08
39 'Committed Amount' ,
58 sy-vline,
59 t_eket1-netpr,
76 sy-vline.

ULINE:/2(79).

WRITE: /2 sy-vline,
76 sy-vline.

ULINE:/2(79).
balance = t_eket1-budget_amount - t_eket1-netpr.
WRITE: /2 sy-vline,
3 'Available Amt.',
20 sy-vline,
21 balance,
76 sy-vline..

********************************************************
* RESERVE 1 LINES.
* WRITE: /2 sy-vline,
* 3 'Purpose' COLOR 3,
* 11 sy-vline,
* 80 sy-vline.
*
* CALL FUNCTION 'READ_TEXT'
* EXPORTING
* client = sy-mandt
* id = 'B01'
* language = 'E'
* name = name
* object = 'EBAN'
** ARCHIVE_HANDLE = 0
** LOCAL_CAT = ' '
** IMPORTING
** HEADER =
* TABLES
* lines = tlines1
* EXCEPTIONS
* id = 1
* language = 2
* name = 3
* not_found = 4
* object = 5
* reference_check = 6
* wrong_access_to_archive = 7
* OTHERS = 8
* .
* IF sy-subrc <> 0.
* flag2 = 1.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
* IF flag2 <> 1.
*
* BACK.
* LOOP AT tlines1.
*
* WRITE: /2 sy-vline,
*
* 11 sy-vline,
* 12 tlines1-tdline,
* 80 sy-vline.
* ENDLOOP.
* ENDIF.
*******************************************
ULINE:/2(79).

* WRITE: /2 sy-vline,
* 76 sy-vline.
*
* ULINE:/2(79).
SKIP 2.
********change

IF sy-linno < '54'.


WRITE: /30 'Offer Received From'.
SKIP.

ULINE:/2(79).
* format color = 6.

WRITE:/2 sy-vline,
3 'SL',
5 sy-vline,
6 'Vendor',
28 sy-vline,
29 'Price',
45 sy-vline,
46 'Remark/Comments',
76 sy-vline.
ULINE:/2(79).
ENDIF.
* format color off..

* SKIP 2.
* RESERVE 1 LINES.
LOOP AT t_final WHERE matnr = t_eket1-matnr AND bnfpo = t_eket1-
bnfpo.

IF sy-linno GE '54'.

NEW-PAGE.

WRITE :/60 sy-pagno.


SKIP .
WRITE: /30 'Offer Received From'.
SKIP 2.
ULINE:/2(79).
WRITE:/2 sy-vline,
3 'SL',
5 sy-vline,
6 'Vendor',
28 sy-vline,
29 'Price',
45 sy-vline,
46 'Remark/Comments',
76 sy-vline.
ULINE:/2(79).
ENDIF.

slno = slno + 1.
SHIFT slno LEFT DELETING LEADING space.
CONCATENATE t_final-ebeln t_final-bnfpo INTO name1.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'A04'
language = 'E'
name = name1
object = 'EKPO'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = tlines2
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
flag = 1.
ENDIF.

**

WRITE:/2 sy-vline,
3 slno,
5 sy-vline,
6 t_final-lifnr ,13 '-',14 t_final-name1+0(14),
28 sy-vline,
29 t_final-netwr,
* 29 t_final-total,
45 sy-vline,
46 '',
76 sy-vline.

RESERVE 1 LINES.

WRITE:/2 sy-vline,
3 '',
5 sy-vline,
6 t_final-name1+14(21),
28 sy-vline,
29 '',
45 sy-vline.
* 46 '',
* 80 sy-vline.

*
WRITE: 46 '',
76 sy-vline.

IF flag <> 1.
BACK.

LOOP AT tlines2.
strln1 = STRLEN( tlines2-tdline ).
WRITE: /2 sy-vline,

5 sy-vline,

28 sy-vline,

45 sy-vline,
46 tlines2-tdline+0(30),
76 sy-vline.
IF strln1 > 30.

WRITE: /2 sy-vline,

5 sy-vline,

28 sy-vline,

45 sy-vline,
46 tlines2-tdline+30(30),
76 sy-vline.
ENDIF.
IF strln1 > 60.

WRITE: /2 sy-vline,

5 sy-vline,

28 sy-vline,

45 sy-vline,
46 tlines2-tdline+60(30),
76 sy-vline.

ENDIF.
IF strln1 > 90.

WRITE: /2 sy-vline,

5 sy-vline,

28 sy-vline,

45 sy-vline,
46 tlines2-tdline+90(30),
76 sy-vline.

ENDIF.

IF strln1 > 120.

WRITE: /2 sy-vline,
5 sy-vline,

28 sy-vline,

45 sy-vline,
46 tlines2-tdline+120(12),
76 sy-vline.

ENDIF.

ENDLOOP.

ENDIF.
CLEAR flag.

ULINE:/2(79).

ENDLOOP.
CLEAR slno.
****************************************************soma dey 10/09/08
SKIP.

IF sy-linno GE '60'.
NEW-PAGE.
WRITE :/60 sy-pagno.
SKIP.
ULINE: /2(79).
ENDIF.

WRITE: /30 'Terms & Condition.' .


ULINE:/28(24).
SKIP .

ULINE:/2(79).
WRITE : /2 sy-vline,
3 'Name of vendor',
17 sy-vline,
18 ' Payment Terms',
38 sy-vline,
39 ' Delivery',
59 sy-vline,
60 'Prices and Taxes ',
76 sy-vline.

ULINE:/2(79).

LOOP AT t_final WHERE matnr = t_eket1-matnr AND bnfpo = t_eket1-


bnfpo.

IF sy-linno GE '60'.
NEW-PAGE.
WRITE :/60 sy-pagno.
SKIP.
ULINE: /2(79).
ENDIF.
PERFORM pay_terms.
PERFORM delivery.

CLEAR strln1.
strln1 = STRLEN( t_final-name1 ).

RESERVE 1 LINES.

WRITE: /2 sy-vline,
3 t_final-name1(14),
17 sy-vline,
38 sy-vline,
59 sy-vline,
76 sy-vline.

IF strln1 > 14.


RESERVE 1 LINES.
WRITE: /2 sy-vline,
3 t_final-name1+14(14),
17 sy-vline,
38 sy-vline,
59 sy-vline,
76 sy-vline.
ENDIF.

IF strln1 > 28.


RESERVE 1 LINES.
WRITE: /2 sy-vline,
3 t_final-name1+28(7),
17 sy-vline,
38 sy-vline,
59 sy-vline,
76 sy-vline.
ENDIF.

IF flg <> 1.
BACK.
LOOP AT tlines6.

* IF sy-linno GE '60'.
* NEW-PAGE.
* WRITE :/60 sy-pagno.
* SKIP.
* ULINE: /2(79).
* ENDIF.

CLEAR strln1.
strln1 = STRLEN( tlines6-tdline ).
RESERVE 1 LINES.
WRITE: /2 sy-vline,

17 sy-vline,
18 tlines6-tdline+0(20),
38 sy-vline,
59 sy-vline,
76 sy-vline.
IF strln1 > 20.

RESERVE 1 LINES.
WRITE: /2 sy-vline,

17 sy-vline,
18 tlines6-tdline+20(20),
38 sy-vline,
59 sy-vline,
76 sy-vline.
ENDIF.
IF strln1 > 40.
RESERVE 1 LINES.
WRITE: /2 sy-vline,

17 sy-vline,
18 tlines6-tdline+40(20),
38 sy-vline,
59 sy-vline,
76 sy-vline.

ENDIF.
IF strln1 > 60.
RESERVE 1 LINES.
WRITE: /2 sy-vline,

17 sy-vline,
18 tlines6-tdline+60(20),
38 sy-vline,
59 sy-vline,
76 sy-vline.

ENDIF.

IF strln1 > 80.


RESERVE 1 LINES.
WRITE: /2 sy-vline,

17 sy-vline,
18 tlines6-tdline+80(20),
38 sy-vline,
59 sy-vline,
76 sy-vline.

ENDIF.

IF strln1 > 100.


RESERVE 1 LINES.
WRITE: /2 sy-vline,

17 sy-vline,
18 tlines6-tdline+100(20),
38 sy-vline,
59 sy-vline,
76 sy-vline.
ENDIF.

IF strln1 > 120.


RESERVE 1 LINES.
WRITE: /2 sy-vline,

17 sy-vline,
18 tlines6-tdline+120(12),
38 sy-vline,
59 sy-vline,
76 sy-vline.

ENDIF.
ENDLOOP.
ENDIF.

IF flg1 <> 1.
BACK.
LOOP AT tlines7.

* IF sy-linno GE '60'.
* NEW-PAGE.
* WRITE :/60 sy-pagno.
* SKIP.
* ULINE: /2(79).
* ENDIF.

CLEAR strln1.
strln1 = STRLEN( tlines7-tdline ).
RESERVE 1 LINES.
WRITE: /2 sy-vline,

17 sy-vline,

38 sy-vline,
39 tlines7-tdline+0(20),
59 sy-vline,
76 sy-vline.
IF strln1 > 20.
RESERVE 1 LINES.

WRITE: /2 sy-vline,

17 sy-vline,

38 sy-vline,
39 tlines7-tdline+20(20),
59 sy-vline,
76 sy-vline.
ENDIF.
IF strln1 > 40.
RESERVE 1 LINES.
WRITE: /2 sy-vline,
17 sy-vline,

38 sy-vline,
39 tlines7-tdline+40(20),
59 sy-vline,
76 sy-vline.

ENDIF.
IF strln1 > 60.
RESERVE 1 LINES.
WRITE: /2 sy-vline,

17 sy-vline,

38 sy-vline,
39 tlines7-tdline+60(20),
59 sy-vline,
76 sy-vline.

ENDIF.

IF strln1 > 80.


RESERVE 1 LINES.
WRITE: /2 sy-vline,

17 sy-vline,

38 sy-vline,
39 tlines7-tdline+80(20),
59 sy-vline,
76 sy-vline.

ENDIF.

IF strln1 > 100.


RESERVE 1 LINES.
WRITE: /2 sy-vline,

17 sy-vline,

38 sy-vline,
39 tlines7-tdline+100(20),
59 sy-vline,
76 sy-vline.
ENDIF.

IF strln1 > 120.


RESERVE 1 LINES.
WRITE: /2 sy-vline,

17 sy-vline,

38 sy-vline,
39 tlines7-tdline+120(12),
59 sy-vline,
76 sy-vline.
ENDIF.
ENDLOOP.
ENDIF.

IF flg2 = 1.
BACK.

LOOP AT t_konp WHERE lifnr = t_final-lifnr


AND matnr = t_final-matnr
AND bnfpo = t_final-bnfpo.
kbetr = t_konp-kbetr / 10.
SHIFT kbetr LEFT DELETING LEADING space.
CONCATENATE t_konp-vtext '@' kbetr '%' INTO tax.
CLEAR strln1.
strln1 = STRLEN( tax ).
WRITE: /2 sy-vline,
17 sy-vline,
38 sy-vline,
59 sy-vline,
60 tax(16) ,
76 sy-vline.
IF strln1 > 16.

WRITE: /2 sy-vline,
17 sy-vline,
38 sy-vline,
59 sy-vline,
60 tax+16(9) ,
76 sy-vline.
ENDIF.

ENDLOOP.
ENDIF.

ULINE:/2(79).
ENDLOOP.

ENDON.
SKIP .
ENDLOOP.
ULINE:/2(79).
SKIP 2.

*******change

***********************************************************************
* END OF ITEM WISE ANALYSIS
***********************************************************************
*

* SKIP 2.

***********************************************************************
*********
* OVER ALL TECHNO COMMERCIAL DEVIATION
***********************************************************************
*******

* WRITE: /15 'OVER ALL TECHNO COMMERCIAL DEVIATIONS WRT TO VENDOR' .


* SKIP.
* ULINE: /2(79).
* WRITE : /2 sy-vline,
* 3 'SL' ,
* 5 sy-vline,
* 6 'VENDOR' ,
* 28 sy-vline,
* 29 'DEVIATION' ,
* 76 sy-vline.
* SORT t_eket1 BY ebeln ebelp.
*
*
* LOOP AT t_eket1.
*
* IF sy-linno GE '60'.
* NEW-PAGE.
* WRITE :/60 sy-pagno.
* SKIP.
* ULINE: /2(79).
* WRITE : /2 sy-vline,
* 3 'SL' ,
* 5 sy-vline,
* 6 'VENDOR' ,
* 28 sy-vline,
* 29 'DEVIATION' ,
* 76 sy-vline.
* ENDIF.
*
* ULINE: /2(79).
* slno1 = slno1 + 1.
* SHIFT slno1 LEFT DELETING LEADING space.
*
*
* WRITE : /2 sy-vline,
* 3 slno1 ,
* 5 sy-vline,
* 6 t_eket1-lifnr , 13 '-', 14 t_eket1-name1+0(14),
* 28 sy-vline,
* 29 '' ,
* 76 sy-vline.
*
* RESERVE 1 LINES.
*
* WRITE : /2 sy-vline,
* 3 '' ,
* 5 sy-vline,
* 6 t_eket1-name1+14(21),
* 28 sy-vline,
* 29 '' ,
* 76 sy-vline.
*
*
*
*
*
*
* l_rfq = t_eket1-ebeln.
*
*
* CALL FUNCTION 'READ_TEXT'
* EXPORTING
* client = sy-mandt
* id = 'A03'
* language = 'E'
* name = l_rfq
* object = 'EKKO'
** ARCHIVE_HANDLE = 0
** LOCAL_CAT = ' '
** IMPORTING
** HEADER =
* TABLES
* lines = tlines3
* EXCEPTIONS
* id = 1
* language = 2
* name = 3
* not_found = 4
* object = 5
* reference_check = 6
* wrong_access_to_archive = 7
* OTHERS = 8
* .
* IF sy-subrc <> 0.
* flag1 = 1.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
*
* IF flag1 <> 1.
* BACK.
* LOOP AT tlines3.
* strln = STRLEN( tlines3-tdline ).
* WRITE : /2 sy-vline ,
*
* 5 sy-vline,
*
* 28 sy-vline,
* 29 tlines3-tdline+0(46),
* 76 sy-vline.
*
* IF strln > '46'.
*
* WRITE : /2 sy-vline ,
* 5 sy-vline,
*
* 28 sy-vline,
* 29 tlines3-tdline+46(46),
* 76 sy-vline.
*
* ENDIF.
*
* IF strln > '92'.
*
*
*
* WRITE : /2 sy-vline ,
* 5 sy-vline,
*
* 28 sy-vline,
* 29 tlines3-tdline+92(40),
* 76 sy-vline.
*
*
* ENDIF.
*
* ENDLOOP.
* ENDIF.
* CLEAR flag1.
* ENDLOOP.
* ULINE : /2(79).
* SKIP .
*******change
IF sy-linno GE '60'.
NEW-PAGE.
WRITE :/60 sy-pagno.
ENDIF.

READ TABLE t_eket1 INDEX 1.


p_rfq = t_eket1-ebeln.

PERFORM get_text USING 'A04'.


WRITE: /2 '1) PCR OBSERVATION :' .
LOOP AT tlines4.
WRITE:/2 tlines4-tdline.
ENDLOOP.
SKIP .
PERFORM get_text USING 'A05'.
WRITE: /2 '2) Negotitation Performed :' .
LOOP AT tlines4.
WRITE:/2 tlines4-tdline.
ENDLOOP.
SKIP .
PERFORM get_text USING 'A06'.
WRITE: /2 '3) Recommendation :' .
LOOP AT tlines4.
WRITE:/2 tlines4-tdline.
ENDLOOP.
SKIP 2.
LOOP AT t_sign WHERE chkbx = 'X'.
WRITE: /2 t_sign-designation,
40 '__________________________________________' .
SKIP 2 .
ENDLOOP.
* WRITE : /2 'Chief Engr(T&D and Adm.)____________Addl.Chief Engr(Gene
ration)____________'.
* SKIP .
* WRITE : /2 'Asst.General Manager(Purchase)________________Financial
Controller______________'.

* FORMAT COLOR OFF.


ENDFORM. " display_data
*&---------------------------------------------------------------------
*
*& Form GET_TEXT
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
* -->P_2078 text
*----------------------------------------------------------------------
*
FORM get_text USING value(p_2078).
CLEAR tlines4.
REFRESH tlines4.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = p_2078
language = 'E'
name = p_rfq
object = 'EKKO'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = tlines4
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8
.
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. " GET_TEXT

***********************************************************************
*************
* END OF TECHNO COMMERCIAL DEVIATION
***********************************************************************
*************
*&---------------------------------------------------------------------
*
*& Form read_purpose
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------
*
FORM read_purpose .
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'B02'
language = 'E'
name = l_banfn
object = 'EBANH'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = tlines5
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
.
* 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. " read_purpose


*&---------------------------------------------------------------------
*
*& Form get_signature
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------
*
FORM get_signature .
SELECT designation FROM zmmsignature
APPENDING CORRESPONDING FIELDS OF TABLE t_sign.

ENDFORM. " get_signature


*&---------------------------------------------------------------------
*
*& Form display_sign
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------
*
FORM display_sign .
SET PF-STATUS 'ZMENU1'.
ULINE:/1(45).

WRITE : /1 sy-vline,
4 sy-vline,
5 'DESIGNATION' COLOR 1,
45 sy-vline.

ULINE:/1(45).

LOOP AT t_sign.
WRITE:/1 sy-vline,
2 t_sign-chkbx AS CHECKBOX,
4 sy-vline,
5 t_sign-designation COLOR 3,

45 sy-vline.

ULINE:/1(45).

ENDLOOP.
ENDFORM. " display_sign
*&---------------------------------------------------------------------
*
*& Form check
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------
*
FORM check .
DATA: itab LIKE t_sign OCCURS 0 WITH HEADER LINE,
l_lines(3),
index(2).

* This is for Header values

DESCRIBE TABLE t_sign LINES l_lines.


* INDEX = 2.
index = 4.

DO l_lines TIMES.

READ LINE index FIELD VALUE t_sign-chkbx.


t_sign-chkbx = sy-lisel+1(1).
MODIFY t_sign INDEX sy-index TRANSPORTING chkbx.
* INDEX = INDEX + 1.
index = index + 2.

ENDDO.
ENDFORM. " check
*&---------------------------------------------------------------------
*
*& Form PAY_TERMS
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------
*
FORM pay_terms .
CLEAR p_rfq.
p_rfq = t_final-ebeln.

CLEAR tlines6.
REFRESH tlines6.

CALL FUNCTION 'READ_TEXT'


EXPORTING
client = sy-mandt
id = 'A07'
language = 'E'
name = p_rfq
object = 'EKKO'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = tlines6
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
flg = 1.
ENDIF.
ENDFORM. " PAY_TERMS
*&---------------------------------------------------------------------
*
*& Form DELIVERY
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------
*
FORM delivery .
CLEAR p_rfq.
CLEAR flg.
p_rfq = t_final-ebeln.

CLEAR tlines7.
REFRESH tlines7.

CALL FUNCTION 'READ_TEXT'


EXPORTING
client = sy-mandt
id = 'A14'
language = 'E'
name = p_rfq
object = 'EKKO'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = tlines7
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8
.
IF sy-subrc <> 0.
flg1 = 1.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DELIVERY
*&---------------------------------------------------------------------
*
*& Form MATERIAL
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------
*
FORM material .
REFRESH tlines1.

p_matnr = t_eket1-matnr.

CALL FUNCTION 'READ_TEXT'


EXPORTING
client = sy-mandt
id = 'GRUN'
language = 'E'
name = p_matnr
object = 'MATERIAL'
TABLES
lines = tlines8
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
ENDFORM. " MATERIAL