ALV SCRIPTFROM 内容比较全的一个例子
REPORT ZQM_PRT04.
*----------------------------------------------------------------------*
* TABLES *
*----------------------------------------------------------------------*
TABLES:
qals,PLKOD.
type-pools: slis.
DATA: it_alv TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA gt_fieldcat TYPE lvc_t_fcat .
DATA ls_fcat TYPE lvc_s_fcat .
DATA: g_status_set TYPE slis_formname,
g_layout TYPE slis_layout_alv, " alv layout
g_sort TYPE slis_t_sortinfo_alv, " ALV sort table
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_events TYPE slis_t_event.
*ALV相关声明
TYPE-POOLS: slis.
DATA: wcl_container TYPE REF TO cl_gui_custom_container, "一个容器
wcl_alv TYPE REF TO cl_gui_alv_grid. "一个ALV对象
DATA gs_layout TYPE lvc_s_layo .
*data:count type i.
data:BEGIN OF gt_output OCCURS 100,
WERK like QALS-WERK, "工厂
NAME1 LIKE T001W-NAME1, "名称
MTYPE(10) type C, "报告单类型
KTEXTLOS LIKE QALS-KTEXTLOS, "编号
MATNR like QALS-MATNR, "物料
MAKTX LIKE MAKT-MAKTX, "物料名称
LOSMENGE LIKE QALS-LOSMENGE, "检验批数量
LMENGE01 like QALS-LMENGE01, "合格数量
MENGENEINH LIKE QALS-MENGENEINH, "单位
PRUEFLOS LIKE QALS-PRUEFLOS, "检验批
CHARG LIKE QALS-CHARG, "批次
HSDAT LIKE MCHA-HSDAT, "生产日期
PASTRTERM LIKE QALS-PASTRTERM,"检验日期
PAENDTERM LIKE QALS-PAENDTERM,"报告日期,检验结束日期
KTEXT LIKE PLKOD-KTEXT, "执行标准
VBEWERTUNG LIKE QAVE-VBEWERTUNG, "使用决策
****特性
MERKNR LIKE QAMV-MERKNR, "检验特性编号
VERWMERKM LIKE QAMV-VERWMERKM, "项目编号
KURZTEXT LIKE QAMV-KURZTEXT, "项目名称
AUSWMENGE1 LIKE QAMV-AUSWMENGE1, "检验标准编码
MBEWERTG LIKE QAMR-MBEWERTG, "结果类型
CODE1 LIKE QAMR-CODE1, "代码组
JYJG LIKE QPCT-KURZTEXT, "结果
JYBZ LIKE QPCT-KURZTEXT,
JYJLL(40) TYPE C,
PLAUSIOBEN like qpmk-PLAUSIOBEN, "上限
PLAUSIUNTE like qpmk-PLAUSIUNTE, "下限
STELLEN LIKE PLMW-STELLEN,
uu(8) type P decimals 4,
pp(8) type p DECIMALS 4,
tt(8) type p DECIMALS 4,
MASSEINHSW like qpmk-MASSEINHSW, "单位
MSEHT LIKE T006A-MSEHT,
VCODE like qave-VCODE,
VCODEGRP like qave-VCODEGRP,
****
JYJL(50) TYPE C, "检验结论
VNAME LIKE QAVE-VNAME, "签发人
***材料单
type(10) type C, "报告单类型
LIFNR like QALS-LIFNR, "供应商代码
LIFNRNAME LIKE lfa1-NAME1, "供应商名称
LICHN LIKE QALS-LICHN, "供应商批次
* CHARG LIKE QALS-CHARG, "系统批次
QFR(13) TYPE C,
JYR(13) TYPE C,
FHR(13) TYPE C,
MTART LIKE MARA-MTART, "物料类型
JYYJ(40) TYPE C, "检验依据
end of gt_output.
data: BEGIN OF gt_out3 OCCURS 100,
PRUEFLOS LIKE QALS-PRUEFLOS, "检验批
type(10) type C, "报告单类型
END OF gt_out3.
data:BEGIN OF gt_display OCCURS 100,
temp1(40) type c,
temp2(40) type c,
temp3(40) type c,
temp4(40) type c,
temp5(40) type c,
END OF gt_display.
data:BEGIN OF gt_temp,
temp1(40) type c,
temp2(40) type c,
temp3(40) type c,
temp4(40) type c,
temp5(40) type c,
END OF gt_temp.
data:gt_play LIKE TABLE OF gt_temp.
DATA:gt_out1 like TABLE OF gt_output WITH HEADER LINE.
DATA:gt_out2 like TABLE OF gt_output WITH HEADER LINE.
DATA: form_name(20).
DATA: COUNT(10) TYPE C.
data: t_temp type i.
data: t_amount(13) type c.
****************************备注变量生命
DATA: l_mandt LIKE stxh-mandt,
l_tdobject LIKE stxh-tdobject,
l_tdname LIKE thead-tdname, "stxh-tdobject,
l_tdid LIKE stxh-tdid,
l_tdspras LIKE thead-tdspras. "stxh-TDSPRAS.
DATA i_tline LIKE tline OCCURS 7 WITH HEADER LINE.
DATA: l-text(1000) TYPE c,
l-totali TYPE i VALUE -1,
l-total TYPE c.
DATA:tdname TYPE STXH-tdname.
data:t_len type I.
data:uu(12) type c,pp(12) type c,tt(12) type c,kk(12) type c,mm(17) type c.
data:t_jybz LIKE QPCT-KURZTEXT.
data:t_code like QPCT-CODE.
data:t_jyjl like QPCT-KURZTEXT.
DATA: ok_code LIKE sy-ucomm.
DATA ls_stable TYPE lvc_s_stbl.
data:my_options like ITCPO.
data:t_type(1) type c.
data:t_p(1) type c.
data:t_i type i.
data:t_ii type i.
data:t_jybz1(18) type c.
data:t_jybz2(18) type c.
data:t_jybz3(18) type c.
data:t_jyjg1(18) type c.
data:t_jyjg2(18) type c.
data:t_jyjg3(18) type c.
data:t_jyxm1(10) type c,
t_jyxm2(10) type c,
t_jyxm3(10) type c,
t_jyxm4(10) type c.
data:t_c type i.
data:t_pzr(10) TYPE c,t_fhr(10) TYPE c,t_jyr(10) TYPE c.
data:t_jyjl1(40) type c,t_jyjl2(40) type c.
data:t_row type i.
data:t_name1(16) type c,t_name2(16) type c,t_name3(18) type c,t_name4(18) type c,t_name(50) type c,t_name5(16) type c.
data:t_jyyj1(12) type c,t_jyyj2(12) type c,t_jyyj3(12) type c,t_jyyj4(12) type c,
t_jybzz1(12) type c,t_jybzz2(12) type c,t_jybzz3(12) type c,t_jybzz4(12) type c,
t_jyjgg1(12) type c,t_jyjgg2(12) type c,t_jyjgg3(12) type c,t_jyjgg4(12) type c.
*data:t_amount(13) type c.
DATA: G_CHAR(12) TYPE C.
DATA: t_kk(8) type P decimals 4.
*****************************
*----------------------------------------------------------------------*
* INTERNAL TABLES AND WORK AREAS *
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
* GLOBAL VARIABLES *
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
* PARAMETERS AND SELECT-OPTIONS *
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK rad1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:
P_WERKS FOR qals-werk OBLIGATORY,
P_PRUEF FOR QALS-PRUEFLOS OBLIGATORY.
* P_MATNR FOR QALS-MATNR OBLIGATORY.
SELECTION-SCREEN END OF BLOCK rad1.
************************************************************************
* MAIN PROCESS *
************************************************************************
*----------------------------------------------------------------------*
* INITIALIZATION *
*----------------------------------------------------------------------*
*INITIALIZATION.
**----------------------------------------------------------------------
* START-OF-SELECTION *
*----------------------------------------------------------------------*
*****取数
PERFORM get_data.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET TITLEBAR 'BAR1'.
SET PF-STATUS 'ZQM_PRT04'.
***呈现
PERFORM display_data.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'FPRINT'."打印
PERFORM FPRINT.
WHEN OTHERS.
ENDCASE.
CLEAR ok_code.
ENDMODULE. " USER_COMMAND_0100 INPUT
*
*AT USER-COMMAND .
* CASE sy-ucomm .
* WHEN 'FPRINT' .
**form print .
* PERFORM FORM_PRINT.
* WHEN 'EXIT' OR 'BACK' .
* LEAVE TO SCREEN 0 .
* ENDCASE .
* CLEAR sy-ucomm .
*END-OF-SELECTION.
FORM get_data.
SELECT QALS~WERK
MARC~BESKZ AS MTYPE
QALS~KTEXTLOS
QALS~MATNR
QALS~LOSMENGE
QALS~LMENGE01
QALS~MENGENEINH
QALS~PRUEFLOS
QALS~CHARG
MCH1~HSDAT
QAVE~VCODE
QAVE~VCODEGRP
QALS~PASTRTERM
QALS~PAENDTERM
* PLKOD~KTEXT
QAVE~VBEWERTUNG
QAVE~VNAME
QAMV~MERKNR
QAMV~VERWMERKM
QAMV~KURZTEXT
QAMV~AUSWMENGE1
QAMR~MBEWERTG
QAMR~CODE1
QPCT~KURZTEXT AS JYJG
MARC~BESKZ AS TYPE
QALS~LIFNR
QALS~LICHN
MARA~MTART
INTO CORRESPONDING FIELDS OF TABLE GT_OUT1
FROM QALS
JOIN MARC ON QALS~WERK = MARC~WERKS AND QALS~MATNR = MARC~MATNR
JOIN MARA ON QALS~MATNR = MARA~MATNR
LEFT JOIN MCH1 ON QALS~MATNR = MCH1~MATNR AND QALS~CHARG = MCH1~CHARG
JOIN QAVE ON QALS~PRUEFLOS = QAVE~PRUEFLOS
JOIN QAMV ON QALS~PRUEFLOS = QAMV~PRUEFLOS
JOIN QAMR ON QALS~PRUEFLOS = QAMR~PRUEFLOS AND QAMV~MERKNR = QAMR~MERKNR
JOIN QPCT ON QAMV~AUSWMENGE1 = QPCT~CODEGRUPPE AND QAMR~CODE1 = QPCT~CODE
* JOIN PLKOD ON QALS~PLNTY = PLKOD~PLNTY AND QALS~PLNNR = PLKOD~PLNNR AND QALS~PLNAL = PLKOD~PLNAL AND QALS~ZAEHL = PLKOD~ZAEHL
WHERE QALS~WERK IN P_WERKS AND
* QALS~MATNR IN P_MATNR AND
QALS~PRUEFLOS IN P_PRUEF AND
QAVE~VBEWERTUNG <> ''.
SELECT QALS~WERK
MARC~BESKZ AS MTYPE
QALS~KTEXTLOS
QALS~MATNR
QALS~LOSMENGE
QALS~LMENGE01
QALS~MENGENEINH
QALS~PRUEFLOS
QALS~CHARG
MCH1~HSDAT
QAVE~VCODE
QAVE~VCODEGRP
QALS~PASTRTERM
QALS~PAENDTERM
* PLKOD~KTEXT
QAVE~VBEWERTUNG
QAVE~VNAME
QAMV~MERKNR
QAMV~VERWMERKM
QAMV~KURZTEXT
QAMV~AUSWMENGE1
QAMR~MBEWERTG
QAMR~CODE1
* QPCT~KURZTEXT AS JYJG
QAMR~ORIGINAL_INPUT AS JYJG
QPMK~PLAUSIUNTE
QPMK~PLAUSIOBEN
QPMK~PLAUSIUNTE as uu
QPMK~PLAUSIOBEN as pp
QPMK~MASSEINHSW
MARC~BESKZ AS TYPE
QALS~LIFNR
QALS~LICHN
MARA~MTART
INTO CORRESPONDING FIELDS OF TABLE GT_OUT2
FROM QALS
JOIN MARC ON QALS~WERK = MARC~WERKS AND QALS~MATNR = MARC~MATNR
JOIN MARA ON QALS~MATNR = MARA~MATNR
LEFT JOIN MCH1 ON QALS~MATNR = MCH1~MATNR AND QALS~CHARG = MCH1~CHARG
JOIN QAVE ON QALS~PRUEFLOS = QAVE~PRUEFLOS
JOIN QAMV ON QALS~PRUEFLOS = QAMV~PRUEFLOS
JOIN QAMR ON QALS~PRUEFLOS = QAMR~PRUEFLOS AND QAMV~MERKNR = QAMR~MERKNR
JOIN QPMK ON QAMV~VERWMERKM = QPMK~MKMNR AND QAMV~QPMK_WERKS = QPMK~ZAEHLER AND QAMV~MKVERSION = QPMK~VERSION
* JOIN QPCT ON QAMV~AUSWMENGE1 = QPCT~CODEGRUPPE AND QAMR~CODE1 = QPCT~CODE
* JOIN PLKOD ON QALS~PLNTY = PLKOD~PLNTY AND QALS~PLNNR = PLKOD~PLNNR AND QALS~PLNAL = PLKOD~PLNAL AND QALS~ZAEHL = PLKOD~ZAEHL
WHERE QALS~WERK IN P_WERKS AND
* QALS~MATNR IN P_MATNR AND
QALS~PRUEFLOS IN P_PRUEF AND
QAVE~VBEWERTUNG <> '' AND
QAMV~AUSWMENGE1 = ''.
loop at gt_out1.
append gt_out1 to gt_output.
CLEAR:gt_out1.
endloop.
loop at gt_out2.
append gt_out2 to gt_output.
CLEAR:gt_out2.
endloop.
t_temp = 0.
LOOP AT GT_OUTPUT.
PERFORM GET_TEXT.
if gt_output-mtype = 'E'.
t_p = gt_output-type.
GT_OUTPUT-MTYPE = '产成品检验报告单'.
ELSE.
t_p = gt_output-type.
GT_OUTPUT-MTYPE = '材料检验报告单'.
ENDIF.
if gt_output-type = 'E'.
select SINGLE QPCT~KURZTEXT
into t_jyjl
from QPCT
WHERE QPCT~CODEGRUPPE = GT_OUTPUT-VCODEGRP AND
QPCT~CODE = GT_OUTPUT-VCODE.
* CONCATENATE '结论:"' t_jyjl '"; ' gt_output-jyjl into gt_display-temp2.
* CONDENSE:gt_display-temp2.
if gt_output-vbewertung = 'A'.
* CONCATENATE '结论:"' t_jyjl '"; 符合 ' GT_OUTPUT-KTEXT ' 标准要求。' INTO GT_OUTPUT-JYJL.
CONCATENATE '符合 ' GT_OUTPUT-KTEXT ' 标准要求。' INTO GT_OUTPUT-JYJL.
CONDENSE:GT_OUTPUT-JYJL.
else.
* CONCATENATE '结论:"' t_jyjl '"; 不符合 ' GT_OUTPUT-KTEXT ' 标准要求。' INTO GT_OUTPUT-JYJL.
CONCATENATE '不符合 ' GT_OUTPUT-KTEXT ' 标准要求。' INTO GT_OUTPUT-JYJL.
CONDENSE:GT_OUTPUT-JYJL.
ENDIF.
else.
select SINGLE QPCT~KURZTEXT
into t_jyjl
from QPCT
WHERE QPCT~CODEGRUPPE = GT_OUTPUT-VCODEGRP AND
QPCT~CODE = GT_OUTPUT-VCODE.
* CONCATENATE '结论:"' t_jyjl '"; ' gt_output-jyjl into gt_display-temp2.
* CONDENSE:gt_display-temp2.
if gt_output-vbewertung = 'A'.
* CONCATENATE '结论:"' t_jyjl '"; 符合 ' GT_OUTPUT-KTEXT ' 标准要求。' INTO GT_OUTPUT-JYJL.
CONCATENATE '符合 ' GT_OUTPUT-JYJL ' 标准要求。' INTO GT_OUTPUT-JYJL.
CONDENSE:GT_OUTPUT-JYJL.
else.
* CONCATENATE '结论:"' t_jyjl '"; 不符合 ' GT_OUTPUT-KTEXT ' 标准要求。' INTO GT_OUTPUT-JYJL.
CONCATENATE '不符合 ' GT_OUTPUT-JYJL ' 标准要求。' INTO GT_OUTPUT-JYJL.
CONDENSE:GT_OUTPUT-JYJL.
ENDIF.
**** 增加取检验依据数据
select SINGLE TXZ01 INTO gt_output-jyyj
from ZQM_INSP_BASIS
where WERKS = GT_OUTPUT-WERK and
MATNR = GT_OUTPUT-MATNR.
endif.
***** 取物料描述
select single makt~MAKTX
INTO GT_OUTPUT-MAKTX
from makt
where MATNR = GT_OUTPUT-MATNR and
SPRAS = 1.
***** 取工厂名称
select single t001w~NAME1
INTO GT_OUTPUT-NAME1
from t001w
where WERKS = GT_OUTPUT-WERK.
**** 取供应商账户名称
select SINGLE lfa1~NAME1
into GT_OUTPUT-LIFNRNAME
from lfa1
where LIFNR = GT_OUTPUT-LIFNR.
t_amount = gt_output-LOSMENGE.
IF GT_OUTPUT-MBEWERTG = 'A'.
GT_OUTPUT-JYJLL = '合格'.
ELSE.
GT_OUTPUT-JYJLL = '不合格'.
endif.
****检验标准
SEARCH gt_output-VERWMERKM for 'XJQL' ABBREVIATED.
IF SY-SUBRC = 0.
IF GT_OUTPUT-MBEWERTG = 'A'.
T_LEN = STRLEN( GT_OUTPUT-JYJG ).
T_LEN = T_LEN - 3.
SEARCH GT_OUTPUT-JYJG FOR '符合' ABBREVIATED .
IF sy-subrc = 0.
GT_OUTPUT-JYBZ = GT_OUTPUT-JYJG+3(t_len).
t_temp = t_temp + 1.
else.
t_temp = 0.
endif.
if t_temp = 0.
T_LEN = STRLEN( GT_OUTPUT-JYJG ).
T_LEN = T_LEN - 4.
SEARCH GT_OUTPUT-JYJG FOR '不符合' ABBREVIATED .
IF sy-subrc = 0.
GT_OUTPUT-JYBZ = GT_OUTPUT-JYJG+4(t_len).
t_temp = t_temp + 1.
else.
t_temp = 0.
endif.
endif.
if t_temp = 0.
GT_OUTPUT-JYBZ = GT_OUTPUT-JYJG.
endif.
else.
t_code = gt_output-code1.
t_code = t_code - 1.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = t_code
IMPORTING
OUTPUT = t_code.
select SINGLE QPCT~KURZTEXT
into t_jybz
from qpct
where QPCT~CODEGRUPPE = gt_output-AUSWMENGE1 and
QPCT~CODE = t_code.
IF SY-SUBRC <> 0.
t_jybz = ''.
endif.
T_LEN = STRLEN( t_jybz ).
T_LEN = T_LEN - 3.
SEARCH t_jybz FOR '符合' ABBREVIATED .
IF sy-subrc = 0.
GT_OUTPUT-JYBZ = t_jybz+3(t_len).
t_temp = t_temp + 1.
else.
t_temp = 0.
endif.
if t_temp = 0.
T_LEN = STRLEN( t_jybz ).
T_LEN = T_LEN - 4.
SEARCH t_jybz FOR '不符合' ABBREVIATED .
IF sy-subrc = 0.
GT_OUTPUT-JYBZ = t_jybz+4(t_len).
t_temp = t_temp + 1.
else.
t_temp = 0.
endif.
endif.
if t_temp = 0.
GT_OUTPUT-JYBZ = t_jybz.
endif.
endif.
ELSE.
*****取上下限标准
select SINGLE PLMW~PLAUSIUNTE PLMW~PLAUSIOBEN PLMW~SOLLWERT PLMW~STELLEN
INTO (gt_output-uu,gt_output-pp,gt_output-tt,gt_output-STELLEN)
FROM PLMW
JOIN PLMK ON PLMK~PLNTY = PLMW~PLNTY AND PLMK~PLNNR = PLMW~PLNNR AND PLMK~PLNKN = PLMW~PLNKN AND
PLMK~KZEINSTELL = PLMW~KZEINSTELL AND PLMK~MERKNR = PLMW~MERKNR
WHERE PLMW~MATNR = GT_OUTPUT-MATNR AND
PLMW~WERKS = GT_OUTPUT-WERK AND
PLMK~VERWMERKM = gt_output-VERWMERKM.
SELECT SINGLE MSEHT
INTO GT_OUTPUT-MSEHT
FROM T006A
WHERE SPRAS = 1 AND
MSEHI = gt_output-MASSEINHSW.
IF gt_output-uu = 0.
if gt_output-pp = 0.
gt_output-jybz = ''.
else.
pp = gt_output-pp.
PERFORM SET_NUM USING PP GT_OUTPUT-STELLEN.
PP = G_CHAR.
CLEAR:G_CHAR.
CONCATENATE '≤ ' pp GT_OUTPUT-MSEHT INTO GT_OUTPUT-JYBZ.
CONDENSE:gt_output-jybz.
endif.
ELSE.
if gt_output-pp = 0.
uu = gt_output-uu.
PERFORM SET_NUM USING UU GT_OUTPUT-STELLEN.
UU = G_CHAR.
CLEAR:G_CHAR.
CONCATENATE '≥ ' uu GT_OUTPUT-MSEHT INTO GT_OUTPUT-JYBZ.
CONDENSE:gt_output-jybz.
else.
if gt_output-tt = 0.
uu = gt_output-uu.
PERFORM SET_NUM USING UU GT_OUTPUT-STELLEN.
UU = G_CHAR.
CLEAR:G_CHAR.
pp = gt_output-pp.
PERFORM SET_NUM USING PP GT_OUTPUT-STELLEN.
PP = G_CHAR.
CLEAR:G_CHAR.
CONCATENATE uu ' - ' pp GT_OUTPUT-MSEHT INTO GT_OUTPUT-JYBZ.
CONDENSE:gt_output-jybz.
else.
tt = gt_output-tt.
t_kk = gt_output-pp - gt_output-tt.
kk = t_kk.
PERFORM SET_NUM USING TT GT_OUTPUT-STELLEN.
TT = G_CHAR.
CLEAR:G_CHAR.
PERFORM SET_NUM USING KK GT_OUTPUT-STELLEN.
KK = G_CHAR.
CLEAR:G_CHAR.
CONCATENATE tt ' ± ' kk GT_OUTPUT-MSEHT INTO GT_OUTPUT-JYBZ.
CONDENSE:gt_output-jybz.
endif.
endif.
ENDIF.
ENDIF.
MODIFY GT_OUTPUT.
CLEAR:GT_OUTPUT.
ENDLOOP.
****取出对应检验批次
loop at gt_output.
gt_out3-PRUEFLOS = gt_output-PRUEFLOS.
gt_out3-type = gt_output-type.
append gt_out3.
CLEAR:gt_output.
ENDLOOP.
sort gt_out3 by PRUEFLOS.
DELETE ADJACENT DUPLICATES FROM gt_out3 COMPARING ALL FIELDS.
loop at gt_out3.
READ TABLE gt_output with key PRUEFLOS = gt_out3-PRUEFLOS.
IF sy-tabix >= 1.
if gt_output-type = 'E'. "产成品
*** 第一行放公司
gt_display-temp2 = gt_output-NAME1.
append gt_display.
CLEAR:gt_display.
*** 第二行放报告单类别
gt_display-temp2 = gt_output-mtype.
APPEND gt_display.
CLEAR:gt_display.
*** 第三行放编号
CONCATENATE '编号:' gt_output-KTEXTLOS INTO gt_display-temp1.
CONDENSE:gt_display-temp1.
APPEND gt_display.
CLEAR:gt_display.
*** 第四行放产品名称、数量
gt_display-temp1 = '产品名称'.
CONCATENATE gt_output-matnr '/' gt_output-MAKTX into gt_display-temp2.
CONDENSE:gt_display-temp2.
* gt_display-temp2 = gt_output-MAKTX.
gt_display-temp3 = '数量'.
* IF GT_OUTPUT-vbewertung = 'A'.
* mm = gt_output-LOSMENGE.
* else.
if gt_output-LMENGE01 = 0.
mm = gt_output-LOSMENGE.
else.
mm = gt_output-LMENGE01.
endif.
* endif.
CONCATENATE mm ' ' gt_output-MENGENEINH INTO gt_display-temp4.
APPEND gt_display.
CLEAR:gt_display.
*** 第五行放检验批
gt_display-temp1 = '检验批'.
gt_display-temp2 = gt_output-PRUEFLOS.
APPEND gt_display.
CLEAR:gt_display.
*** 第六行放批号,日期
gt_display-temp1 = '生产批号'.
gt_display-temp2 = gt_output-CHARG.
gt_display-temp3 = '生产日期'.
if gt_output-hsdat = '00000000'.
gt_display-temp4 = ''.
else.
gt_display-temp4 = gt_output-hsdat.
endif.
APPEND gt_display.
CLEAR:gt_display.
*** 第七行放检验日期、报告日期
gt_display-temp1 = '检验日期'.
gt_display-temp2 = gt_output-PASTRTERM.
gt_display-temp3 = '报告日期'.
gt_display-temp4 = gt_output-PAENDTERM.
APPEND gt_display.
CLEAR:gt_display.
*** 第八行放执行标准
gt_display-temp1 = '执行标准'.
gt_display-temp2 = gt_output-KTEXT.
APPEND gt_display.
CLEAR:gt_display.
*** 第九行放标题
gt_display-temp1 = '检验项目'.
gt_display-temp2 = '检验标准'.
gt_display-temp3 = '检验结果'.
gt_display-temp4 = '结论'.
APPEND gt_display.
CLEAR:gt_display.
**** 第十行开始放明细
loop at gt_output where PRUEFLOS = gt_out3-PRUEFLOS.
gt_display-temp1 = gt_output-KURZTEXT.
gt_display-temp2 = gt_output-jybz.
gt_display-temp3 = gt_output-jyjg.
gt_display-temp4 = gt_output-jyjll.
APPEND gt_display.
CLEAR:gt_display.
endloop.
* ** 最后放尾页
gt_display-temp1 = '检验结论'.
gt_display-temp2 = gt_output-jyjl.
APPEND gt_display.
CLEAR:gt_display.
**** 自建表取数
****签字人取法
select SINGLE pzuser fhuser jyuser
into (gt_display-temp1,gt_display-temp3,gt_display-temp4)
from zqm_jy_user
where werks = gt_output-werk and
mtype = 'A' and
stdate <= gt_output-PAENDTERM and
endate >= gt_output-PAENDTERM.
gt_display-temp2 = ''.
CONCATENATE '签发人:' gt_display-temp1 into gt_display-temp1.
CONCATENATE '复核人:' gt_display-temp3 into gt_display-temp3.
CONCATENATE '检验人:' gt_display-temp4 into gt_display-temp4.
* ** 检验人
APPEND gt_display.
CLEAR:gt_display.
ELSE."原材料
*** 第一行放公司
gt_display-temp2 = gt_output-NAME1.
append gt_display.
CLEAR:gt_display.
*** 第二行放报告单类别
gt_display-temp2 = gt_output-mtype.
APPEND gt_display.
CLEAR:gt_display.
*** 第三行放编号
CONCATENATE '编号:' gt_output-KTEXTLOS INTO gt_display-temp1.
CONDENSE:gt_display-temp1.
APPEND gt_display.
CLEAR:gt_display.
*** 第四行放产品名称、数量
gt_display-temp1 = '产品名称'.
CONCATENATE gt_output-matnr '/' gt_output-MAKTX into gt_display-temp2.
CONDENSE:gt_display-temp2.
* gt_display-temp2 = gt_output-MAKTX.
gt_display-temp3 = '数量'.
* IF GT_OUTPUT-vbewertung = 'A'.
* mm = gt_output-LOSMENGE.
* else.
if gt_output-LMENGE01 = 0.
mm = gt_output-LOSMENGE.
else.
mm = gt_output-LMENGE01.
endif.
* endif.
CONCATENATE mm ' ' gt_output-MENGENEINH INTO gt_display-temp4.
APPEND gt_display.
CLEAR:gt_display.
*** 第五行放供应商,日期
gt_display-temp1 = '供应商'.
CONCATENATE gt_output-LIFNR '/' gt_output-LIFNRNAME INTO gt_display-temp2.
CONDENSE:gt_display-temp2.
gt_display-temp3 = '生产日期'.
if gt_output-hsdat = '00000000'.
gt_display-temp4 = ''.
else.
gt_display-temp4 = gt_output-hsdat.
endif.
APPEND gt_display.
CLEAR:gt_display.
*** 第六行放供应商批次、系统批次
gt_display-temp1 = '检验批'.
gt_display-temp2 = gt_output-PRUEFLOS."gt_output-LICHN.
gt_display-temp3 = '批次'.
gt_display-temp4 = gt_output-CHARG.
APPEND gt_display.
CLEAR:gt_display.
*** 第七行放检验日期、报告日期
gt_display-temp1 = '检验日期'.
gt_display-temp2 = gt_output-PASTRTERM.
gt_display-temp3 = '报告日期'.
gt_display-temp4 = gt_output-PAENDTERM.
APPEND gt_display.
CLEAR:gt_display.
*** 第八行放执行标准
* gt_display-temp1 = '执行标准'.
* gt_display-temp2 = gt_output-KTEXT.
* APPEND gt_display.
* CLEAR:gt_display.
*** 第九行放标题
gt_display-temp1 = '检验项目'.
gt_display-temp2 = '检验依据'.
gt_display-temp3 = '检验标准'.
gt_display-temp4 = '检验结果'.
gt_display-temp5 = '检验结论'.
APPEND gt_display.
CLEAR:gt_display.
**** 第十行开始放明细
loop at gt_output where PRUEFLOS = gt_out3-PRUEFLOS.
gt_display-temp1 = gt_output-KURZTEXT.
gt_display-temp2 = gt_output-jyyj.
gt_display-temp3 = gt_output-jybz.
gt_display-temp4 = gt_output-jyjg.
gt_display-temp5 = gt_output-jyjll.
APPEND gt_display.
CLEAR:gt_display.
endloop.
* ** 最后放尾页
gt_display-temp1 = '检验结论'.
select SINGLE QPCT~KURZTEXT
into t_jyjl
from QPCT
WHERE QPCT~CODEGRUPPE = GT_OUTPUT-VCODEGRP AND
QPCT~CODE = GT_OUTPUT-VCODE.
* CONCATENATE '结论:"' t_jyjl '"; ' gt_output-jyjl into gt_display-temp2.
* CONDENSE:gt_display-temp2.
gt_display-temp2 = gt_output-jyjl.
* if gt_output-VBEWERTUNG = 'A'.
* CONCATENATE gt_output-jyjl ' 结论合格' into gt_display-temp2.
* CONDENSE:gt_display-temp2.
** gt_display-temp2 = '合格'.
* else.
* CONCATENATE gt_output-jyjl ' 结论不合格' into gt_display-temp2.
* CONDENSE:gt_display-temp2.
** gt_display-temp2 = '不合格'.
* endif.
* gt_display-temp2 = gt_output-jyjl.
APPEND gt_display.
CLEAR:gt_display.
**** 自建表取数
****签字人取法
if gt_output-MTART = 'ROH'.
select SINGLE pzuser fhuser jyuser
into (gt_display-temp1,gt_display-temp3,gt_display-temp4)
from zqm_jy_user
where werks = gt_output-werk and
mtype = 'B' and
stdate <= gt_output-PAENDTERM and
endate >= gt_output-PAENDTERM.
endif.
if gt_output-MTART = 'VERP'.
select SINGLE pzuser fhuser jyuser
into (gt_display-temp1,gt_display-temp3,gt_display-temp4)
from zqm_jy_user
where werks = gt_output-werk and
mtype = 'C' and
stdate <= gt_output-PAENDTERM and
endate >= gt_output-PAENDTERM.
endif.
gt_display-temp2 = ''.
CONCATENATE '批准人:' gt_display-temp1 into gt_display-temp1.
CONCATENATE '复核人:' gt_display-temp3 into gt_display-temp3.
CONCATENATE '检验人:' gt_display-temp4 into gt_display-temp4.
* ** 检验人
APPEND gt_display.
CLEAR:gt_display.
ENDIF.
endif.
ENDLOOP.
loop at gt_display.
append gt_display to gt_play.
CLEAR:gt_display.
ENDLOOP.
***
if gt_output[] is INITIAL.
else.
CALL SCREEN 100.
endif.
* LOOP AT GT_OUTPUT.
* PERFORM FORM_PRINT.
* ENDLOOP.
ENDFORM.
FORM FORM_PRINT .
DATA: lld_flag.
DATA: tkd_flag.
DATA: index TYPE i.
CLEAR lld_flag.
CLEAR tkd_flag.
index = 0.
count = 0.
if t_p = 'E'.
form_name = 'ZQM_PRT041'.
ELSE.
form_name = 'ZQM_PRT042'.
ENDIF.
IF lld_flag is INITIAL.
lld_flag = 'X'.
PERFORM open_form.
ENDIF.
ENDFORM. " FORM_PRINT
*&---------------------------------------------------------------------*
*& Form OPEN_FORM
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM OPEN_FORM .
* my_options-TDDEST = 'WAHAHA_PRT'. "打印设备
my_options-TDIMMED = 'X'.
my_options-TDDELETE = 'X'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = form_name
OPTIONS = my_options
EXCEPTIONS
OTHERS = 1.
if sy-subrc <> 0 .
t_type = 'X'.
else.
t_type = ''.
endif.
ENDFORM. " OPEN_FORM
*&---------------------------------------------------------------------*
*& Form PRINT_LLD_HEAD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PRINT_LLD_HEAD .
*CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'LLD'
* window = 'TITLE'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'LLD'
window = 'HEAD'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_HEAD1'
window = 'HEAD1'.
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'LLD_HEAD1'
* window = 'HEAD1'.
ENDFORM. " PRINT_LLD_HEAD
*&---------------------------------------------------------------------*
*& Form PRINT_LLD_ITEM
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PRINT_LLD_ITEM .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_BODY'
window = 'MAIN'
FUNCTION = 'APPEND'
TYPE = 'BODY'.
ENDFORM. " PRINT_LLD_ITEM
FORM PRINT_LLD_ITEM2 .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_BODY2'
window = 'MAIN2'
* FUNCTION = 'APPEND'
TYPE = 'BODY'.
ENDFORM. " PRINT_LLD_ITEM
FORM PRINT_LLD_BODY .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'LLD_BODY'
window = 'MAIN'.
ENDFORM. " PRINT_LLD_ITEM
FORM PRINT_TKD_BODY .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TKD_BODY'
window = 'MAIN'
FUNCTION = 'APPEND'
TYPE = 'BODY'.
ENDFORM. " PRINT_LLD_ITEM
FORM PRINT_TKD_BODY2 .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TKD_BODY'
window = 'MAIN2'
* FUNCTION = 'APPEND'
TYPE = 'BODY'.
ENDFORM. " PRINT_LLD_ITEM
FORM PRINT_TKD_BODY_D .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TKD_BODY'
window = 'MAIN'
function = 'DELETE'.
ENDFORM. " PRINT_LLD_ITEM
FORM PRINT_TKD_BODY_OTHER.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TKD_BODY'
window = 'MAIN'.
ENDFORM. " PRINT_LLD_ITEM
FORM PRINT_BOTTOM .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'LLD'
window = 'MAIN'.
ENDFORM. " PRINT_LLD_ITEM
FORM NEXT_PAGE.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'NEW-PAGE'.
ENDFORM.
FORM PRINT_HEAD.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_HEAD1'
window = 'HEAD1'.
ENDFORM.
FORM PRINT_HEAD2.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_HEAD2'
window = 'HEAD2'.
ENDFORM.
FORM PRINT_TPP_BODY.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TPP_BODY'
window = 'MAIN'.
ENDFORM.
FORM PRINT_TJY_BT.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TJY_BT'
window = 'MAIN'.
ENDFORM.
FORM PRINT_TJYH_BT.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TJYH_BT'
window = 'MAIN'.
ENDFORM.
FORM PRINT_TPD_BODY.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TPD_BODY'
window = 'MAIN'.
ENDFORM.
FORM PRINT_PIC_BODY.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'PIC_BODY'
window = 'MAIN'.
ENDFORM.
FORM PRINT_PIC2_BODY.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'PIC2_BODY'
window = 'MAIN'.
ENDFORM.
FORM GET_TEXT.
CONCATENATE sy-mandt GT_OUTPUT-PRUEFLOS 'L' INTO tdname.
SELECT SINGLE mandt tdobject tdname tdid tdspras
INTO (l_mandt,l_tdobject,l_tdname,l_tdid,l_tdspras)
FROM stxh
CLIENT SPECIFIED
WHERE mandt = sy-mandt
AND tdid = 'QAVE'
AND tdname = tdname.
if sy-subrc = 0.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = l_tdid
language = l_tdspras
name = l_tdname
object = l_tdobject
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = i_tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
LOOP AT i_tline.
IF sy-tabix = 1.
if gt_output-type = 'E'.
GT_OUTPUT-KTEXT = i_tline-tdline.
else.
GT_OUTPUT-JYJL = i_tline-tdline.
endif.
ENDIF.
ENDLOOP.
endif.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form DISPLAY_DATA
*&---------------------------------------------------------------------*
FORM display_data.
IF gt_display[] is INITIAL.
return.
ENDIF.
* sort gt_display by PRUEFLOS MERKNR.
* PERFORM display_alv TABLES gt_display USING '检验报告单'.
*-----如果窗口还没有创建ALV对象则创建它
IF wcl_container IS INITIAL .
CREATE OBJECT: wcl_container "建立容器对象
EXPORTING
container_name = 'ALV_CONTAINER'. "容器对象的名字
CREATE OBJECT wcl_alv "建立ALV对象
EXPORTING
i_parent = wcl_container. "ALV对象所在的容器
PERFORM build_fieldcat.
*-----设置布局
PERFORM prepare_layout CHANGING gs_layout .
*-----显示alv
CALL METHOD wcl_alv->set_table_for_first_display
EXPORTING
is_layout = gs_layout "传入布局设置
* it_toolbar_excluding = gt_exclude "传入按钮设置
CHANGING
it_outtab = gt_play "传入内表
it_fieldcatalog = gt_fieldcat "传入表头
* it_sort = gt_sort "传入排序标准
* it_filter = s_line
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
ELSE .
*----刷新alv
CALL METHOD wcl_alv->refresh_table_display
EXPORTING
is_stable = ls_stable "这个是稳定刷新属性,作用是再次刷新表格的时候滚动条停留在当前位置不动
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.
*--异常处理
ENDIF.
ENDIF .
ENDFORM. "DISPLAY_DATA
FORM build_fieldcat.
REFRESH it_alv.
PERFORM alv_append USING 'TEMP1' '' .
PERFORM alv_append USING 'TEMP2' '' .
PERFORM alv_append USING 'TEMP3' '' .
PERFORM alv_append USING 'TEMP4' '' .
PERFORM alv_append USING 'TEMP5' '' .
ENDFORM. " file_upload
FORM alv_append USING fieldname seltext_l.
CLEAR ls_fcat.
ls_fcat-fieldname = fieldname.
ls_fcat-coltext = seltext_l.
ls_fcat-seltext = seltext_l.
APPEND ls_fcat TO gt_fieldcat.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form PREPARE_LAYOUT ALV格式
*&---------------------------------------------------------------------*
FORM prepare_layout CHANGING gs_layout TYPE lvc_s_layo.
gs_layout-zebra = 'X' . "隔行变色
gs_layout-cwidth_opt = 'X'. "自动调整行宽
gs_layout-sel_mode = 'A'.
ENDFORM. " PREPARE_LAYOUT
*&---------------------------------------------------------------------*
*& Form FPRINT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FPRINT .
LOOP AT GT_OUT3.
t_p = ''.
count = 0.
t_i = 0.
t_ii = 0.
t_row = 0.
LOOP AT GT_OUTPUT WHERE PRUEFLOS = GT_OUT3-PRUEFLOS.
if t_p = ''.
t_p = gt_output-type.
ENDIF.
if gt_output-hsdat = '00000000'.
gt_output-hsdat = ''.
endif.
if gt_output-LMENGE01 = 0.
t_amount = gt_output-LOSMENGE.
else.
t_amount = gt_output-LMENGE01.
endif.
modify gt_output.
CLEAR:gt_output.
t_i = t_i + 1.
t_row = t_row + 1.
ENDLOOP.
*** 判断有多少页
if t_i <= 4.
t_ii = 1.
elseif t_i <= 12.
t_ii = 2.
elseif t_i <= 20.
t_ii = 3.
elseif t_i <= 28.
t_ii = 4.
elseif t_i <= 36.
t_ii = 5.
endif.
****
* t_ii = 2."测试用
* t_row = 5.
read table gt_output WITH KEY PRUEFLOS = GT_OUT3-PRUEFLOS.
**** 表尾检测人
if gt_output-type = 'E'.
select SINGLE pzuser fhuser jyuser
into (t_pzr,t_fhr,t_jyr)
from zqm_jy_user
where werks = gt_output-werk and
mtype = 'A' and
stdate <= gt_output-PAENDTERM and
endate >= gt_output-PAENDTERM.
else.
****签字人
if gt_output-MTART = 'ROH'.
select SINGLE pzuser fhuser jyuser
into (t_pzr,t_fhr,t_jyr)
from zqm_jy_user
where werks = gt_output-werk and
mtype = 'B' and
stdate <= gt_output-PAENDTERM and
endate >= gt_output-PAENDTERM.
endif.
if gt_output-MTART = 'VERP'.
select SINGLE pzuser fhuser jyuser
into (t_pzr,t_fhr,t_jyr)
from zqm_jy_user
where werks = gt_output-werk and
mtype = 'C' and
stdate <= gt_output-PAENDTERM and
endate >= gt_output-PAENDTERM.
endif.
endif.
PERFORM FORM_PRINT.
IF sy-subrc <> 0.
WRITE: 'Error in OPEN_FORM'(001).
exit.
ENDIF.
t_i = 0.
LOOP AT GT_OUTPUT WHERE PRUEFLOS = GT_OUT3-PRUEFLOS.
t_i = t_i + 1.
****产品名称
CONCATENATE GT_OUTPUT-MATNR '/' GT_OUTPUT-MAKTX INTO T_NAME.
t_c = 16.
t_len = STRLEN( T_NAME ).
t_len = t_len - t_c.
t_name1 = T_NAME+0(16).
IF T_LEN > 0.
if t_len <= 16.
t_name2 = T_NAME+16(t_len).
CLEAR:t_name5.
else.
if t_len <= 32.
t_name2 = T_NAME+16(16).
t_len = t_len - t_c.
if t_len > 0.
t_name5 = T_NAME+32(t_len).
else.
CLEAR:t_name5.
endif.
else.
t_name2 = T_NAME+16(16).
t_len = t_len - t_c.
t_name5 = T_NAME+32(t_len).
endif.
endif.
ELSE.
CLEAR:t_name2.
CLEAR:t_name5.
ENDIF.
****供应商名称
CONCATENATE GT_OUTPUT-LIFNR '/' GT_OUTPUT-LIFNRNAME INTO T_NAME.
t_c = 18.
t_len = STRLEN( T_NAME ).
t_len = t_len - t_c.
t_name3 = T_NAME+0(18).
IF T_LEN > 0.
t_name4 = T_NAME+18(t_len).
ELSE.
CLEAR:t_name4.
ENDIF.
**截取项目名称
t_c = 10.
t_len = STRLEN( GT_OUTPUT-KURZTEXT ).
t_len = t_len - t_c.
t_jyxm1 = GT_OUTPUT-KURZTEXT+0(10).
IF T_LEN > 0.
if t_len <= 10.
t_jyxm2 = GT_OUTPUT-KURZTEXT+10(t_len).
CLEAR:t_jyxm3.
CLEAR:t_jyxm4.
else.
if t_len <= 20.
t_jyxm2 = GT_OUTPUT-KURZTEXT+10(10).
t_len = t_len - t_c.
if t_len > 0.
t_jyxm3 = GT_OUTPUT-KURZTEXT+20(t_len).
else.
CLEAR:t_jyxm3.
endif.
CLEAR:t_jyxm4.
else.
t_jyxm2 = GT_OUTPUT-KURZTEXT+10(10).
t_len = t_len - t_c.
t_jyxm3 = GT_OUTPUT-KURZTEXT+20(10).
t_len = t_len - t_c.
if t_len > 0.
t_jyxm4 = GT_OUTPUT-KURZTEXT+30(t_len).
else.
CLEAR:t_jyxm4.
endif.
endif.
endif.
ELSE.
CLEAR:t_jyxm2.
CLEAR:t_jyxm3.
CLEAR:t_jyxm4.
ENDIF.
***截取结果
*截取标准
****产成品
if gt_output-type = 'E'.
t_c = 18.
t_len = STRLEN( GT_OUTPUT-JYBZ ).
t_len = t_len - t_c.
t_jybz1 = GT_OUTPUT-JYBZ+0(18).
IF T_LEN > 0.
if t_len <= 18.
t_jybz2 = GT_OUTPUT-JYBZ+18(t_len).
CLEAR:t_jybz3.
else.
t_jybz2 = GT_OUTPUT-JYBZ+18(18).
t_len = t_len - t_c.
if t_len > 0.
t_jybz3 = GT_OUTPUT-JYBZ+36(t_len).
else.
CLEAR:t_jybz3.
endif.
endif.
ELSE.
CLEAR:t_jybz2.
CLEAR:t_jybz3.
ENDIF.
else.
****原材料
t_c = 12.
t_len = STRLEN( GT_OUTPUT-JYBZ ).
t_len = t_len - t_c.
t_jybzz1 = GT_OUTPUT-JYBZ+0(12).
IF T_LEN > 0.
if t_len <= 12.
t_jybzz2 = GT_OUTPUT-JYBZ+12(t_len).
CLEAR:t_jybzz3.
CLEAR:t_jybzz4.
else.
if t_len <= 24.
t_jybzz2 = GT_OUTPUT-JYBZ+12(12).
t_len = t_len - t_c.
if t_len > 0.
t_jybzz3 = GT_OUTPUT-JYBZ+24(t_len).
else.
CLEAR:t_jybzz3.
endif.
CLEAR:t_jybzz4.
else.
t_jybzz2 = GT_OUTPUT-JYBZ+12(12).
t_len = t_len - t_c.
t_jybzz3 = GT_OUTPUT-JYBZ+24(12).
t_len = t_len - t_c.
if t_len > 0.
t_jybzz4 = GT_OUTPUT-JYBZ+36(t_len).
else.
CLEAR:t_jybzz4.
endif.
endif.
endif.
ELSE.
CLEAR:t_jybzz2.
CLEAR:t_jybzz3.
CLEAR:t_jybzz4.
ENDIF.
**** 增加取依据数据
t_c = 12.
t_len = STRLEN( GT_OUTPUT-JYYJ ).
t_len = t_len - t_c.
t_jyyj1 = GT_OUTPUT-JYYJ+0(12).
IF T_LEN > 0.
if t_len <= 12.
t_jyyj2 = GT_OUTPUT-JYYJ+12(t_len).
CLEAR:t_jyyj3.
CLEAR:t_jyyj4.
else.
if t_len <= 24.
t_jyyj2 = GT_OUTPUT-JYYJ+12(12).
t_len = t_len - t_c.
if t_len > 0.
t_jyyj3 = GT_OUTPUT-JYYJ+24(t_len).
else.
CLEAR:t_jyyj3.
endif.
CLEAR:t_jyyj4.
else.
t_jyyj2 = GT_OUTPUT-JYYJ+12(12).
t_len = t_len - t_c.
t_jyyj3 = GT_OUTPUT-JYYJ+24(12).
t_len = t_len - t_c.
if t_len > 0.
t_jyyj4 = GT_OUTPUT-JYYJ+36(t_len).
else.
CLEAR:t_jyyj4.
endif.
endif.
endif.
ELSE.
CLEAR:t_jyyj2.
CLEAR:t_jyyj3.
CLEAR:t_jyyj4.
ENDIF.
endif.
***截取结果
***产成品
if gt_output-type = 'E'.
t_c = 17.
t_len = STRLEN( GT_OUTPUT-JYJG ).
t_len = t_len - t_c.
t_jyjg1 = GT_OUTPUT-JYJG+0(17).
IF T_LEN > 0.
if t_len <= 17.
t_jyjg2 = GT_OUTPUT-JYJG+17(t_len).
CLEAR:t_jyjg3.
else.
t_jyjg2 = GT_OUTPUT-JYJG+17(17).
t_len = t_len - t_c.
if t_len > 0.
t_jyjg3 = GT_OUTPUT-JYJG+34(t_len).
else.
CLEAR:t_jyjg3.
endif.
endif.
ELSE.
CLEAR:t_jyjg2.
CLEAR:t_jyjg3.
ENDIF.
else.
***原材料
t_c = 12.
t_len = STRLEN( GT_OUTPUT-JYJG ).
t_len = t_len - t_c.
t_jyjgg1 = GT_OUTPUT-JYJG+0(12).
IF T_LEN > 0.
if t_len <= 24.
t_jyjgg2 = GT_OUTPUT-JYJG+12(12).
t_len = t_len - t_c.
if t_len > 0.
t_jyjgg3 = GT_OUTPUT-JYJG+24(t_len).
else.
CLEAR:t_jyjgg3.
endif.
CLEAR:t_jyjgg4.
else.
t_jyjgg2 = GT_OUTPUT-JYJG+12(12).
t_len = t_len - t_c.
t_jyjgg3 = GT_OUTPUT-JYJG+24(12).
t_len = t_len - t_c.
if t_len > 0.
t_jyjgg4 = GT_OUTPUT-JYJG+36(t_len).
else.
CLEAR:t_jyjgg4.
endif.
endif.
ELSE.
CLEAR:t_jyjgg2.
CLEAR:t_jyjgg3.
CLEAR:t_jyjgg4.
ENDIF.
endif.
if t_jyjgg1 = ''.
t_jyjgg1 = ' '.
endif.
if t_jyjgg2 = ''.
t_jyjgg2 = ' '.
endif.
if t_jyjgg3 = ''.
t_jyjgg3 = ' '.
endif.
if t_jyjgg4 = ''.
t_jyjgg4 = ' '.
endif.
****检验结论
t_c = 40.
t_len = STRLEN( GT_OUTPUT-JYJL ).
t_len = t_len - t_c.
t_jyjl1 = GT_OUTPUT-JYJL+0(40).
IF T_LEN > 0.
t_jyjl2 = GT_OUTPUT-JYJl+40(t_len).
ELSE.
CLEAR:t_jyjl2.
ENDIF.
****打开第一个page
IF t_i = 1.
CALL FUNCTION 'START_FORM'
EXPORTING
form = form_name
startpage = 'PAGE1'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
WRITE: 'Error in START_FORM PAGE1'.
exit.
ENDIF.
PERFORM print_lld_head.
IF sy-subrc <> 0.
WRITE: 'Error in HEAD'(001).
exit.
ENDIF.
endif.
**** 第一页放的下
if t_ii = 1.
* if t_i <= 4. "测试用
count = count + 18.
if t_type <> 'X'.
PERFORM PRINT_LLD_ITEM.
PERFORM PRINT_TKD_BODY.
ENDIF.
if t_row <= 4 and t_i = t_row.
count = count + 110.
* count = count + 80
PERFORM PRINT_TPP_BODY.
PERFORM PRINT_TPD_BODY.
if gt_output-WERK = '2589'.
PERFORM PRINT_PIC2_BODY. "测试用
else.
PERFORM PRINT_PIC_BODY. "测试用
endif.
* count = count + 40.
* PERFORM PRINT_TJY_BT.
PERFORM PRINT_TJYH_BT.
endif.
* endif.
endif.
if t_ii = 2.
* if t_i <= 5."测试用
if t_i <= 8.
count = count + 18.
PERFORM PRINT_LLD_ITEM.
IF sy-subrc <> 0.
WRITE: 'Error in HEAD1'(001).
exit.
ENDIF.
PERFORM PRINT_TKD_BODY.
IF sy-subrc <> 0.
WRITE: 'Error in HEAD1'(001).
exit.
ENDIF.
if t_i >= 5.
if t_i = t_row.
count = 0.
CALL FUNCTION 'END_FORM'.
CALL FUNCTION 'START_FORM'
EXPORTING
form = form_name
startpage = 'PAGE2'
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
CODEPAGE = 7
OTHERS = 8.
IF sy-subrc <> 0.
WRITE: 'Error in START_FROM PAGE2'(001).
exit.
ENDIF.
PERFORM PRINT_HEAD2.
* count = count + 18.
* PERFORM PRINT_LLD_ITEM2.
* IF sy-subrc <> 0.
* WRITE: 'Error in LLD_ITEM2 PAGE2'(001).
* exit.
* ENDIF.
endif.
* count = count + 18.
* PERFORM PRINT_LLD_ITEM.
* IF sy-subrc <> 0.
* WRITE: 'Error in LLD_ITEM2 PAGE2'(001).
* exit.
* ENDIF.
* PERFORM PRINT_TKD_BODY.
* count = count + 18.
if t_i = t_row.
count = count + 92.
PERFORM PRINT_TPP_BODY.
PERFORM PRINT_TPD_BODY.
if gt_output-WERK = '2589'.
PERFORM PRINT_PIC2_BODY. "测试用
else.
PERFORM PRINT_PIC_BODY. "测试用
endif.
* count = count + 70.
* PERFORM PRINT_TJY_BT.
PERFORM PRINT_TJYH_BT.
endif.
endif.
elseif t_i <= 12."t_i = 9.
if t_i = 9.
count = 0.
CALL FUNCTION 'END_FORM'.
CALL FUNCTION 'START_FORM'
EXPORTING
form = form_name
startpage = 'PAGE2'
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
CODEPAGE = 7
OTHERS = 8.
IF sy-subrc <> 0.
WRITE: 'Error in START_FROM PAGE2'(001).
exit.
ENDIF.
PERFORM PRINT_HEAD2.
* count = count + 18.
* PERFORM PRINT_LLD_ITEM2.
* IF sy-subrc <> 0.
* WRITE: 'Error in LLD_ITEM2 PAGE2'(001).
* exit.
* ENDIF.
endif.
* count = count + 18.
PERFORM PRINT_LLD_ITEM.
IF sy-subrc <> 0.
WRITE: 'Error in LLD_ITEM2 PAGE2'(001).
exit.
ENDIF.
PERFORM PRINT_TKD_BODY.
count = count + 18.
if t_i = t_row.
count = count + 92.
PERFORM PRINT_TPP_BODY.
PERFORM PRINT_TPD_BODY.
if gt_output-WERK = '2589'.
PERFORM PRINT_PIC2_BODY. "测试用
else.
PERFORM PRINT_PIC_BODY. "测试用
endif.
* count = count + 70.
* PERFORM PRINT_TJY_BT.
PERFORM PRINT_TJYH_BT.
endif.
* ENDIF.
* PERFORM PRINT_TKD_BODY2.
elseif t_i <= 20.
if t_i = 17.
count = 0.
CALL FUNCTION 'END_FORM'.
CALL FUNCTION 'START_FORM'
EXPORTING
form = form_name
startpage = 'PAGE3'
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
CODEPAGE = 7
OTHERS = 8.
IF sy-subrc <> 0.
WRITE: 'Error in START_FROM PAGE2'(001).
exit.
ENDIF.
PERFORM PRINT_HEAD2.
* count = count + 18.
* PERFORM PRINT_LLD_ITEM2.
* IF sy-subrc <> 0.
* WRITE: 'Error in LLD_ITEM2 PAGE2'(001).
* exit.
* ENDIF.
endif.
* count = count + 18.
PERFORM PRINT_LLD_ITEM.
IF sy-subrc <> 0.
WRITE: 'Error in LLD_ITEM2 PAGE2'(001).
exit.
ENDIF.
PERFORM PRINT_TKD_BODY.
count = count + 18.
if t_i = t_row.
count = count + 92.
PERFORM PRINT_TPP_BODY.
PERFORM PRINT_TPD_BODY.
if gt_output-WERK = '2589'.
PERFORM PRINT_PIC2_BODY. "测试用
else.
PERFORM PRINT_PIC_BODY. "测试用
endif.
* count = count + 70.
* PERFORM PRINT_TJY_BT.
PERFORM PRINT_TJYH_BT.
endif.
endif.
* endif.
elseif t_ii = 3.
if t_i <= 8.
count = count + 18.
PERFORM PRINT_LLD_ITEM.
IF sy-subrc <> 0.
WRITE: 'Error in HEAD1'(001).
exit.
ENDIF.
PERFORM PRINT_TKD_BODY.
IF sy-subrc <> 0.
WRITE: 'Error in HEAD1'(001).
exit.
ENDIF.
elseif t_i <= 20."t_i = 9.
if t_i = 9.
count = 0.
CALL FUNCTION 'END_FORM'.
CALL FUNCTION 'START_FORM'
EXPORTING
form = form_name
startpage = 'PAGE2'
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
CODEPAGE = 7
OTHERS = 8.
IF sy-subrc <> 0.
WRITE: 'Error in START_FROM PAGE2'(001).
exit.
ENDIF.
PERFORM PRINT_HEAD2.
* count = count + 18.
* PERFORM PRINT_LLD_ITEM2.
* IF sy-subrc <> 0.
* WRITE: 'Error in LLD_ITEM2 PAGE2'(001).
* exit.
* ENDIF.
endif.
if t_i >= 12 and t_i <= 16.
* count = count + 18.
PERFORM PRINT_LLD_ITEM.
IF sy-subrc <> 0.
WRITE: 'Error in LLD_ITEM2 PAGE2'(001).
exit.
ENDIF.
PERFORM PRINT_TKD_BODY.
count = count + 18.
if t_i = t_row.
count = 0.
CALL FUNCTION 'END_FORM'.
CALL FUNCTION 'START_FORM'
EXPORTING
form = form_name
startpage = 'PAGE3'
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
CODEPAGE = 7
OTHERS = 8.
IF sy-subrc <> 0.
WRITE: 'Error in START_FROM PAGE2'(001).
exit.
ENDIF.
PERFORM PRINT_HEAD2.
endif.
else.
if t_i = 17.
count = 0.
CALL FUNCTION 'END_FORM'.
CALL FUNCTION 'START_FORM'
EXPORTING
form = form_name
startpage = 'PAGE3'
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
CODEPAGE = 7
OTHERS = 8.
IF sy-subrc <> 0.
WRITE: 'Error in START_FROM PAGE2'(001).
exit.
ENDIF.
PERFORM PRINT_HEAD2.
endif.
PERFORM PRINT_LLD_ITEM.
IF sy-subrc <> 0.
WRITE: 'Error in LLD_ITEM2 PAGE2'(001).
exit.
ENDIF.
PERFORM PRINT_TKD_BODY.
count = count + 18.
endif.
if t_i = t_row.
count = count + 92.
PERFORM PRINT_TPP_BODY.
PERFORM PRINT_TPD_BODY.
if gt_output-WERK = '2589'.
PERFORM PRINT_PIC2_BODY. "测试用
else.
PERFORM PRINT_PIC_BODY. "测试用
endif.
* count = count + 70.
* PERFORM PRINT_TJY_BT.
PERFORM PRINT_TJYH_BT.
endif.
* ENDIF.
* PERFORM PRINT_TKD_BODY2.
endif.
endif.
* if t_i <= 4. "放的下尾页
* count = count + 18.
* if t_type <> 'X'.
* PERFORM PRINT_LLD_ITEM.
* PERFORM PRINT_TKD_BODY.
* ENDIF.
* elseif t_i <= 8."尾页放第二页
* count = count + 18.
* if t_type <> 'X'.
* PERFORM PRINT_LLD_ITEM.
* PERFORM PRINT_TKD_BODY.
* ENDIF.
* elseif t_i <= 12."第二页放的下尾页
* if t_ii <= 8.
* count = count + 18.
* if t_type <> 'X'.
* PERFORM PRINT_LLD_ITEM.
* PERFORM PRINT_TKD_BODY.
* ENDIF.
* else.
* call FUNCTION 'END_FORM'.
* CALL FUNCTION 'START_FORM'
* EXPORTING
* startpage = 'PAGE2'
* EXCEPTIONS
* OTHERS = 1.
** call FUNCTION 'END_FORM'.
** PERFORM NEXT_PAGE.
* PERFORM PRINT_HEAD2.
** PERFORM PRINT_TKD_BODY.
* endif.
* elseif t_i <= 15. "尾页放第三页
*
* endif.
ENDLOOP.
* PERFORM PRINT_TPP_BODY.
* PERFORM PRINT_TPD_BODY.
* PERFORM PRINT_TJY_BT.
* PERFORM PRINT_TJYH_BT.
CALL FUNCTION 'END_FORM'.
if t_type <> 'X'.
CALL FUNCTION 'CLOSE_FORM'.
ENDIF.
ENDLOOP.
ENDFORM. " FPRINT
***小数位截取
FORM SET_NUM USING P_CHAR P_NUM.
DATA: P_LEN TYPE I.
DATA: P_TEMP TYPE I.
DATA: P_BEN(12) TYPE C.
DATA: P_AF(4) TYPE C.
DATA: P_AF_TEMP(1) TYPE C.
DATA: P_I TYPE I.
DATA: P_C TYPE I.
P_LEN = STRLEN( P_CHAR ).
P_TEMP = P_LEN - 4.
P_BEN = P_CHAR+0(P_TEMP).
P_AF = P_CHAR+P_TEMP(4).
P_I = 0.
G_CHAR = P_BEN.
P_C = P_NUM.
WHILE P_C > 0.
P_AF_TEMP = P_AF+P_I(1).
CONCATENATE G_CHAR P_AF_TEMP INTO G_CHAR.
CONDENSE:G_CHAR.
P_I = P_I + 1.
P_C = P_C - 1.
ENDWHILE.
CLEAR:P_LEN,P_TEMP,P_BEN,P_AF,P_AF_TEMP,P_I,P_C.
ENDFORM.
ALV SCRIPTFROM 内容比较全的一个例子的更多相关文章
- 用thinkphp写的一个例子:抓取网站的内容并且保存到本地
我需要写这么一个例子,到电子课本网下载一本电子书. 电子课本网的电子书,是把书的每一页当成一个图片,然后一本书就是有很多张图片,我需要批量的进行下载图片操作. 下面是代码部分: public func ...
- WebRTC的一个例子
内容引自:一个WebRTC实现获取内网IP的例子(穿透NAT) 网页代码直接复制到下面(如果以上链接被墙,可以直接将下面代码保存文件,然后在浏览器打开即可,不支持IE浏览器): <!doctyp ...
- 从一个例子中体会React的基本面
[起初的准备工作] npm init npm install --save react react-dom npm install --save-dev html-webpack-plugin web ...
- Erlang 程序引发共享内存 bug 的一个例子
虽然 Erlang 的广告说得非常好,functional.share-nothing.消息传递,blah blah 的,好像用 Erlang 写并发程序就高枕无忧了,但是由于 Erlang 信奉高度 ...
- 对Jena的简单理解和一个例子
本文简单介绍Jena(Jena 2.4),使用Protégé 3.1(不是最新版本)创建一个简单的生物(Creature)本体,然后参照Jena文档中的一个例子对本体进行简单的处理,输出本体中的Cla ...
- 使用flume的一个例子
新项目中需要使用到hadoop和vertica,使用flume把数据加载到hadoop中,我做了一个例子, 即监控一个sharefolder,如果里面有文件,则会文件load到hadoop. 开启Fl ...
- 下拉框——把一个select框中选中内容移到另一个select框中遇到的问题
在使用jQuery实现把一个select框中选中内容移到另一个select框中功能时遇到了一个问题,就是点击按钮时内容可以到另一个select框中,但是到了另一个select框中的内容却很快闪退回原来 ...
- Javascript 进阶 面向对象编程 继承的一个例子
Javascript的难点就是面向对象编程,上一篇介绍了Javascript的两种继承方式:Javascript 进阶 继承,这篇使用一个例子来展示js如何面向对象编程,以及如何基于类实现继承. 1. ...
- 请教 JTable 里的单元格如何使得双击进入单元格后,单元格的内容处于全选中状态
http://bbs.csdn.net/topics/390195204 ———————————————————————————————————————— java 达人, 最近在开发一个 java ...
随机推荐
- PAT Basic 1093 字符串A+B (20 分)
给定两个字符串 A 和 B,本题要求你输出 A+B,即两个字符串的并集.要求先输出 A,再输出 B,但重复的字符必须被剔除. 输入格式: 输入在两行中分别给出 A 和 B,均为长度不超过 1的.由可见 ...
- 05-spring框架—— Spring 事务
5.1 Spring 的事务管理 事务原本是数据库中的概念,在 Dao 层.但一般情况下,需要将事务提升到业务层,即 Service 层.这样做是为了能够使用事务的特性来管理具体的业务. 在 Spri ...
- backtop返回页面顶部jquery代码
<div id="toTop" style="width:30px;height:110px;border:1px solid #74B9DC; border-ra ...
- maven项目引入外部jar包
方式1:dependency 本地jar包 <dependency> <groupId>com.hope.cloud</groupId> <!--自定义--& ...
- java内存泄漏与处理
内存溢出 out of memory,是指程序在申请内存时,没有足够的内存空间供其使用,出现out of memory: 内存泄露 memory leak,是指程序在申请内存后,无法释放已申请的内存空 ...
- node + mongoDB
在MongoDB安装这篇博客中已经创建了一个bella_blog的数据库,该数据已经包含了user集合. 下面就可以在node sever端用MongoDB了. Mongoose库简而言之就是在nod ...
- buuctf@[OGeek2019]babyrop
#!/usr/bin/python #coding:utf-8 from pwn import * #context.log_level = 'debug' io = process('./pwn', ...
- wx小程序知识点(八)
八.小程序的优劣势 优势: ① 不需要下载 ② 打开速度快 ③ 开发成本低 ④ 安卓上可以添加在桌面,与原生 App 相似 ⑤ 小程序的发布审查流程比较严格,安全保障 劣势: ① 页面大小不能 ...
- mybatis-plus-generator 实践
package com.huixiaoer.ant.generator; import com.baomidou.mybatisplus.annotation.DbType; import com.b ...
- json的概念,语法规则,数组,物件结构
主要说一些关于json的简单应用 ㈠概念 JSON(JavaScript Object Notation, JS 对象简谱) 是一种轻量级的数据交换格式. 它基于 ECMAScript (欧洲计算机协 ...