08-09-2007 6:36 AM
Hi All,
I need the example of Vendor performance report..
If anyone already did it then please send the example of that report..
Note ::: I am not asking for General Examples of reports.
Thanks in advance
Raj
08-09-2007 10:54 AM
REPORT j_1iupdate_venmmast LINE-SIZE 150 MESSAGE-ID 8i.
TABLES: lfa1, lfm1, j_1inewjcode.
*STRUCTURES
DATA: BEGIN OF wa_lfm1,
lifnr LIKE lfm1-lifnr,
ekorg LIKE lfm1-ekorg.
DATA: END OF wa_lfm1.
DATA: BEGIN OF wa_lfa1,
lifnr LIKE lfa1-lifnr,
txjcd LIKE lfa1-txjcd,
adrnr LIKE lfa1-adrnr .
DATA: END OF wa_lfa1.
DATA: BEGIN OF wa_lfb1,
lifnr LIKE lfa1-lifnr,
bukrs LIKE t001-bukrs.
DATA: END OF wa_lfb1.
DATA: it_lfa1 LIKE wa_lfa1 OCCURS 10 WITH HEADER LINE,
it_lfm1 LIKE wa_lfm1 OCCURS 10 WITH HEADER LINE.
DATA jcode LIKE j_1inewjcode-txjcd.
DATA count TYPE i.
DATA: new_lfa1 LIKE wa_lfa1 OCCURS 0 WITH HEADER LINE.
DATA : it_adrc LIKE adrc OCCURS 10 WITH HEADER LINE.
DATA : bukrs LIKE t001-bukrs, porg LIKE t024e-ekorg.
DATA: it_lfb1 LIKE wa_lfb1 OCCURS 10 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
PARAMETERS:
p_bukrs LIKE t001-bukrs OBLIGATORY,
p_ekorg LIKE t024e-ekorg OBLIGATORY MEMORY ID buk.
SELECTION-SCREEN END OF BLOCK block1.
SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: p_lifnr FOR lfm1-lifnr.
SELECTION-SCREEN END OF BLOCK block2.
PARAMETERS: test AS CHECKBOX DEFAULT 'X'.
AT SELECTION-SCREEN ON p_bukrs.
SELECT SINGLE j_1ibukrs FROM j_1iindcus
INTO bukrs
WHERE j_1ibukrs = p_bukrs.
IF sy-subrc <> 0.
MESSAGE e128(8i).
ENDIF.
AT SELECTION-SCREEN ON p_ekorg.
SELECT SINGLE ekorg INTO porg FROM t024e
WHERE ekorg = p_ekorg
AND bukrs = bukrs.
IF sy-subrc NE 0 .
MESSAGE e015(me) WITH p_ekorg space.
ENDIF .
*-------header print.
TOP-OF-PAGE.
NEW-LINE NO-SCROLLING.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE : / ,
05 'Vendor', "#EC NOTEXT
22 'New Jud Code'." 38 'Old Jud code'.
FORMAT COLOR OFF.
NEW-LINE SCROLLING.
START-OF-SELECTION.
Get the dummy Jur Code
SELECT SINGLE txjcd FROM j_1inewjcode
INTO jcode
WHERE aland = 'IN'.
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH 'Jur code not defined in Table J_1INEWJCODE'.
ENDIF.
CHECK for lfB1 if the customer exists for company code
SELECT lifnr bukrs FROM lfb1 INTO TABLE it_lfb1
WHERE
lifnr IN p_lifnr
AND bukrs = p_bukrs.
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH 'No vendors defined for company code'.
ENDIF.
Check if vendor defined for purchasing
SELECT lifnr ekorg FROM lfm1 INTO TABLE it_lfm1
FOR ALL ENTRIES IN it_lfb1[]
WHERE lifnr = it_lfb1-lifnr
AND ekorg = p_ekorg.
Get data from General data of vendor master
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH 'No Vendors defined for purchasing organization '.
ENDIF.
SELECT lifnr txjcd adrnr FROM lfa1 INTO TABLE it_lfa1
FOR ALL ENTRIES IN it_lfm1[]
WHERE lifnr = it_lfm1-lifnr.
SORT it_lfa1 BY txjcd.
DELETE it_lfa1[] WHERE txjcd = space.
SELECT * FROM adrc INTO TABLE it_adrc FOR ALL ENTRIES IN it_lfa1
WHERE addrnumber = it_lfa1-adrnr.
CLEAR count.
LOOP AT it_lfa1.
IF test <> 'X'.
UPDATE lfa1 SET txjcd = jcode
WHERE lifnr = it_lfa1-lifnr.
ENDIF.
count = count + 1.
WRITE : / , 5 it_lfa1-lifnr, 25 jcode.
ENDLOOP.
LOOP AT it_adrc.
IF test <> 'X'.
UPDATE adrc SET taxjurcode = jcode
WHERE addrnumber = it_adrc-addrnumber.
ENDIF.
ENDLOOP.
IF test <> 'X'.
WRITE : / 'The No of Vendor Master updated with new Jur Code is:',
count.
ENDIF.
regards,
srinivas
<b>*reward for useful answers*</b>
08-09-2007 10:52 AM
Hi There,
There is a standard program for vendor performance ....J_1IUPDATE_VENMMAST
Pablo
Reward point if useful
08-09-2007 10:54 AM
REPORT j_1iupdate_venmmast LINE-SIZE 150 MESSAGE-ID 8i.
TABLES: lfa1, lfm1, j_1inewjcode.
*STRUCTURES
DATA: BEGIN OF wa_lfm1,
lifnr LIKE lfm1-lifnr,
ekorg LIKE lfm1-ekorg.
DATA: END OF wa_lfm1.
DATA: BEGIN OF wa_lfa1,
lifnr LIKE lfa1-lifnr,
txjcd LIKE lfa1-txjcd,
adrnr LIKE lfa1-adrnr .
DATA: END OF wa_lfa1.
DATA: BEGIN OF wa_lfb1,
lifnr LIKE lfa1-lifnr,
bukrs LIKE t001-bukrs.
DATA: END OF wa_lfb1.
DATA: it_lfa1 LIKE wa_lfa1 OCCURS 10 WITH HEADER LINE,
it_lfm1 LIKE wa_lfm1 OCCURS 10 WITH HEADER LINE.
DATA jcode LIKE j_1inewjcode-txjcd.
DATA count TYPE i.
DATA: new_lfa1 LIKE wa_lfa1 OCCURS 0 WITH HEADER LINE.
DATA : it_adrc LIKE adrc OCCURS 10 WITH HEADER LINE.
DATA : bukrs LIKE t001-bukrs, porg LIKE t024e-ekorg.
DATA: it_lfb1 LIKE wa_lfb1 OCCURS 10 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
PARAMETERS:
p_bukrs LIKE t001-bukrs OBLIGATORY,
p_ekorg LIKE t024e-ekorg OBLIGATORY MEMORY ID buk.
SELECTION-SCREEN END OF BLOCK block1.
SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: p_lifnr FOR lfm1-lifnr.
SELECTION-SCREEN END OF BLOCK block2.
PARAMETERS: test AS CHECKBOX DEFAULT 'X'.
AT SELECTION-SCREEN ON p_bukrs.
SELECT SINGLE j_1ibukrs FROM j_1iindcus
INTO bukrs
WHERE j_1ibukrs = p_bukrs.
IF sy-subrc <> 0.
MESSAGE e128(8i).
ENDIF.
AT SELECTION-SCREEN ON p_ekorg.
SELECT SINGLE ekorg INTO porg FROM t024e
WHERE ekorg = p_ekorg
AND bukrs = bukrs.
IF sy-subrc NE 0 .
MESSAGE e015(me) WITH p_ekorg space.
ENDIF .
*-------header print.
TOP-OF-PAGE.
NEW-LINE NO-SCROLLING.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE : / ,
05 'Vendor', "#EC NOTEXT
22 'New Jud Code'." 38 'Old Jud code'.
FORMAT COLOR OFF.
NEW-LINE SCROLLING.
START-OF-SELECTION.
Get the dummy Jur Code
SELECT SINGLE txjcd FROM j_1inewjcode
INTO jcode
WHERE aland = 'IN'.
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH 'Jur code not defined in Table J_1INEWJCODE'.
ENDIF.
CHECK for lfB1 if the customer exists for company code
SELECT lifnr bukrs FROM lfb1 INTO TABLE it_lfb1
WHERE
lifnr IN p_lifnr
AND bukrs = p_bukrs.
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH 'No vendors defined for company code'.
ENDIF.
Check if vendor defined for purchasing
SELECT lifnr ekorg FROM lfm1 INTO TABLE it_lfm1
FOR ALL ENTRIES IN it_lfb1[]
WHERE lifnr = it_lfb1-lifnr
AND ekorg = p_ekorg.
Get data from General data of vendor master
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH 'No Vendors defined for purchasing organization '.
ENDIF.
SELECT lifnr txjcd adrnr FROM lfa1 INTO TABLE it_lfa1
FOR ALL ENTRIES IN it_lfm1[]
WHERE lifnr = it_lfm1-lifnr.
SORT it_lfa1 BY txjcd.
DELETE it_lfa1[] WHERE txjcd = space.
SELECT * FROM adrc INTO TABLE it_adrc FOR ALL ENTRIES IN it_lfa1
WHERE addrnumber = it_lfa1-adrnr.
CLEAR count.
LOOP AT it_lfa1.
IF test <> 'X'.
UPDATE lfa1 SET txjcd = jcode
WHERE lifnr = it_lfa1-lifnr.
ENDIF.
count = count + 1.
WRITE : / , 5 it_lfa1-lifnr, 25 jcode.
ENDLOOP.
LOOP AT it_adrc.
IF test <> 'X'.
UPDATE adrc SET taxjurcode = jcode
WHERE addrnumber = it_adrc-addrnumber.
ENDIF.
ENDLOOP.
IF test <> 'X'.
WRITE : / 'The No of Vendor Master updated with new Jur Code is:',
count.
ENDIF.
regards,
srinivas
<b>*reward for useful answers*</b>
08-09-2007 11:08 AM
Hi Raj,,
This may help you.......
see the sample code
&----
*& Report ZRFQ_COMP
*& Quotation Comparison Report
&----
REPORT ZRFQ_COMP no standard page heading line-size 187 line-count 35.
&----
*&Tables
&----
Tables : ekko,
ekpo,
konp,
a016.
&----
*&Data Decleration
&----
Data : v_pos type i value 19.
Data : begin of it_rfq occurs 0,
ebeln type ekko-ebeln,
ekorg type ekko-ekorg,
lifnr type ekko-lifnr,
matnr type ekpo-matnr,
WERKS type ekpo-WERKS,
end of it_rfq.
Data : begin of it_a016 occurs 0,
ebeln type ekko-ebeln,
knumh type knumh,
end of it_a016.
Data : begin of it_a363 occurs 0,
werks type werks,
lifnr type lifnr,
matnr type matnr,
knumh type knumh,
end of it_a363.
Data : begin of it_pr_details occurs 0,
knumh type knumh,
kschl type kschl,
kbetr type kwert,
end of it_pr_details.
Data : begin of it_final occurs 0,
ebeln type ebeln,
lifnr type lifnr,
name1 type lfa1-name1,
pb00 type kbetr,
zpac type kbetr,
zb00 type kbetr,
ZIN1 type kbetr,
JEC1 type kbetr,
JHX1 type kbetr,
JMOP type kbetr,
JMX1 type kbetr,
JMX3 type kbetr,
JSEP TYPE KBETR,
JVRD type kbetr,
end of it_final.
Data : begin of it_vendorname occurs 0,
lifnr type lifnr,
name1 type lfa1-name1,
end of it_vendorname.
&----
*&Selection Screen
&----
Selection-screen: begin of block blk1 with frame title text-001.
parameters : p_matnr like ekpo-matnr obligatory.
select-options : s_ebeln for ekko-ebeln,
s_ekorg for ekko-ekorg,
s_lifnr for ekko-lifnr.
Selection-screen: end of block blk1.
&----
*&Start-of-Selection.
&----
Start-of-selection.
Select ekko~ebeln
ekko~ekorg
ekko~lifnr
ekpo~matnr
ekpo~werks
into table it_rfq
from ekko
inner join ekpo
on ekkoebeln eq ekpoebeln
where ekko~ebeln in s_ebeln
and ekko~ekorg in s_ekorg
and ekko~lifnr in s_lifnr
and ekpo~matnr eq p_matnr
and ekko~bstyp eq 'A'.
if sy-subrc eq 0.
*--> Condition number from A tables.
Perform get_connum.
*--> Getting the Pricing Details from Konp Table.
Perform get_prices.
*--> Populate Vendor Name.
Perform pop_vendor_name.
*--> Populating the Final Internal table for Report.
Perform pop_final_tab.
else.
message 'Purchase Document does not exist' type 'E'.
endif.
&----
*&End-of-Selection.
&----
End-of-Selection.
write 😕 sy-vline,
2 'Vendor Number',
19 sy-vline.
v_pos = 19.
loop at it_final.
write at v_pos sy-vline.
v_pos = v_pos + 1.
write at v_pos it_final-lifnr.
v_pos = v_pos + 35.
endloop.
write at: v_pos sy-vline,
/(v_pos) sy-uline.
write 😕 sy-vline,
2 'Gross Price',
19 sy-vline.
v_pos = 19.
loop at it_final.
write at v_pos sy-vline.
v_pos = v_pos + 20.
write at v_pos it_final-pb00.
v_pos = v_pos + 16.
endloop.
write at: v_pos sy-vline,
/(v_pos) sy-uline.
write 😕 sy-vline,
2 'Packing & Forward',
19 sy-vline.
v_pos = 19.
loop at it_final.
write at v_pos sy-vline.
v_pos = v_pos + 20.
write at v_pos it_final-zpac.
v_pos = v_pos + 16.
endloop.
write at: v_pos sy-vline,
/(v_pos) sy-uline.
write 😕 sy-vline,
2 'Surcharge',
19 sy-vline.
v_pos = 19.
loop at it_final.
write at v_pos sy-vline.
v_pos = v_pos + 20.
write at v_pos it_final-zb00.
v_pos = v_pos + 16.
endloop.
write at: v_pos sy-vline,
/(v_pos) sy-uline.
write 😕 sy-vline,
2 'Installation',
19 sy-vline.
v_pos = 19.
loop at it_final.
write at v_pos sy-vline.
v_pos = v_pos + 20.
write at v_pos it_final-zin1.
v_pos = v_pos + 16.
endloop.
write at: v_pos sy-vline,
/(v_pos) sy-uline.
write 😕 sy-vline,
2 'Ed cess on BED%',
19 sy-vline.
v_pos = 19.
loop at it_final.
write at v_pos sy-vline.
v_pos = v_pos + 20.
write at v_pos it_final-jec1.
v_pos = v_pos + 16.
endloop.
write at: v_pos sy-vline,
/(v_pos) sy-uline.
write 😕 sy-vline,
2 'A/P Secess set off',
19 sy-vline.
v_pos = 19.
loop at it_final.
write at v_pos sy-vline.
v_pos = v_pos + 20.
write at v_pos it_final-jhx1.
v_pos = v_pos + 16.
endloop.
write at: v_pos sy-vline,
/(v_pos) sy-uline.
write 😕 sy-vline,
2 'Basic Excise Duty',
19 sy-vline.
v_pos = 19.
loop at it_final.
write at v_pos sy-vline.
v_pos = v_pos + 20.
write at v_pos it_final-zpac.
v_pos = v_pos + 16.
endloop.
write at: v_pos sy-vline,
/(v_pos) sy-uline.
write 😕 sy-vline,
2 'A/P BED set off',
19 sy-vline.
v_pos = 19.
loop at it_final.
write at v_pos sy-vline.
v_pos = v_pos + 20.
write at v_pos it_final-jmx1.
v_pos = v_pos + 16.
endloop.
write at: v_pos sy-vline,
/(v_pos) sy-uline.
write 😕 sy-vline,
2 'Ecess % set off',
19 sy-vline.
v_pos = 19.
loop at it_final.
write at v_pos sy-vline.
v_pos = v_pos + 20.
write at v_pos it_final-jmx3.
v_pos = v_pos + 16.
endloop.
write at: v_pos sy-vline,
/(v_pos) sy-uline.
write 😕 sy-vline,
2 'Sec ED Cess on BED',
19 sy-vline.
v_pos = 19.
loop at it_final.
write at v_pos sy-vline.
v_pos = v_pos + 20.
write at v_pos it_final-jsep.
v_pos = v_pos + 16.
endloop.
write at: v_pos sy-vline,
/(v_pos) sy-uline.
write 😕 sy-vline,
2 'VAT%',
19 sy-vline.
v_pos = 19.
loop at it_final.
write at v_pos sy-vline.
v_pos = v_pos + 20.
write at v_pos it_final-jvrd.
v_pos = v_pos + 16.
endloop.
write at: v_pos sy-vline,
/(v_pos) sy-uline.
&----
*&Top-of-Page.
&----
Top-of-Page.
format color 1.
Write: 'Material Number :' color 1, p_matnr color 1.
loop at it_final.
v_pos = v_pos + 1.
v_pos = v_pos + 35.
endloop.
write at: /(v_pos) sy-uline,/ sy-vline,2 'Vendor Name'.
v_pos = 19.
loop at it_final.
write at v_pos sy-vline.
v_pos = v_pos + 1.
write at v_pos it_final-name1.
v_pos = v_pos + 35.
endloop.
write at: v_pos sy-vline,
/(v_pos) sy-uline.
&----
*& Form get_connum
&----
Condition number from A tables
----
form get_connum .
Select EVRTN
knumh
from a016
into table it_a016
for all entries in it_rfq
where EVRTN eq it_rfq-ebeln.
Select werks
lifnr
matnr
knumh
from a363
into table it_a363
for all entries in it_rfq
where werks eq it_rfq-werks
and lifnr eq it_rfq-lifnr
and matnr eq it_rfq-matnr.
endform. " get_connum
&----
*& Form get_prices
&----
Getting the Pricing Details from Konp Table.
----
form get_prices .
if not it_a016[] is initial.
select knumh
kschl
kbetr
from konp
into table it_pr_details
for all entries in it_a016
where knumh eq it_a016-knumh.
endif.
if not it_a363[] is initial.
select knumh
kschl
kbetr
from konp
appending table it_pr_details
for all entries in it_a016
where knumh eq it_a016-knumh.
endif.
endform. " get_prices
&----
*& Form pop_final_tab
&----
Populating the Final Internal table for Report
----
form pop_final_tab .
data : l_subrc like sy-subrc.
sort it_a016 by ebeln.
loop at it_rfq.
clear l_subrc.
read table it_a016 with key ebeln = it_rfq-ebeln
binary search.
if sy-subrc eq 0.
loop at it_pr_details where knumh eq it_a016-knumh.
it_final-ebeln = it_rfq-ebeln.
it_final-lifnr = it_rfq-lifnr.
read table it_vendorname with
key lifnr = it_rfq-lifnr.
it_final-name1 = it_vendorname-name1.
case it_pr_details-kschl.
when 'PBOO'.
it_final-pb00 = it_pr_details-kbetr.
if it_pr_details-kbetr eq 0.
clear it_final.
continue.
endif.
when 'ZPAC'.
it_final-zpac = it_pr_details-kbetr.
when 'ZB00'.
it_final-ZB00 = it_pr_details-kbetr.
when 'ZIN1'.
it_final-ZIN1 = it_pr_details-kbetr.
endcase.
endloop.
else.
l_subrc = sy-subrc.
endif.
read table it_a363 with key lifnr = it_rfq-lifnr
werks = it_rfq-werks
matnr = it_rfq-matnr.
if sy-subrc eq 0.
loop at it_pr_details where knumh eq it_a016-knumh.
it_final-ebeln = it_rfq-ebeln.
it_final-lifnr = it_rfq-lifnr.
read table it_vendorname with
key lifnr = it_rfq-lifnr.
it_final-name1 = it_vendorname-name1.
case it_pr_details-kschl.
when 'JEC1'.
it_final-JEC1 = it_pr_details-kbetr.
when 'JHX1'.
it_final-JHX1 = it_pr_details-kbetr.
when 'JMOP'.
it_final-JMOP = it_pr_details-kbetr.
when 'JMX1'.
it_final-JMX1 = it_pr_details-kbetr.
when 'JMX3'.
it_final-JMX3 = it_pr_details-kbetr.
when 'JSEP'.
it_final-JSEP = it_pr_details-kbetr.
when 'JVRD'.
it_final-JVRD = it_pr_details-kbetr.
endcase.
endloop.
elseif l_subrc ne 0.
continue.
endif.
append it_final.
clear it_final.
endloop.
endform. " pop_final_tab
&----
*& Form pop_vendor_name
&----
Populate Vendor Name
----
form pop_vendor_name .
if not it_rfq[] is initial.
Select lifnr
name1
from lfa1
into table it_vendorname
where lifnr eq it_rfq-lifnr.
endif.
<i><b>
"Plz dnt Forget to reward points"</b></i>
Regards,
Mandeep.