Payment Performance Report
Dear Experts,
Following is the scenario,
Sales Person Raj
Customer Code C1000
Payment Terms 15 days
Invoice Date 01.02.2010
Invoice Value 20000
Payment Date 20.02.2010
Payment Amount 20000
Payment performance 0%
As the customer has not paid within the credit days, when i execute a query based on the sales person and posting date (From, To) parameters the payment performance should result 0%.
Is the same possible to generate through query?
Awaiting your reply
saravanan
Edited by: Sanbrahma39 on Feb 16, 2010 1:01 PM
Dear Gordon,
As rightly conveyed the payment performance is calculated based on the (Paidtodate/Doctotal)*100. I tried to generate the report using query
SELECT T0.[DocNum], T0.[DocDate], T0.[CardName], T0.[DocTotal], T0.[PaidToDate] FROM OINV T0 INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode WHERE T1.[SlpName] = [%0] and T0.[DocDate] > = [%1] and T0.[DocDate] < = [%2].
The thing is SAP delivered the result perfectly based on the query given above, now the condition is like the query has to check the payment received within the payment terms, then only it need to consider for payment performance.
Ex:
Sales Employee - Raj
Customer Code -C1000
Payment Terms -15 days
IN1 Date - 01.02.2010
IN1 Amount - 10000
Payment Date - 14.02.2010
Payment Amt - 10000
IN2 Date - 02.02.2010
IN2 Amount - 40000
Payment Date - 19.02.2010
Payment Amount - 40000
Now if i try to generate a payment performance report of a sales employee Raj as per my query it would show 100% as payment terms is not been considered.
I need a query to consider the payment terms also so when i generate a report the payment performance should be 20% only.
Hope this assists
Saravanan
Similar Messages
-
Vendor Payment Performance Report
Hi,
I am in the process of developing a report which should show details of Project, Service orders and purchase orders information. If end user inputs project/SO/PO/Vendor in the selection screen of the report, they are expected to see service orders and their related costs information. In the drill down they would like to see related Purchase orders information of the service orders including PO Quantity, PO Value, Invoiced Quanity, Invoice value, Invoice creation date, Invoice posting date, Invoice due date(Invoice date + Vendor Payment terms), Actual payment date to Vendor, Blocked invoices, Reason for blocking, Vendor info. Is there any Business Content reports, cubes, extractors availabe to serve my purpose ? If this requirement can't be developed in one report please suggest what is the best way of doing.
Eg of Report Result data:
Selection screen can have Project, Service Order, PO, Vendor, Year & Month
Report Results:
Project SO PlannedCost
WBS1 1001 5000 GBP
(5000 GBP contains 2000 GBP spent on labour cost + 3000 GBP spent on material which will be paid to different vendors)
If we drill down using Purchase Order it should show PO details for 3000 GBP and show blank for 2000 GBP
Project SO PO POValue InvoiceValue IVdate IVPaiddate IVDuedate Vendor
WBS1 1001 2000 -
WBS1 1001 P123 1000 1000 1.8.09 16.8.09 15.8.09 CP
WBS1 1001 P234 500 500 15.7.09 15.8.09 15.8.09 BP
With the above info 100% ontime payment made to vendor BP, for CP it is not, Customer is interested to see this level of information.
For 3000 GBP , for all the purchase orders we need to show PO Quantity, PO Value, Invoiced Quanity, Invoice value, Invoice creation date, Invoice posting date, Invoice due date(Invoice date + Payment terms), Actual invoice payment date, Blocked invoices, Reason for blocking, Vendor info details
Waiting for experts suggestions on the above requirement.Hi,
You can create a report on this, but first have to findout in which all the tables your fields existing. Based on this you can build a report in r/3 or a FM which you can use it in Generic DS.
Hev you gone thru standard Purchase DS which available in r/3 side. Just check them it might suits your requirement.
also check the below docu for more info:
http://help.sap.com/saphelp_470/helpdata/en/75/ee1fa755c811d189900000e8322d00/frameset.htm
Reg
Pra -
hai
how to create an vendor performance report which display purchase order issued to a vendor, material supplied delivery times, payment terms, prices during a period of time.
for this report what are the tables and fields we have to use pls give me sample report..
thank you..Hi,
Against the RFQ's vendor submit quotations and the Based on the RFQ's data we have to compare the different Vendors with the respective data like terms and prices
Fetch the data of all RFQ's from EKKO and EKPO tables
and take the EKKO-KNUMV field and pass to KONV table and fetch the different prices based on the Condition types for each RFQ and put it in a tabular format and compare.
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.
endform. " pop_vendor_name
Reward points if useful
Regards
Anji -
Calculation of customer payment performance by profit center
I want to calculate customer payment performance by profit center it is a report.
Caluation clue.
<b>Performance is a measure of when the payment was made versus the due date calculated by the payment terms</b>.
i want the logic to be included in the following code.
REPORT
TABLE DECLARATIONS
TABLES: BFOD_A, "FI subsequent BA/PC adjustment: Customer items
BSID, "Open Items
BSAD, "Cleared Items
BKPF, "Docuemnt Header
KNA1, "Customer Master
CEPCT, "Texts for Profit Center Master Data
CEPC, "Profit center master data table
SKB1, "G/L account master
VBFA, "Sales Document Flow
VBAK. "Sales Document: Header Data
CONTROLS: TABAGING TYPE TABLEVIEW USING SCREEN 9000.
FIELD-SYMBOLS: <COLUMN>.
Internal tables followed by types
TYPES: BEGIN OF T_TOTAL,
WAERS LIKE COEP-TWAER,
DAYS01 LIKE COEP-WTGBTR,
DAYS02 LIKE COEP-WTGBTR,
DAYS03 LIKE COEP-WTGBTR,
DAYS04 LIKE COEP-WTGBTR,
DAYS05 LIKE COEP-WTGBTR,
TOTAL LIKE COEP-WTGBTR,
END OF T_TOTAL.
DATA: V_DISVARIANT TYPE DISVARIANT,
REF_CUSTOM TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
REF_ALV_ZRPT TYPE REF TO CL_GUI_ALV_GRID.
DATA: V_SAVE(1) TYPE C,
V_DEFAULT(1) TYPE C,
V_VARIANT TYPE DISVARIANT,
V_SORT TYPE LVC_S_SORT,
V_LAYOUT TYPE LVC_S_LAYO,
V_SAVE_TABIX LIKE SY-TABIX,
V_SAVE_TIME LIKE SY-UZEIT,
V_ALV_FIELDCAT TYPE LVC_S_FCAT,
V_SAVE_INDEX LIKE SY-TABIX,
V_ROW TYPE LVC_S_ROW,
V_ROWS TYPE LINE OF LVC_T_ROW.
DATA: BEGIN OF V_HDR,
CURKY(9) TYPE C,
CURR(20) TYPE C,
COL1(20) TYPE C,
COL2(20) TYPE C,
COL3(20) TYPE C,
COL4(20) TYPE C,
TOTAL(20) TYPE C,
END OF V_HDR.
DATA: BEGIN OF V_FIELD,
NAME(15) TYPE C,
VALUE(17) TYPE C,
END OF V_FIELD.
DATA: BEGIN OF I_BFOD_A OCCURS 0,
PRCTR LIKE BFOD_A-PRCTR,
KUNNR LIKE BFOD_A-KUNNR,
BUKRS LIKE BFOD_A-BUKRS,
GJAHR LIKE BFOD_A-GJAHR,
BELNR LIKE BFOD_A-BELNR,
BUZEI LIKE BFOD_A-BUZEI,
AUGDT LIKE BFOD_A-AUGDT,
HKONT LIKE BFOD_A-HKONT,
BUDAT LIKE BFOD_A-BUDAT,
SHKZG LIKE BFOD_A-SHKZG,
DMBTR LIKE BFOD_A-DMBTR,
DMBE2 LIKE BFOD_A-DMBE2,
END OF I_BFOD_A.
DATA: I_SET_VALUES LIKE SETVALUES OCCURS 0 WITH HEADER LINE,
I_SORT TYPE LVC_T_SORT,
I_ALV_FIELDCAT TYPE LVC_T_FCAT,
I_PRCTR_COCD TYPE FCINPCA001 OCCURS 0 WITH HEADER LINE,
I_BFODA_KUNNR LIKE I_BFOD_A OCCURS 0 WITH HEADER LINE,
Begin of changes for DEVK909110
I_REPORT TYPE ZFR0ARPR_S1 OCCURS 0 WITH HEADER LINE,
I_REPORT TYPE ZPSS_ARBYPC OCCURS 0 WITH HEADER LINE,
End of changes for DEVK909110
I_FAEDE LIKE FAEDE,
I_TOTAL TYPE T_TOTAL OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF I_BKPF OCCURS 0,
BUKRS LIKE BKPF-BUKRS,
BELNR LIKE BKPF-BELNR,
GJAHR LIKE BKPF-GJAHR,
BKTXT LIKE BKPF-BKTXT,
XBLNR LIKE BKPF-XBLNR,
HWAER LIKE BKPF-HWAER,
HWAE2 LIKE BKPF-HWAE2,
END OF I_BKPF.
*... combine BSAD and BSID
DATA: BEGIN OF I_BSYD OCCURS 0,
KUNNR LIKE BSID-KUNNR,
BUKRS LIKE BSID-BUKRS,
GJAHR LIKE BSID-GJAHR,
BELNR LIKE BSID-BELNR,
BUZEI LIKE BSID-BUZEI,
AUGDT LIKE BSID-AUGDT,
BLDAT LIKE BSID-BLDAT,
BUDAT LIKE BSID-BUDAT,
HKONT LIKE BSID-HKONT,
WAERS LIKE BSID-WAERS,
ZFBDT LIKE BSID-ZFBDT,
ZBD1T LIKE BSID-ZBD1T,
ZBD2T LIKE BSID-ZBD2T,
ZBD3T LIKE BSID-ZBD3T,
XBLNR LIKE BSID-XBLNR,
REBZG LIKE BSID-REBZG,
SHKZG LIKE BSID-SHKZG,
DMBTR LIKE BSID-DMBTR,
WRBTR LIKE BSID-WRBTR,
END OF I_BSYD.
DATA: BEGIN OF I_CEPC OCCURS 0,
PRCTR LIKE CEPC-PRCTR,
KHINR LIKE CEPC-KHINR,
END OF I_CEPC.
DATA: BEGIN OF I_CEPCT OCCURS 0,
PRCTR LIKE CEPCT-PRCTR,
MCTXT LIKE CEPCT-MCTXT,
END OF I_CEPCT.
DATA: BEGIN OF I_PRCTR OCCURS 0,
PRCTR LIKE BFOD_A-PRCTR,
END OF I_PRCTR.
DATA: BEGIN OF I_KNA1 OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
NAME1 LIKE KNA1-NAME1,
END OF I_KNA1.
Working Variables Declarations
*... accumulators
DATA: V_BFOD_TXNAMT LIKE BSID-WRBTR, "transaction currency amt
V_FRCURR LIKE TCURR-FCURR, "local currency
V_TOCURR LIKE TCURR-FCURR, "local currency
V_LCURR LIKE T001-WAERS, "local currency
V_CUSTTOTUSD LIKE BFOD_A-DMBE2, "customer total grp curr
V_TOTAL LIKE BPPE-WTP03, "days total grp curr
V_CURRENT LIKE BPPE-WTP03, "days current grp curr
V_TOTAL_USD LIKE BPPE-WTP03, "days total grp curr
V_TOTAL_ROW LIKE BPPE-WTP03. "total of local curr/row
DATA: V_PRCTR LIKE CEPC-PRCTR, "profit center
V_SUBRC LIKE SY-SUBRC,
V_FLAG TYPE I,
V_DPAST TYPE I, "past due days working
V_GRAND TYPE C,
V_DIFF_COLOR TYPE C,
V_MSG(50) TYPE C,
V_SAVE_PCFN(128) TYPE C,
V_EXTENSION(4) TYPE C,
V_PREV_PRCTR LIKE CEPC-PRCTR,
V_POS LIKE SY-FDPOS,
V_SAVE_BUKRS LIKE BFOD_A-BUKRS,
V_SAVE_KHINR LIKE CEPC-KHINR,
V_PERC TYPE P DECIMALS 10,
V_ZBD1T LIKE BSID-ZBD1T,
V_ZFBDT LIKE BSID-ZFBDT,
V_GROUP_CLASS LIKE RGSBS-CLASS,
V_GROUP_NAME LIKE RGSBS-SETNR,
V_GROUP_TITLE LIKE RGSBS-TITLE,
V_SETID LIKE SETHIER-SETID,
V_FILETYPE LIKE RLGRAP-FILETYPE VALUE 'DAT',
V_CNT LIKE SY-TABIX,
V_PREV_BELNR LIKE BSID-BELNR,
V_REPORT1 LIKE I_REPORT,
V_REPORT LIKE I_REPORT,
V_TABIX LIKE SY-TABIX.
Constants
CONSTANTS:
C_0H(2) TYPE C VALUE '0H',
C_0106(4) TYPE C VALUE '0106',
C_SPACE(11) TYPE C VALUE ' ',
C_USD(3) TYPE C VALUE 'USD',
C_KBRC LIKE CEPC-KOKRS VALUE 'KBRC',
C_TXT(4) TYPE C VALUE '.txt',
C_XLS(4) TYPE C VALUE '.xls',
C_RTF(4) TYPE C VALUE '.rtf',
C_PERIOD(1) TYPE C VALUE '.',
C_TODATE LIKE CEPC-DATBI VALUE '99991231'.
RANGES: R_KUNNR FOR KNA1-KUNNR. "Customer
Selection Screen Parameters and Select-options
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_KHINR LIKE CEPC-KHINR.
SELECT-OPTIONS: S_PRCTR FOR CEPC-PRCTR,
S_KUNNR FOR KNA1-KUNNR,
S_BUKRS FOR BKPF-BUKRS,
S_HKONT FOR SKB1-SAKNR.
PARAMETERS: P_BUDAT LIKE BFOD_A-BUDAT OBLIGATORY.
SELECTION-SCREEN ULINE.
SELECT-OPTIONS: S_BELNR FOR BFOD_A-BELNR,
S_AUART FOR VBAK-AUART,
S_VTWEG FOR VBAK-VTWEG,
S_VBTYP FOR VBFA-VBTYP_V.
SELECTION-SCREEN ULINE.
PARAMETERS: P_AGEDY TYPE ZZAGEMULT DEFAULT '30' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
PARAMETERS: P_DSVAR LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF BLOCK B2.
class lcl_event_receiver: local class to handle event DOUBLE_CLICK
Definition:
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS:
MTH_PRINT_TOP_OF_PAGE
FOR EVENT PRINT_TOP_OF_PAGE OF CL_GUI_ALV_GRID.
METHODS:
MTH_PRINT_TOP_OF_LIST
FOR EVENT PRINT_TOP_OF_LIST OF CL_GUI_ALV_GRID.
PRIVATE SECTION.
ENDCLASS. "lcl_event_receiver DEFINITION
class lcl_event_receiver: local class to handle event DOUBLE_CLICK
Implementation:
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
METHOD MTH_PRINT_TOP_OF_PAGE.
CALL FUNCTION 'Z_CA_STD_HEADER'
EXPORTING
HEADING = SY-TITLE
P_REPID = SY-CPROG
LINE_WIDTH = SY-LINSZ.
ENDMETHOD. "MTH_PRINT_TOP_OF_PAGE
METHOD MTH_PRINT_TOP_OF_LIST.
CALL FUNCTION 'Z_CA_STD_HEADER'
EXPORTING
HEADING = SY-TITLE
P_REPID = SY-CPROG
LINE_WIDTH = SY-LINSZ.
CALL FUNCTION 'Z_CA_PRINT_SELECTION_OPTIONS'
EXPORTING
P_PGMN = SY-CPROG
P_SKIP = 'X'
P_NOTOP = 'X'.
NEW-PAGE.
ENDMETHOD. "MTH_PRINT_TOP_OF_LIST
ENDCLASS. "LCL_EVENT_RECEIVER IMPLEMENTATION
DATA: REF_EVENT_RECEIVER TYPE REF TO LCL_EVENT_RECEIVER.
Selection Screen Prompt values
At Selection Screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_DSVAR.
DATA: LS_DISPLAY_VARIANT TYPE DISVARIANT.
Get the display variant
V_DISVARIANT-REPORT = SY-CPROG.
V_DISVARIANT-VARIANT = P_DSVAR.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = V_DISVARIANT
I_SAVE = 'A'
IMPORTING
ES_VARIANT = LS_DISPLAY_VARIANT
EXCEPTIONS
OTHERS = 3.
Load results to parameter
IF SY-SUBRC = 0 AND NOT LS_DISPLAY_VARIANT IS INITIAL.
P_DSVAR = LS_DISPLAY_VARIANT-VARIANT.
ENDIF.
*...performed when looking for values in fields
performs the drop down selection list
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KHINR. "Profit center grp
PERFORM F_GET_S_KHINR.
Selection Screen validations
AT SELECTION-SCREEN.
IF P_KHINR IS INITIAL.
IF S_PRCTR[] IS INITIAL.
IF S_BUKRS[] IS INITIAL.
MESSAGE E000 WITH TEXT-300 TEXT-302.
ENDIF.
ENDIF.
ELSE.
IF S_PRCTR[] IS INITIAL.
PERFORM F_VALIDATE_KHINR.
ELSE.
*.. Error msg: Please enter either a Profit Center Group or a
profit center, but not both
MESSAGE E000 WITH TEXT-300 TEXT-301.
EXIT.
ENDIF.
ENDIF.
IF NOT S_AUART[] IS INITIAL.
MESSAGE E000 WITH TEXT-303.
ENDIF.
IF NOT S_VTWEG[] IS INITIAL.
MESSAGE E000 WITH TEXT-304.
ENDIF.
Event AT LINE-SELECTION
AT LINE-SELECTION.
CHECK SY-LSIND LE 1.
CHECK NOT I_REPORT-BELNR IS INITIAL.
SET PARAMETER ID 'BLN' FIELD I_REPORT-BELNR.
SET PARAMETER ID 'BUK' FIELD I_REPORT-BUKRS.
SET PARAMETER ID 'GJR' FIELD I_REPORT-GJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
CLEAR: I_REPORT-BELNR, I_REPORT-BUKRS, I_REPORT-GJAHR.
INITIALIZATION
INITIALIZATION.
START OF MAIN PROCESSING
START-OF-SELECTION.
Check aging days multiplier
IF P_AGEDY LE 0.
MESSAGE S000 WITH 'Aging Days Multiplier must be greater than zero'.
EXIT.
ENDIF.
Populate the s_prctr from a profit center group
IF NOT I_SET_VALUES[] IS INITIAL.
PERFORM F_POPULATE_PRCTR_FROM_PRCTRGRP.
ENDIF.
Build and validate prctr against cepc table
IF NOT S_PRCTR[] IS INITIAL.
PERFORM F_BUILD_I_CEPC_TABLE. "FILLS THE VALID PROFIT CTR TABLE
ENDIF.
Get base selections
PERFORM F_SELECT_DATA. "BUILD REF INTERNAL TABLES
Get additional fields and build reporting structure
PERFORM F_BUILD_I_REPORT. "BUILDS INTERNAL REPORTING TABLE
Generate ALV report
PERFORM F_WRITE_REPORT. "WRITES i_report AND RUNS CALCS
END-OF-SELECTION.
FREE: I_BFOD_A, I_KNA1, I_CEPC, I_CEPCT, I_REPORT.
Form F_DIS_MSG
FORM F_DIS_MSG USING VALUE(P_PERCENTAGE) VALUE(P_TEXT).
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = P_PERCENTAGE
TEXT = P_TEXT
EXCEPTIONS
OTHERS = 1.
ENDFORM. " F_DIS_MSG
Form F_GET_S_KHINR
Get prompt values for Profit Center Group
FORM F_GET_S_KHINR.
PERFORM F_DIS_MSG USING 100 'Get prompt values for Profit Ctr Group.'.
COMMIT WORK.
CALL FUNCTION 'K_GROUP_SELECT'
EXPORTING
BUTTONS = 'X'
CLASS = '0H '
CRUSER = '*'
FIELD_NAME = 'RPRCTR'
SEARCHFLD = 'KBRC'
SEARCHFLD_INPUT = ' '
SEARCHFLD_REQUIRED = 'X'
SET = '*'
START_COLUMN = 10
START_ROW = 5
TABLE = 'GLPCT'
TYPELIST = 'BS'
UPDUSER = '*'
IMPORTING
CLASS_NAME = V_GROUP_CLASS
SET_NAME = V_GROUP_NAME
SET_TITLE = V_GROUP_TITLE
EXCEPTIONS
NO_SET_PICKED = 1
OTHERS = 2.
IF SY-SUBRC = 0.
P_KHINR = V_GROUP_NAME.
ENDIF.
ENDFORM. " F_GET_S_KHINR
FORM F_VALIDATE_KHINR *
FORM F_VALIDATE_KHINR.
PERFORM F_DIS_MSG USING 100 'Validate Profit Center group.'.
COMMIT WORK.
CLEAR I_SET_VALUES.
REFRESH I_SET_VALUES.
CONCATENATE C_0106 C_KBRC P_KHINR INTO V_SETID.
CONDENSE V_SETID.
CALL FUNCTION 'G_SET_TREE_IMPORT'
EXPORTING
CLIENT = SY-MANDT
FIELDNAME = 'RPRCTR'
LANGU = SY-LANGU
SETID = V_SETID
TABNAME = 'GLPCT'
NO_TABLE_BUFFERING = 'X'
TABLES
SET_VALUES = I_SET_VALUES
EXCEPTIONS
SET_NOT_FOUND = 1
ILLEGAL_FIELD_REPLACEMENT = 2
ILLEGAL_TABLE_REPLACEMENT = 3
OTHERS = 4.
IF SY-SUBRC NE 0.
E: Unable to find Profit Center Group & - please modify selection
MESSAGE E000 WITH TEXT-002 P_KHINR.
ENDIF.
IF I_SET_VALUES[] IS INITIAL.
MESSAGE E000 WITH P_KHINR TEXT-039.
ENDIF.
ENDFORM. " F_VALIDATE_KHINR
Form F_SELECT_DATA
FORM F_SELECT_DATA.
PERFORM F_DIS_MSG USING 100 'Retrieve info from SAP tables.'.
COMMIT WORK.
Build the BFOD_A internal table based on user selections
f i_cepc table is initial, it means derive all prctr under a co cd
IF S_PRCTR[] IS INITIAL.
PERFORM F_RETRIEVE_BFODA_BY_COMPANY.
ELSE.
PERFORM F_RETRIEVE_BFODA_BY_PRCTR.
ENDIF.
IF I_BFOD_A[] IS INITIAL.
*... No records fit selection criteria.
MESSAGE E000 WITH TEXT-H20.
ENDIF.
Get the text for profit center
SELECT SPRAS PRCTR DATBI KOKRS MCTXT FROM CEPCT
INTO CORRESPONDING FIELDS OF TABLE I_CEPCT
FOR ALL ENTRIES IN I_CEPC
WHERE SPRAS = SY-LANGU
AND PRCTR = I_CEPC-PRCTR.
Build an internal table of unique bfod keys for bsid and bsad
I_BFODA_KUNNR[] = I_BFOD_A[].
SORT I_BFODA_KUNNR BY KUNNR BUKRS GJAHR BELNR BUZEI.
DELETE ADJACENT DUPLICATES FROM I_BFODA_KUNNR COMPARING
KUNNR BUKRS GJAHR BELNR BUZEI.
Build BSID Internal table
SELECT MANDT BUKRS KUNNR UMSKS UMSKZ AUGDT AUGBL ZUONR GJAHR BELNR
BUZEI BUDAT HKONT BLDAT WAERS REBZG XBLNR SHKZG DMBTR
WRBTR ZFBDT ZBD1T ZBD2T ZBD3T
FROM BSID INTO CORRESPONDING FIELDS OF TABLE I_BSYD
FOR ALL ENTRIES IN I_BFODA_KUNNR
WHERE KUNNR EQ I_BFODA_KUNNR-KUNNR
AND BUKRS EQ I_BFODA_KUNNR-BUKRS
AND GJAHR EQ I_BFODA_KUNNR-GJAHR
AND BELNR EQ I_BFODA_KUNNR-BELNR
AND BUZEI EQ I_BFODA_KUNNR-BUZEI.
Build BSAD internal table
SELECT MANDT BUKRS KUNNR UMSKS UMSKZ AUGDT AUGBL ZUONR GJAHR BELNR
BUZEI HKONT BUDAT BLDAT WAERS REBZG XBLNR SHKZG DMBTR WRBTR ZFBDT
ZBD1T ZBD2T ZBD3T
FROM BSAD APPENDING CORRESPONDING FIELDS OF TABLE I_BSYD
FOR ALL ENTRIES IN I_BFODA_KUNNR
WHERE KUNNR EQ I_BFODA_KUNNR-KUNNR
AND BUKRS EQ I_BFODA_KUNNR-BUKRS
AND AUGDT GT P_BUDAT
AND GJAHR EQ I_BFODA_KUNNR-GJAHR
AND BELNR EQ I_BFODA_KUNNR-BELNR
AND BUZEI EQ I_BFODA_KUNNR-BUZEI.
IF NOT I_BSYD[] IS INITIAL.
Remove records based on selection criteria
DELETE I_BSYD WHERE
NOT BUDAT LE P_BUDAT OR
NOT HKONT IN S_HKONT.
ENDIF.
Acquire document headers
SELECT BUKRS BELNR GJAHR BKTXT XBLNR HWAER HWAE2 FROM BKPF
INTO TABLE I_BKPF
FOR ALL ENTRIES IN I_BSYD
WHERE BUKRS EQ I_BSYD-BUKRS
AND BELNR EQ I_BSYD-BELNR
AND GJAHR EQ I_BSYD-GJAHR.
Sort document lines
SORT I_BSYD BY KUNNR BUKRS GJAHR BELNR BUZEI ASCENDING.
SORT I_BKPF BY BUKRS BELNR GJAHR ASCENDING.
Create table of unique customers
SORT I_BFODA_KUNNR BY KUNNR.
DELETE ADJACENT DUPLICATES FROM I_BFODA_KUNNR COMPARING KUNNR.
Build customer table
SELECT KUNNR NAME1 FROM KNA1
INTO TABLE I_KNA1
FOR ALL ENTRIES IN I_BFODA_KUNNR
WHERE KUNNR EQ I_BFODA_KUNNR-KUNNR.
Free memory space
FREE I_BFODA_KUNNR.
ENDFORM. " F_SELECT_DATA
Form F_BUILD_I_CEPC_TABLE
build the i_cepc internal table that would populate the
valid profit centers to processed.
FORM F_BUILD_I_CEPC_TABLE.
PERFORM F_DIS_MSG USING 100 'Build the Profit Center Ref Table.'.
COMMIT WORK.
Acquire CEPC table
IF I_PRCTR[] IS INITIAL.
SORT S_PRCTR.
SELECT PRCTR KHINR
FROM CEPC
INTO TABLE I_CEPC
WHERE PRCTR IN S_PRCTR.
Sort table
SORT I_CEPC BY PRCTR KHINR.
Remove duplicate values
DELETE ADJACENT DUPLICATES FROM I_CEPC COMPARING PRCTR.
I_PRCTR[] = I_CEPC[].
Sort table
SORT I_PRCTR BY PRCTR.
ELSE.
Sort table
SORT I_PRCTR BY PRCTR.
Acquire CEPC table
SELECT PRCTR KHINR
FROM CEPC
INTO TABLE I_CEPC
FOR ALL ENTRIES IN I_PRCTR
WHERE PRCTR = I_PRCTR-PRCTR.
SOrt table
SORT I_CEPC BY PRCTR KHINR.
ENDIF.
IF I_CEPC[] IS INITIAL.
MESSAGE E000 WITH TEXT-006.
ENDIF.
ENDFORM. " F_BUILD_i_CEPC_TABLE
Form F_BUILD_I_REPORT
Build the A/R report internal table from bfod_a, bsid and bsad
It is necessary to go to BSAD/BSID to get the document currency
not present in bfod_a.
FORM F_BUILD_I_REPORT.
PERFORM F_DIS_MSG USING 100 'Build the report information.'.
COMMIT WORK.
Sort all internal tables, this is essential for later processing
SORT I_BFOD_A BY KUNNR BUKRS GJAHR BELNR BUZEI .
SORT I_BSYD BY KUNNR BUKRS GJAHR BELNR BUZEI.
SORT I_CEPC BY PRCTR KHINR.
LOOP AT I_BFOD_A.
New customer
AT NEW KUNNR.
READ TABLE I_KNA1 WITH KEY KUNNR = I_BFOD_A-KUNNR BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE I_KNA1-NAME1 TO I_REPORT-NAME1.
ENDIF.
ENDAT.
Acquire header fields
READ TABLE I_BKPF WITH KEY BUKRS = I_BFOD_A-BUKRS
BELNR = I_BFOD_A-BELNR
GJAHR = I_BFOD_A-GJAHR BINARY SEARCH.
IF SY-SUBRC NE 0.
CLEAR I_BKPF.
ENDIF.
Build base record
PERFORM F_MOVE_BASE_TO_REPORT.
Load profit center data
IF P_KHINR IS INITIAL.
IF V_PREV_PRCTR = I_BFOD_A-PRCTR.
I_REPORT-KHINR = I_CEPC-KHINR.
ELSE.
READ TABLE I_CEPC WITH KEY PRCTR = I_BFOD_A-PRCTR BINARY SEARCH.
IF SY-SUBRC = 0.
I_REPORT-KHINR = I_CEPC-KHINR.
ELSE.
CLEAR I_REPORT-KHINR.
ENDIF.
V_PREV_PRCTR = I_BFOD_A-PRCTR.
ENDIF.
ELSE.
I_REPORT-KHINR = P_KHINR.
ENDIF.
Reverse signs
IF I_REPORT-SHKZG = 'H'.
I_REPORT-DMBTR = I_REPORT-DMBTR * -1.
I_REPORT-DMBE2 = I_REPORT-DMBE2 * -1.
ENDIF.
Additional details
READ TABLE I_BSYD WITH KEY KUNNR = I_BFOD_A-KUNNR
BUKRS = I_BFOD_A-BUKRS
GJAHR = I_BFOD_A-GJAHR
BELNR = I_BFOD_A-BELNR
BUZEI = I_BFOD_A-BUZEI BINARY SEARCH.
IF SY-SUBRC = 0.
PERFORM F_FORMAT_I_REPORT_FR_BSYD.
APPEND I_REPORT.
ENDIF.
ENDLOOP.
ENDFORM. " F_BUILD_I_REPORT
Form F_FORMAT_I_REPORT_FR_BSYD
Retrieve all the information needed for reporting from BSID.
If a document has a referencing invoice (REBZG), the payment terms
and the baseline date to be used will come from the referencing
invoice.
FORM F_FORMAT_I_REPORT_FR_BSYD.
*=> get the document currency amount from bsid
I_REPORT-BLDAT = I_BSYD-BLDAT.
I_REPORT-WAERS = I_BSYD-WAERS.
PERFORM F_CONVERT_CURRENCY_FR_2_AMTS USING I_REPORT-HWAER I_BSYD-WAERS
I_BSYD-DMBTR I_BSYD-WRBTR
I_BFOD_A-DMBTR
CHANGING V_BFOD_TXNAMT.
I_REPORT-WRBTR = V_BFOD_TXNAMT.
IF I_BSYD-SHKZG = 'H'.
I_REPORT-WRBTR = I_REPORT-WRBTR * -1.
ENDIF.
V_ZBD1T = I_BSYD-ZBD1T.
V_ZFBDT = I_BSYD-ZFBDT.
*=> determine reference document (referencing invoice)
CLEAR I_REPORT-SORT.
CASE I_BSYD-REBZG.
WHEN ' '.
I_REPORT-SORT = I_BFOD_A-BELNR.
WHEN 'V'.
I_REPORT-SORT = I_BSYD-XBLNR.
WHEN OTHERS.
I_REPORT-SORT = I_BSYD-REBZG.
PERFORM F_GET_DATEPAYTERM_FR_ORIGDOC.
ENDCASE.
CLEAR I_FAEDE.
I_FAEDE-SHKZG = I_BSYD-SHKZG.
I_FAEDE-KOART = 'D'.
I_FAEDE-ZFBDT = I_BSYD-ZFBDT.
I_FAEDE-ZBD1T = I_BSYD-ZBD1T.
I_FAEDE-ZBD2T = I_BSYD-ZBD2T.
I_FAEDE-ZBD3T = I_BSYD-ZBD3T.
I_FAEDE-REBZG = I_BSYD-REBZG.
I_FAEDE-BLDAT = I_BSYD-BLDAT.
CALL FUNCTION 'DETERMINE_DUE_DATE'
EXPORTING
I_FAEDE = I_FAEDE
IMPORTING
E_FAEDE = I_FAEDE
EXCEPTIONS
ACCOUNT_TYPE_NOT_SUPPORTED = 1
OTHERS = 2.
V_DPAST = P_BUDAT - I_FAEDE-NETDT.
IF V_DPAST < 0.
I_REPORT-DPAST = 0.
ELSE.
MOVE V_DPAST TO I_REPORT-DPAST.
ENDIF.
I_REPORT-ZBD1T = V_ZBD1T.
I_REPORT-NETDT = I_FAEDE-NETDT.
Update totals
PERFORM F_BUILD_TOTALS.
ENDFORM. " F_FORMAT_I_REPORT_FR_BSYD
Form F_GET_DATEPAYTERM_FR_ORIGDOC
FORM F_GET_DATEPAYTERM_FR_ORIGDOC.
In order to go back to the original document's payment terms and
baseline date, we neeed to resort bsid/bsad to a different sort
order b-coz only these 3 fields logically matched the orig doc
SORT I_BSYD BY KUNNR BUKRS BELNR.
READ TABLE I_BSYD WITH KEY KUNNR = I_BFOD_A-KUNNR
BUKRS = I_BFOD_A-BUKRS
BELNR = I_REPORT-SORT BINARY SEARCH.
IF SY-SUBRC = 0.
V_ZBD1T = I_BSYD-ZBD1T. "payment term
V_ZFBDT = I_BSYD-ZFBDT. "baseline due date
ENDIF.
SORT I_BSYD BY KUNNR BUKRS GJAHR BELNR BUZEI.
ENDFORM. " F_GET_DATEPAYTERM_FR_ORIGDOC
Form F_WRITE_REPORT
Write A/R report summarized by profit center.
Report will be build by profit center and sum all customers
then will sum past do for profit center and catagorized
will also sum by project / wbs element.
FORM F_WRITE_REPORT.
SORT I_REPORT BY PRCTR KUNNR SORT BLDAT BELNR DPAST DESCENDING.
CALL SCREEN 9000.
ENDFORM. " F_WRITE_REPORT
Form F_POPULATE_PRCTR_FROM_PRCTRGRP
FORM F_POPULATE_PRCTR_FROM_PRCTRGRP.
LOOP AT I_SET_VALUES.
IF I_SET_VALUES-TO = I_SET_VALUES-FROM.
I_PRCTR-PRCTR = I_SET_VALUES-TO.
COLLECT I_PRCTR.
S_PRCTR-SIGN = 'I'.
S_PRCTR-OPTION = 'EQ'.
S_PRCTR-LOW = I_SET_VALUES-TO.
COLLECT S_PRCTR.
ELSE.
MESSAGE E000 WITH 'System Error, contact programmer'
I_SET_VALUES-TO I_SET_VALUES-FROM.
ENDIF.
ENDLOOP.
ENDFORM. " F_POPULATE_PRCTR_FROM_PRCTRGRP
Form F_CONVERT_CURRENCY_FR_2_AMTS
This function module will ensure proper handling of decimals
and conversion of currency. This will give you the historical
exchange rate used.
BFOD_A does not have the trans curr amt so we will get it
using: ( bsid trans curr amt / bsid loc curr amt ) *
bfod_a loc currency amt
FORM F_CONVERT_CURRENCY_FR_2_AMTS USING V_FRCURR V_TOCURR
V_OFRAMT V_OTOAMT V_NFRAMT
CHANGING V_NTOAMT.
CALL FUNCTION 'Z_CONVERT_CURRENCY_FROM_2_AMTS'
EXPORTING
FROM_CURRENCY = V_FRCURR
TO_CURRENCY = V_TOCURR
OLD_FROM_AMOUNT = V_OFRAMT
OLD_TO_AMOUNT = V_OTOAMT
NEW_FROM_AMOUNT = V_NFRAMT
IMPORTING
NEW_TO_AMOUNT = V_NTOAMT
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH TEXT-005.
ENDIF.
ENDFORM. " F_CONVERT_CURRENCY_FR_2_AMTS
Form F_RETRIEVE_BFODA_BY_COMPANY
FORM F_RETRIEVE_BFODA_BY_COMPANY.
Acquire BFOD_A table
SELECT PRCTR KUNNR BUKRS GJAHR BELNR BUZEI AUGDT HKONT BUDAT
SHKZG DMBTR DMBE2 FROM BFOD_A
INTO TABLE I_BFOD_A
WHERE BUKRS IN S_BUKRS.
IF I_BFOD_A[] IS INITIAL.
EXIT.
ELSE.
Remove records based on selection criteria
DELETE I_BFOD_A WHERE NOT KUNNR IN S_KUNNR OR
NOT BUDAT LE P_BUDAT OR
NOT HKONT IN S_HKONT OR
NOT BELNR IN S_BELNR OR
( NOT AUGDT IS INITIAL AND
NOT AUGDT > P_BUDAT ).
ENDIF.
Build selection option
LOOP AT I_BFOD_A.
I_PRCTR-PRCTR = I_BFOD_A-PRCTR.
COLLECT I_PRCTR.
S_PRCTR-SIGN = 'I'.
S_PRCTR-OPTION = 'EQ'.
S_PRCTR-LOW = I_BFOD_A-PRCTR.
COLLECT S_PRCTR.
ENDLOOP.
SORT S_PRCTR.
SORT I_PRCTR BY PRCTR.
PERFORM F_BUILD_I_CEPC_TABLE.
ENDFORM. " F_RETRIEVE_BFODA_BY_COMPANY
Form F_RETRIEVE_BFODA_BY_PRCTR
FORM F_RETRIEVE_BFODA_BY_PRCTR.
Acquire BFOD_A table
SELECT PRCTR KUNNR BUKRS GJAHR BELNR BUZEI AUGDT HKONT BUDAT
SHKZG DMBTR DMBE2 FROM BFOD_A
INTO TABLE I_BFOD_A
FOR ALL ENTRIES IN I_PRCTR
WHERE PRCTR = I_PRCTR-PRCTR AND
KUNNR IN S_KUNNR AND
BUKRS IN S_BUKRS.
IF I_BFOD_A[] IS INITIAL.
EXIT.
ELSE.
Remove records based on selection criteria
DELETE I_BFOD_A WHERE NOT KUNNR IN S_KUNNR OR
NOT BUKRS IN S_BUKRS OR
NOT BUDAT LE P_BUDAT OR
NOT HKONT IN S_HKONT OR
NOT BELNR IN S_BELNR OR
( NOT AUGDT IS INITIAL AND
NOT AUGDT > P_BUDAT ).
ENDIF.
ENDFORM. " F_RETRIEVE_BFODA_BY_PRCTR
Form F_MOVE_BASE_TO_REPORT
FORM F_MOVE_BASE_TO_REPORT.
I_REPORT-PRCTR = I_BFOD_A-PRCTR.
I_REPORT-KUNNR = I_BFOD_A-KUNNR.
I_REPORT-BELNR = I_BFOD_A-BELNR.
I_REPORT-BUKRS = I_BFOD_A-BUKRS.
I_REPORT-HKONT = I_BFOD_A-HKONT.
I_REPORT-AUGDT = I_BFOD_A-AUGDT.
I_REPORT-BUDAT = I_BFOD_A-BUDAT.
I_REPORT-GJAHR = I_BFOD_A-GJAHR.
I_REPORT-BUZEI = I_BFOD_A-BUZEI.
I_REPORT-SHKZG = I_BFOD_A-SHKZG.
I_REPORT-DMBTR = I_BFOD_A-DMBTR.
I_REPORT-DMBE2 = I_BFOD_A-DMBE2.
I_REPORT-HWAER = I_BKPF-HWAER.
I_REPORT-HWAE2 = I_BKPF-HWAE2.
I_REPORT-BKTXT = I_BKPF-BKTXT.
I_REPORT-XBLNR = I_BKPF-XBLNR.
ENDFORM. " F_MOVE_BASE_TO_REPORT
Module STATUS_9000 OUTPUT
text
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS '9000'.
SET TITLEBAR '900'.
Launch standard ALV grid
PERFORM F_CREATE_ALV_GRID_CONTROL.
PERFORM F_LOAD_COLUMN_HEADINGS.
ENDMODULE. " STATUS_9000 OUTPUT
Module USER_COMMAND_9000 INPUT
text
MODULE USER_COMMAND_9000 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT' OR 'CANC' OR 'BACK'.
CALL METHOD REF_CUSTOM->FREE.
SET SCREEN 0.
LEAVE SCREEN.
Begin of changes for Release 2 by HBE7890 - DEVK909110
WHEN 'PRIN'.
PERFORM PRINT_AGING_TOTALS.
End of changes.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
Form F_CREATE_ALV_GRID_CONTROL
text
FORM F_CREATE_ALV_GRID_CONTROL.
Set field catalog for ALV
PERFORM F_SET_FIELDCAT.
IF REF_CUSTOM IS INITIAL.
Create ALV container
CREATE OBJECT REF_CUSTOM
EXPORTING
CONTAINER_NAME = 'ZRPT_CONTAINER'.
Create ALV grid control
CREATE OBJECT REF_ALV_ZRPT
EXPORTING
I_PARENT = REF_CUSTOM.
Adjust look and feel
PERFORM F_CHANGE_SETTINGS.
Call the ALV Build
CALL METHOD REF_ALV_ZRPT->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = V_LAYOUT
IS_VARIANT = V_VARIANT
I_SAVE = V_SAVE
I_DEFAULT = V_DEFAULT
CHANGING
IT_SORT = I_SORT
IT_OUTTAB = I_REPORT[]
IT_FIELDCATALOG = I_ALV_FIELDCAT[].
Create print top of page
CREATE OBJECT REF_EVENT_RECEIVER.
SET HANDLER REF_EVENT_RECEIVER->MTH_PRINT_TOP_OF_PAGE
FOR REF_ALV_ZRPT.
Create print top of page
CREATE OBJECT REF_EVENT_RECEIVER.
SET HANDLER REF_EVENT_RECEIVER->MTH_PRINT_TOP_OF_LIST
FOR REF_ALV_ZRPT.
ENDIF.
ENDFORM. " F_CREATE_ALV_GRID_CONTROL
Form F_CHANGE_SETTINGS
text
FORM F_CHANGE_SETTINGS .
Set layout parameters
V_LAYOUT-GRID_TITLE = 'A/R by Profit Center'.
V_LAYOUT-SEL_MODE = 'A'.
V_LAYOUT-INFO_FNAME = 'LINECOLOR'.
V_LAYOUT-CWIDTH_OPT = 'X'.
V_LAYOUT-NO_MERGING = 'X'.
V_LAYOUT-NUMC_TOTAL = 'X'.
V_DEFAULT = 'X'.
V_SAVE = 'A'.
Set display variant
V_VARIANT-REPORT = SY-REPID.
IF P_DSVAR NE ''.
V_VARIANT-VARIANT = P_DSVAR.
ENDIF.
ENDFORM. " F_CHANGE_SETTINGS
Form F_SET_FIELDCAT
text
FORM F_SET_FIELDCAT .
Set field catalog for ALV
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'ZFR0ARPR_S1' "DEVK909110
I_STRUCTURE_NAME = 'ZPSS_ARBYPC' "DEVK909110
CHANGING
CT_FIELDCAT = I_ALV_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
Override any attributes
LOOP AT I_ALV_FIELDCAT INTO V_ALV_FIELDCAT.
IF V_ALV_FIELDCAT-FIELDNAME EQ 'NAME1'.
MOVE 'Customer Name' TO: V_ALV_FIELDCAT-REPTEXT,
V_ALV_FIELDCAT-SCRTEXT_L,
V_ALV_FIELDCAT-SCRTEXT_M,
V_ALV_FIELDCAT-SCRTEXT_S.
ENDIF.
IF V_ALV_FIELDCAT-FIELDNAME EQ 'SORT'.
MOVE 'Documentation' TO: V_ALV_FIELDCAT-REPTEXT,
V_ALV_FIELDCAT-SCRTEXT_L,
V_ALV_FIELDCAT-SCRTEXT_M.
MOVE 'DocRef' TO V_ALV_FIELDCAT-SCRTEXT_S.
ENDIF.
MODIFY I_ALV_FIELDCAT FROM V_ALV_FIELDCAT.
ENDLOOP.
ENDFORM. " F_SET_FIELDCAT
Form F_BUILD_TOTALS
text
FORM F_BUILD_TOTALS .
DATA: V_DAYS TYPE I,
V_INDEX(2) TYPE N.
CLEAR I_TOTAL.
Build total line
MOVE I_REPORT-HWAER TO I_TOTAL-WAERS.
MOVE I_REPORT-DMBTR TO I_TOTAL-TOTAL.
DO 5 TIMES.
V_DAYS = ( SY-INDEX - 1 ) * P_AGEDY.
V_INDEX = SY-INDEX.
IF I_REPORT-DPAST LE V_DAYS.
CONCATENATE 'I_TOTAL-DAYS' V_INDEX INTO V_FIELD-NAME.
ASSIGN (V_FIELD-NAME) TO <COLUMN>.
<COLUMN> = I_REPORT-DMBTR.
EXIT.
ELSEIF SY-INDEX EQ 5.
CONCATENATE 'I_TOTAL-DAYS' V_INDEX INTO V_FIELD-NAME.
ASSIGN (V_FIELD-NAME) TO <COLUMN>.
<COLUMN> = I_REPORT-DMBTR.
EXIT.
ENDIF.
ENDDO.
COLLECT I_TOTAL.
ENDFORM. " F_BUILD_TOTALS
CO-PA has all the information you need...
Profitability Analysis is that part of CO where operations will access its performance factors and profitability statements contain margins, standard cost variance, sales information, allocations and other related profit or loss data. This module helps analyze profitability of customers, markets and products at various levels of contribution margins. Profitability is measured down to the SD billing document line and is adjusted periodically against standard costs and other costs.
It has 2 methods of approach :
Costing based Profitability Analysis - This is primarily designed to let you analyze profits quickly for the purpose of sales management.
Account based Profitabilty Analysis - This type of Profitability Analysis enables you to reconcile cost and financial accounting at any time using accounts.
Guess, the second approach is what you are looking for... -
I want to calculate customer payment performance by profit center it is a report.
Caluation clue.
Performance is a measure of when the payment was made versus the due date calculated by the payment terms.
i want the logic to be included in the following code.hi,
try with this function module
ITEM_OVERDUE_DAYS
cheers,
sasi -
Consumer/customer relations payment load report
is there any standard report for Consumer/customer relations payment load report.....for country specific
Hi Rajan,
There is a lot of scope for performance tuning the code:
1. Read statement should be with BINARY SEARCH
2. Select statement should have FIELDS in the same order as they exist in the table
3. Select statement where clause should have fields in same order as they exist in the table.
4. Internal tables seem to be having a huge number of fields. If possible, please limit the fields to only required fields in the internal table.
Best regards,
Prashant -
GT70 2PC – Software testing and performance report.
It is so excited here again. Currently, my first/only object after work is playing Titanfall.
I intended to share another performance testing today. But I didn’t. I found there are too many great open box posts on different forums. Therefore, I decide to dig the MSI software compatibility and do a touring. What can I say? I’m Mr.Curiosity who really desires to know every built-in application in system. That is why I share this article with you, my friends. I would like to discuss with everybody who is interested in MSI software. Of course, I have some performance reports for you, too. Please also remind me if you find any typo/wrong in this post. Thanks in advance.
1. MSI Boot Configure
This is the first software which pops up immediately. It is thoughtful design because we can choose enter the [Windows 8.1 metro] or [desktop] by ourselves now. I give it two thumbs up!!!
Select your favorite boot configuration and press [OK]. If we want it work immdiately, we can logout the system and re-login again.
2. MSI Remind Manager
Honestly, I didn’t know what it is in the beginning. The cute robot shows every time when I login the system. I found this is a reminder for product registration. Good, I would like to have best MSI support and warranty for my lovely GT70 2PC. But don’t worry, if you don’t want to get this message again, you just need to select the right option and close it.
3. Synaptics TouchPad
This is a driver for mouse. [Mouse property] will show if we do the double clicks on TouchPad icon in tray. You can choose enable/disable internal pointing device when external pointing device is attached. This is brilliant. A tough guy (like me…HA! HA!) didn’t like to play game with touchpad. Because the character in game will be weak and slow if I control it by touchpad. Of course, I need the external mouse all the time and don’t want the interference from touchpad.
4. System Control Manager (SCM)
We can enable/disable the WLAN/BT/camera devices by SCM. Besides, it can control the display brightness, volume, screen on/off and ECO. ECO is special mode for gaming watching movie.
5. Sound Blaster CINEMA
Sound Blaster CINEMA is come from an old school audio company – CREATIVE. The software can adjust the surround sound easily. We also can adjust 5.1/7.1 surround sound for the internal speakers and external headphone. That is great, isn’t it?
Besides, we can also adjust CRYSTALIZER/BASS/SMART VOLUME/digital output by ourselves.
6. Killer Network Manager
This is a major feature of MSI NB.
In Killer Network Manager, we can set the network priority for each of applications and we also can abandon the connection from malicious software.
[Performance] shows current status of network. We can find out which application occupied the most greedy resources by it.
[Network -> Test Network Speed] will detect the network environment automatically. Furthermore, it will adjust the priority for applications.
[Killer Ethernet] show the LAN connection info.
[Killer Wireless] show the router info.
7. SteelSeries Engine
This is another major feature of MSI NB
If we do the right click on icon in tray, the menu will show following list. We can select [Launch SteelSeries Firmware Update Tool], [Updates]…and so on.
If we select the [Settings]. It can help us change default language and set application auto running when system power on.
I. Buttons
Double click to open the SteelSeries Engine. I think it can set 4 different keyboard settings for each of profiles. And it can switch by FN+1~4.
[Keypress Marc] can record what you input. And [Record Delays ] can modify the delay time. HA! No game can block us anymore. Please remember to press the [SAVE] for your setting
[Launch Application] can launch any application immediately. I suggest to set the cold key for this function.
Here is example. I use [PgUp] to quick start the 3D Mark11. See, it will pop up when I pressed [PgUp].
It is simple to use [TextMarco] set our own phrase. Now I become a quick speaker in my team. One key, only one key can help me to type a lot of words.
Are you tired to press some keys that you never want to touch in game (Like WIN KEY)? It is not the problem now. [Disable Key] will do the favor and disable any key which you hate.
II. [Colors] can change the color of backlight keyboard. Also, you can set different modes (Gaming/Audio…etc) on it.
We can change the color zone. There is not only 4 or 5 colors. The engine provides thousands of colors for us. [Audio mode] is the coolest. It will change colors by itself when we play music by speakers. I like to dance with my keyboard.
III. We can select different languages by [Settings].
IV. [Properties] can save our hard works of settings reliably.
V. If you want to defeat your competitors, it is important to know your enemy. However, It is more important to know yourself. [Statistics] can help us observe which keys are most popular by our fingers.
Right click on [Profile]. It can modify/export/import/delete the profiles.
Mouse can use the same kind of settings as keyboard.
DPI setting for mouse.
Save files.
We can record the mouse, too.
8. Norton
Norton Internet Security: Anti-Virus software, MSI provides 60 days for free.
Norton Online Backup: Online data backup software, MSI provides 30 days for free.
Norton Anti-Theft: Anti-Theft software, MSI provides 30 days for free.
If you like Norton’s products, you can buy it online.
If you don’t, I believe we can uninstall it directly.
So, the decision is ours.
Introduction from Norton official website
9. Dragon Gaming Center
I. System Monitor:
It can monitor CPU/GPU loading and temperature. We also can find the network speed and fan speed in it.
II. Utility:
You can set your favorite apps in [Add new Utility].
E.g. I added a [MSI Afterburner]. Click [Open] to build the link. Do you feel familiar with something? Exactly, [Launch Application] of [SteelSeries Engine] can do this, too.
III. Instant Play:
We can define [Fn+F4] to enable the quick start. But there is more secret.
We can also use [Browse] to assign the game which we want.
Click the icon of game and [Fn+F4] will be ready. We can only use 1 program at once.
I usually change the brightness, volume and mouse sensitive before the game. As you know, every games are different. It is sweet because we can use [Apply Setting] to do this.
I can’t believe it. We also can find the clock feature in it. How convenient it is!
IV. Hybrid Power is another MSI feature.
It can provide the power by AC adapter and battery in the same time. We can monitor the status in here.
10. BurnRecovery
It can create the recovery CD/DVD/USB for MSI NB.
Here can select Recovery disc/USB/ISO.
I will make a ISO file first.
We can select where to put the ISO.
Creating the recovery file...
Finish!
Open the folder and we can find 4 ISO files in it.
Well…[BurnRecovery Help] provide the details spec.
In my opinion, everyone should create their own recovery image. You will need it in one day.
11. Battery Calibration
This is software for battery calibration. In order to keep our battery good, we should do the calibration every three months. Don’t forget to plug-in the AC adapter and battery during the process..
Press [Start] to begin the process. It will make the battery fully charged first.
Then, it will empty the battery like this.
System will shut down after the empty process. At last, fully charged again. It will take 4~5 hrs to complete the process.
12. MSI Dragoon Army /MSI Facebook /Web site /YouTube
Those are MSI forums/Facebook/official website/YouTube and links.
[MSI Dragoon Army] is the official forum for MSI. We can find NB, MB and AIO info in it.
Facebook Quick Link for many countries of world.
MSI official website
YouTube channel of MSI.
13. Super-Charger
There is no message when I click this app at the first time. But when I attached my IPAD, it pops up the [Super-Charger]. It is amazing because IPAD can’t be charge by this USB port. As far as I know, the USB 3.0 only provides maximum 900mA for its device. IPAD will need 2.1A for charge process. I have no idea how MSI NB make IPAD charging okay.
14. XSplit GameCaster
This is one of important features. I saw many different first class gaming machines this year. All of them have the broadcast software. (Like PS4, Xbos ONE)
It can switch the default language after we login.
Twitch/YouTube / Facebook/ Twitter/Google+ can be used by [Accounts]. It is easy to start the live show.
We can modify the resolution and use twitch by [Setting]
We can configure FPS/CPU loading/where to show on display by [Status label].
Hotkey configuration.
Videos storage.
Press [Ctrl+Tab] to call Gamecaster in game. And we can twitch or modify setting. I will provide my gaming video for you later.
15. Power DVD
This is a famous video player. Also, it can support BD format.
We can use the [Setting] to change our language.
We can change 5 times for default country .
It is glad that I’ve finished the introduction of GT70 software.
Performance report:
Um…Now is late at night. I should go to my lovely bed. Following is the testing report for the reference.
1. FurMark
1920*1080, 15 minutes.
2. AIDA 64
CPU and GPU stress testing, 30 minutes.
3. 3D Mark 11
4. 3DMark Vantage
5. 3DMark 2013
6. Heaven Benchmark 4.0
7. CINBENCH 11.5
8. FINAL FANTASY XIV Benchmark
9. PCMARK 7
10. HD Tune Pro 5.50
11. AS SSD Benchmark
12. Crystal Disk Mark
I didn’t forget my promise. Here is my gaming videos
http://youtu.be/tCd5Lnj2U0IEditors' Choice Award. Good job MSI !!
http://www.computershopper.com/laptops/reviews/msi-gt70-dominator-893#review-body -
Unable to change RFC destination in IT Performance reporting wizard
Hi Experts,
I am setting up IT Performance Reporting in my Solman EHP1 system. In the first page of the PErformance reporting wizard, it asked me for RFC destination from BI to Solman(1st field) and Solman to BI (2nd field). I initially entered an existing RFC destination that we are already using in a separate application that has a user with very-limited authorization. Now, I am trying to change the RFC destination by running the same "Configure IT Performance Reporting" wizard but both fields are already GREYED out.
I tried deleting the RFC destination previously defined in an attempt to reenable the fields but only the 2nd field was enabled. When I try to continue the setup, it results into a Shortdump because it is still looking for the initially defined RFC dest which is defined in the 1st field that cannot be edited.
SAP has not yet provided us with a solution.Your help is greatly appreciated.
Thank you very much.You canprovide the RFC destination in DOE administration portal. Goto Configurations link and search for "BACKEND DESTINATION" parameter in "BACKEND CONFIGURATION" link. Here you can provide RFC destination at SWCV level or at Data object level.
After deleting RFC destination in SM59, it will never take you to backend system. -
Vendor Scorecard Performance Report
The Vendor Scorecard Performance Report data is based on dates entered in the PO (dates provided by the vendor to us at the time we cut the PO or even months after the PO is cut-this date can change) as opposed to our expected lead time (lead time promised by the vendor in general).We always need to put the vendor's advised date in the PO so that our back-order reports have the correct ETA info. Currently, the report will show the vendor as having an almost perfect record because our expected receipt date is based on the vendor's production schedule (whether it is within our expected lead time or not).
We need some kind of indicator in the vendor set up which tells the system that the expected delivery date is "out of tolerance". Is there any way to achieve this and have the report based on expected lead time as opposed to PO dates?
Could somebody please help me to achieve this...?No database version? No example tables and data? No attempt to solve this yourself?
Please provide the necessary details as mentioned in the SQL and PL/SQL FAQ:
{message:id=9360002} -
Is there a standard tcode for payment statistic report to identify payments that really due based on actual pymt date.
hello chloe lam,
That will be possible if your create your report via XLR with required fields.
regards,
Wilma Wang
SAP Business One Forums Team -
What are the main tables using in vendor performance report.
what are the main tables using in vendor performance report.
how many select statements are in ABAP reports.Refer the links -
vendor performance report !!!
vendor performance report
vendor performance report
I need standard vendor performance report
Regards,
Amit
Reward all helpful replies. -
Functiona Spec For VENDOR PERFORMANCE REPORT
Hi experts
I need to develope a VENDOR PERFORMANCE REPORT. But due to some reason i cant be able to get the Functional Specification for that object. So could you please help me by sending the above mention functional Specification.
thnaks and regadrs
PratikPratik,
Bad question in ABAP forum.
can you please close this thread and put it into MM forum for quick reply.
Amit. -
What is vendor performance report what are the fields using in the report
What is vendor performance report what are the fields using in the report and i need some sample reports for that particular topic (clasical report)not using any alvs or any advance topics.
U R Satish Patnaikhi
good
*"Table declarations...................................................
TABLES:
EKKO, " Purchasing Document Header
CDHDR, " Change document header
SSCRFIELDS. " Fields on selection screens
*"Selection screen elements............................................
SELECT-OPTIONS:
S_EBELN FOR EKKO-EBELN, " Purchasing Document Number
S_LIFNR FOR EKKO-LIFNR, " Vendor's account number
S_EKGRP FOR EKKO-EKGRP, " Purchasing group
S_BEDAT FOR EKKO-BEDAT, " Purchasing Document Date
S_UDATE FOR CDHDR-UDATE. " Creation date of the change
" document
*" Data declarations...................................................
Field String to hold Purchase Document Number *
DATA:
BEGIN OF FS_EBELN,
EBELN(90) TYPE C, " Purchase Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created
" the Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EBELN,
Field String to hold Purchase Document Header *
BEGIN OF FS_EKKO,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EKKO,
Field String to hold Account Number and name of the Vendor *
BEGIN OF FS_LFA1,
LIFNR TYPE LFA1-LIFNR, " Account Number of Vendor
NAME1 TYPE LFA1-NAME1, " Name1
END OF FS_LFA1,
Field String to hold Change date and the name of the user *
BEGIN OF FS_CDHDR,
OBJECTCLAS TYPE CDHDR-OBJECTCLAS, " Object Class
OBJECTID TYPE CDHDR-OBJECTID, " Object value
CHANGENR TYPE CDHDR-CHANGENR, " Document change number
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
END OF FS_CDHDR,
Field String to hold Change document items *
BEGIN OF FS_CDPOS,
OBJECTCLAS TYPE CDPOS-OBJECTCLAS," Object class
OBJECTID(10) TYPE C, " Object Value
CHANGENR TYPE CDPOS-CHANGENR, " Document change number
TABNAME TYPE CDPOS-TABNAME, " Table Name
FNAME TYPE CDPOS-FNAME, " Field Name
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_CDPOS,
Field String to hold Date Element Name *
BEGIN OF FS_DATAELE,
TABNAME TYPE DD03L-TABNAME, " Table Name
FIELDNAME TYPE DD03L-FIELDNAME, " Field Name
ROLLNAME TYPE DD03L-ROLLNAME, " Data element (semantic domain)
END OF FS_DATAELE,
Field String to hold Short Text of the Date Element *
BEGIN OF FS_TEXT,
ROLLNAME TYPE DD04T-ROLLNAME, " Data element (semantic domain)
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
END OF FS_TEXT,
Field String to hold data to be displayed on the ALV grid *
BEGIN OF FS_OUTTAB,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
WERKS TYPE LFA1-WERKS, " Plant
NAME1 TYPE LFA1-NAME1, " Name1
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_OUTTAB,
Internal table to hold Purchase Document Number *
T_EBELN LIKE STANDARD TABLE
OF FS_EBELN,
Internal table to hold Purchase Document Header *
T_EKKO LIKE STANDARD TABLE
OF FS_EKKO,
Temp Internal table to hold Purchase Document Header *
T_EKKO_TEMP LIKE STANDARD TABLE
OF FS_EKKO,
Internal table to hold Account number and Name of the Vendor *
T_LFA1 LIKE STANDARD TABLE
OF FS_LFA1,
Internal Table to hold Change date and the name of the user *
T_CDHDR LIKE STANDARD TABLE
OF FS_CDHDR,
Internal Table to hold Change document items *
T_CDPOS LIKE STANDARD TABLE
OF FS_CDPOS,
Temp. Internal Table to hold Change document items *
T_CDPOS_TEMP LIKE STANDARD TABLE
OF FS_CDPOS,
Internal Table to hold Data Element Name *
T_DATAELE LIKE STANDARD TABLE
OF FS_DATAELE,
Temp. Internal Table to hold Data Element Name *
T_DATAELE_TEMP LIKE STANDARD TABLE
OF FS_DATAELE,
Internal Table to hold Short Text of the Date Element *
T_TEXT LIKE STANDARD TABLE
OF FS_TEXT,
Internal Table to hold data to be displayed on the ALV grid *
T_OUTTAB LIKE STANDARD TABLE
OF FS_OUTTAB.
C L A S S D E F I N I T I O N *
CLASS LCL_EVENT_HANDLER DEFINITION DEFERRED.
*" Data declarations...................................................
Work variables *
DATA:
W_EBELN TYPE EKKO-EBELN, " Purchasing Document Number
W_LIFNR TYPE EKKO-LIFNR, " Vendor's account number
W_EKGRP TYPE EKKO-EKGRP, " Purchasing group
W_VALUE TYPE EKKO-EBELN, " Reflected Value
W_SPACE VALUE ' ', " Space
W_FLAG TYPE I, " Flag Variable
W_VARIANT TYPE DISVARIANT, " Variant
*--- ALV Grid
W_GRID TYPE REF TO CL_GUI_ALV_GRID,
*--- Event Handler
W_EVENT_CLICK TYPE REF TO LCL_EVENT_HANDLER,
*--- Field catalog table
T_FIELDCAT TYPE LVC_T_FCAT.
AT SELECTION-SCREEN EVENT *
AT SELECTION-SCREEN ON S_EBELN.
Subroutine to validate Purchase Document Number.
PERFORM VALIDATE_PD_NUM.
AT SELECTION-SCREEN ON S_LIFNR.
Subroutine to validate Vendor Number.
PERFORM VALIDATE_VEN_NUM.
AT SELECTION-SCREEN ON S_EKGRP.
Subroutine to validate Purchase Group.
PERFORM VALIDATE_PUR_GRP.
START-OF-SELECTION EVENT *
START-OF-SELECTION.
Subroutine to select all Purchase orders.
PERFORM SELECT_PO.
CHECK W_FLAG EQ 0.
Subroutine to select Object values.
PERFORM SELECT_OBJ_ID.
CHECK W_FLAG EQ 0.
Subroutine to select Changed values.
PERFORM SELECT_CHANGED_VALUE.
CHECK W_FLAG EQ 0.
Subroutine to Select Purchase Orders.
PERFORM SELECT_PUR_DOC.
Subroutine to select Vendor Details.
PERFORM SELECT_VENDOR.
Subroutine to select Text for the Changed values.
PERFORM DESCRIPTION.
END-OF-SELECTION EVENT *
END-OF-SELECTION.
IF NOT T_EKKO IS INITIAL.
Subroutine to populate the Output Table.
PERFORM FILL_OUTTAB.
Subroutine to build Field Catalog.
PERFORM PREPARE_FIELD_CATALOG CHANGING T_FIELDCAT.
CALL SCREEN 100.
ENDIF. " IF NOT T_EKKO...
CLASS LCL_EVENT_HANDLER DEFINITION
Defining Class which handles events
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID.
ENDCLASS. " LCL_EVENT_HANDLER DEFINITION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION
Implementing the Class which can handle events
CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
*---Handle Double Click
METHOD HANDLE_HOTSPOT_CLICK .
Subroutine to get the HotSpot Cell information.
PERFORM GET_CELL_INFO.
SET PARAMETER ID 'BES' FIELD W_VALUE.
CALL TRANSACTION 'ME23N'.
ENDMETHOD. " HANDLE_HOTSPOT_CLICK
ENDCLASS. " LCL_EVENT_HANDLER
*& Module STATUS_0100 OUTPUT
PBO Event
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'OOPS'.
SET TITLEBAR 'TIT'.
Subroutine to fill the Variant Structure
PERFORM FILL_VARIANT.
IF W_GRID IS INITIAL.
CREATE OBJECT W_GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = CL_GUI_CONTAINER=>SCREEN0
I_APPL_EVENTS =
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC <> 0
CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT = W_VARIANT
I_SAVE = 'A'
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = T_OUTTAB
IT_FIELDCATALOG = T_FIELDCAT
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC <> 0.
ENDIF. " IF W_GRID IS INITIAL
CREATE OBJECT W_EVENT_CLICK.
SET HANDLER W_EVENT_CLICK->HANDLE_HOTSPOT_CLICK FOR W_GRID.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
PAI Event
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form PREPARE_FIELD_CATALOG
Subroutine to build the Field catalog
<--P_T_FIELDCAT Field Catalog Table
FORM PREPARE_FIELD_CATALOG CHANGING PT_FIELDCAT TYPE LVC_T_FCAT .
DATA LS_FCAT TYPE LVC_S_FCAT.
Purchasing group...
LS_FCAT-FIELDNAME = 'EKGRP'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Number...
LS_FCAT-FIELDNAME = 'EBELN'.
LS_FCAT-REF_TABLE = 'EKKO' .
LS_FCAT-EMPHASIZE = 'C411'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-HOTSPOT = 'X'.
APPEND LS_FCAT TO PT_FIELDCAT .
CLEAR LS_FCAT .
Name of Person who Created the Object...
LS_FCAT-FIELDNAME = 'ERNAM'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-OUTPUTLEN = '15' .
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Date...
LS_FCAT-FIELDNAME = 'BEDAT'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Vendor's account number...
LS_FCAT-FIELDNAME = 'LIFNR'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Account Number of Vendor or Creditor...
LS_FCAT-FIELDNAME = 'NAME1'.
LS_FCAT-REF_TABLE = 'LFA1'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Vendor Name'(001).
LS_FCAT-SELTEXT = 'Vendor Name'(001).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Creation date of the change document...
LS_FCAT-FIELDNAME = 'UDATE'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Change Date'(002).
LS_FCAT-SELTEXT = 'Change Date'(002).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
User name of the person responsible in change document...
LS_FCAT-FIELDNAME = 'USERNAME'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Modified by'(003).
LS_FCAT-SELTEXT = 'Modified by'(003).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Short Text Describing R/3 Repository Objects...
LS_FCAT-FIELDNAME = 'DDTEXT'.
LS_FCAT-REF_TABLE = 'DD04T'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '15'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Old contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_OLD'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
New contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_NEW'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
ENDFORM. " PREPARE_FIELD_CATALOG
*& Form SELECT_PO
Subroutine to select all the Purchase Orders
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PO .
SELECT EBELN " Purchasing Document Number
ERNAM " Name of Person who Created
" the Object
LIFNR " Vendor's account number
EKGRP " Purchasing group
BEDAT " Purchasing Document Date
FROM EKKO
PACKAGE SIZE 10000
APPENDING TABLE T_EBELN
WHERE EBELN IN S_EBELN
AND BEDAT IN S_BEDAT.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S401(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDFORM. " SELECT_PO
*& Form SELECT_OBJ_ID
Subroutine to select Object ID
There are no interface parameters to be passed to this subroutine.
FORM SELECT_OBJ_ID .
IF NOT T_EBELN IS INITIAL.
SELECT OBJECTCLAS " Object Class
OBJECTID " Object value
CHANGENR " Document change number
USERNAME " User name
UDATE " Creation date
FROM CDHDR
INTO TABLE T_CDHDR
FOR ALL ENTRIES IN T_EBELN
WHERE OBJECTID EQ T_EBELN-EBELN
AND UDATE IN S_UDATE
AND TCODE IN ('ME21N','ME22N','ME23N').
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Header Not Found'(031).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EBELN IS INITIAL
ENDFORM. " SELECT_OBJ_ID
*& Form SELECT_CHANGED_VALUE
Subroutine to select Changed Values
There are no interface parameters to be passed to this subroutine.
FORM SELECT_CHANGED_VALUE .
IF NOT T_CDHDR IS INITIAL.
SELECT OBJECTCLAS " Object class
OBJECTID " Object value
CHANGENR " Document change number
TABNAME " Table Name
FNAME " Field Name
VALUE_NEW " New contents of changed field
VALUE_OLD " Old contents of changed field
FROM CDPOS
PACKAGE SIZE 10000
APPENDING TABLE T_CDPOS
FOR ALL ENTRIES IN T_CDHDR
WHERE OBJECTCLAS EQ T_CDHDR-OBJECTCLAS
AND OBJECTID EQ T_CDHDR-OBJECTID
AND CHANGENR EQ T_CDHDR-CHANGENR.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Item Not Found'(032).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_CDHDR IS INITIAL
T_CDPOS_TEMP[] = T_CDPOS[].
ENDFORM. " SELECT_CHANGED_VALUE
*& Form SELECT_PUR_DOC
Subroutine to select Purchase Order Details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PUR_DOC .
IF NOT T_CDPOS IS INITIAL.
SORT T_EBELN BY EBELN.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_EBELN INTO FS_EBELN WITH KEY EBELN =
FS_CDPOS-OBJECTID BINARY SEARCH.
IF SY-SUBRC NE 0.
DELETE TABLE T_EBELN FROM FS_EBELN.
ENDIF. " IF SY-SUBRC NE 0.
ENDLOOP. " LOOP AT T_CDPOS...
LOOP AT T_EBELN INTO FS_EBELN.
MOVE FS_EBELN-EBELN TO FS_EKKO-EBELN.
MOVE FS_EBELN-ERNAM TO FS_EKKO-ERNAM.
MOVE FS_EBELN-LIFNR TO FS_EKKO-LIFNR.
MOVE FS_EBELN-EKGRP TO FS_EKKO-EKGRP.
MOVE FS_EBELN-BEDAT TO FS_EKKO-BEDAT.
APPEND FS_EKKO TO T_EKKO.
ENDLOOP. " LOOP AT T_EBELN...
T_EKKO_TEMP[] = T_EKKO[].
ENDIF. " IF NOT T_CDPOS IS INITIAL
ENDFORM. " SELECT_PUR_DOC
*& Form SELECT_VENDOR
Subroutine to select Vendor details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_VENDOR .
IF NOT T_EKKO IS INITIAL.
SORT T_EKKO_TEMP BY LIFNR.
DELETE ADJACENT DUPLICATES FROM T_EKKO_TEMP COMPARING LIFNR.
SELECT LIFNR " Account Number of Vendor or
" Creditor
NAME1 " Name 1
FROM LFA1
INTO TABLE T_LFA1
FOR ALL ENTRIES IN T_EKKO_TEMP
WHERE LIFNR EQ T_EKKO_TEMP-LIFNR.
IF SY-SUBRC NE 0.
MESSAGE S002(M8) WITH 'Master Details'(033).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EKKO IS INITIAL
ENDFORM. " SELECT_VENDOR
*& Form DESCRIPTION
Subroutine to get the description
There are no interface parameters to be passed to this subroutine.
FORM DESCRIPTION .
IF NOT T_CDPOS IS INITIAL.
SORT T_CDPOS_TEMP BY TABNAME FNAME.
DELETE ADJACENT DUPLICATES FROM T_CDPOS_TEMP COMPARING TABNAME FNAME
SELECT TABNAME " Table Name
FIELDNAME " Field Name
ROLLNAME " Data element
FROM DD03L
INTO TABLE T_DATAELE
FOR ALL ENTRIES IN T_CDPOS_TEMP
WHERE TABNAME EQ T_CDPOS_TEMP-TABNAME
AND FIELDNAME EQ T_CDPOS_TEMP-FNAME.
IF NOT T_DATAELE IS INITIAL.
T_DATAELE_TEMP[] = T_DATAELE[].
SORT T_DATAELE_TEMP BY ROLLNAME.
DELETE ADJACENT DUPLICATES FROM T_DATAELE_TEMP COMPARING ROLLNAME.
SELECT ROLLNAME " Data element
DDTEXT " Short Text Describing R/3
" Repository Objects
FROM DD04T
INTO TABLE T_TEXT
FOR ALL ENTRIES IN T_DATAELE_TEMP
WHERE ROLLNAME EQ T_DATAELE_TEMP-ROLLNAME
AND DDLANGUAGE EQ SY-LANGU.
IF SY-SUBRC NE 0.
EXIT.
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_DATAELE IS INITIAL.
ENDIF. " IF NOT T_CDPOS IS INITIAL.
ENDFORM. " DESCRIPTION
*& Form FILL_OUTTAB
Subroutine to populate the Outtab
There are no interface parameters to be passed to this subroutine.
FORM FILL_OUTTAB .
SORT T_CDHDR BY OBJECTCLAS OBJECTID CHANGENR.
SORT T_EKKO BY EBELN.
SORT T_LFA1 BY LIFNR.
SORT T_DATAELE BY TABNAME FIELDNAME.
SORT T_TEXT BY ROLLNAME.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_CDHDR INTO FS_CDHDR WITH KEY
OBJECTCLAS = FS_CDPOS-OBJECTCLAS
OBJECTID = FS_CDPOS-OBJECTID
CHANGENR = FS_CDPOS-CHANGENR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_CDHDR-USERNAME TO FS_OUTTAB-USERNAME.
MOVE FS_CDHDR-UDATE TO FS_OUTTAB-UDATE.
READ TABLE T_EKKO INTO FS_EKKO WITH KEY
EBELN = FS_CDHDR-OBJECTID
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_EKKO-EBELN TO FS_OUTTAB-EBELN.
MOVE FS_EKKO-ERNAM TO FS_OUTTAB-ERNAM.
MOVE FS_EKKO-LIFNR TO FS_OUTTAB-LIFNR.
MOVE FS_EKKO-EKGRP TO FS_OUTTAB-EKGRP.
MOVE FS_EKKO-BEDAT TO FS_OUTTAB-BEDAT.
READ TABLE T_LFA1 INTO FS_LFA1 WITH KEY
LIFNR = FS_EKKO-LIFNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_LFA1-NAME1 TO FS_OUTTAB-NAME1.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
MOVE FS_CDPOS-VALUE_NEW TO FS_OUTTAB-VALUE_NEW.
MOVE FS_CDPOS-VALUE_OLD TO FS_OUTTAB-VALUE_OLD.
READ TABLE T_DATAELE INTO FS_DATAELE WITH KEY
TABNAME = FS_CDPOS-TABNAME
FIELDNAME = FS_CDPOS-FNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
READ TABLE T_TEXT INTO FS_TEXT WITH KEY
ROLLNAME = FS_DATAELE-ROLLNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_TEXT-DDTEXT TO FS_OUTTAB-DDTEXT.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
APPEND FS_OUTTAB TO T_OUTTAB.
CLEAR FS_OUTTAB.
ENDLOOP.
ENDFORM. " FILL_OUTTAB
*& Form GET_CELL_INFO
Subroutine to get the Cell Information
--> W_VALUE Holds the value of Hotspot clicked
FORM GET_CELL_INFO .
CALL METHOD W_GRID->GET_CURRENT_CELL
IMPORTING
E_ROW =
E_VALUE = W_VALUE
E_COL =
ES_ROW_ID =
ES_COL_ID =
ES_ROW_NO =
ENDFORM. " GET_CELL_INFO
*& Form VALIDATE_PD_NUM
Subroutine to validate Purchase Document Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PD_NUM .
IF NOT S_EBELN[] IS INITIAL.
SELECT EBELN " Purchase Document Number
FROM EKKO
INTO W_EBELN
UP TO 1 ROWS
WHERE EBELN IN S_EBELN.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E717(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EBELN[]...
ENDFORM. " VALIDATE_PD_NUM
*& Form VALIDATE_VEN_NUM
Subroutine to validate Vendor Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_VEN_NUM .
IF NOT S_LIFNR[] IS INITIAL.
SELECT LIFNR " Vendor Number
FROM LFA1
INTO W_LIFNR
UP TO 1 ROWS
WHERE LIFNR IN S_LIFNR.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E002(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_LIFNR[]...
ENDFORM. " VALIDATE_VEN_NUM
*& Form VALIDATE_PUR_GRP
Subroutine to validate the Purchase Group
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PUR_GRP .
IF NOT S_EKGRP[] IS INITIAL.
SELECT EKGRP " Purchase Group
FROM T024
INTO W_EKGRP
UP TO 1 ROWS
WHERE EKGRP IN S_EKGRP.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E622(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EKFRP[]...
ENDFORM. " VALIDATE_PUR_GRP
*& Form FILL_VARIANT
Subroutine to fill the Variant Structure
There are no interface parameters to be passed to this subroutine
FORM FILL_VARIANT .
Filling the Variant structure
W_VARIANT-REPORT = SY-REPID.
W_VARIANT-USERNAME = SY-UNAME.
ENDFORM. " FILL_VARIANT
reward point if helpful.
thanks
mrutyun^ -
Need Vendor performance report
i want Vendor performance report based on which you finalise the PO on a particular vendor?
pls give the source codeSee this sample code
*"Table declarations...................................................
TABLES:
EKKO, " Purchasing Document Header
CDHDR, " Change document header
SSCRFIELDS. " Fields on selection screens
*"Selection screen elements............................................
SELECT-OPTIONS:
S_EBELN FOR EKKO-EBELN, " Purchasing Document Number
S_LIFNR FOR EKKO-LIFNR, " Vendor's account number
S_EKGRP FOR EKKO-EKGRP, " Purchasing group
S_BEDAT FOR EKKO-BEDAT, " Purchasing Document Date
S_UDATE FOR CDHDR-UDATE. " Creation date of the change
" document
*" Data declarations...................................................
Field String to hold Purchase Document Number *
DATA:
BEGIN OF FS_EBELN,
EBELN(90) TYPE C, " Purchase Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created
" the Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EBELN,
Field String to hold Purchase Document Header *
BEGIN OF FS_EKKO,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EKKO,
Field String to hold Account Number and name of the Vendor *
BEGIN OF FS_LFA1,
LIFNR TYPE LFA1-LIFNR, " Account Number of Vendor
NAME1 TYPE LFA1-NAME1, " Name1
END OF FS_LFA1,
Field String to hold Change date and the name of the user *
BEGIN OF FS_CDHDR,
OBJECTCLAS TYPE CDHDR-OBJECTCLAS, " Object Class
OBJECTID TYPE CDHDR-OBJECTID, " Object value
CHANGENR TYPE CDHDR-CHANGENR, " Document change number
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
END OF FS_CDHDR,
Field String to hold Change document items *
BEGIN OF FS_CDPOS,
OBJECTCLAS TYPE CDPOS-OBJECTCLAS," Object class
OBJECTID(10) TYPE C, " Object Value
CHANGENR TYPE CDPOS-CHANGENR, " Document change number
TABNAME TYPE CDPOS-TABNAME, " Table Name
FNAME TYPE CDPOS-FNAME, " Field Name
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_CDPOS,
Field String to hold Date Element Name *
BEGIN OF FS_DATAELE,
TABNAME TYPE DD03L-TABNAME, " Table Name
FIELDNAME TYPE DD03L-FIELDNAME, " Field Name
ROLLNAME TYPE DD03L-ROLLNAME, " Data element (semantic domain)
END OF FS_DATAELE,
Field String to hold Short Text of the Date Element *
BEGIN OF FS_TEXT,
ROLLNAME TYPE DD04T-ROLLNAME, " Data element (semantic domain)
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
END OF FS_TEXT,
Field String to hold data to be displayed on the ALV grid *
BEGIN OF FS_OUTTAB,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
WERKS TYPE LFA1-WERKS, " Plant
NAME1 TYPE LFA1-NAME1, " Name1
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_OUTTAB,
Internal table to hold Purchase Document Number *
T_EBELN LIKE STANDARD TABLE
OF FS_EBELN,
Internal table to hold Purchase Document Header *
T_EKKO LIKE STANDARD TABLE
OF FS_EKKO,
Temp Internal table to hold Purchase Document Header *
T_EKKO_TEMP LIKE STANDARD TABLE
OF FS_EKKO,
Internal table to hold Account number and Name of the Vendor *
T_LFA1 LIKE STANDARD TABLE
OF FS_LFA1,
Internal Table to hold Change date and the name of the user *
T_CDHDR LIKE STANDARD TABLE
OF FS_CDHDR,
Internal Table to hold Change document items *
T_CDPOS LIKE STANDARD TABLE
OF FS_CDPOS,
Temp. Internal Table to hold Change document items *
T_CDPOS_TEMP LIKE STANDARD TABLE
OF FS_CDPOS,
Internal Table to hold Data Element Name *
T_DATAELE LIKE STANDARD TABLE
OF FS_DATAELE,
Temp. Internal Table to hold Data Element Name *
T_DATAELE_TEMP LIKE STANDARD TABLE
OF FS_DATAELE,
Internal Table to hold Short Text of the Date Element *
T_TEXT LIKE STANDARD TABLE
OF FS_TEXT,
Internal Table to hold data to be displayed on the ALV grid *
T_OUTTAB LIKE STANDARD TABLE
OF FS_OUTTAB.
C L A S S D E F I N I T I O N *
CLASS LCL_EVENT_HANDLER DEFINITION DEFERRED.
*" Data declarations...................................................
Work variables *
DATA:
W_EBELN TYPE EKKO-EBELN, " Purchasing Document Number
W_LIFNR TYPE EKKO-LIFNR, " Vendor's account number
W_EKGRP TYPE EKKO-EKGRP, " Purchasing group
W_VALUE TYPE EKKO-EBELN, " Reflected Value
W_SPACE VALUE ' ', " Space
W_FLAG TYPE I, " Flag Variable
W_VARIANT TYPE DISVARIANT, " Variant
*--- ALV Grid
W_GRID TYPE REF TO CL_GUI_ALV_GRID,
*--- Event Handler
W_EVENT_CLICK TYPE REF TO LCL_EVENT_HANDLER,
*--- Field catalog table
T_FIELDCAT TYPE LVC_T_FCAT.
AT SELECTION-SCREEN EVENT *
AT SELECTION-SCREEN ON S_EBELN.
Subroutine to validate Purchase Document Number.
PERFORM VALIDATE_PD_NUM.
AT SELECTION-SCREEN ON S_LIFNR.
Subroutine to validate Vendor Number.
PERFORM VALIDATE_VEN_NUM.
AT SELECTION-SCREEN ON S_EKGRP.
Subroutine to validate Purchase Group.
PERFORM VALIDATE_PUR_GRP.
START-OF-SELECTION EVENT *
START-OF-SELECTION.
Subroutine to select all Purchase orders.
PERFORM SELECT_PO.
CHECK W_FLAG EQ 0.
Subroutine to select Object values.
PERFORM SELECT_OBJ_ID.
CHECK W_FLAG EQ 0.
Subroutine to select Changed values.
PERFORM SELECT_CHANGED_VALUE.
CHECK W_FLAG EQ 0.
Subroutine to Select Purchase Orders.
PERFORM SELECT_PUR_DOC.
Subroutine to select Vendor Details.
PERFORM SELECT_VENDOR.
Subroutine to select Text for the Changed values.
PERFORM DESCRIPTION.
END-OF-SELECTION EVENT *
END-OF-SELECTION.
IF NOT T_EKKO IS INITIAL.
Subroutine to populate the Output Table.
PERFORM FILL_OUTTAB.
Subroutine to build Field Catalog.
PERFORM PREPARE_FIELD_CATALOG CHANGING T_FIELDCAT.
CALL SCREEN 100.
ENDIF. " IF NOT T_EKKO...
CLASS LCL_EVENT_HANDLER DEFINITION
Defining Class which handles events
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID.
ENDCLASS. " LCL_EVENT_HANDLER DEFINITION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION
Implementing the Class which can handle events
CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
*---Handle Double Click
METHOD HANDLE_HOTSPOT_CLICK .
Subroutine to get the HotSpot Cell information.
PERFORM GET_CELL_INFO.
SET PARAMETER ID 'BES' FIELD W_VALUE.
CALL TRANSACTION 'ME23N'.
ENDMETHOD. " HANDLE_HOTSPOT_CLICK
ENDCLASS. " LCL_EVENT_HANDLER
*& Module STATUS_0100 OUTPUT
PBO Event
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'OOPS'.
SET TITLEBAR 'TIT'.
Subroutine to fill the Variant Structure
PERFORM FILL_VARIANT.
IF W_GRID IS INITIAL.
CREATE OBJECT W_GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = CL_GUI_CONTAINER=>SCREEN0
I_APPL_EVENTS =
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC <> 0
CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT = W_VARIANT
I_SAVE = 'A'
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = T_OUTTAB
IT_FIELDCATALOG = T_FIELDCAT
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC <> 0.
ENDIF. " IF W_GRID IS INITIAL
CREATE OBJECT W_EVENT_CLICK.
SET HANDLER W_EVENT_CLICK->HANDLE_HOTSPOT_CLICK FOR W_GRID.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
PAI Event
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form PREPARE_FIELD_CATALOG
Subroutine to build the Field catalog
<--P_T_FIELDCAT Field Catalog Table
FORM PREPARE_FIELD_CATALOG CHANGING PT_FIELDCAT TYPE LVC_T_FCAT .
DATA LS_FCAT TYPE LVC_S_FCAT.
Purchasing group...
LS_FCAT-FIELDNAME = 'EKGRP'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Number...
LS_FCAT-FIELDNAME = 'EBELN'.
LS_FCAT-REF_TABLE = 'EKKO' .
LS_FCAT-EMPHASIZE = 'C411'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-HOTSPOT = 'X'.
APPEND LS_FCAT TO PT_FIELDCAT .
CLEAR LS_FCAT .
Name of Person who Created the Object...
LS_FCAT-FIELDNAME = 'ERNAM'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-OUTPUTLEN = '15' .
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Date...
LS_FCAT-FIELDNAME = 'BEDAT'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Vendor's account number...
LS_FCAT-FIELDNAME = 'LIFNR'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Account Number of Vendor or Creditor...
LS_FCAT-FIELDNAME = 'NAME1'.
LS_FCAT-REF_TABLE = 'LFA1'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Vendor Name'(001).
LS_FCAT-SELTEXT = 'Vendor Name'(001).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Creation date of the change document...
LS_FCAT-FIELDNAME = 'UDATE'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Change Date'(002).
LS_FCAT-SELTEXT = 'Change Date'(002).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
User name of the person responsible in change document...
LS_FCAT-FIELDNAME = 'USERNAME'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Modified by'(003).
LS_FCAT-SELTEXT = 'Modified by'(003).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Short Text Describing R/3 Repository Objects...
LS_FCAT-FIELDNAME = 'DDTEXT'.
LS_FCAT-REF_TABLE = 'DD04T'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '15'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Old contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_OLD'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
New contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_NEW'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
ENDFORM. " PREPARE_FIELD_CATALOG
*& Form SELECT_PO
Subroutine to select all the Purchase Orders
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PO .
SELECT EBELN " Purchasing Document Number
ERNAM " Name of Person who Created
" the Object
LIFNR " Vendor's account number
EKGRP " Purchasing group
BEDAT " Purchasing Document Date
FROM EKKO
PACKAGE SIZE 10000
APPENDING TABLE T_EBELN
WHERE EBELN IN S_EBELN
AND BEDAT IN S_BEDAT.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S401(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDFORM. " SELECT_PO
*& Form SELECT_OBJ_ID
Subroutine to select Object ID
There are no interface parameters to be passed to this subroutine.
FORM SELECT_OBJ_ID .
IF NOT T_EBELN IS INITIAL.
SELECT OBJECTCLAS " Object Class
OBJECTID " Object value
CHANGENR " Document change number
USERNAME " User name
UDATE " Creation date
FROM CDHDR
INTO TABLE T_CDHDR
FOR ALL ENTRIES IN T_EBELN
WHERE OBJECTID EQ T_EBELN-EBELN
AND UDATE IN S_UDATE
AND TCODE IN ('ME21N','ME22N','ME23N').
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Header Not Found'(031).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EBELN IS INITIAL
ENDFORM. " SELECT_OBJ_ID
*& Form SELECT_CHANGED_VALUE
Subroutine to select Changed Values
There are no interface parameters to be passed to this subroutine.
FORM SELECT_CHANGED_VALUE .
IF NOT T_CDHDR IS INITIAL.
SELECT OBJECTCLAS " Object class
OBJECTID " Object value
CHANGENR " Document change number
TABNAME " Table Name
FNAME " Field Name
VALUE_NEW " New contents of changed field
VALUE_OLD " Old contents of changed field
FROM CDPOS
PACKAGE SIZE 10000
APPENDING TABLE T_CDPOS
FOR ALL ENTRIES IN T_CDHDR
WHERE OBJECTCLAS EQ T_CDHDR-OBJECTCLAS
AND OBJECTID EQ T_CDHDR-OBJECTID
AND CHANGENR EQ T_CDHDR-CHANGENR.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Item Not Found'(032).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_CDHDR IS INITIAL
T_CDPOS_TEMP[] = T_CDPOS[].
ENDFORM. " SELECT_CHANGED_VALUE
*& Form SELECT_PUR_DOC
Subroutine to select Purchase Order Details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PUR_DOC .
IF NOT T_CDPOS IS INITIAL.
SORT T_EBELN BY EBELN.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_EBELN INTO FS_EBELN WITH KEY EBELN =
FS_CDPOS-OBJECTID BINARY SEARCH.
IF SY-SUBRC NE 0.
DELETE TABLE T_EBELN FROM FS_EBELN.
ENDIF. " IF SY-SUBRC NE 0.
ENDLOOP. " LOOP AT T_CDPOS...
LOOP AT T_EBELN INTO FS_EBELN.
MOVE FS_EBELN-EBELN TO FS_EKKO-EBELN.
MOVE FS_EBELN-ERNAM TO FS_EKKO-ERNAM.
MOVE FS_EBELN-LIFNR TO FS_EKKO-LIFNR.
MOVE FS_EBELN-EKGRP TO FS_EKKO-EKGRP.
MOVE FS_EBELN-BEDAT TO FS_EKKO-BEDAT.
APPEND FS_EKKO TO T_EKKO.
ENDLOOP. " LOOP AT T_EBELN...
T_EKKO_TEMP[] = T_EKKO[].
ENDIF. " IF NOT T_CDPOS IS INITIAL
ENDFORM. " SELECT_PUR_DOC
*& Form SELECT_VENDOR
Subroutine to select Vendor details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_VENDOR .
IF NOT T_EKKO IS INITIAL.
SORT T_EKKO_TEMP BY LIFNR.
DELETE ADJACENT DUPLICATES FROM T_EKKO_TEMP COMPARING LIFNR.
SELECT LIFNR " Account Number of Vendor or
" Creditor
NAME1 " Name 1
FROM LFA1
INTO TABLE T_LFA1
FOR ALL ENTRIES IN T_EKKO_TEMP
WHERE LIFNR EQ T_EKKO_TEMP-LIFNR.
IF SY-SUBRC NE 0.
MESSAGE S002(M8) WITH 'Master Details'(033).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EKKO IS INITIAL
ENDFORM. " SELECT_VENDOR
*& Form DESCRIPTION
Subroutine to get the description
There are no interface parameters to be passed to this subroutine.
FORM DESCRIPTION .
IF NOT T_CDPOS IS INITIAL.
SORT T_CDPOS_TEMP BY TABNAME FNAME.
DELETE ADJACENT DUPLICATES FROM T_CDPOS_TEMP COMPARING TABNAME FNAME
SELECT TABNAME " Table Name
FIELDNAME " Field Name
ROLLNAME " Data element
FROM DD03L
INTO TABLE T_DATAELE
FOR ALL ENTRIES IN T_CDPOS_TEMP
WHERE TABNAME EQ T_CDPOS_TEMP-TABNAME
AND FIELDNAME EQ T_CDPOS_TEMP-FNAME.
IF NOT T_DATAELE IS INITIAL.
T_DATAELE_TEMP[] = T_DATAELE[].
SORT T_DATAELE_TEMP BY ROLLNAME.
DELETE ADJACENT DUPLICATES FROM T_DATAELE_TEMP COMPARING ROLLNAME.
SELECT ROLLNAME " Data element
DDTEXT " Short Text Describing R/3
" Repository Objects
FROM DD04T
INTO TABLE T_TEXT
FOR ALL ENTRIES IN T_DATAELE_TEMP
WHERE ROLLNAME EQ T_DATAELE_TEMP-ROLLNAME
AND DDLANGUAGE EQ SY-LANGU.
IF SY-SUBRC NE 0.
EXIT.
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_DATAELE IS INITIAL.
ENDIF. " IF NOT T_CDPOS IS INITIAL.
ENDFORM. " DESCRIPTION
*& Form FILL_OUTTAB
Subroutine to populate the Outtab
There are no interface parameters to be passed to this subroutine.
FORM FILL_OUTTAB .
SORT T_CDHDR BY OBJECTCLAS OBJECTID CHANGENR.
SORT T_EKKO BY EBELN.
SORT T_LFA1 BY LIFNR.
SORT T_DATAELE BY TABNAME FIELDNAME.
SORT T_TEXT BY ROLLNAME.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_CDHDR INTO FS_CDHDR WITH KEY
OBJECTCLAS = FS_CDPOS-OBJECTCLAS
OBJECTID = FS_CDPOS-OBJECTID
CHANGENR = FS_CDPOS-CHANGENR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_CDHDR-USERNAME TO FS_OUTTAB-USERNAME.
MOVE FS_CDHDR-UDATE TO FS_OUTTAB-UDATE.
READ TABLE T_EKKO INTO FS_EKKO WITH KEY
EBELN = FS_CDHDR-OBJECTID
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_EKKO-EBELN TO FS_OUTTAB-EBELN.
MOVE FS_EKKO-ERNAM TO FS_OUTTAB-ERNAM.
MOVE FS_EKKO-LIFNR TO FS_OUTTAB-LIFNR.
MOVE FS_EKKO-EKGRP TO FS_OUTTAB-EKGRP.
MOVE FS_EKKO-BEDAT TO FS_OUTTAB-BEDAT.
READ TABLE T_LFA1 INTO FS_LFA1 WITH KEY
LIFNR = FS_EKKO-LIFNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_LFA1-NAME1 TO FS_OUTTAB-NAME1.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
MOVE FS_CDPOS-VALUE_NEW TO FS_OUTTAB-VALUE_NEW.
MOVE FS_CDPOS-VALUE_OLD TO FS_OUTTAB-VALUE_OLD.
READ TABLE T_DATAELE INTO FS_DATAELE WITH KEY
TABNAME = FS_CDPOS-TABNAME
FIELDNAME = FS_CDPOS-FNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
READ TABLE T_TEXT INTO FS_TEXT WITH KEY
ROLLNAME = FS_DATAELE-ROLLNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_TEXT-DDTEXT TO FS_OUTTAB-DDTEXT.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
APPEND FS_OUTTAB TO T_OUTTAB.
CLEAR FS_OUTTAB.
ENDLOOP.
ENDFORM. " FILL_OUTTAB
*& Form GET_CELL_INFO
Subroutine to get the Cell Information
--> W_VALUE Holds the value of Hotspot clicked
FORM GET_CELL_INFO .
CALL METHOD W_GRID->GET_CURRENT_CELL
IMPORTING
E_ROW =
E_VALUE = W_VALUE
E_COL =
ES_ROW_ID =
ES_COL_ID =
ES_ROW_NO =
ENDFORM. " GET_CELL_INFO
*& Form VALIDATE_PD_NUM
Subroutine to validate Purchase Document Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PD_NUM .
IF NOT S_EBELN[] IS INITIAL.
SELECT EBELN " Purchase Document Number
FROM EKKO
INTO W_EBELN
UP TO 1 ROWS
WHERE EBELN IN S_EBELN.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E717(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EBELN[]...
ENDFORM. " VALIDATE_PD_NUM
*& Form VALIDATE_VEN_NUM
Subroutine to validate Vendor Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_VEN_NUM .
IF NOT S_LIFNR[] IS INITIAL.
SELECT LIFNR " Vendor Number
FROM LFA1
INTO W_LIFNR
UP TO 1 ROWS
WHERE LIFNR IN S_LIFNR.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E002(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_LIFNR[]...
ENDFORM. " VALIDATE_VEN_NUM
*& Form VALIDATE_PUR_GRP
Subroutine to validate the Purchase Group
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PUR_GRP .
IF NOT S_EKGRP[] IS INITIAL.
SELECT EKGRP " Purchase Group
FROM T024
INTO W_EKGRP
UP TO 1 ROWS
WHERE EKGRP IN S_EKGRP.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E622(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EKFRP[]...
ENDFORM. " VALIDATE_PUR_GRP
*& Form FILL_VARIANT
Subroutine to fill the Variant Structure
There are no interface parameters to be passed to this subroutine
FORM FILL_VARIANT .
Filling the Variant structure
W_VARIANT-REPORT = SY-REPID.
W_VARIANT-USERNAME = SY-UNAME.
ENDFORM. " FILL_VARIANT
Regards,
Pavan. -
U0095 Vendor performance report this report gives performance of supplier to se
Vendor performance report this report gives performance of supplier to send an order to customer
Kiran,
The functionality you are asking sounds like standard functionality. Doesn't make sense to custom develop the same.
Make sure you search and confirm that standard reports are NOT available for the same.
Regards,
Ravi
Note : please mark the helpful answers
Maybe you are looking for
-
I am a complete novice to Dreamweaver so please bear with me. I am trying to edit some pages (.php files) for my employer. I was able to edit the index.php file but none of the others. All of the html code is greyed out except certain areas and unfor
-
Problem with Time Machine backup (Snow Leopard)
Hello everyone. So today I was doing a backup and my external hard drive fell off the tabel and disconnected itself mid-back up. Now I am getting this error when I attempt to do the backup again, "This backup is too large for the backup disk. The bac
-
I am stuck on some things and I can't find them in my book so here goes. I need to determine if a string is even or odd and then return letters from that word based on which it is. I think i need to use a boolean for the even or odd (not for sure) an
-
Question marks appear in my browsers now, used as quotation marks...
Lately all sorts of question marks are appearing in certian parts of my browsers, I think that somehow a font is corrupted or something... it appears they are there appostrophies and quotations marks should be; this is very annoying. How can I fix th
-
Still can't launch any updated iWorks apps after after reinstalling Mavericks
So Mavericks works fine and my old versions of iWorks apps were fine. The they updated to later versions. First of all I had issues, then realized that the old icons were still on the Dock. Once removed, they worked. Also removed old apps from the Ap