好男人就是我,我就是你兵哥
分类: IT职场
2015-01-20 18:11:46
这一步是定义F4格式
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style: italic;
color: #808080;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
.L0S70 {
color: #808080;
}
MODULE user_command_9000.
PROCESS ON VALUE-REQUEST.
FIELD gs_head-partner MODULE value_partner ."客户
MODULE value_city INPUT.
DATA wa_field TYPE dfies.
DATA lt_field_tab TYPE TABLE OF dfies.
DATA wa_return TYPE ddshretval.
DATA lt_return_tab TYPE TABLE OF ddshretval.
DATA:BEGIN OF values.
DATA VALUE(50) TYPE c.
DATA END OF values.
DATA:values_tab LIKE TABLE OF values.
DATA gv_partner TYPE bu_partner.
DATA gv_check TYPE char1.
DATA g_cursor TYPE i.
DATA I_TMP TYPE I.
DATA:
l_row LIKE sy-tabix,
lt_systems LIKE dynpread OCCURS 0 WITH HEADER LINE.
*取出屏幕行
CLEAR l_row.
CALL FUNCTION 'DYNP_GET_STEPL'
IMPORTING
povstepl = l_row.
*县
DATA lt_county TYPE TABLE OF v_adrctprt.
DATA ls_county TYPE v_adrctprt.
DATA lv_city1 TYPE city_code.
REFRESH:lt_field_tab,values_tab,lt_return_tab.
CLEAR wa_field.
wa_field-tabname = 'V_ADRCTPRT'.
wa_field-fieldname = 'CITYP_CODE'.
APPEND wa_field TO lt_field_tab.
CLEAR wa_field.
wa_field-tabname = 'V_ADRCTPRT'.
wa_field-fieldname = 'CITY_PART'.
APPEND wa_field TO lt_field_tab.
CLEAR wa_field.
wa_field-tabname = 'V_ADRCTPRT'.
wa_field-fieldname = 'MC_CITY'.
APPEND wa_field TO lt_field_tab.
CLEAR wa_field.
wa_field-tabname = 'V_ADRCTPRT'.
wa_field-fieldname = 'REGION'.
APPEND wa_field TO lt_field_tab.
CLEAR lv_lines_f4.
GET CURSOR LINE lv_lines_f4.
i_tmp = table_c-current_line + lv_lines_f4 - 1.
CLEAR gs_head.
READ TABLE gt_head INTO gs_head INDEX i_tmp.
IF gs_head-city IS NOT INITIAL.
CLEAR lv_city1.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = gs_head-city
IMPORTING
output = lv_city1.
REFRESH lt_county.
SELECT cityp_code city_part mc_city region
FROM v_adrctprt
INTO CORRESPONDING FIELDS OF TABLE lt_county
WHERE region = gs_head-region
AND langu = '1'
AND country = 'CN'
AND city_code = lv_city1.
ELSE.
REFRESH lt_county.
SELECT cityp_code city_part
FROM v_adrctprt
INTO CORRESPONDING FIELDS OF TABLE lt_county
WHERE langu = '1'
AND country = 'CN'.
ENDIF.
LOOP AT lt_county INTO ls_county.
values-value = ls_county-cityp_code.
APPEND values TO values_tab.
values-value = ls_county-city_part.
APPEND values TO values_tab.
values-value = ls_county-mc_city.
APPEND values TO values_tab.
values-value = ls_county-region.
APPEND values TO values_tab.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'CITYP_CODE'
TABLES
value_tab = values_tab
field_tab = lt_field_tab
return_tab = lt_return_tab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
READ TABLE lt_return_tab INTO wa_return INDEX 1.
gs_head-county = wa_return-fieldval.
CLEAR LS_COUNTY.
READ TABLE LT_COUNTY INTO LS_COUNTY WITH KEY
ENDIF.
* *更新屏幕上已经修改的字段
REFRESH lt_systems.
lt_systems-fieldname = 'GS_HEAD-REGION'.
lt_systems-stepl = l_row.
lt_systems-fieldvalue = gs_head-region.
APPEND lt_systems.
lt_systems-fieldname = 'GS_HEAD-REGION_T'.
lt_systems-stepl = l_row.
lt_systems-fieldvalue = gs_head-region_t.
APPEND lt_systems.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-repid
dynumb = '9000'
TABLES
dynpfields = lt_systems
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
ENDMODULE.