REPORT YR3TABLE2FTP.
include YR3TABLE2FTP_TOP.
include YR3TABLE2FTP_SELSCR.
include YR3TABLE2FTP_FORM.
INITIALIZATION.
but1 = \'输出字段配置\'.
but2 = \'HIVE-TABLE-SQL\'.
but3 = \'输出逻辑扩展程序模板\'.
IF sy-sysid = \'DEV\' OR sy-sysid = \'QAS\' OR sy-sysid = \'PRE\'.
p_user = \'adssa\'.
p_pwd = \'fdsssdf\'.
p_host = \'32.21.32.123\'.
ELSEIF sy-sysid = \'PRD\'.
p_user = \'fsfwewrew\'.
p_pwd = \'fsfsfs\'.
p_host = \'34.11.53.132\'.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
IF p_prog IS NOT INITIAL.
PERFORM frm_find_table USING \'X\'.
PERFORM frm_find_sel.
ENDIF.
CLEAR:p_snam1,p_snam2,p_snam3,p_snam4,p_snam5,
s_asist1,s_asist2,s_asist3,s_asist4,s_asist5,
s_asist1[],s_asist2[],s_asist3[],s_asist4[],s_asist5[].
LOOP AT SCREEN.
IF screen-name = \'P_PWD\'.
screen-invisible = \'1\'.
ELSEIF screen-name = \'P_SNAM1\' OR
screen-name = \'P_SNAM2\' OR
screen-name = \'P_SNAM3\' OR
screen-name = \'P_SNAM4\' OR
screen-name = \'P_SNAM5\' OR
screen-name = \'S_ASIST1-LOW\' OR screen-name = \'S_ASIST1-HIGH\' OR
screen-name = \'S_ASIST2-LOW\' OR screen-name = \'S_ASIST2-HIGH\' OR
screen-name = \'S_ASIST3-LOW\' OR screen-name = \'S_ASIST3-HIGH\' OR
screen-name = \'S_ASIST4-LOW\' OR screen-name = \'S_ASIST4-HIGH\' OR
screen-name = \'S_ASIST5-LOW\' OR screen-name = \'S_ASIST5-HIGH\'.
screen-input = 0.
LOOP AT sel_flds.
READ TABLE gt_vrm_values WITH KEY key = sel_flds-fld.
CASE sel_flds-p_snam.
WHEN \'s_asist1\'.
IF screen-name = \'S_ASIST1-LOW\' OR screen-name = \'S_ASIST1-HIGH\'.
screen-input = 1.
p_snam1 = gt_vrm_values-text.
ENDIF.
WHEN \'s_asist2\'.
IF screen-name = \'S_ASIST2-LOW\' OR screen-name = \'S_ASIST2-HIGH\'.
screen-input = 1.
p_snam2 = gt_vrm_values-text.
ENDIF.
WHEN \'s_asist3\'.
IF screen-name = \'S_ASIST3-LOW\' OR screen-name = \'S_ASIST3-HIGH\'.
screen-input = 1.
p_snam3 = gt_vrm_values-text.
ENDIF.
WHEN \'s_asist4\'.
IF screen-name = \'S_ASIST4-LOW\' OR screen-name = \'S_ASIST4-HIGH\'.
screen-input = 1.
p_snam4 = gt_vrm_values-text.
ENDIF.
WHEN \'s_asist5\'.
IF screen-name = \'S_ASIST5-LOW\' OR screen-name = \'S_ASIST5-HIGH\'.
screen-input = 1.
p_snam5 = gt_vrm_values-text.
ENDIF.
ENDCASE.
ENDLOOP.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
CLEAR:gt_vrm_values,gt_vrm_values[].
gt_vrm_values-key = \'GBK\'.
gt_vrm_values-text = gt_vrm_values-key.
APPEND gt_vrm_values.
gt_vrm_values-key = \'UTF-8\'.
gt_vrm_values-text = gt_vrm_values-key.
APPEND gt_vrm_values.
gt_vrm_values-key = \'GB2312\'.
gt_vrm_values-text = gt_vrm_values-key.
APPEND gt_vrm_values.
gt_vrm_values-key = \'UTF-16BE\'.
gt_vrm_values-text = gt_vrm_values-key.
APPEND gt_vrm_values.
gt_vrm_values-key = \'UTF-16LE\'.
gt_vrm_values-text = gt_vrm_values-key.
APPEND gt_vrm_values.
CALL FUNCTION \'VRM_SET_VALUES\'
EXPORTING
id = \'p_encodi\'
values = gt_vrm_values[].
CLEAR:gt_vrm_values,gt_vrm_values[].
gt_vrm_values-key = \'_NNNNNN\'.
gt_vrm_values-text = \'_NNNNNN\'.
APPEND gt_vrm_values.
CALL FUNCTION \'VRM_SET_VALUES\'
EXPORTING
id = \'p_fileno\'
values = gt_vrm_values[].
CLEAR:gt_vrm_values,gt_vrm_values[].
gt_vrm_values-key = \'YYYYMMDD\'.
gt_vrm_values-text = \'YYYYMMDD\'.
APPEND gt_vrm_values.
gt_vrm_values-key = \'YYYYMM\'.
gt_vrm_values-text = \'YYYYMM\'.
APPEND gt_vrm_values.
gt_vrm_values-key = \'YYYYMMDDHHMMSS\'.
gt_vrm_values-text = \'YYYYMMDDHHMMSS\'.
APPEND gt_vrm_values.
CALL FUNCTION \'VRM_SET_VALUES\'
EXPORTING
id = \'p_ymd\'
values = gt_vrm_values[].
CHECK p_table <> g_last_tbname.
g_last_tbname = p_table.
CLEAR:gt_vrm_values,gt_vrm_values[],gt_vrm_values_dt,gt_vrm_values_dt[],gt_dd03l,gt_dd03l[],rtables,rtables[].
PERFORM frm_val TABLES gt_vrm_values rtables gt_vrm_values_dt gt_dd03l USING \'\'.
CALL FUNCTION \'VRM_SET_VALUES\'
EXPORTING
id = \'p_name1\'
values = gt_vrm_values_dt.
CALL FUNCTION \'VRM_SET_VALUES\'
EXPORTING
id = \'p_name2\'
values = gt_vrm_values[].
CALL FUNCTION \'VRM_SET_VALUES\'
EXPORTING
id = \'p_name3\'
values = gt_vrm_values[].
CALL FUNCTION \'VRM_SET_VALUES\'
EXPORTING
id = \'p_name4\'
values = gt_vrm_values[].
CALL FUNCTION \'VRM_SET_VALUES\'
EXPORTING
id = \'p_name5\'
values = gt_vrm_values[].
CALL FUNCTION \'VRM_SET_VALUES\'
EXPORTING
id = \'p_name6\'
values = gt_vrm_values[].
CALL FUNCTION \'VRM_SET_VALUES\'
EXPORTING
id = \'p_name7\'
values = gt_vrm_values[].
CALL FUNCTION \'VRM_SET_VALUES\'
EXPORTING
id = \'p_name8\'
values = gt_vrm_values[].
IF flg2 = \'X\'.
CONCATENATE p_table `_` INTO p_fil_px.
CLEAR: p_name1,p_name2,p_name3,p_name4,p_name5,p_name6,p_name7,p_name8,
s_val1,s_val2,s_val3,s_val4,s_val5,s_val6,s_val7,s_val8,
s_val1[],s_val2[],s_val3[],s_val4[],s_val5[],s_val6[],s_val7[],s_val8[].
LOOP AT gt_dd03l WHERE keyflag = \'X\' .
CASE sy-tabix.
WHEN 1.
p_name2 = gt_dd03l-fieldname.
WHEN 2.
p_name3 = gt_dd03l-fieldname.
WHEN 3.
p_name4 = gt_dd03l-fieldname.
WHEN 4.
p_name5 = gt_dd03l-fieldname.
WHEN 5.
p_name6 = gt_dd03l-fieldname.
WHEN 6.
p_name7 = gt_dd03l-fieldname.
WHEN 7.
p_name8 = gt_dd03l-fieldname.
ENDCASE.
ENDLOOP.
ENDIF.
CLEAR:flg2.
AT SELECTION-SCREEN ON p_table.
flg2 = \'X\'.
SELECT SINGLE * FROM dd02l WHERE tabname = p_table AND ( tabclass = \'TRANSP\' OR tabclass = \'CLUSTER\' ) .
IF sy-subrc <> 0.
MESSAGE \'表不存在\' TYPE \'E\'.
ENDIF.
AT SELECTION-SCREEN ON p_fil_px.
AT SELECTION-SCREEN ON p_split.
IF p_split = \'\'.
MESSAGE \'列分隔符不能为空\' TYPE \'E\'.
ENDIF.
AT SELECTION-SCREEN ON p_counts.
IF p_counts <= 0.
MESSAGE \'每文件最大条目数需大于0\' TYPE \'E\'.
ENDIF.
AT SELECTION-SCREEN ON p_prog.
IF p_prog <> \'\'.
SELECT SINGLE * FROM progdir WHERE name = p_prog.
IF sy-subrc <> 0.
MESSAGE \'输出逻辑扩展程序不存在\' TYPE \'E\'.
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON BLOCK b11.
CLEAR: gt_name[].
IF p_name1 IS NOT INITIAL AND s_val1[] IS NOT INITIAL.
gt_name-name = p_name1.
APPEND gt_name.
ENDIF.
IF p_name2 IS NOT INITIAL AND s_val2[] IS NOT INITIAL.
READ TABLE gt_name WITH KEY name = p_name2.
IF sy-subrc = 0.
MESSAGE \'条件字段重复,请检查输入条件\' TYPE \'E\'.
ENDIF.
gt_name-name = p_name2.
APPEND gt_name.
ENDIF.
IF p_name3 IS NOT INITIAL AND s_val3[] IS NOT INITIAL.
READ TABLE gt_name WITH KEY name = p_name3.
IF sy-subrc = 0.
MESSAGE \'条件字段重复,请检查输入条件\' TYPE \'E\'.
ENDIF.
gt_name-name = p_name3.
APPEND gt_name.
ENDIF.
IF p_name4 IS NOT INITIAL AND s_val4[] IS NOT INITIAL.
READ TABLE gt_name WITH KEY name = p_name4.
IF sy-subrc = 0.
MESSAGE \'条件字段重复,请检查输入条件\' TYPE \'E\'.
ENDIF.
gt_name-name = p_name4.
APPEND gt_name.
ENDIF.
IF p_name5 IS NOT INITIAL AND s_val5[] IS NOT INITIAL.
READ TABLE gt_name WITH KEY name = p_name5.
IF sy-subrc = 0.
MESSAGE \'条件字段重复,请检查输入条件\' TYPE \'E\'.
ENDIF.
gt_name-name = p_name5.
APPEND gt_name.
ENDIF.
IF p_name6 IS NOT INITIAL AND s_val6[] IS NOT INITIAL.
READ TABLE gt_name WITH KEY name = p_name6.
IF sy-subrc = 0.
MESSAGE \'条件字段重复,请检查输入条件\' TYPE \'E\'.
ENDIF.
gt_name-name = p_name6.
APPEND gt_name.
ENDIF.
IF p_name7 IS NOT INITIAL AND s_val7[] IS NOT INITIAL.
READ TABLE gt_name WITH KEY name = p_name7.
IF sy-subrc = 0.
MESSAGE \'条件字段重复,请检查输入条件\' TYPE \'E\'.
ENDIF.
gt_name-name = p_name7.
APPEND gt_name.
ENDIF.
IF p_name8 IS NOT INITIAL AND s_val8[] IS NOT INITIAL.
READ TABLE gt_name WITH KEY name = p_name8.
IF sy-subrc = 0.
MESSAGE \'条件字段重复,请检查输入条件\' TYPE \'E\'.
ENDIF.
gt_name-name = p_name8.
APPEND gt_name.
ENDIF.
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN \'CLI1\'.
CALL SCREEN 1001 STARTING AT 37 1
ENDING AT 99 20.
WHEN \'CLI2\'.
CALL SCREEN 1002 STARTING AT 37 1
ENDING AT 97 20.
WHEN \'CLI3\'.
CALL SCREEN 1003 STARTING AT 30 1
ENDING AT 150 20.
ENDCASE.
START-OF-SELECTION.
CONDENSE p_fil_px.
IF p_fil_px = \'\'.
MESSAGE \'文件名不能为空\' TYPE \'S\' DISPLAY LIKE \'E\'.
EXIT.
ENDIF.
PERFORM f_get_data. "取数逻辑
END-OF-SELECTION.
|