REPORTZPPU006.*&---------------------------------------------------------------------**& Report ZPPU_MASS_UPLOAD_ROUTING*&*&---------------------------------------------------------------------**&*&*&---------------------------------------------------------------------**&---------------------------------------------------------------------**Define TYPES*&---------------------------------------------------------------------*
TYPE-POOLS:SLIS,
ICON.TABLES:SSCRFIELDS.TYPES:BEGIN OFTYP_UPLOAD,
MATNR(18) TYPE C,"物料编码
MAKTX TYPEDUMMY,
PLNAL(2) TYPE C,"组计数器
DISPC(40) TYPE C,"工艺路线描述
VORNR(4) TYPE C,"作业序号
STEUS(4) TYPE C,"控制码
ARBPL(8) TYPE C,"工作中心
WERKS(4) TYPE C,"工厂
KTSCH(7) TYPE C,"标准文本
LTXA1(40) TYPE C,"工序文本
BMSCH(13) TYPE C,"工序基本数量
MEINH(3) TYPE C,"工序基本数量单位
UMREZ(5) TYPE C,"基本单位换算
VGW01(9) TYPE C,"人工工时
VGE01(3) TYPE C,"计量单位
VGW02(9) TYPE C,"机器工时
VGE02(3) TYPE C,"计量单位
VGW03(9) TYPE C,"检验工时
VGE03(3) TYPE C,"计量单位
VGW04(9) TYPE C," VGE04(3) TYPE C," VGW05(9) TYPE C," VGE05(3) TYPE C," VGW06(9) TYPE C," VGE06(3) TYPE C," ANZMS(5) TYPEC,
SPMUSTYPE C,"所需分解
SPLIM(3) TYPE C,"分解数
INFNR(10) TYPE C,"采购信息记录
EKORG(4) TYPE C, "采购组织
SAKTO(10) TYPE C, "成本要素*PURCH_ORG(4) type c,"采购组织*MATL_GROUP(9) type c,"物料组*PRICE_UNIT(5) type c,*COST_ELEM(10) type c,*INFO_REC_NET_PRICE(15) type c,*CURRENCY(3) type c,
END OFTYP_UPLOAD.TYPES:BEGIN OFTYP_DATA,
MATNRTYPE MATNR,"物料编码
WERKS TYPE WERKS_D,"工厂
PLNAL TYPE PLNAL,"组计数器
DISPC(40) TYPE C,"工艺路线描述
VORNR TYPE VORNR,"作业序号
STEUS TYPE STEUS,"控制码
ARBPL TYPE ARBPL,"工作中心
KTSCH TYPE KTSCH,"标准文本
LTXA1 TYPE LTXA1,"工序文本
BMSCH(13) TYPE C,"工序基本数量
MEINH(3) TYPE C,"工序基本数量单位
UMREZ(5) TYPE C,"基本单位换算
LAR01 TYPELSTAR,
VGW01TYPE VGWRT,"人工工时
VGE01 TYPE VGWRTEH,"计量单位
LAR02 TYPELSTAR,
VGW02TYPE VGWRT,"机器工时
VGE02 TYPE VGWRTEH,"计量单位
LAR03 TYPELSTAR,
VGW03TYPE VGWRT,"检验工时
VGE03 TYPE VGWRTEH,"计量单位
LAR04 TYPELSTAR,
VGW04TYPE VGWRT," VGE04 TYPE VGWRTEH," LAR05 TYPELSTAR,
VGW05TYPE VGWRT," VGE05 TYPE VGWRTEH," LAR06 TYPELSTAR,
VGW06TYPE VGWRT," VGE06 TYPE VGWRTEH," ANZMS TYPEANZMS,
SPMUSTYPE SPLITTUNG,"所需分解
SPLIM TYPE SPLITTANZ,"分解数
INFNR(10) TYPE C,"采购信息记录
EKORG(4) TYPE C, "采购组织
SAKTO(10) TYPE C, "成本要素*PURCH_ORG(4) type c,"采购组织*MATL_GROUP(9) type c,"物料组*PRICE_UNIT(5) type c,*COST_ELEM(10) type c,*INFO_REC_NET_PRICE(15) type c,*CURRENCY(3) type c,
END OFTYP_DATA.TYPES:BEGIN OFTYP_RESULT,
MATNRTYPE MATNR,"物料编码
MAKTX TYPE MAKTX,"物料编码
WERKS TYPE WERKS_D,"工厂
PLNAL TYPE PLNAL,"组计数器
LIGHT TYPE C LENGTH 4,
MSGTYPE C LENGTH 220,END OFTYP_RESULT.*&---------------------------------------------------------------------**Define GLOBAL DATA*&---------------------------------------------------------------------*
DATA:GTH_FIELDCAT_LVC TYPELVC_S_FCAT,
GTD_FIELDCAT_LVCTYPELVC_T_FCAT,
GST_LAYOUT_LVCTYPELVC_S_LAYO.DATA:GTH_UPLOAD TYPETYP_UPLOAD,
GTD_UPLOADTYPE STANDARD TABLE OFTYP_UPLOAD.DATA:GTH_DATA TYPETYP_DATA,
GTD_DATATYPE STANDARD TABLE OFTYP_DATA,
GTD_DATA1TYPE STANDARD TABLE OFTYP_DATA.DATA:GTH_RESULT TYPETYP_RESULT,
GTD_RESULTTYPE STANDARD TABLE OFTYP_RESULT.*&---------------------------------------------------------------------**Define SCREEN*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-T01.PARAMETER:P_FN TYPE C LENGTH 132 LOWER CASE.SELECTION-SCREEN END OF BLOCKBLK1.SELECTION-SCREEN FUNCTION KEY 1.INITIALIZATION.MOVE '@49@下载模板' TO SSCRFIELDS-FUNCTXT_01.AT SELECTION-SCREEN.IF SSCRFIELDS-UCOMM = 'FC01'.PERFORMPRM_SAVE_FILE.EXIT.ENDIF.*&---------------------------------------------------------------------**Event START-OF-SELECTION*&---------------------------------------------------------------------*
START-OF-SELECTION.PERFORM SUB_UPLOAD_FILE TABLESGTD_UPLOADUSINGP_FN.PERFORMSUB_PROCESS_DATA.PERFORMSUB_CREATE_ROUTING.PERFORMSUB_DISPLAY_RESULT.*&---------------------------------------------------------------------**Event AT SELECTION-SCREEN*&---------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FORP_FN.PERFORM VQ_FN CHANGINGP_FN.*&---------------------------------------------------------------------**& Form PRM_SAVE_FILE*&---------------------------------------------------------------------**text*----------------------------------------------------------------------**--> p1 text*
FORMPRM_SAVE_FILE .DATA:GV_FILE1 TYPE STRING.DATA:GV_FILE2 TYPE STRING.DATA:GV_FILE3 TYPE STRING.DATA:LS_KEY TYPEWWWDATATAB,
LV_DESTINATLIKE RLGRAP-FILENAME,
LV_RCTYPEI.CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOGEXPORTINGWINDOW_TITLE= '保存文件到'
CHANGINGFILENAME=GV_FILE1
PATH=GV_FILE2
FULLPATH=GV_FILE3EXCEPTIONSCNTL_ERROR= 1ERROR_NO_GUI= 2NOT_SUPPORTED_BY_GUI= 3INVALID_DEFAULT_FILE_NAME= 4OTHERS= 5.IF SY-SUBRC <> 0.ENDIF.IF GV_FILE3 IS NOT INITIAL.
LS_KEY-RELID = 'MI'.
LS_KEY-OBJID = 'ZPPU006'.
LV_DESTINAT=GV_FILE3."下载模板
CALL FUNCTION 'DOWNLOAD_WEB_OBJECT'
EXPORTINGKEY=LS_KEYDESTINATION =LV_DESTINATIMPORTINGRC=LV_RC.ENDIF.ENDFORM.*&---------------------------------------------------------------------**& Form VQ_FN*&---------------------------------------------------------------------**text*----------------------------------------------------------------------**-->I_FN text*----------------------------------------------------------------------*
FORM VQ_FN CHANGINGI_FN.DATA:LTD_FT TYPEFILETABLE,
LTH_FTTYPEFILE_TABLE,
LWK_RCTYPEI,
LWK_UATYPEI.DATA:LWK_FN TYPE STRING.CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOGEXPORTINGFILE_FILTER= CL_GUI_FRONTEND_SERVICES=>FILETYPE_TEXTCHANGINGFILE_TABLE=LTD_FT
RC=LWK_RC
USER_ACTION=LWK_UAEXCEPTIONSFILE_OPEN_DIALOG_FAILED= 1CNTL_ERROR= 2ERROR_NO_GUI= 3NOT_SUPPORTED_BY_GUI= 4OTHERS= 5.IF SY-SUBRC <> 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ELSE.CHECK LWK_UA = 0.READ TABLE LTD_FT INTO LTH_FT INDEX 1.
I_FN= LTH_FT-FILENAME.ENDIF.ENDFORM. "VQ_FN*&---------------------------------------------------------------------**& Form sub_upload_file*&---------------------------------------------------------------------**text*----------------------------------------------------------------------**-->OT_TAB text*-->I_FN text*----------------------------------------------------------------------*
FORM SUB_UPLOAD_FILE TABLESOT_TABUSINGI_FN.DATA:LWK_FN TYPE STRING.
LWK_FN=I_FN.CALL FUNCTION 'GUI_UPLOAD'
EXPORTINGFILENAME=LWK_FN
FILETYPE= 'DAT'
TABLESDATA_TAB=OT_TABEXCEPTIONSFILE_OPEN_ERROR= 1FILE_READ_ERROR= 2NO_BATCH= 3GUI_REFUSE_FILETRANSFER= 4INVALID_TYPE= 5NO_AUTHORITY= 6UNKNOWN_ERROR= 7BAD_DATA_FORMAT= 8HEADER_NOT_ALLOWED= 9SEPARATOR_NOT_ALLOWED= 10HEADER_TOO_LONG= 11UNKNOWN_DP_ERROR= 12ACCESS_DENIED= 13DP_OUT_OF_MEMORY= 14DISK_FULL= 15DP_TIMEOUT= 16OTHERS= 17.IF SY-SUBRC <> 0.MESSAGE ID SY-MSGID TYPE 'I' NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.ENDFORM. "SUB_UPLOAD_FILE*&---------------------------------------------------------------------**& Form SUB_PROCESS_DATA*&---------------------------------------------------------------------**text*----------------------------------------------------------------------**--> p1 text*
FORMSUB_PROCESS_DATA .DATA:LWK_LEN TYPEI.LOOP AT GTD_UPLOAD INTOGTH_UPLOAD.CHECK GTH_UPLOAD IS NOT INITIAL.MOVE-CORRESPONDING GTH_UPLOAD TOGTH_DATA.
LWK_LEN= STRLEN( GTH_DATA-PLNAL ).CASELWK_LEN.
WHEN1.CONCATENATE '0' GTH_DATA-PLNALINTO GTH_DATA-PLNAL.ENDCASE.
LWK_LEN= STRLEN( GTH_DATA-VORNR ).CASELWK_LEN.
WHEN1.CONCATENATE '000' GTH_DATA-VORNRINTO GTH_DATA-VORNR.
WHEN2.CONCATENATE '00' GTH_DATA-VORNRINTO GTH_DATA-VORNR.
WHEN3.CONCATENATE '0' GTH_DATA-VORNRINTO GTH_DATA-VORNR.ENDCASE.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTINGINPUT= GTH_DATA-MATNRIMPORTING
OUTPUT = GTH_DATA-MATNR.*GTH_DATA-LAR01 = '600301'.*GTH_DATA-LAR02 = '600302'.*GTH_DATA-LAR03 = '600303'.
APPEND GTH_DATA TOGTD_DATA.ENDLOOP.SORT GTD_DATA BYMATNR WERKS PLNAL."增加工厂权限
GTD_DATA1 =GTD_DATA.SORT GTD_DATA1 BYWERKS.DELETE ADJACENT DUPLICATES FROMGTD_DATA1 COMPARING WERKS.LOOP AT GTD_DATA1 INTOGTH_DATA.AUTHORITY-CHECK OBJECT 'M_MATE_WRK'
*ID 'ACTVT' FIELD '*'
ID 'WERKS' FIELD GTH_DATA-WERKS.IF SY-SUBRC <> 0.MESSAGE '您没有分配工厂代码' && GTH_DATA-WERKS && '权限,请检查' TYPE 'E'.ENDIF.ENDLOOP.ENDFORM. "SUB_PROCESS_DATA*&---------------------------------------------------------------------**& Form sub_create_routing*&---------------------------------------------------------------------**text*----------------------------------------------------------------------*
FORMSUB_CREATE_ROUTING.DATA:LFLG_NEW TYPEC,
LFLG_ENDTYPEC.DATA:LWK_PLNNR TYPEPLNNR.DATA:LWK_MEINS TYPEMEINS,
LWK_MAKTXTYPEMAKTX.DATA:LWK_PROFILE TYPE BAPI1012_CONTROL_DATA-PROFILE,
LWK_BOMUSAGETYPE BAPI1012_CONTROL_DATA-BOM_USAGE,
LWK_APPLICATIONTYPE BAPI1012_CONTROL_DATA-APPLICATION,
LWK_GROUPTYPE BAPI1012_TSK_C-TASK_LIST_GROUP,
LWK_GROUPCOUNTERTYPE BAPI1012_TSK_C-GROUP_COUNTER.DATA:LTH_TSK TYPEBAPI1012_TSK_C,
LTD_TSKTYPE STANDARD TABLE OFBAPI1012_TSK_C,
LTH_MTKTYPEBAPI1012_MTK_C,
LTD_MTKTYPE STANDARD TABLE OFBAPI1012_MTK_C,
LTH_SEQTYPEBAPI1012_SEQ_C,
LTD_SEQTYPE STANDARD TABLE OFBAPI1012_SEQ_C,
LTH_OPRTYPEBAPI1012_OPR_C,
LTD_OPRTYPE STANDARD TABLE OFBAPI1012_OPR_C,
LTH_RTTYPEBAPIRET2,
LTD_RTTYPE STANDARD TABLE OFBAPIRET2.LOOP AT GTD_DATA INTOGTH_DATA.CLEAR:LFLG_NEW,
LFLG_END.AT NEWPLNAL.
LFLG_NEW= 'X'.ENDAT.AT END OFPLNAL.
LFLG_END= 'X'.ENDAT.IF LFLG_NEW = 'X'.CLEAR:LWK_MEINS,
LWK_MAKTX.CLEAR:LWK_PROFILE,
LWK_BOMUSAGE,
LWK_APPLICATION,
LWK_GROUP,
LWK_GROUPCOUNTER.CLEAR:LTH_TSK,
LTH_MTK,
LTH_SEQ,
LTH_OPR,
LTH_RT.REFRESH:LTD_TSK,
LTD_MTK,
LTD_SEQ,
LTD_OPR,
LTD_RT.CLEAR:LWK_PLNNR.SELECT SINGLEA~PLNNRINTOLWK_PLNNRFROM MAPL AS A JOIN PLKO AS B ON A~PLNTY = B~PLNTY ANDA~PLNNR= B~PLNNR ANDA~PLNAL= B~PLNAL ANDA~ZAEHL=B~ZAEHLWHERE A~MATNR = GTH_DATA-MATNRAND A~WERKS = GTH_DATA-WERKSAND A~PLNTY = 'N'
AND A~LOEKZ = ''
AND B~LOEKZ = ''
AND B~VERWE = '1'.SELECT SINGLEMEINSINTOLWK_MEINSFROMMARAWHERE MATNR = GTH_DATA-MATNR.SELECT SINGLEMAKTXINTOLWK_MAKTXFROMMAKTWHERE MATNR = GTH_DATA-MATNR ANDSPRAS= '1'.
LWK_PROFILE= '1'.
LWK_BOMUSAGE= 'N'.*-----
LTH_TSK-VALID_FROM = sy-DATUM.
LTH_TSK-VALID_TO_DATE = '99991231'.
LTH_TSK-TASK_LIST_GROUP =LWK_PLNNR.
LTH_TSK-GROUP_COUNTER = GTH_DATA-PLNAL.
LTH_TSK-TASK_LIST_USAGE = '1'.
LTH_TSK-PLANT = GTH_DATA-WERKS.
LTH_TSK-TASK_LIST_STATUS = '4'.
LTH_TSK-LOT_SIZE_FROM = 0.
LTH_TSK-LOT_SIZE_TO = 999999999.
LTH_TSK-TASK_MEASURE_UNIT =LWK_MEINS.
LTH_TSK-TASK_MEASURE_UNIT_ISO =LWK_MEINS.
LTH_TSK-DESCRIPTION = GTH_DATA-DISPC.APPEND LTH_TSK TOLTD_TSK.*-----
LTH_MTK-MATERIAL = GTH_DATA-MATNR.
LTH_MTK-PLANT = GTH_DATA-WERKS.
LTH_MTK-VALID_FROM = sy-DATUM.
LTH_MTK-VALID_TO_DATE = '99991231'.APPEND LTH_MTK TOLTD_MTK.*-----
LTH_SEQ-SEQUENCE_NO = '000000'.
LTH_SEQ-VALID_FROM = sy-DATUM.
LTH_SEQ-VALID_TO_DATE = '99991231'.
LTH_SEQ-SEQUENCE_CATEGORY = '0'.
LTH_SEQ-DESCRIPTION = '标准工序'.
LTH_SEQ-LOT_SZ_MIN = 0.
LTH_SEQ-LOT_SZ_MAX = 999999999.
LTH_SEQ-ALIGNMENT_KEY_FOR_SCHEDULING = '2'.
LTH_SEQ-TASK_MEASURE_UNIT =LWK_MEINS.
LTH_SEQ-TASK_MEASURE_UNIT_ISO =LWK_MEINS.APPEND LTH_SEQ TOLTD_SEQ.ENDIF.*-----
LTH_OPR-SEQUENCE_NO = '000000'.
LTH_OPR-VALID_FROM = sy-DATUM.
LTH_OPR-VALID_TO_DATE = '99991231'.
LTH_OPR-GROUP_COUNTER = GTH_DATA-PLNAL.
LTH_OPR-ACTIVITY = GTH_DATA-VORNR.
LTH_OPR-CONTROL_KEY = GTH_DATA-STEUS.
LTH_OPR-WORK_CNTR = GTH_DATA-ARBPL.
LTH_OPR-PLANT = GTH_DATA-WERKS.
LTH_OPR-STANDARD_TEXT_KEY = GTH_DATA-KTSCH.
LTH_OPR-DESCRIPTION = GTH_DATA-LTXA1.
LTH_OPR-BASE_QUANTITY = GTH_DATA-BMSCH.CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
EXPORTINGINPUT= GTH_DATA-MEINHLANGUAGE = SY-LANGUIMPORTING
OUTPUT = LTH_OPR-OPERATION_MEASURE_UNITEXCEPTIONSUNIT_NOT_FOUND= 1OTHERS= 2."LTH_OPR-OPERATION_MEASURE_UNIT = GTH_DATA-MEINH.
LTH_OPR-DENOMINATOR = GTH_DATA-BMSCH.
LTH_OPR-NOMINATOR = GTH_DATA-UMREZ.
LTH_OPR-ACTTYPE_01 = GTH_DATA-LAR01.
LTH_OPR-STD_VALUE_01 = GTH_DATA-VGW01.
LTH_OPR-STD_UNIT_01 = GTH_DATA-VGE01.
LTH_OPR-ACTTYPE_02 = GTH_DATA-LAR02.
LTH_OPR-STD_VALUE_02 = GTH_DATA-VGW02.
LTH_OPR-STD_UNIT_02 = GTH_DATA-VGE02.
LTH_OPR-ACTTYPE_03 = GTH_DATA-LAR03.
LTH_OPR-STD_VALUE_03 = GTH_DATA-VGW03.
LTH_OPR-STD_UNIT_03 = GTH_DATA-VGE03.
LTH_OPR-ACTTYPE_04 = GTH_DATA-LAR04.
LTH_OPR-STD_VALUE_04 = GTH_DATA-VGW04.
LTH_OPR-STD_UNIT_04 = GTH_DATA-VGE04.
LTH_OPR-ACTTYPE_05 = GTH_DATA-LAR05.
LTH_OPR-STD_VALUE_05 = GTH_DATA-VGW05.
LTH_OPR-STD_UNIT_05 = GTH_DATA-VGE05.
LTH_OPR-ACTTYPE_06 = GTH_DATA-LAR06.
LTH_OPR-STD_VALUE_06 = GTH_DATA-VGW06.
LTH_OPR-STD_UNIT_06 = GTH_DATA-VGE06.
LTH_OPR-NO_OF_EMPLOYEE = GTH_DATA-ANZMS.
LTH_OPR-IND_SPLITTING_REQRD = GTH_DATA-SPMUS.
LTH_OPR-MAX_NO_OF_SPLITS = GTH_DATA-SPLIM.
LTH_OPR-COST_RELEVANT = 'X'.
LTH_OPR-REQUIRED_OVERLAPPING = 'X'.
LTH_OPR-MIN_SEND_AHEAD_QTY = 1.
LTH_OPR-INFO_REC = GTH_DATA-INFNR.
LTH_OPR-PURCH_ORG = GTH_DATA-EKORG.
LTH_OPR-COST_ELEM = GTH_DATA-SAKTO.*LTH_OPR-PURCH_ORG = GTH_DATA-PURCH_ORG.*LTH_OPR-MATL_GROUP = GTH_DATA-MATL_GROUP.*LTH_OPR-PRICE_UNIT = GTH_DATA-PRICE_UNIT.*LTH_OPR-COST_ELEM = GTH_DATA-COST_ELEM.*LTH_OPR-INFO_REC_NET_PRICE = GTH_DATA-INFO_REC_NET_PRICE.*LTH_OPR-CURRENCY = GTH_DATA-CURRENCY.
APPEND LTH_OPR TOLTD_OPR.*-----
IF LFLG_END = 'X'.CALL FUNCTION 'BAPI_ROUTING_CREATE'
EXPORTINGPROFILE=LWK_PROFILE
BOMUSAGE=LWK_BOMUSAGE
APPLICATION=LWK_APPLICATIONIMPORTING
GROUP =LWK_GROUP
GROUPCOUNTER=LWK_GROUPCOUNTERTABLES
TASK =LTD_TSK
MATERIALTASKALLOCATION=LTD_MTK
SEQUENCE=LTD_SEQ
OPERATION=LTD_OPR
RETURN=LTD_RT.READ TABLE LTD_RT INTOLTH_RTWITH KEY TYPE = 'S'
ID = 'BAPI'
NUMBER = '000'.IF SY-SUBRC = 0.CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
GTH_RESULT-LIGHT =ICON_LED_GREEN.MESSAGE ID LTH_RT-ID TYPE LTH_RT-TYPE NUMBER LTH_RT-NUMBER
WITH LTH_RT-MESSAGE_V1 LTH_RT-MESSAGE_V2
LTH_RT-MESSAGE_V3 LTH_RT-MESSAGE_V4INTO GTH_RESULT-MSG.ELSE.CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
GTH_RESULT-LIGHT =ICON_LED_RED.LOOP AT LTD_RT INTOLTH_RT.MESSAGE ID LTH_RT-ID TYPE LTH_RT-TYPE NUMBER LTH_RT-NUMBER
WITH LTH_RT-MESSAGE_V1 LTH_RT-MESSAGE_V2
LTH_RT-MESSAGE_V3 LTH_RT-MESSAGE_V4INTO LTH_RT-MESSAGE.CONCATENATE LTH_RT-MESSAGE GTH_RESULT-MSGINTO GTH_RESULT-MSG SEPARATED BY '/'.ENDLOOP.ENDIF.
GTH_RESULT-MATNR = GTH_DATA-MATNR.
GTH_RESULT-MAKTX =LWK_MAKTX.
GTH_RESULT-WERKS = GTH_DATA-WERKS.
GTH_RESULT-PLNAL = GTH_DATA-PLNAL.APPEND GTH_RESULT TOGTD_RESULT.CLEAR:GTH_RESULT.ENDIF.ENDLOOP.ENDFORM. "sub_create_routing*&---------------------------------------------------------------------**& Form SUB_DISPLAY_RESULT*&---------------------------------------------------------------------**text*----------------------------------------------------------------------**--> p1 text*
FORMSUB_DISPLAY_RESULT .PERFORMBUILD_FIELDCAT.PERFORM CALL_ALV TABLESGTD_RESULTUSINGGTD_FIELDCAT_LVC
GST_LAYOUT_LVC''
''
''.ENDFORM. "SUB_DISPLAY_RESULT*&---------------------------------------------------------------------**& Form BUILD_FIELDCAT*&---------------------------------------------------------------------**text*----------------------------------------------------------------------*
FORMBUILD_FIELDCAT .PERFORM ADD_FIELD USING 'MATNR' 'GTD_RESULT'
'' '' '物料号' '' '' 'X'.PERFORM ADD_FIELD USING 'MAKTX' 'GTD_RESULT'
'' '' '物料描述' '' '' ''.PERFORM ADD_FIELD USING 'WERKS' 'GTD_RESULT'
'' '' '工厂' '' '' ''.PERFORM ADD_FIELD USING 'PLNAL' 'GTD_RESULT'
'' '' '组计数器' '' '' ''.PERFORM ADD_FIELD USING 'LIGHT' 'GTD_RESULT'
'' '' '提示' '' '' ''.PERFORM ADD_FIELD USING 'MSG' 'GTD_RESULT'
'' '' '消息' '' '' ''.ENDFORM. "BUILD_FIELDCAT*&---------------------------------------------------------------------**& Form ADD_FIELD*&---------------------------------------------------------------------**text*----------------------------------------------------------------------**-->I_FIELDNAME text*-->I_TABNAME text*-->I_REFFIELD text*-->I_REFTAB text*-->I_TEXT text*-->I_EDIT text*-->I_KEY text*-->I_NOZERO text*----------------------------------------------------------------------*
FORM ADD_FIELD USING I_FIELDNAME TYPELVC_FNAME
I_TABNAMETYPELVC_TNAME
I_REFFIELDTYPELVC_RFNAME
I_REFTABTYPELVC_RTNAME
I_TEXTTYPE STRINGI_EDITTYPEC
I_KEYTYPEC
I_NOZEROTYPEC.CLEARGTH_FIELDCAT_LVC.
GTH_FIELDCAT_LVC-FIELDNAME =I_FIELDNAME.
GTH_FIELDCAT_LVC-TABNAME =I_TABNAME.
GTH_FIELDCAT_LVC-REF_FIELD =I_REFFIELD.
GTH_FIELDCAT_LVC-REF_TABLE =I_REFTAB.
GTH_FIELDCAT_LVC-COLDDICTXT = 'L'.
GTH_FIELDCAT_LVC-SCRTEXT_L =I_TEXT.
GTH_FIELDCAT_LVC-EDIT =I_EDIT.
GTH_FIELDCAT_LVC-KEY =I_KEY.
GTH_FIELDCAT_LVC-NO_ZERO =I_NOZERO.APPEND GTH_FIELDCAT_LVC TOGTD_FIELDCAT_LVC.ENDFORM. "ADD_FIELD*&---------------------------------------------------------------------**& Form CALL_ALV*&---------------------------------------------------------------------**text*----------------------------------------------------------------------**-->IT_OUTTAB text*-->IT_FIELDCAT text*-->I_LAYOUT text*-->I_STATUS text*-->I_COMMAND text*-->I_TITLE text*----------------------------------------------------------------------*
FORM CALL_ALV TABLESIT_OUTTABUSING IT_FIELDCAT TYPELVC_T_FCAT
I_LAYOUTTYPELVC_S_LAYO
I_STATUSTYPESLIS_FORMNAME
I_COMMANDTYPESLIS_FORMNAME
I_TITLETYPESLIS_FORMNAME.CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTINGI_CALLBACK_PROGRAM= SY-CPROG
I_CALLBACK_PF_STATUS_SET=I_STATUS
I_CALLBACK_USER_COMMAND=I_COMMAND
I_CALLBACK_TOP_OF_PAGE=I_TITLE
IS_LAYOUT_LVC=I_LAYOUT
IT_FIELDCAT_LVC=IT_FIELDCAT
I_SAVE= 'A'
TABLEST_OUTTAB=IT_OUTTABEXCEPTIONSPROGRAM_ERROR= 1OTHERS= 2.IF SY-SUBRC <> 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.ENDFORM. "CALL_ALV