************************************************************************
*程式代號:ZPP0031R
*程式名稱:多料號展 BOM
* -------- -----------------------------------------------------
* 20160204 程式建立 By Bruce
************************************************************************
REPORT zpp0031r MESSAGE-ID ok.
TABLES: stpox,mara,marc,sktext,afko,stko,makt,plmz,mapl,
plpo,drat,mast.
TYPE-POOLS: slis.
DATA: layout TYPE slis_layout_alv.
DATA: fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA: selpool TYPE TABLE OF cstmat WITH HEADER LINE.
DATA: dstst_flg LIKE csdata-xfeld.
DATA: matcat TYPE TABLE OF cscmat WITH HEADER LINE.
DATA: stb TYPE STANDARD TABLE OF stpox WITH HEADER LINE.
DATA: return TYPE TABLE OF bapireturn WITH HEADER LINE.
DATA: return1 TYPE TABLE OF bapiret1 WITH HEADER LINE.
TYPES:BEGIN OF itabs,
matnr LIKE mara-matnr,
stufe LIKE stb-stufe, "LEVEL
posnr LIKE stb-posnr, "ITEM
matkl LIKE mara-matkl,
idnrk LIKE stb-idnrk, "METERIAL
chname LIKE sktext-maktx, "CHINESE NAME
en_name LIKE sktext-maktx, "ENGLISH NAME
maktx LIKE stb-ojtxp,
maktx2(80) TYPE c,
potx1 LIKE stb-potx1, "SIZE
meins LIKE stb-meins, "UNIT
mmein LIKE stb-meins, "Base Unit
quan TYPE p DECIMALS 4, "QUANTITY
datuv LIKE stb-datuv,
bmeng LIKE stko-bmeng,
alpgr LIKE stpo-alpgr,
aennr LIKE stb-aennr,
stlkn LIKE stb-stlkn,
mtart LIKE mara-mtart, "Material Type
nfmat LIKE marc-nfmat,
ewahr LIKE stb-ewahr,
ltxa1 LIKE plpo-ltxa1,
wegxx LIKE stb-wegxx,
mstae LIKE stpox-mstae,
dismm LIKE stpox-dismm,
ktext LIKE stpox-potx1,
END OF itabs.
DATA: itab TYPE itabs OCCURS 0 WITH HEADER LINE.
DATA: t_stlnr LIKE stpo-stlnr,
p_name LIKE makt-maktx,
old_stlst LIKE stko-stlst,
t_datuv LIKE stb-datuv,
p_maktx LIKE stb-ojtxp,
p_plnkn LIKE plmz-plnkn,
p_ltxa1 LIKE plpo-ltxa1,
t_idnrk LIKE stb-idnrk,
t_maktx LIKE sktext-maktx,
t_stufe LIKE stb-stufe VALUE 0,
amount_internal LIKE wmto_s-amount,
amount_display LIKE wmto_s-amount,
foreign_amount LIKE bapieine-net_price,
p_matnr LIKE mara-matnr,
m_text(70)