Escolar Documentos
Profissional Documentos
Cultura Documentos
*& Report ZTEST_CHALLANREPFINAL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZTEST_CHALLANREPFINAL.
include zselscreen.
data : begin of fs_lips,
vgbel like lips-vgbel,
vbeln like lips-vbeln,
matnr like lips-matnr,
werks like lips-werks,
charg like lips-charg,
lfimg like lips-lfimg,
end of fs_lips.
data : begin of fs_ekbe,
ebeln like ekbe-ebeln,
matnr like ekbe-matnr,
werks like ekbe-werks,
bldat like ekbe-bldat,
budat like ekbe-budat,
end of fs_ekbe.
data : begin of fs_mkpf,
budat like mkpf-budat,
end of fs_mkpf.
data : begin of fs_likp,
vbeln like likp-vbeln,
trmtyp like likp-trmtyp,
werks like likp-werks,
end of fs_likp.
data : begin of fs_mseg,
erfmg like mseg-erfmg,
ebeln like mseg-ebeln,
matnr like mseg-matnr,
kdauf like mseg-kdauf,
werks like mseg-werks,
end of fs_mseg.
data : begin of fs_t001w,
werks like t001w-werks,
name1 like t001w-werks,
end of fs_t001w.
data : begin of fs_makt,
matnr like makt-matnr,
maktx like makt-maktx,
end of fs_makt.
data : begin of fs_ekko,
ebeln like ekko-ebeln,
reswk like ekko-reswk,
bsart like ekko-bsart,
end of fs_ekko.
data : begin of fs_ekpo,
werks like ekpo-werks,
ebeln like ekpo-ebeln,
end of fs_ekpo.
data : begin of fs_final,
matnr like lips-matnr,
maktx like makt-maktx,
ebeln like ekbe-ebeln,
budat like mkpf-budat,
vbeln like likp-vbeln,
lfimg like lips-lfimg,
ptfrom like t001w-werks,
ptto like t001w-werks,
ptfname like t001w-name1,
pttoname like t001w-name1,
qty like mseg-erfmg,
end of fs_final.
data : t_lips like table of fs_lips,
t_ekbe like table of fs_ekbe,
t_mkpf like table of fs_mkpf,
t_likp like table of fs_likp,
t_mseg like table of fs_mseg,
t_t001w like table of fs_t001w,
t_t001w1 like table of fs_t001w,
t_makt like table of fs_makt,
t_ekko like table of fs_ekko,
t_ekpo like table of fs_ekpo,
t_final like table of fs_final.
***Query for fetching the delivery
select vbeln TRMTYP werks from likp into table t_likp where TRMTYP in s_mat
and lfart = 'NL'.
*LOOP AT T_likp INTO FS_likp.
* WRITE : / FS_likp-VBELN ,fs_likp-trmtyp.
perform getpo ."using fs_likp-vbeln .
* skip.
* ENDLOOP.
*IF not t_likp is initial.
select ebeln matnr werks bldat budat from ekbe into table t_ekbe for all ent
ries in t_ekko where ebeln eq t_ekko-ebeln and
bldat in s_docdat.
* endif.
select budat from mkpf into table t_mkpf where bldat in s_docdat.
*
* select budat from mkpf into table t_mkpf for all entries in t_ekbe where
budat eq t_ekbe-budat and
* bldat in s_docdat.
select erfmg
ebeln
matnr
kdauf
werks from mseg into table
t_mseg where matnr
in s_mat
and werks in s_plant.
******moving data from all temprary internal table to final internal table
loop at t_lips into fs_lips.
read table t_ekbe into fs_ekbe with key
matnr = fs_lips-matnr.
fs_final-matnr = fs_ekbe-matnr.
read table t_makt into fs_makt with key
matnr = fs_lips-matnr.
fs_final-maktx = fs_makt-maktx.
read table t_ekko into fs_ekko with key
reswk = fs_ekbe-werks.
fs_final-ebeln = fs_ekko-ebeln.
read table t_mkpf into fs_mkpf with key
budat = fs_ekbe-budat.
fs_final-budat = fs_mkpf-budat.
read table t_likp into fs_likp with key
vbeln = fs_lips-vbeln.
fs_final-vbeln = fs_likp-vbeln.
fs_final-lfimg = fs_lips-lfimg.
read table t_ekpo into fs_ekpo with key
ebeln = fs_ekbe-ebeln.
fs_final-ptfrom = fs_ekpo-werks.
read table t_t001w into fs_t001w with key
werks = fs_lips-werks.
fs_final-ptfname = fs_t001w-name1.
fs_final-ptto = fs_lips-werks.
read table t_t001w1 into fs_t001w with key
werks = fs_ekbe-werks.
fs_final-pttoname = fs_t001w-name1.
read table t_mseg into fs_mseg with key
matnr = fs_lips-matnr.
fs_final-qty = fs_mseg-erfmg.
append fs_final to t_final.
clear fs_final.
endloop.
loop at t_final into fs_final .
write : / fs_final-matnr ,
fs_final-maktx ,
fs_final-ebeln ,
fs_final-budat ,
fs_final-vbeln ,
fs_final-lfimg ,
fs_final-ptfrom,
fs_final-ptto ,
fs_final-ptfname ,
fs_final-pttoname,
fs_final-qty .
endloop.
*&---------------------------------------------------------------------*
*& Form GETPO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_FS_LIKP_VBELN text
*----------------------------------------------------------------------*
FORM GETPO ."USING P_FS_LIKP_VBELN .
select vgbel vbeln matnr werks charg lfimg from lips into table t_lips for all
entries in t_likp where vbeln eq t_LIKP-VBELN
and werks in s_plant .
*select vgbel matnr werks charg lfimg from lips into table t_lips where vbel
n eq P_FS_LIKP_VBELN.
* and werks in s_plant and charg in s_batch .
loop at t_lips into fs_lips.
perform check_po using fs_lips-vgbel.
perform get_planttname.
endloop.
ENDFORM. " GETPO
*&---------------------------------------------------------------------*
*& Form CHECK_PO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_FS_LIPS_VGBEL text
*----------------------------------------------------------------------*
FORM CHECK_PO USING P_FS_LIPS_VGBEL.
select ebeln reswk bsart from ekko into table t_ekko where ebeln eq p_fs_lips_
vgbel and bsart eq 'UB'.
loop at t_ekko into fs_ekko.
* write : / fs_ekko-bsart , fs_ekko-ebeln.
perform getpf using fs_ekko-ebeln.
endloop.
ENDFORM. " CHECK_PO
*&---------------------------------------------------------------------*
*& Form GETPF
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_FS_EKKO_EBELN text
*----------------------------------------------------------------------*
FORM GETPF USING P_FS_EKKO_EBELN.
select werks from ekpo into table t_ekpo where ebeln eq p_fs_ekko_ebeln.
perform get_plantfname.
ENDFORM. " GETPF
*&---------------------------------------------------------------------*
*& Form GET_PLANTFNAME
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_PLANTFNAME.
select werks name1 from t001w into table t_t001w for all entries in t_ekpo whe
re werks eq t_ekpo-werks.
ENDFORM. " GET_PLANTFNAME
*&---------------------------------------------------------------------*
*& Form GET_PLANTTNAME
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_PLANTTNAME .
select werks name1 from t001w into table t_t001w1 for all entries in t_lips wh
ere werks eq t_lips-werks.
ENDFORM. " GET_PLANTTNAME