ลิขิตฟ้า หรือ จะสู้มานะคน

chon_pro
Location :
สมุทรปราการ Thailand

[Profile ทั้งหมด]

ให้ทิปเจ้าของ Blog [?]
ฝากข้อความหลังไมค์
Rss Feed
Smember
ผู้ติดตามบล็อก : 12 คน [?]




ผมแค่อยากเขียน บันทึกเกี่ยวกับข้อมูลการทำงานของผมต่างๆ เพื่อเก็บเอาไว้ใช้ดูเวลาที่ผมหลงลืม และเพื่อเป็นประโยชน์ กับน้องๆๆๆ ทั้งหลาย
loaocat

Stat Counter :
Group Blog
 
All Blogs
 
Friends' blogs
[Add chon_pro's blog to your web]
Links
 

 

ZPP264_V2 booking test lens to Sales Stock

report zpp264 no standard page heading
line-count 50(2) line-size 165
message-id zrtc.

tables: vbak,
vbap,
vbuk,
vbup.

data: messtab like bdcmsgcoll occurs 0 with header line,
bdcdata like bdcdata occurs 0 with header line.

data: begin of iexcel occurs 0,
item(5) type c,
matnr like vbap-matnr,
desc(60) type c,
qty(5) type c,
remark(20) type c,
end of iexcel.

data: begin of ivbak occurs 0,
vbeln like vbak-vbeln,
erdat like vbak-erdat,
auart like vbak-auart,
end of ivbak.

data: begin of ivbap occurs 0,
matnr like vbap-matnr,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
auart like vbak-auart,
end of ivbap.


data: begin of itab occurs 0,
auart like vbak-auart,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
qty(5) type c,
item(5) type c,
desc(60) type c,
remark(20) type c,
end of itab.

data: begin of itab_err occurs 0,
auart like vbak-auart,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
qty(5) type c,
item(5) type c,
desc(60) type c,
remark(20) type c,
end of itab_err.

data: begin of itab_confirm occurs 0,
auart like vbak-auart,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
qty(5) type c,
item(5) type c,
desc(60) type c,
remark(20) type c,
end of itab_confirm.


data: begin of etab occurs 0,
item(5) type c,
matnr like vbap-matnr,
desc(60) type c,
qty(5) type c,
remark(20) type c,
end of etab.
*** Excel output file **************
data: begin of ohead occurs 0,
f1(10) type c,
tab1(1) type c value '|',
f2(20) type c,
tab2(1) type c value '|',
f3(60) type c,
tab3(1) type c value '|',
f4(10) type c,
tab4(1) type c value '|',
f5(20) type c,
tab5(1) type c value '|',
end of ohead.

data: begin of ohead_xls occurs 0,
item(5) type c,
tab1(1) type c value '|',
matnr like vbap-matnr,
tab2(1) type c value '|',
desc(60) type c,
tab3(1) type c value '|',
qty(5) type c,
tab4(1) type c value '|',
remark(20) type c,
tab5(1) type c value '|',
end of ohead_xls.


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

selection-screen begin of block 0 with frame title text-005.
parameters: r_MB1C radiobutton group grp0,
r_MB1B radiobutton group grp0.
selection-screen end of block 0.

selection-screen begin of block 1 with frame title text-000.

select-options: s_vbeln for vbak-vbeln.
selection-screen skip 1.
parameters: p_erdat like vbak-erdat.
selection-screen end of block 1.

selection-screen begin of block 2 with frame title text-000.
selection-screen skip 1.

parameters: p_file1 like rlgrap-filename
default 'e:Direct.txt'
obligatory.

parameters: r_zro radiobutton group grp1,
r_zdi radiobutton group grp1.

selection-screen skip 1.

parameters: p_lgort like mard-lgort obligatory default '0050'.
selection-screen skip 1.


parameters: o_file1 like rlgrap-filename
default 'D:zpp264out.xls'
obligatory.

parameter: bdc_mode(1) type c default 'N' obligatory.

selection-screen end of block 2.

*** top-of-page ****
top-of-page.

call function 'Z_STANDARD_HEADING_OF_RTC'
EXPORTING
heading = 'List of Item posted to Sales Stock'
prog = 'ZPP264'
EXCEPTIONS
others = 1.

perform column_header.

**** initialization ****.
initialization.

p_erdat = sy-datum - 180.

at selection-screen on value-request for p_file1.
perform get_text_filename using p_file1.

at selection-screen on value-request for o_file1.
perform get_text_filename using o_file1.


start-of-selection.
clear: ivbak,
iexcel.
refresh: ivbak,
iexcel.

perform upload_text_file using p_file1.
if not iexcel[] is initial.

perform get_vbak_data.
perform get_sale_item_data.
perform process_data.

if not itab[] is initial.

if not r_mb1b is initial.
perform bdc_process_zdi_412e.
endif.

if not r_mb1c is initial.
if r_zro = 'X' .
perform bdc_process_zro.
if not etab[] is initial.
perform create_excel_field_name.
perform write_out_excel_format.
endif.
else.

clear: itab_err.
refresh: itab_err.


perform bdc_process_zdi_521e.
if not etab[] is initial.
perform bdc_process_zdi_521.
endif.

endif.
else. "No selected item found for Input file.

if not etab[] is initial.
perform create_excel_field_name.
perform write_out_excel_format.
endif.

endif.
endif.

if not itab_confirm[] is initial.
loop at itab_confirm.

write: /(01) sy-vline no-gap,
(10) itab_confirm-item no-gap,
(01) sy-vline no-gap,
(10) itab_confirm-auart no-gap,
(01) sy-vline no-gap,
(15) itab_confirm-vbeln no-gap,
(01) sy-vline no-gap,
(10) itab_confirm-posnr no-gap,
(01) sy-vline no-gap,
(20) itab_confirm-matnr no-gap,
(01) sy-vline no-gap,
(60) itab_confirm-desc no-gap,
(01) sy-vline no-gap,
(10) itab_confirm-qty no-gap,
(01) sy-vline no-gap,
(20) itab_confirm-remark,
(01) sy-vline no-gap.
at last.
perform end_of_report.
endat.
endloop.
endif.

endif.

end-of-selection.

*&---------------------------------------------------------------------*
*& Form get_text_filename
*&---------------------------------------------------------------------*
form get_text_filename using p_file.
call function 'WS_FILENAME_GET'
EXPORTING
mask = ',*.*,*.*.'
mode = 'O'
def_path = 'c:'
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 01
no_batch = 02
selection_cancel = 03
selection_error = 04.

endform. " get_text_filename
*&---------------------------------------------------------------------*
*& Form upload_text_file
*&---------------------------------------------------------------------*
form upload_text_file using p_file.
call function 'WS_UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = iexcel
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
others = 10.

if sy-subrc <> 0.
message e000 with 'Can not upload text file'.
else.
delete iexcel index 1.
delete iexcel where matnr is initial.
endif.

endform. " upload_text_file
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
form get_vbak_data.

select vbeln erdat auart
into (ivbak-vbeln,
ivbak-erdat,
ivbak-auart)
from vbak
where vbeln in s_vbeln
and erdat ge p_erdat.
select single lfstk into vbuk-lfstk
from vbuk
where vbeln = ivbak-vbeln
and lfstk ne 'C'.
if sy-subrc = 0.
append ivbak.
clear ivbak.
endif.
endselect.

endform.
*&---------------------------------------------------------------------*
*& Form process_data
*&---------------------------------------------------------------------*
form process_data.
clear: itab, etab.
refresh: itab, etab.

loop at iexcel.
read table ivbap with key matnr = iexcel-matnr.
if sy-subrc = 0.
itab-vbeln = ivbap-vbeln.
itab-posnr = ivbap-posnr.
itab-matnr = ivbap-matnr.
itab-qty = iexcel-qty.
itab-item = iexcel-item.
itab-desc = iexcel-desc.
itab-remark = iexcel-remark.
itab-auart = ivbap-auart.
append itab.
clear itab.
else.
etab-matnr = iexcel-matnr.
etab-qty = iexcel-qty.
etab-item = iexcel-item.
etab-desc = iexcel-desc.
etab-remark = iexcel-remark.
append etab.
clear etab.

endif.
endloop.

endform. " process_data
*&---------------------------------------------------------------------*
*& Form get_sale_item_data
*&---------------------------------------------------------------------*
form get_sale_item_data.

if not ivbak[] is initial.
clear: ivbap.
refresh: ivbap.
loop at ivbak.
select vbeln posnr matnr into (vbap-vbeln,
vbap-posnr,
vbap-matnr)
from vbap
where vbeln = ivbak-vbeln.
select single * from vbup
where vbeln = vbap-vbeln
and posnr = vbap-posnr
and lfsta <> 'C'.
if sy-subrc = 0.
ivbap-vbeln = vbap-vbeln.
ivbap-posnr = vbap-posnr.
ivbap-matnr = vbap-matnr.
shift ivbap-matnr left deleting leading '0'.
ivbap-auart = ivbak-auart.
append ivbap.
clear ivbap.
endif.
endselect.
endloop.

else.
message e000 with
'No Sales Order found in VBAK according to your selection'.
endif.

endform. " get_sale_item_data
*&---------------------------------------------------------------------*
*& Form bdc_process
*&---------------------------------------------------------------------*
form bdc_process_zro.

clear: itab_err.
refresh: itab_err.

sort itab by auart vbeln posnr.
loop at itab.
perform bdc_for_zro_zros.

endloop.



endform. " bdc_process
*&---------------------------------------------------------------------*
*& Form BDC_DYNPRO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0412 text *
* -->P_0413 text *
*----------------------------------------------------------------------*
form bdc_dynpro tables bdcdata structure bdcdata
using program
dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata.
clear bdcdata.

endform. " BDC_DYNPRO

*&---------------------------------------------------------------------*
*& Form BDC_FIELD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0417 text *
* -->P_0418 text *
*----------------------------------------------------------------------*
form bdc_field tables bdcdata structure bdcdata
using fnam
fval.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.

endform. " BDC_FIELD
*&---------------------------------------------------------------------*
*& Form bdc_for_zro_zros
*&---------------------------------------------------------------------*
form bdc_for_zro_zros.
clear bdcdata.
refresh bdcdata.

perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0400'.

perform bdc_field tables bdcdata
using 'RM07M-BWARTWA'
'521'.

perform bdc_field tables bdcdata
using 'RM07M-SOBKZ'
'E'.

perform bdc_field tables bdcdata
using 'XFULL'
' '.

perform bdc_field tables bdcdata
using 'RM07M-WERKS'
'0006'.

perform bdc_field tables bdcdata
using 'RM07M-LGORT'
p_lgort.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '/00'.


perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0421'.

perform bdc_field tables bdcdata
using 'MSEGK-MAT_KDAUF'
itab-vbeln.

perform bdc_field tables bdcdata
using 'MSEGK-MAT_KDPOS'
itab-posnr.

perform bdc_field tables bdcdata
using 'MSEG-MATNR(01)'
itab-matnr.

perform bdc_field tables bdcdata
using 'MSEG-ERFMG(01)'
itab-qty.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '=BU'.



call transaction 'MB1C' using bdcdata mode bdc_mode
update 'S' MESSAGES INTO messtab..


if sy-subrc <> 0.
move-corresponding itab to itab_confirm.
itab_confirm-remark = 'ERROR'.
append itab_confirm.
clear itab_confirm.
else.
move-corresponding itab to itab_confirm.
read table messtab index sy-tfill.
if sy-subrc = 0.
move messtab-msgv1 to itab_confirm-remark.
endif.

append itab_confirm.
clear itab_confirm.
endif.

endform. " bdc_for_zro_zros
*&---------------------------------------------------------------------*
*& Form create_excel_field_name
*&---------------------------------------------------------------------*
form create_excel_field_name.
clear ohead.
refresh ohead.

move: '|' to ohead-tab1,
'|' to ohead-tab2,
'|' to ohead-tab3,
'|' to ohead-tab4,
'|' to ohead-tab5.


ohead-f1 = 'Item'.
ohead-f2 = 'Material'.
ohead-f3 = 'Desc.'.
ohead-f4 = 'Qty'.
ohead-f5 = 'Remark'.

append ohead.
clear ohead.


endform.
*&---------------------------------------------------------------------*
*& Form write_out_execl_format
*&---------------------------------------------------------------------*
form write_out_excel_format.

call function 'WS_DOWNLOAD'
EXPORTING
filename = o_file1
filetype = 'DAT'
TABLES
data_tab = ohead
EXCEPTIONS
invalid_filesize = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
customer_error = 7
others = 8.

clear: ohead_xls.
refresh ohead_xls.

loop at etab.
move-corresponding etab to ohead_xls.
move: '|' to ohead_xls-tab1,
'|' to ohead_xls-tab2,
'|' to ohead_xls-tab3,
'|' to ohead_xls-tab4,
'|' to ohead_xls-tab5.

append ohead_xls.
clear ohead_xls.
endloop.

call function 'WS_DOWNLOAD'
EXPORTING
filename = o_file1
filetype = 'DAT'
mode = 'A'
TABLES
data_tab = ohead_xls
EXCEPTIONS
invalid_filesize = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
customer_error = 7
others = 8.

clear: ohead_xls.
refresh: ohead_xls.

endform.
*&---------------------------------------------------------------------*
*& Form move_header_vline
*&---------------------------------------------------------------------*
form move_header_vline.

* move: ';' to ohead-vline01,
* ';' to ohead-vline02,
* ';' to ohead-vline03,
* ';' to ohead-vline04,
* ';' to ohead-vline05,
* ';' to ohead-vline06.

endform. " move_header_vline
*&---------------------------------------------------------------------*
*& Form move_vline
*&---------------------------------------------------------------------*
form move_vline.
* move: ';' to ohead_xls-vline01,
* ';' to ohead_xls-vline02,
* ';' to ohead_xls-vline03,
* ';' to ohead_xls-vline04,
* ';' to ohead_xls-vline05,
* ';' to ohead_xls-vline06.

endform. " move_vline
*&---------------------------------------------------------------------*
*& Form column_header
*&---------------------------------------------------------------------*
form column_header.

write: /(01) sy-vline no-gap,
(10) 'Item' no-gap,
(01) sy-vline no-gap,
(10) 'Type' no-gap,
(01) sy-vline no-gap,
(15) 'Sales Order' no-gap,
(01) sy-vline no-gap,
(10) 'Sales Item' no-gap,
(01) sy-vline no-gap,
(20) 'Material no.' no-gap,
(01) sy-vline no-gap,
(60) 'Material Description' no-gap,
(01) sy-vline no-gap,
(10) 'Qty' no-gap,
(01) sy-vline no-gap,
(21) 'Remark' no-gap,
(01) sy-vline no-gap.

uline.

endform. " column_header
*&---------------------------------------------------------------------*
*& Form end_of_report
*&---------------------------------------------------------------------*
form end_of_report.

call function 'Z_STANDARD_END_OF_REPORT'
EXCEPTIONS
others = 1.

endform. " end_of_report
*&---------------------------------------------------------------------*
*& Form bdc_process_zdi
*&---------------------------------------------------------------------*
form bdc_process_zdi_521e.

sort itab by auart vbeln posnr.
loop at itab.
perform bdc_for_zdi.

endloop.

endform. " bdc_process_zdi
*&---------------------------------------------------------------------*
*& Form bdc_for_zdi
*&---------------------------------------------------------------------*
form bdc_for_zdi.
clear bdcdata.
refresh bdcdata.

perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0400'.

perform bdc_field tables bdcdata
using 'RM07M-BWARTWA'
'521'.

perform bdc_field tables bdcdata
using 'RM07M-SOBKZ'
'E'.

perform bdc_field tables bdcdata
using 'XFULL'
' '.

perform bdc_field tables bdcdata
using 'RM07M-WERKS'
'0006'.

perform bdc_field tables bdcdata
using 'RM07M-LGORT'
p_lgort.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '/00'.


perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0421'.

perform bdc_field tables bdcdata
using 'MSEGK-MAT_KDAUF'
itab-vbeln.

perform bdc_field tables bdcdata
using 'MSEGK-MAT_KDPOS'
itab-posnr.

perform bdc_field tables bdcdata
using 'MSEG-MATNR(01)'
itab-matnr.

perform bdc_field tables bdcdata
using 'MSEG-ERFMG(01)'
itab-qty.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '=BU'.



call transaction 'MB1C' using bdcdata mode bdc_mode
update 'S' MESSAGES INTO messtab.


if sy-subrc <> 0.
move-corresponding itab to itab_confirm.
itab_confirm-remark = 'ERROR'.
append itab_confirm.
clear itab_confirm.
else.
move-corresponding itab to itab_confirm.
read table messtab index sy-tfill.
if sy-subrc = 0.
move messtab-msgv1 to itab_confirm-remark.
endif.

append itab_confirm.
clear itab_confirm.
endif.


endform. " bdc_for_zdi
*&---------------------------------------------------------------------*
*& Form bdc_process_zdi_521
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form bdc_process_zdi_521.
sort etab by matnr.
loop at etab.
perform bdc_for_zdi_521.

endloop.

endform. " bdc_process_zdi_521
*&---------------------------------------------------------------------*
*& Form bdc_for_zdi_521
*&---------------------------------------------------------------------*
form bdc_for_zdi_521.
clear bdcdata.
refresh bdcdata.

perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0400'.

perform bdc_field tables bdcdata
using 'RM07M-BWARTWA'
'521'.

perform bdc_field tables bdcdata
using 'RM07M-SOBKZ'
' '.

perform bdc_field tables bdcdata
using 'XFULL'
' '.

perform bdc_field tables bdcdata
using 'RM07M-WERKS'
'0006'.

perform bdc_field tables bdcdata
using 'RM07M-LGORT'
p_lgort.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '/00'.


perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0421'.

* perform bdc_field tables bdcdata
* using 'MSEGK-MAT_KDAUF'
* itab-vbeln.
*
* perform bdc_field tables bdcdata
* using 'MSEGK-MAT_KDPOS'
* itab-posnr.

perform bdc_field tables bdcdata
using 'MSEG-MATNR(01)'
etab-matnr.

perform bdc_field tables bdcdata
using 'MSEG-ERFMG(01)'
etab-qty.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '=BU'.



call transaction 'MB1C' using bdcdata mode bdc_mode
update 'S' MESSAGES INTO messtab.

call transaction 'MB1B' using bdcdata mode bdc_mode
update 'S'.

if sy-subrc <> 0.
move-corresponding itab to itab_confirm.
itab_confirm-remark = 'ERROR'.
append itab_confirm.
clear itab_confirm.
else.
move-corresponding itab to itab_confirm.
read table messtab index sy-tfill.
if sy-subrc = 0.
move messtab-msgv1 to itab_confirm-remark.
endif.

append itab_confirm.
clear itab_confirm.
endif.


endform. " bdc_for_zdi_521
*&---------------------------------------------------------------------*
*& Form bdc_process_zdi_412e
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM bdc_process_zdi_412e.


sort itab by auart vbeln posnr.
loop at itab.
perform bdc_for_412E.

endloop.

ENDFORM. " bdc_process_zdi_412e
*&---------------------------------------------------------------------*
*& Form bdc_for_412E
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM bdc_for_412E.
clear bdcdata.
refresh bdcdata.

perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0400'.

perform bdc_field tables bdcdata
using 'RM07M-BWARTWA'
'412'.

perform bdc_field tables bdcdata
using 'RM07M-SOBKZ'
'E'.

perform bdc_field tables bdcdata
using 'XFULL'
' '.

perform bdc_field tables bdcdata
using 'RM07M-WERKS'
'0006'.

perform bdc_field tables bdcdata
using 'RM07M-LGORT'
p_lgort.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '/00'.


perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0421'.

perform bdc_field tables bdcdata
using 'MSEGK-MAT_KDAUF'
itab-vbeln.

perform bdc_field tables bdcdata
using 'MSEGK-MAT_KDPOS'
itab-posnr.

perform bdc_field tables bdcdata
using 'MSEGK-UMLGO'
'0101'.



perform bdc_field tables bdcdata
using 'MSEG-MATNR(01)'
itab-matnr.

perform bdc_field tables bdcdata
using 'MSEG-ERFMG(01)'
itab-qty.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '=BU'.





call transaction 'MB1B' using bdcdata mode bdc_mode
update 'S' MESSAGES INTO messtab.


if sy-subrc <> 0.
move-corresponding itab to itab_confirm.
itab_confirm-remark = 'ERROR'.
append itab_confirm.
clear itab_confirm.
else.
move-corresponding itab to itab_confirm.
read table messtab index sy-tfill.
if sy-subrc = 0.
move messtab-msgv1 to itab_confirm-remark.
endif.
append itab_confirm.
clear itab_confirm.
endif.

ENDFORM. " bdc_for_412E




 

Create Date : 12 พฤศจิกายน 2552    
Last Update : 12 พฤศจิกายน 2552 10:00:22 น.
Counter : 338 Pageviews.  

Goods Receive Report

report zmmr002 no standard page heading
line-size 245
line-count 65.
*-----------------------------------------------------------------------
* TABLES
*-----------------------------------------------------------------------
tables: t001k,t001,sadr,marm,mseg,mkpf,ekpo.
tables: t001w,t001z,makt,lfa1.
*-----------------------------------------------------------------------
* DATA DECLARATION
*-----------------------------------------------------------------------
data: begin of i_mseg occurs 5.
include structure mseg.
data: end of i_mseg.
*
data: begin of i_mkpf occurs 5.
include structure mkpf.
data: end of i_mkpf.
*
data: begin of i_lfa1 occurs 5.
include structure lfa1.
data: end of i_lfa1.
*
data: begin of i_ekpo occurs 5.
include structure ekpo.
data: end of i_ekpo.
*
data: begin of i_tab occurs 5,
werks like mseg-werks, "Plant
lgort like mseg-lgort, "Location
ebeln like ekpo-ebeln, "P/O no.
omeng like ekpo-menge, "Order Qty.
netpr like ekpo-netwr, "Order price
ebelp like ekpo-ebelp, "P/O item no.
budat like mkpf-budat, "Posting date
mblnr like mkpf-mblnr, "Document no.
bwart like mseg-bwart, "Movement type
xblnr like mkpf-xblnr, "Ref. doc. no.
charg like mseg-charg, "Batch
matnr like mseg-matnr, "Material no.
maktx like makt-maktx, "Material description
menge like mseg-menge, "Receiving Qty.
meins like mseg-meins, "U.O.M
dmbtr like mseg-dmbtr, "Amount in PO
lifnr like mseg-lifnr, "Vendor
kostl like mseg-kostl, "Cost center
ps_psp_pnr like mseg-ps_psp_pnr, "WBS element no
lfbnr like mseg-lfbnr, "Reverse document no.
banfn like ekpo-banfn, "P/R No.
name1 like lfa1-name1, "Vendor name
usnam like mkpf-usnam, "User name
end of i_tab.
*
data: v_comp_name(60),
v_fr_date like sy-datum,
v_to_date like sy-datum,
gc_flg like sy-subrc.
*-----------------------------------------------------------------------
* SELECTION SCREEN
*-----------------------------------------------------------------------
selection-screen begin of block b1 with frame title title1.
select-options: v_werks for mseg-werks default '0006',
v_lgort for mseg-lgort,
v_matnr for mseg-matnr,
v_mblnr for mkpf-mblnr,
v_budat for mkpf-budat,
v_lifnr for mseg-lifnr,
v_ebeln for mseg-ebeln,
v_kostl for mseg-kostl,
v_ps_psp for mseg-ps_psp_pnr,
v_usnam for mkpf-usnam.
parameters: v_mjahr like mkpf-mjahr,
v_comp like t001-bukrs default '0006'.
selection-screen end of block b1.
*-----------------------------------------------------------------------
* INITIALIZATION
*-----------------------------------------------------------------------
initialization.
title1 = 'Selection Criteria'.
v_budat-sign = 'I'.
v_budat-option = 'BT'.
concatenate sy-datum(4) sy-datum+4(2) '01' into v_budat-low.
v_budat-high = sy-datum.
v_mjahr = sy-datum(4).
append v_budat.
*-----------------------------------------------------------------------
* START-OF-SELECTION
*-----------------------------------------------------------------------
start-of-selection.
refresh: i_mseg,i_mkpf,i_ekpo,i_lfa1.
perform select_mkpf using gc_flg.
check gc_flg = 0.
perform select_mseg using gc_flg.
check gc_flg = 0.
perform select_mseg_reverse using gc_flg.
check gc_flg = 0.
perform select_pr_item.
perform select_vendor_name.
perform pros_inti_rep.
*--------------------------------------------------------------
* END OF SELECTION
*--------------------------------------------------------------
end-of-selection.
tables: t001l.
data: i_matnr type i,
p_matnr(15),
f_po,
f_itm.
select single * from t001 where bukrs = v_comp.
v_comp_name = t001-butxt.
sort i_tab ascending by werks lgort ebeln ebelp budat.
loop at i_tab.
at new werks.
select single * from t001w where werks = i_tab-werks.
new-page.
endat.
at new ebeln.
f_po = 'Y'.
endat.
at new ebelp.
f_itm = 'Y'.
endat.
i_matnr = i_tab-matnr.
p_matnr = i_matnr.
condense p_matnr.
if f_po = 'Y'.
f_po = 'N'.
f_itm = 'N'.
write: / i_tab-ebeln,
12 i_tab-ebelp no-zero left-justified no-sign,
24 i_tab-mblnr,
36 i_tab-budat,
48 i_tab-bwart,
54 p_matnr(15),
69 i_tab-maktx(20),
92 i_tab-lifnr,
102 i_tab-name1(23),
119(13) i_tab-omeng decimals 2 right-justified no-sign,
135(13) i_tab-menge decimals 2 right-justified,
150 i_tab-meins,
155(13) i_tab-dmbtr decimals 2 right-justified,
169(11) i_tab-netpr decimals 2 right-justified no-sign,
182 i_tab-xblnr,
202 i_tab-kostl,
212 i_tab-ps_psp_pnr,
229 i_tab-usnam.
elseif f_itm = 'Y'.
f_itm = 'N'.
write: /12 i_tab-ebelp no-zero left-justified no-sign,
24 i_tab-mblnr,
36 i_tab-budat,
48 i_tab-bwart,
54 p_matnr(15),
69 i_tab-maktx(20),
92 i_tab-lifnr,
102 i_tab-name1(23),
119(13) i_tab-omeng decimals 2 right-justified no-sign,
135(13) i_tab-menge decimals 2 right-justified,
150 i_tab-meins,
155(13) i_tab-dmbtr decimals 2 right-justified,
169(11) i_tab-netpr decimals 2 right-justified no-sign,
182 i_tab-xblnr,
202 i_tab-kostl,
212 i_tab-ps_psp_pnr,
229 i_tab-usnam.
else.
write: /24 i_tab-mblnr,
36 i_tab-budat,
48 i_tab-bwart,
54 p_matnr(15),
69 i_tab-maktx(20),
92 i_tab-lifnr,
102 i_tab-name1(23),
135(13) i_tab-menge decimals 2 right-justified,
150 i_tab-meins,
155(13) i_tab-dmbtr decimals 2 right-justified,
182 i_tab-xblnr,
202 i_tab-kostl,
212 i_tab-ps_psp_pnr,
229 i_tab-usnam.
endif.
at end of ebelp.
sum.
write: /119(13) sy-uline,
135(13) sy-uline,
155(13) sy-uline,
/50 '*** Total by Item ***',
119(13) i_tab-omeng decimals 2 right-justified no-sign,
135(13) i_tab-menge decimals 2 right-justified,
155(13) i_tab-dmbtr decimals 2 right-justified,
/119(13) sy-uline,
135(13) sy-uline,
155(13) sy-uline.
endat.
at end of werks.
sum.
write: /50 '*** Total by plant ***',
155(13) i_tab-dmbtr decimals 2 right-justified,
/155(13) sy-uline.
endat.
endloop.
*--------------------------------------------------------------
* TOP-OF-PAGE
*--------------------------------------------------------------
top-of-page.
write: /107 v_comp_name,
230 'Date:',sy-datum dd/mm/yyyy.
write: /105 'List of GR material document',
230 'Page:', sy-pagno left-justified,
/102 'From:',v_budat-low dd/mm/yyyy,' To:',
v_budat-high dd/mm/yyyy,
230 'Pgm : ZMMR002'.
write: / 'Plant:',i_tab-werks,' ',t001w-name1,
230 'Time:',sy-uzeit left-justified.
uline /(245).
write: / 'PO no.',
12 'Item no.',
24 'Doc. no.',
36 'Post date',
48 'Mvt.',
54 'Mat. no.',
69 'Description',
92 'Vendor',
102 'Vendor name',
119(13) 'Order Qty.' right-justified,
135(13) 'Recv Qty.' right-justified,
150 'UOM',
155(13) 'Amount' right-justified,
169(11) 'Price' right-justified,
182 'Deliv note',
202 'Cost cc.',
212 'Capex no.',
229 'User Name'.
uline /(245).
*&---------------------------------------------------------------------*
*& Form select_mkpf
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GC_FLG text
*----------------------------------------------------------------------*
form select_mkpf using p_gc_flg.
select * from mkpf into table i_mkpf
where budat in v_budat and
usnam in v_usnam and
mblnr in v_mblnr and
mjahr = v_mjahr.
p_gc_flg = sy-subrc.
endform. " select_mkpf
*&---------------------------------------------------------------------*
*& Form select_mseg
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GC_FLG text
*----------------------------------------------------------------------*
form select_mseg using p_gc_flg.
select * from mseg into table i_mseg
for all entries in i_mkpf
where mblnr = i_mkpf-mblnr and
mjahr = i_mkpf-mjahr and
bwart between '101' and '104' and
werks in v_werks and
lgort in v_lgort and
matnr in v_matnr and
lifnr in v_lifnr and
ebeln in v_ebeln and
kostl in v_kostl and
ps_psp_pnr in v_ps_psp.
p_gc_flg = sy-subrc.
endform. " select_mseg
*&---------------------------------------------------------------------*
*& Form select_pr_item
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form select_pr_item .
data li_tab like i_mseg occurs 0 with header line.
li_tab[] = i_mseg[].
sort li_tab by ebeln ebelp.
delete adjacent duplicates from li_tab comparing ebeln ebelp.
select * from ekpo into table i_ekpo
for all entries in li_tab
where ebeln = li_tab-ebeln and
ebelp = li_tab-ebelp.
endform. " select_pr_item
*&---------------------------------------------------------------------*
*& Form selc_vendor_name
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form select_vendor_name .
data: li_tab like i_mseg occurs 0 with header line,
li_tab2 like i_mseg occurs 0 with header line.

li_tab[] = i_mseg[].
sort li_tab by lifnr.
delete adjacent duplicates from li_tab comparing lifnr.
select * from lfa1 into table i_lfa1
for all entries in li_tab
where lifnr = li_tab-lifnr.
endform. " select_vendor_name
*&---------------------------------------------------------------------*
*& Form pros_inti_rep
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form pros_inti_rep .
loop at i_mseg.
clear i_tab.
move-corresponding i_mseg to i_tab.
clear i_mkpf.
read table i_mkpf with key mblnr = i_mseg-mblnr
mjahr = i_mseg-mjahr.
move-corresponding i_mkpf to i_tab.
clear i_ekpo.
read table i_ekpo with key ebeln = i_mseg-ebeln
ebelp = i_mseg-ebelp.
i_tab-banfn = i_ekpo-banfn.
i_tab-maktx = i_ekpo-txz01.
i_tab-netpr = i_ekpo-netpr.
i_tab-omeng = i_ekpo-menge.
i_tab-netpr = i_ekpo-netpr.
clear i_lfa1.
read table i_lfa1 with key lifnr = i_mseg-lifnr.
i_tab-name1 = i_lfa1-name1.
if i_mseg-matnr is initial.
i_tab-menge = i_mseg-erfmg.
i_tab-meins = i_mseg-erfme.
endif.
*
* IF i_MSEG-SHKZG = 'H'.
* I_TAB-MENGE = 0 - i_tab-MENGE.
* I_TAB-DMBTR = 0 - i_tab-DMBTR.
* ENDIF.
* if i_mseg-bwart = '101' or i_mseg-bwart = '103'.
* i_tab-lfbnr = ' '.
* endif.
if i_mseg-dmbtr = 0.
i_tab-dmbtr = i_tab-menge * i_tab-netpr.
endif.
append i_tab.
endloop.
endform. " pros_inti_rep
*&---------------------------------------------------------------------*
*& Form select_mseg_reverse
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GC_FLG text
*----------------------------------------------------------------------*
form select_mseg_reverse using p_gc_flg.
data: li_tab like i_mseg occurs 0 with header line.

refresh li_tab.
li_tab[] = i_mseg[].
delete li_tab where bwart = '101' or bwart = '103'.
sort li_tab by lfbja lfbnr lfpos.
loop at i_mseg where bwart = '101' or bwart = '103'.
read table li_tab with key lfbnr = i_mseg-mblnr
lfbja = i_mseg-mjahr
lfpos = i_mseg-zeile.
if sy-subrc = 0.
delete i_mseg.
endif.
endloop.
delete i_mseg where bwart = '102' or bwart = '104'.
if i_mseg[] is initial.
p_gc_flg = 5.
else.
p_gc_flg = 0.
endif.
endform. " select_mseg_reverse




 

Create Date : 05 พฤศจิกายน 2552    
Last Update : 5 พฤศจิกายน 2552 9:01:16 น.
Counter : 347 Pageviews.  

Purchase order performance report.

*----------------------------------------------------------------------
* Modification Log:
* 1) Changed by : Suchon Poomcharoen
* Changed on : 14/10/2009
* Transport :
* Correction-No : CH01
* Description : 1) Add Pur. Doc , WBS , find Acct Doc.
*----------------------------------------------------------------------

REPORT ZMM005 MESSAGE-ID ZRTC .

*--------------------------------------------
TABLES:
*--------------------------------------------
EKKO, EKPO, EKET, EKBE, EKKN.


*--------------------------------------------
*SELECTION
*--------------------------------------------
*BLOCK 0
SELECTION-SCREEN BEGIN OF BLOCK 0 WITH
FRAME TITLE TEXT-001.
SELECT-OPTIONS S_LIFNR FOR EKKO-LIFNR NO INTERVALS.
SELECT-OPTIONS S_MATNR FOR EKPO-MATNR NO INTERVALS.
SELECT-OPTIONS S_MATKL FOR EKPO-MATKL NO INTERVALS.
SELECT-OPTIONS S_EKGRP FOR EKKO-EKGRP NO INTERVALS.
SELECT-OPTIONS S_BEDAT FOR EKKO-BEDAT.
SELECT-OPTIONS S_PURDOC for EKKO-EBELN.
PARAMETER S_WBS LIKE EKKN-PS_PSP_PNR .
*SELECT-OPTIONS S_WBS for EKKN-PS_PSP_PNR NO INTERVALS.
SELECTION-SCREEN END OF BLOCK 0.
*BLOCK 2
SELECTION-SCREEN BEGIN OF BLOCK 2 WITH
FRAME TITLE TEXT-010.
PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT. " ALV Variant
*SELECTION-SCREEN SKIP.
*SELECTION-SCREEN PUSHBUTTON /10(20) SUMMA USER-COMMAND ABCD.
SELECTION-SCREEN END OF BLOCK 2.


*--------------------------------------------
*DATA
*--------------------------------------------
*ALV DATA
TYPE-POOLS: SLIS.
DATA: GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GT_EVENTS TYPE SLIS_T_EVENT,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
REPNAME LIKE SY-REPID,
G_SAVE(1) TYPE C,
G_EXIT(1) TYPE C,
G_VARIANT LIKE DISVARIANT,
GX_VARIANT LIKE DISVARIANT.

*USER DATA
DATA VWCASE(3) TYPE N.
DATA SDAT LIKE EKET-EINDT.


*--------------------------------------------
*INTERNAL TABLE
*--------------------------------------------
*ITAB
DATA: BEGIN OF ITAB OCCURS 0,
BELNR LIKE EKBE-BELNR, "Start insert by suchon CH01
LIFNR LIKE EKKO-LIFNR,
BEDAT LIKE EKKO-BEDAT,
WAERS LIKE EKKO-WAERS,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
ELIKZ LIKE EKPO-ELIKZ,
EINDT LIKE EKET-EINDT,
BUDAT LIKE EKBE-BUDAT,
MENGE2 LIKE EKBE-MENGE,
DELP TYPE I,
CMT(15) TYPE C,
*BELNR LIKE EKBE-BELNR, "Start insert by suchon CH01
BUZEI LIKE EKBE-BUZEI,
DMBTR LIKE EKBE-DMBTR,
PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,"End insert by suchon CH01
DMBTR1 LIKE EKBE-DMBTR,
DMBTR2 LIKE EKBE-DMBTR,
DMBTR3 LIKE EKBE-DMBTR,
DMBTR4 LIKE EKBE-DMBTR,
DMBTR5 LIKE EKBE-DMBTR,
DMBTR6 LIKE EKBE-DMBTR,
DMBTR7 LIKE EKBE-DMBTR,
DMBTR8 LIKE EKBE-DMBTR,
DMBTR9 LIKE EKBE-DMBTR,
DMBTR10 LIKE EKBE-DMBTR,
DMBTR11 LIKE EKBE-DMBTR,
DMBTR12 LIKE EKBE-DMBTR,
*BRTWR1 LIKE EKPO-BRTWR,
BRTWR1(13) TYPE C,
BRTWR2(13) TYPE C,
BRTWR3(13) TYPE C,
BRTWR4(13) TYPE C,
BRTWR5(13) TYPE C,
BRTWR6(13) TYPE C,
BRTWR7(13) TYPE C,
BRTWR8(13) TYPE C,
BRTWR9(13) TYPE C,
BRTWR10(13) TYPE C,
BRTWR11(13) TYPE C,
BRTWR12(13) TYPE C,
SUM_BRTWR LIKE EKPO-BRTWR,
POST1 LIKE PRPS-POST1,
H_note LIKE TLINE-TDLINE,
SUM_OUT LIKE EKPO-BRTWR,
SUM_ACT LIKE EKBE-DMBTR,
END OF ITAB.

*ITAB1
DATA: BEGIN OF ITAB1 OCCURS 0,
LIFNR LIKE EKKO-LIFNR,
BEDAT LIKE EKKO-BEDAT,
WAERS LIKE EKKO-WAERS,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
ELIKZ LIKE EKPO-ELIKZ,
EINDT LIKE EKET-EINDT,
BUDAT LIKE EKBE-BUDAT,
MENGE2 LIKE EKBE-MENGE,
DELP TYPE I,
CMT(15) TYPE C,
BELNR LIKE EKBE-BELNR, "Start insert by suchon CH01
BUZEI LIKE EKBE-BUZEI,
DMBTR LIKE EKBE-DMBTR,
PS_PSP_PNR LIKE EKKN-PS_PSP_PNR, "End insert by suchon CH01
DMBTR1 LIKE EKBE-DMBTR,
DMBTR2 LIKE EKBE-DMBTR,
DMBTR3 LIKE EKBE-DMBTR,
DMBTR4 LIKE EKBE-DMBTR,
DMBTR5 LIKE EKBE-DMBTR,
DMBTR6 LIKE EKBE-DMBTR,
DMBTR7 LIKE EKBE-DMBTR,
DMBTR8 LIKE EKBE-DMBTR,
DMBTR9 LIKE EKBE-DMBTR,
DMBTR10 LIKE EKBE-DMBTR,
DMBTR11 LIKE EKBE-DMBTR,
DMBTR12 LIKE EKBE-DMBTR,
*BRTWR1 LIKE EKPO-BRTWR,
BRTWR1(13) TYPE C,
BRTWR2(13) TYPE C,
BRTWR3(13) TYPE C,
BRTWR4(13) TYPE C,
BRTWR5(13) TYPE C,
BRTWR6(13) TYPE C,
BRTWR7(13) TYPE C,
BRTWR8(13) TYPE C,
BRTWR9(13) TYPE C,
BRTWR10(13) TYPE C,
BRTWR11(13) TYPE C,
BRTWR12(13) TYPE C,
SUM_BRTWR LIKE EKPO-BRTWR,
POST1 LIKE PRPS-POST1,
H_note LIKE TLINE-TDLINE,
SUM_OUT LIKE EKPO-BRTWR,
SUM_ACT LIKE EKBE-DMBTR,

END OF ITAB1.
*MTEXT
DATA: BEGIN OF mtext OCCURS 50.
INCLUDE STRUCTURE tline.
DATA: END OF mtext.
*Temp data
DATA TEMP1 LIKE ITAB1.

*EKKOTAB
DATA: BEGIN OF EKKOTAB OCCURS 0,
EBELN LIKE EKKO-EBELN,
LIFNR LIKE EKKO-LIFNR,
BEDAT LIKE EKKO-BEDAT,
WAERS LIKE EKKO-WAERS,
END OF EKKOTAB.

*EKPOTAB
DATA: BEGIN OF EKPOTAB OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
LIFNR LIKE EKKO-LIFNR,
BEDAT LIKE EKKO-BEDAT,
WAERS LIKE EKKO-WAERS,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
ELIKZ LIKE EKPO-ELIKZ,
EINDT LIKE EKET-EINDT,
BRTWR LIKE EKPO-BRTWR,
END OF EKPOTAB.




*--------------------------------------------
INITIALIZATION.
*--------------------------------------------
REPNAME = SY-REPID.
PERFORM BUILD.
PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
PERFORM COMMENT_BUILD CHANGING GT_LIST_TOP_OF_PAGE.
PERFORM INITIALIZE_VARIANT.



*--------------------------------------------
AT SELECTION-SCREEN.
*--------------------------------------------
IF S_BEDAT IS INITIAL.
MESSAGE E000
WITH 'Please enter a date in Main Selection Criteria'.
ENDIF.

* IF P_01 = 'X' AND P_D01 IS INITIAL.
* MESSAGE E000
* WITH 'Please enter a number on Delivered Before Plan Delivery'.
* ENDIF.
*
* IF P_02 = 'X' AND P_D02 IS INITIAL.
* MESSAGE E000
* WITH 'Please enter a number on Delivered After Plan Delivery'.
* ENDIF.
*
* IF P_04 = 'X' AND P_D04 IS INITIAL.
* MESSAGE E000
* WITH 'Please enter a number on Un-delivered Before Plan Delivery'.
* ENDIF.
*
* IF P_05 = 'X' AND P_D05 IS INITIAL.
* MESSAGE E000
* WITH 'Please enter a number on Un-delivered After Plan Delivery'.
* ENDIF.

PERFORM PAI_OF_SELECTION_SCREEN.


*--------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
*--------------------------------------------
PERFORM F4_FOR_VARIANT.


*--------------------------------------------
START-OF-SELECTION.
*--------------------------------------------
PERFORM START.


*--------------------------------------------
END-OF-SELECTION.
*--------------------------------------------
PERFORM CALL_ALV.





*--------------------------------------------
FORM START.
*--------------------------------------------

PERFORM GET_EKKOTAB.
PERFORM GET_EKPOTAB.
PERFORM GET_ITAB1.
PERFORM MOVE_ITAB1_TO_ITAB.
* START INSERT BY SUCHON CH01
IF NOT S_WBS IS INITIAL.
DELETE ITAB WHERE PS_PSP_PNR <> S_WBS.
ENDIF.
ENDFORM. "START
* END INSERT BY SUCHON CH01


*--------------------------------------------
FORM GET_EKKOTAB.
*--------------------------------------------
REFRESH EKKOTAB. CLEAR EKKOTAB.

SELECT EBELN LIFNR BEDAT WAERS
INTO (EKKO-EBELN, EKKO-LIFNR, EKKO-BEDAT, EKKO-WAERS)
FROM EKKO WHERE
LIFNR IN S_LIFNR AND
EKGRP IN S_EKGRP AND
BEDAT IN S_BEDAT
AND EBELN IN S_Purdoc. " INSERT BY SUCHON , CH01

MOVE EKKO-EBELN TO EKKOTAB-EBELN.
MOVE EKKO-LIFNR TO EKKOTAB-LIFNR.
MOVE EKKO-BEDAT TO EKKOTAB-BEDAT.
MOVE EKKO-WAERS TO EKKOTAB-WAERS.
APPEND EKKOTAB. CLEAR EKKOTAB.

ENDSELECT.


ENDFORM. "GET_EKKOTAB



*--------------------------------------------
FORM GET_EKPOTAB.
*--------------------------------------------
REFRESH EKPOTAB. CLEAR EKPOTAB.

LOOP AT EKKOTAB.

SELECT EBELN EBELP MATNR TXZ01 MENGE MEINS NETPR ELIKZ BRTWR
INTO (EKPO-EBELN, EKPO-EBELP, EKPO-MATNR, EKPO-TXZ01,
EKPO-MENGE, EKPO-MEINS, EKPO-NETPR, EKPO-ELIKZ,
EKPO-BRTWR)
FROM EKPO WHERE
EBELN = EKKOTAB-EBELN AND
MATNR IN S_MATNR AND
MATKL IN S_MATKL.

SELECT SINGLE EINDT INTO EKET-EINDT
FROM EKET WHERE
EBELN = EKPO-EBELN AND EBELP = EKPO-EBELP.
MOVE EKKOTAB-LIFNR TO EKPOTAB-LIFNR.
MOVE EKKOTAB-BEDAT TO EKPOTAB-BEDAT.
MOVE EKKOTAB-WAERS TO EKPOTAB-WAERS.
MOVE EKPO-EBELN TO EKPOTAB-EBELN.
MOVE EKPO-EBELP TO EKPOTAB-EBELP.
MOVE EKPO-MATNR TO EKPOTAB-MATNR.
MOVE EKPO-TXZ01 TO EKPOTAB-TXZ01.
MOVE EKPO-MENGE TO EKPOTAB-MENGE.
MOVE EKPO-MEINS TO EKPOTAB-MEINS.
MOVE EKPO-NETPR TO EKPOTAB-NETPR.
MOVE EKPO-ELIKZ TO EKPOTAB-ELIKZ.
MOVE EKET-EINDT TO EKPOTAB-EINDT.
MOVE EKPO-BRTWR TO EKPOTAB-BRTWR.
APPEND EKPOTAB. CLEAR EKPOTAB.

ENDSELECT.

ENDLOOP.

ENDFORM. "GET_EKPOTAB

*--------------------------------------------
FORM GET_ITAB1.
*--------------------------------------------
DATA DVPLAN TYPE I.
DATA COMMT(15) TYPE C.
DATA tname LIKE thead-tdname.



REFRESH ITAB1. CLEAR ITAB1.

LOOP AT EKPOTAB.

SELECT SINGLE PS_PSP_PNR
INTO (ITAB1-PS_PSP_PNR)
FROM EKKN WHERE EBELN = EKPOTAB-EBELN
AND EBELP = EKPOTAB-EBELP.

SELECT SINGLE POST1
INTO (ITAB1-POST1)
FROM PRPS
WHERE PSPNR = ITAB1-PS_PSP_PNR.

MOVE EKPOTAB-EBELN TO TNAME.

***************CALL HEADER NOTES*******************
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F02'
language = 'E'
name = tname
object = 'EKKO'
TABLES
lines = MTEXT
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
****************************************************
IF SY-SUBRC = 0.
READ TABLE MTEXT INDEX 1 ."INTO itab1-h_note.
MOVE MTEXT-TDLINE TO ITAB1-H_NOTE.
ENDIF.

ITAB1-SUM_BRTWR = ITAB1-SUM_BRTWR + EKPOTAB-BRTWR.

SELECT DMBTR BUDAT
INTO (ITAB1-DMBTR,ITAB1-BUDAT)
FROM EKBE WHERE EBELN = EKPOTAB-EBELN
AND EBELP = EKPOTAB-EBELP AND BEWTP = 'Q'.
TEMP1-DMBTR = TEMP1-DMBTR + ITAB1-DMBTR.
TEMP1-BUDAT = ITAB1-BUDAT.
ENDSELECT.

ITAB1-SUM_ACT = ITAB1-SUM_ACT + TEMP1-DMBTR .

CASE EKPOTAB-EINDT+4(2) .
WHEN 1.
ITAB1-BRTWR1 = EKPOTAB-BRTWR - TEMP1-DMBTR.

IF EKPOTAB-EINDT+4(2) = TEMP1-BUDAT+4(2).
ITAB1-DMBTR1 = TEMP1-DMBTR.
ELSE.
PERFORM CHK_DATE_INV.
ENDIF.
CLEAR TEMP1.
WHEN 2.
ITAB1-BRTWR2 = EKPOTAB-BRTWR.
IF EKPOTAB-EINDT+4(2) = TEMP1-BUDAT+4(2).
ITAB1-DMBTR2 = TEMP1-DMBTR.
ELSE.
PERFORM CHK_DATE_INV.
ENDIF.
CLEAR TEMP1.
WHEN 3.
ITAB1-BRTWR3 = EKPOTAB-BRTWR.
IF EKPOTAB-EINDT+4(2) = TEMP1-BUDAT+4(2).
ITAB1-DMBTR3 = TEMP1-DMBTR.
ELSE.
PERFORM CHK_DATE_INV.
ENDIF.
CLEAR TEMP1.

WHEN 4.
ITAB1-BRTWR4 = EKPOTAB-BRTWR.
IF EKPOTAB-EINDT+4(2) = TEMP1-BUDAT+4(2).
ITAB1-DMBTR4 = TEMP1-DMBTR.
ELSE.
PERFORM CHK_DATE_INV.
ENDIF.
CLEAR TEMP1.

WHEN 5.
ITAB1-BRTWR5 = EKPOTAB-BRTWR.
IF EKPOTAB-EINDT+4(2) = TEMP1-BUDAT+4(2).
ITAB1-DMBTR5 = TEMP1-DMBTR.
ELSE.
PERFORM CHK_DATE_INV.
ENDIF.
CLEAR TEMP1.

WHEN 6.
ITAB1-BRTWR6 = EKPOTAB-BRTWR.
IF EKPOTAB-EINDT+4(2) = TEMP1-BUDAT+4(2).
ITAB1-DMBTR6 = TEMP1-DMBTR.
ELSE.
PERFORM CHK_DATE_INV.
ENDIF.
CLEAR TEMP1.

WHEN 7.
ITAB1-BRTWR7 = EKPOTAB-BRTWR.
IF EKPOTAB-EINDT+4(2) = TEMP1-BUDAT+4(2).
ITAB1-DMBTR7 = TEMP1-DMBTR.
ELSE.
PERFORM CHK_DATE_INV.
ENDIF.
CLEAR TEMP1.

WHEN 8.
ITAB1-BRTWR8 = EKPOTAB-BRTWR.
IF EKPOTAB-EINDT+4(2) = TEMP1-BUDAT+4(2).
ITAB1-DMBTR8 = TEMP1-DMBTR.
ELSE.
PERFORM CHK_DATE_INV.
ENDIF.
CLEAR TEMP1.

WHEN 9.
ITAB1-BRTWR9 = EKPOTAB-BRTWR.
IF EKPOTAB-EINDT+4(2) = TEMP1-BUDAT+4(2).
ITAB1-DMBTR9 = TEMP1-DMBTR.
ELSE.
PERFORM CHK_DATE_INV.
ENDIF.
CLEAR TEMP1.

WHEN 10.
ITAB1-BRTWR10 = EKPOTAB-BRTWR.
IF EKPOTAB-EINDT+4(2) = TEMP1-BUDAT+4(2).
ITAB1-DMBTR10 = TEMP1-DMBTR.
ELSE.
PERFORM CHK_DATE_INV.
ENDIF.
CLEAR TEMP1.

WHEN 11.
ITAB1-BRTWR11 = EKPOTAB-BRTWR.
IF EKPOTAB-EINDT+4(2) = TEMP1-BUDAT+4(2).
ITAB1-DMBTR11 = TEMP1-DMBTR.
ELSE.
PERFORM CHK_DATE_INV.
ENDIF.
CLEAR TEMP1.

WHEN 12.
ITAB1-BRTWR12 = EKPOTAB-BRTWR.
IF EKPOTAB-EINDT+4(2) = TEMP1-BUDAT+4(2).
ITAB1-DMBTR12 = TEMP1-DMBTR.
ELSE.
PERFORM CHK_DATE_INV.
ENDIF.
CLEAR TEMP1.

ENDCASE.
Perform move_ekpotab_to_itab1.
AT end of EBELN .
sum.
ITAB1-SUM_OUT = EKPOTAB-BRTWR.
APPEND ITAB1.
CLEAR ITAB1.
CLEAR TEMP1.
endat.

ENDLOOP.


ENDFORM. "GET_ITAB1

*--------------------------------------------
FORM MOVE_ITAB1_TO_ITAB.
*--------------------------------------------

REFRESH ITAB. CLEAR ITAB.
PERFORM GET_FILTER_CASE.

LOOP AT ITAB1.

CLEAR SDAT.
CASE VWCASE.

*Deliver - Select All
WHEN '003'.
IF ITAB1-BUDAT <> SPACE.
MOVE-CORRESPONDING ITAB1 TO ITAB.
APPEND ITAB. CLEAR ITAB.
ENDIF.
*UnDeliver - Select All
WHEN '006'.
IF ITAB1-BUDAT IS INITIAL OR ITAB1-BUDAT = ''.
MOVE-CORRESPONDING ITAB1 TO ITAB.
APPEND ITAB. CLEAR ITAB.
ENDIF.
*Select All
WHEN '007'.
MOVE-CORRESPONDING ITAB1 TO ITAB.
APPEND ITAB. CLEAR ITAB.

ENDCASE. "VWCASE

ENDLOOP. "ITAB1

ENDFORM. "MOVE_ITAB1_TO_ITAB

*--------------------------------------------
FORM GET_FILTER_CASE.
*--------------------------------------------
CLEAR VWCASE.
MOVE '007' TO VWCASE.
ENDFORM. "GET_FILTER_CASE


*--------------------------------------------
FORM F4_FOR_VARIANT.
*--------------------------------------------
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = G_VARIANT
I_SAVE = G_SAVE
IMPORTING
E_EXIT = G_EXIT
ES_VARIANT = GX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 2.
MESSAGE ID SY-MSGID TYPE 'S' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
IF G_EXIT = SPACE.
P_VARI = GX_VARIANT-VARIANT.
ENDIF.
ENDIF.
ENDFORM. " F4_FOR_VARIANT



*--------------------------------------------
FORM PAI_OF_SELECTION_SCREEN.
*--------------------------------------------
IF NOT P_VARI IS INITIAL.
MOVE G_VARIANT TO GX_VARIANT.
MOVE P_VARI TO GX_VARIANT-VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
I_SAVE = G_SAVE
CHANGING
CS_VARIANT = GX_VARIANT.
G_VARIANT = GX_VARIANT.
ELSE.
PERFORM INITIALIZE_VARIANT.
ENDIF.
ENDFORM. " PAI_OF_SELECTION_SCREEN



*--------------------------------------------
FORM CALL_ALV.
*--------------------------------------------
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPNAME
* I_STRUCTURE_NAME = 'ITAB1'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_SORT = GT_SORT[]
IT_EVENTS = GT_EVENTS[]
IS_VARIANT = G_VARIANT
I_DEFAULT = 'A'
I_SAVE = G_SAVE
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. "CALL ALV

*--------------------------------------------
FORM INITIALIZE_VARIANT.
*--------------------------------------------
G_SAVE = 'A'.
CLEAR G_VARIANT.
G_VARIANT-REPORT = REPNAME.
GX_VARIANT = G_VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = G_SAVE
CHANGING
CS_VARIANT = GX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 0.
P_VARI = GX_VARIANT-VARIANT.
ENDIF.
ENDFORM. " INITIALIZE_VARIANT



*--------------------------------------------
FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
*--------------------------------------------
DATA: GS_LINE TYPE SLIS_LISTHEADER.

CLEAR GS_LINE.
GS_LINE-TYP = 'H'.
GS_LINE-INFO = 'Rodenstock (Thailand) Co.,Ltd.'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.

CLEAR GS_LINE.
GS_LINE-TYP = 'S'.
GS_LINE-INFO = 'Purchase Order Performance Report'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
ENDFORM. "COMMENT_BUILD


*--------------------------------------------
FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
*--------------------------------------------
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.

READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
ENDFORM. "EVENTTAB_BUILD



*--------------------------------------------
FORM TOP_OF_PAGE.
*--------------------------------------------
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
ENDFORM. "TOP_OF_PAGE



*--------------------------------------------
FORM BUILD.
*--------------------------------------------

FIELDCAT_LN-TABNAME = 'ITAB'.

FIELDCAT_LN-FIELDNAME = 'PS_PSP_PNR'.
FIELDCAT_LN-SELTEXT_L = 'WBS element'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'POST1'.
FIELDCAT_LN-SELTEXT_L = 'Description'.
FIELDCAT_LN-FIX_COLUMN = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'EBELN'.
FIELDCAT_LN-SELTEXT_L = 'PO No.'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'H_NOTE'.
FIELDCAT_LN-SELTEXT_L = 'Detail.'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.


FIELDCAT_LN-FIELDNAME = 'SUM_BRTWR'.
FIELDCAT_LN-SELTEXT_L = 'PO Amount'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'BRTWR1'.
FIELDCAT_LN-SELTEXT_L = 'Outstanding / Jan'.
* FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'DMBTR1'.
FIELDCAT_LN-SELTEXT_L = 'Actual / Jan'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'BRTWR2'.
FIELDCAT_LN-SELTEXT_L = 'Outstanding / Feb'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'DMBTR2'.
FIELDCAT_LN-SELTEXT_L = 'Actual / Feb'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'BRTWR3'.
FIELDCAT_LN-SELTEXT_L = 'Outstanding / Mar'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'DMBTR3'.
FIELDCAT_LN-SELTEXT_L = 'Actual / Mar'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'BRTWR4'.
FIELDCAT_LN-SELTEXT_L = 'Outstanding / Apr'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'DMBTR4'.
FIELDCAT_LN-SELTEXT_L = 'Actual / Apr'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'BRTWR5'.
FIELDCAT_LN-SELTEXT_L = 'Outstanding / May'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'DMBTR5'.
FIELDCAT_LN-SELTEXT_L = 'Actual / May'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'BRTWR6'.
FIELDCAT_LN-SELTEXT_L = 'Outstanding / Jun'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'DMBTR6'.
FIELDCAT_LN-SELTEXT_L = 'Actual / Jun'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'BRTWR7'.
FIELDCAT_LN-SELTEXT_L = 'Outstanding / July'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'DMBTR7'.
FIELDCAT_LN-SELTEXT_L = 'Actual / July'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'BRTWR8'.
FIELDCAT_LN-SELTEXT_L = 'Outstanding / Aug'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'DMBTR8'.
FIELDCAT_LN-SELTEXT_L = 'Actual / Aug'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'BRTWR9'.
FIELDCAT_LN-SELTEXT_L = 'Outstanding / Sep'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'DMBTR9'.
FIELDCAT_LN-SELTEXT_L = 'Actual / Sep'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'BRTWR10'.
FIELDCAT_LN-SELTEXT_L = 'Qutstanding / Oct'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'DMBTR10'.
FIELDCAT_LN-SELTEXT_L = 'Actual / Oct'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'BRTWR11'.
FIELDCAT_LN-SELTEXT_L = 'Outstanding / Nov'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'DMBTR11'.
FIELDCAT_LN-SELTEXT_L = 'Actual / Nov'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'BRTWR12'.
FIELDCAT_LN-SELTEXT_L = 'Outstanding / Dec'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'DMBTR12'.
FIELDCAT_LN-SELTEXT_L = 'Actual / Dec'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'SUM_OUT'.
FIELDCAT_LN-SELTEXT_L = 'TOTAL Outstanding'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.

FIELDCAT_LN-FIELDNAME = 'SUM_ACT'.
FIELDCAT_LN-SELTEXT_L = 'TOTAL Actual'.
FIELDCAT_LN-NO_ZERO = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.




DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'PS_PSP_PNR'.
GS_SORT-SPOS = 1.
* GS_SORT-UP = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.

GS_LAYOUT-TOTALS_BEFORE_ITEMS = 'X'.
GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GS_LAYOUT-F2CODE = '&ETA'.
GS_LAYOUT-ZEBRA = 'X'.

ENDFORM. "BUILD
*&---------------------------------------------------------------------*
*& Form move_ekpotab_to_itab1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM move_ekpotab_to_itab1.
MOVE EKPOTAB-LIFNR TO ITAB1-LIFNR.
MOVE EKPOTAB-BEDAT TO ITAB1-BEDAT.
MOVE EKPOTAB-WAERS TO ITAB1-WAERS.
MOVE EKPOTAB-EBELN TO ITAB1-EBELN.
MOVE EKPOTAB-EBELP TO ITAB1-EBELP.
MOVE EKPOTAB-MATNR TO ITAB1-MATNR.
MOVE EKPOTAB-TXZ01 TO ITAB1-TXZ01.
MOVE EKPOTAB-MENGE TO ITAB1-MENGE.
MOVE EKPOTAB-MEINS TO ITAB1-MEINS.
MOVE EKPOTAB-NETPR TO ITAB1-NETPR.
MOVE EKPOTAB-ELIKZ TO ITAB1-ELIKZ.
MOVE EKPOTAB-EINDT TO ITAB1-EINDT.
MOVE EKBE-BUDAT TO ITAB1-BUDAT.
MOVE EKBE-MENGE TO ITAB1-MENGE2.
* MOVE DVPLAN TO ITAB1-DELP.
* MOVE COMMT TO ITAB1-CMT.
* APPEND ITAB1. CLEAR ITAB1.
ENDFORM. " move_ekpotab_to_itab1
*&---------------------------------------------------------------------*
*& Form GET_INV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P1 text
*----------------------------------------------------------------------
*&---------------------------------------------------------------------*
*& Form CHK_DATE_INV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM CHK_DATE_INV.
CASE TEMP1-BUDAT+4(2).
WHEN 1.
ITAB1-DMBTR1 = ITAB1-DMBTR1 + TEMP1-DMBTR.
concatenate ITAB1-BRTWR1 '*' into ITAB1-BRTWR1 .
WHEN 2.
ITAB1-DMBTR2 = ITAB1-DMBTR2 + TEMP1-DMBTR.
concatenate ITAB1-BRTWR2 '*' into ITAB1-BRTWR2.
WHEN 3.
ITAB1-DMBTR3 = ITAB1-DMBTR3 + TEMP1-DMBTR.
concatenate ITAB1-BRTWR3 '*' into ITAB1-BRTWR3 .
WHEN 4.
ITAB1-DMBTR4 = ITAB1-DMBTR4 + TEMP1-DMBTR.
concatenate ITAB1-BRTWR4 '*' into ITAB1-BRTWR4.
WHEN 5.
ITAB1-DMBTR5 = ITAB1-DMBTR5 + TEMP1-DMBTR.
concatenate ITAB1-BRTWR5 '*' into ITAB1-BRTWR5.
WHEN 6.
ITAB1-DMBTR6 = ITAB1-DMBTR6 + TEMP1-DMBTR.
concatenate ITAB1-BRTWR6 '*' into ITAB1-BRTWR6.
WHEN 7.
ITAB1-DMBTR7 = ITAB1-DMBTR7 + TEMP1-DMBTR.
concatenate ITAB1-BRTWR7 '*' into ITAB1-BRTWR7 .
WHEN 8.
ITAB1-DMBTR8 = ITAB1-DMBTR8 + TEMP1-DMBTR.
concatenate ITAB1-BRTWR8 '*' into ITAB1-BRTWR8 .
WHEN 9.
ITAB1-DMBTR9 = ITAB1-DMBTR9 + TEMP1-DMBTR.
concatenate ITAB1-BRTWR9 '*' into ITAB1-BRTWR9.
WHEN 10.
ITAB1-DMBTR10 = ITAB1-DMBTR10 + TEMP1-DMBTR.
concatenate ITAB1-BRTWR10 '*' into ITAB1-BRTWR10.
WHEN 11.
ITAB1-DMBTR11 = ITAB1-DMBTR11 + TEMP1-DMBTR.
concatenate ITAB1-BRTWR11 '*' into ITAB1-BRTWR11 .
WHEN 12.
ITAB1-DMBTR12 = ITAB1-DMBTR12 + TEMP1-DMBTR.
concatenate ITAB1-BRTWR12 '*' into ITAB1-BRTWR12 .
ENDCASE.




 

Create Date : 05 พฤศจิกายน 2552    
Last Update : 5 พฤศจิกายน 2552 8:57:43 น.
Counter : 298 Pageviews.  

Downloading to Excel

Downloading to Excel
REPORT ztablexls.
********************************************************************
* Developer : S.Srini.
* Location : Chennai,
* : Tamil Nadu,
* : India.
* Date : 3/10/2001.
********************************************************************
* TESTED - MS EXCEL 97
* NOT RECOMMENDED FOR LENGTHY OUTPUT AND LARGE DATA TABLE BROWSING
********************************************************************
TABLES: USR03,DD02L.
DATA: ZX030L LIKE X030L.
DATA BEGIN OF ZDFIES OCCURS 0.
INCLUDE STRUCTURE DFIES.
DATA END OF ZDFIES.
DATA: BEGIN OF FLDITAB OCCURS 0,
FLDNAME(11) TYPE C,
END OF FLDITAB.
DATA ITABUSR03 LIKE USR03 OCCURS 0 WITH HEADER LINE.
DATA TNAME LIKE DD02L-TABNAME.
SELECT * FROM USR03 INTO TABLE ITABUSR03.
TNAME = 'USR03'.
PERFORM GETFIELEDS.
PERFORM SHOW123.
********************************************
FORM GETFIELEDS.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
LANGU = SY-LANGU
ONLY = SPACE
TABNAME = TNAME
WITHTEXT = 'X'
IMPORTING
HEADER = ZX030L
TABLES
FIELDTAB = ZDFIES
EXCEPTIONS
INTERNAL_ERROR = 01
NO_TEXTS_FOUND = 02
TABLE_HAS_NO_FIELDS = 03
TABLE_NOT_ACTIV = 04.
CASE SY-SUBRC.
WHEN 0.
LOOP AT ZDFIES.
FLDITAB-FLDNAME = ZDFIES-FIELDNAME.
APPEND FLDITAB.
ENDLOOP.
WHEN OTHERS.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
with SY-SUBRC.
ENDCASE.
ENDFORM.
***********************************
FORM SHOW123.
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = 'C:USR03.XLS'
DATA_SHEET_NAME = 'USER LIST'
TABLES
DATA_TAB = ITABUSR03
FIELDNAMES = FLDITAB
EXCEPTIONS
FILE_NOT_EXIST = 1
FILENAME_EXPECTED = 2
COMMUNICATION_ERROR = 3
OLE_OBJECT_METHOD_ERROR = 4
OLE_OBJECT_PROPERTY_ERROR = 5
INVALID_FILENAME = 6
INVALID_PIVOT_FIELDS = 7
DOWNLOAD_PROBLEM = 8
OTHERS = 9.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.




 

Create Date : 15 กันยายน 2552    
Last Update : 15 กันยายน 2552 11:26:19 น.
Counter : 270 Pageviews.  

ZPP264 booking test lens to Sales Stock

report zpp264 no standard page heading
line-count 50(2) line-size 145
message-id zrtc.

tables: vbak,
vbap,
vbuk,
vbup.

data: messtab like bdcmsgcoll occurs 0 with header line,
bdcdata like bdcdata occurs 0 with header line.

data: begin of iexcel occurs 0,
item(5) type c,
matnr like vbap-matnr,
desc(40) type c,
qty(5) type c,
remark(20) type c,
end of iexcel.

data: begin of ivbak occurs 0,
vbeln like vbak-vbeln,
erdat like vbak-erdat,
auart like vbak-auart,
end of ivbak.

data: begin of ivbap occurs 0,
matnr like vbap-matnr,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
auart like vbak-auart,
end of ivbap.


data: begin of itab occurs 0,
auart like vbak-auart,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
qty(5) type c,
item(5) type c,
desc(40) type c,
remark(20) type c,
end of itab.

data: begin of itab_err occurs 0,
auart like vbak-auart,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
qty(5) type c,
item(5) type c,
desc(40) type c,
remark(20) type c,
end of itab_err.

data: begin of etab occurs 0,
item(5) type c,
matnr like vbap-matnr,
desc(40) type c,
qty(5) type c,
remark(20) type c,
end of etab.
*** Excel output file **************
data: begin of ohead occurs 0,
f1(10) type c,
f2(20) type c,
f3(40) type c,
f4(10) type c,
f5(20) type c,
end of ohead.

data: begin of ohead_xls occurs 0,
f1(10) type c,
f2(20) type c,
f3(40) type c,
f4(10) type c,
f5(20) type c,
end of ohead_xls.

*******************************
selection-screen begin of block 0 with frame title text-000.

select-options: s_vbeln for vbak-vbeln.
selection-screen skip 1.
parameters: p_erdat like vbak-erdat.
selection-screen end of block 0.

selection-screen begin of block 2 with frame title text-001.
selection-screen skip 1.

parameters: p_file1 like rlgrap-filename
default 'c:zpp264.txt'
obligatory.

parameters: r_zro radiobutton group grp1,
r_zdi radiobutton group grp1.
selection-screen skip 1.



parameters: o_file1 like rlgrap-filename
default 'c:zpp264_no_sales_found.xls'
obligatory.

parameter: bdc_mode(1) type c default 'N' obligatory.

selection-screen end of block 2.

*** top-of-page ****
top-of-page.

call function 'Z_STANDARD_HEADING_OF_RTC'
exporting
heading = 'List of Error Item posted to Sales Stock'
prog = 'ZPP264'
exceptions
others = 1.

perform column_header.

**** initialization ****.
initialization.
p_erdat = sy-datum - 180.

at selection-screen on value-request for p_file1.
perform get_text_filename using p_file1.

at selection-screen on value-request for o_file1.
perform get_text_filename using o_file1.


start-of-selection.
clear: ivbak,
iexcel.
refresh: ivbak,
iexcel.


perform upload_text_file using p_file1.
if not iexcel[] is initial.

perform get_vbak_data.
perform get_sale_item_data.
perform process_data.

if not itab[] is initial.
if r_zro = 'X'.
perform bdc_process_zro.
if not etab[] is initial.
perform create_excel_field_name.
perform write_out_execl_format.
endif.
else.

clear: itab_err.
refresh: itab_err.
perform bdc_process_zdi_521e.
if not etab[] is initial.
perform bdc_process_zdi_521.
endif.

endif.

else. "No selected item found for Input file.

if not etab[] is initial.
perform create_excel_field_name.
perform write_out_execl_format.
endif.

endif.

if not itab_err[] is initial.
loop at itab_err.

write: /(01) sy-vline no-gap,
(10) itab_err-item no-gap,
(01) sy-vline no-gap,
(10) itab_err-auart no-gap,
(01) sy-vline no-gap,
(15) itab_err-vbeln no-gap,
(01) sy-vline no-gap,
(10) itab_err-posnr no-gap,
(01) sy-vline no-gap,
(20) itab_err-matnr no-gap,
(01) sy-vline no-gap,
(40) itab_err-desc no-gap,
(01) sy-vline no-gap,
(10) itab_err-qty no-gap,
(01) sy-vline no-gap,
(20) itab_err-remark,
(01) sy-vline no-gap.
at last.
perform end_of_report.
endat.
endloop.
endif.

endif.

end-of-selection.

*&---------------------------------------------------------------------*
*& Form get_text_filename
*&---------------------------------------------------------------------*
form get_text_filename using p_file.
call function 'WS_FILENAME_GET'
exporting
mask = ',*.*,*.*.'
mode = 'O'
def_path = 'c:'
importing
filename = p_file
exceptions
inv_winsys = 01
no_batch = 02
selection_cancel = 03
selection_error = 04.

endform. " get_text_filename
*&---------------------------------------------------------------------*
*& Form upload_text_file
*&---------------------------------------------------------------------*
form upload_text_file using p_file.
call function 'WS_UPLOAD'
exporting
filename = p_file
filetype = 'DAT'
tables
data_tab = iexcel
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
others = 10.

if sy-subrc <> 0.
message e000 with 'Can not upload text file'.
else.
delete iexcel index 1.
delete iexcel where matnr is initial.
endif.

endform. " upload_text_file
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
form get_vbak_data.

select vbeln erdat auart
into (ivbak-vbeln,
ivbak-erdat,
ivbak-auart)
from vbak
where vbeln in s_vbeln
and erdat ge p_erdat.
select single lfstk into vbuk-lfstk
from vbuk
where vbeln = ivbak-vbeln
and lfstk ne 'C'.
if sy-subrc = 0.
append ivbak.
clear ivbak.
endif.
endselect.

endform.
*&---------------------------------------------------------------------*
*& Form process_data
*&---------------------------------------------------------------------*
form process_data.
clear: itab, etab.
refresh: itab, etab.

loop at iexcel.
read table ivbap with key matnr = iexcel-matnr.
if sy-subrc = 0.
itab-vbeln = ivbap-vbeln.
itab-posnr = ivbap-posnr.
itab-matnr = ivbap-matnr.
itab-qty = iexcel-qty.
itab-item = iexcel-item.
itab-desc = iexcel-desc.
itab-remark = iexcel-remark.
itab-auart = ivbap-auart.
append itab.
clear itab.
else.
etab-matnr = iexcel-matnr.
etab-qty = iexcel-qty.
etab-item = iexcel-item.
etab-desc = iexcel-desc.
etab-remark = iexcel-remark.
append etab.
clear etab.

endif.
endloop.

endform. " process_data
*&---------------------------------------------------------------------*
*& Form get_sale_item_data
*&---------------------------------------------------------------------*
form get_sale_item_data.

if not ivbak[] is initial.
clear: ivbap.
refresh: ivbap.
loop at ivbak.
select vbeln posnr matnr into (vbap-vbeln,
vbap-posnr,
vbap-matnr)
from vbap
where vbeln = ivbak-vbeln.
select single * from vbup
where vbeln = vbap-vbeln
and posnr = vbap-posnr
and lfsta <> 'C'.
if sy-subrc = 0.
ivbap-vbeln = vbap-vbeln.
ivbap-posnr = vbap-posnr.
ivbap-matnr = vbap-matnr.
shift ivbap-matnr left deleting leading '0'.
ivbap-auart = ivbak-auart.
append ivbap.
clear ivbap.
endif.
endselect.
endloop.

else.
message e000 with
'No Sales Order found in VBAK according to your selection'.
endif.

endform. " get_sale_item_data
*&---------------------------------------------------------------------*
*& Form bdc_process
*&---------------------------------------------------------------------*
form bdc_process_zro.

clear: itab_err.
refresh: itab_err.

sort itab by auart vbeln posnr.
loop at itab.
perform bdc_for_zro_zros.

endloop.



endform. " bdc_process
*&---------------------------------------------------------------------*
*& Form BDC_DYNPRO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0412 text *
* -->P_0413 text *
*----------------------------------------------------------------------*
form bdc_dynpro tables bdcdata structure bdcdata
using program
dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata.
clear bdcdata.

endform. " BDC_DYNPRO

*&---------------------------------------------------------------------*
*& Form BDC_FIELD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0417 text *
* -->P_0418 text *
*----------------------------------------------------------------------*
form bdc_field tables bdcdata structure bdcdata
using fnam
fval.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.

endform. " BDC_FIELD
*&---------------------------------------------------------------------*
*& Form bdc_for_zro_zros
*&---------------------------------------------------------------------*
form bdc_for_zro_zros.
clear bdcdata.
refresh bdcdata.

perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0400'.

perform bdc_field tables bdcdata
using 'RM07M-BWARTWA'
'521'.

perform bdc_field tables bdcdata
using 'RM07M-SOBKZ'
'E'.

perform bdc_field tables bdcdata
using 'XFULL'
' '.

perform bdc_field tables bdcdata
using 'RM07M-WERKS'
'0006'.

perform bdc_field tables bdcdata
using 'RM07M-LGORT'
'0050'.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '/00'.


perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0421'.

perform bdc_field tables bdcdata
using 'MSEGK-MAT_KDAUF'
itab-vbeln.

perform bdc_field tables bdcdata
using 'MSEGK-MAT_KDPOS'
itab-posnr.

perform bdc_field tables bdcdata
using 'MSEG-MATNR(01)'
itab-matnr.

perform bdc_field tables bdcdata
using 'MSEG-ERFMG(01)'
itab-qty.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '=BU'.


call transaction 'MB1C' using bdcdata mode bdc_mode
update 'S'.
if sy-subrc <> 0.
move-corresponding itab to itab_err.
append itab_err.
clear itab_err.
endif.

endform. " bdc_for_zro_zros
*&---------------------------------------------------------------------*
*& Form create_excel_field_name
*&---------------------------------------------------------------------*
form create_excel_field_name.
clear ohead.
refresh ohead.

ohead-f1 = 'Item'.
ohead-f2 = 'Material'.
ohead-f3 = 'Desc.'.
ohead-f4 = 'Qty'.
ohead-f5 = 'Remark'.

append ohead.
clear ohead.


endform.
*&---------------------------------------------------------------------*
*& Form write_out_execl_format
*&---------------------------------------------------------------------*
form write_out_execl_format.

call function 'WS_DOWNLOAD'
exporting
filename = o_file1
filetype = 'DAT'
tables
data_tab = ohead
exceptions
invalid_filesize = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
customer_error = 7
others = 8.

call function 'WS_DOWNLOAD'
exporting
filename = o_file1
filetype = 'DAT'
mode = 'A'
tables
data_tab = etab
exceptions
invalid_filesize = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
customer_error = 7
others = 8.

endform.
*&---------------------------------------------------------------------*
*& Form move_header_vline
*&---------------------------------------------------------------------*
form move_header_vline.

* move: ';' to ohead-vline01,
* ';' to ohead-vline02,
* ';' to ohead-vline03,
* ';' to ohead-vline04,
* ';' to ohead-vline05,
* ';' to ohead-vline06.

endform. " move_header_vline
*&---------------------------------------------------------------------*
*& Form move_vline
*&---------------------------------------------------------------------*
form move_vline.
* move: ';' to ohead_xls-vline01,
* ';' to ohead_xls-vline02,
* ';' to ohead_xls-vline03,
* ';' to ohead_xls-vline04,
* ';' to ohead_xls-vline05,
* ';' to ohead_xls-vline06.

endform. " move_vline
*&---------------------------------------------------------------------*
*& Form column_header
*&---------------------------------------------------------------------*
form column_header.

write: /(01) sy-vline no-gap,
(10) 'Item' no-gap,
(01) sy-vline no-gap,
(10) 'Type' no-gap,
(01) sy-vline no-gap,
(15) 'Sales Order' no-gap,
(01) sy-vline no-gap,
(10) 'Sales Item' no-gap,
(01) sy-vline no-gap,
(20) 'Material no.' no-gap,
(01) sy-vline no-gap,
(40) 'Material Description' no-gap,
(01) sy-vline no-gap,
(10) 'Qty' no-gap,
(01) sy-vline no-gap,
(21) 'Remark' no-gap,
(01) sy-vline no-gap.

uline.

endform. " column_header
*&---------------------------------------------------------------------*
*& Form end_of_report
*&---------------------------------------------------------------------*
form end_of_report.

call function 'Z_STANDARD_END_OF_REPORT'
exceptions
others = 1.

endform. " end_of_report
*&---------------------------------------------------------------------*
*& Form bdc_process_zdi
*&---------------------------------------------------------------------*
form bdc_process_zdi_521e.

sort itab by auart vbeln posnr.
loop at itab.
perform bdc_for_zdi.

endloop.

endform. " bdc_process_zdi
*&---------------------------------------------------------------------*
*& Form bdc_for_zdi
*&---------------------------------------------------------------------*
form bdc_for_zdi.
clear bdcdata.
refresh bdcdata.

perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0400'.

perform bdc_field tables bdcdata
using 'RM07M-BWARTWA'
'521'.

perform bdc_field tables bdcdata
using 'RM07M-SOBKZ'
'E'.

perform bdc_field tables bdcdata
using 'XFULL'
' '.

perform bdc_field tables bdcdata
using 'RM07M-WERKS'
'0006'.

perform bdc_field tables bdcdata
using 'RM07M-LGORT'
'0050'.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '/00'.


perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0421'.

perform bdc_field tables bdcdata
using 'MSEGK-MAT_KDAUF'
itab-vbeln.

perform bdc_field tables bdcdata
using 'MSEGK-MAT_KDPOS'
itab-posnr.

perform bdc_field tables bdcdata
using 'MSEG-MATNR(01)'
itab-matnr.

perform bdc_field tables bdcdata
using 'MSEG-ERFMG(01)'
itab-qty.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '=BU'.


call transaction 'MB1C' using bdcdata mode bdc_mode
update 'S'.
if sy-subrc <> 0.
move-corresponding itab to itab_err.
append itab_err.
clear itab_err.
endif.

endform. " bdc_for_zdi
*&---------------------------------------------------------------------*
*& Form bdc_process_zdi_521
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form bdc_process_zdi_521.
sort etab by matnr.
loop at etab.
perform bdc_for_zdi_521.

endloop.

endform. " bdc_process_zdi_521
*&---------------------------------------------------------------------*
*& Form bdc_for_zdi_521
*&---------------------------------------------------------------------*
form bdc_for_zdi_521.
clear bdcdata.
refresh bdcdata.

perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0400'.

perform bdc_field tables bdcdata
using 'RM07M-BWARTWA'
'521'.

perform bdc_field tables bdcdata
using 'RM07M-SOBKZ'
' '.

perform bdc_field tables bdcdata
using 'XFULL'
' '.

perform bdc_field tables bdcdata
using 'RM07M-WERKS'
'0006'.

perform bdc_field tables bdcdata
using 'RM07M-LGORT'
'0050'.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '/00'.


perform bdc_dynpro tables bdcdata
using 'SAPMM07M' '0421'.

* perform bdc_field tables bdcdata
* using 'MSEGK-MAT_KDAUF'
* itab-vbeln.
*
* perform bdc_field tables bdcdata
* using 'MSEGK-MAT_KDPOS'
* itab-posnr.

perform bdc_field tables bdcdata
using 'MSEG-MATNR(01)'
etab-matnr.

perform bdc_field tables bdcdata
using 'MSEG-ERFMG(01)'
etab-qty.

perform bdc_field tables bdcdata
using 'BDC_OKCODE' '=BU'.


call transaction 'MB1C' using bdcdata mode bdc_mode
update 'S'.
if sy-subrc <> 0.
move-corresponding etab to itab_err.
append itab_err.
clear itab_err.
endif.




 

Create Date : 07 กันยายน 2552    
Last Update : 7 กันยายน 2552 10:58:03 น.
Counter : 216 Pageviews.  

1  2  
 Pantip.com | PantipMarket.com | Pantown.com | © 2004 BlogGang.com allrights reserved.