如何检查table中是否维护字段TFK
How to check if the field TFK is maintained in the table
我正在尝试针对某些情况显示错误消息。目标是从 table COST,对于对象编号(包含 TEST + 成本中心 + activity 类型),gjahr,值类型(WRTTP)和版本(VERSN),检查是否为某固定单价(TFK001-016)table中有数据。因此,如果 TFKXXX 未在 COST table 中维护,它将显示一条错误消息。
现在我所做的是使用调用函数,获取 TFK 字段的三个数字周期,因此根据 date/monmit/periv 的导出参数,我们将获得 [=20= 的字段] 也就是句号。然后我做了一个TFK和lv_poper的合并。现在我要做的是检查是否为关键参数维护了一个 TFK001-016 字段。我无法执行 <ls_co_data>-lv_tfkxxx
,因为它不存在于 table COST 中。有谁知道如何检查字段 TFK001-016 是否保留在 table COST 中?
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = lv_date
i_monmit = lv_monmit
i_periv = lv_periv
IMPORTING
e_buper = lv_poper
e_gjahr = lv_gjahr
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
lv_objnr = 'TEST' + <ls_co_data>-send_cctr + <ls_co_data>-acttype.
lv_tkfxxx = 'TKF' + lv_poper.
LOOP AT lt_cost ASSIGNING FIELD-SYMBOL(<ls_cost>)
WHERE objnr = lv_objnr
AND gjahr = lv_gjahr
AND wrttp = 1
AND versn = 0.
IF lv_tkfxxx IS NOT INITIAL. "The lv_tkfxxx should be checked in the cost table
lv_text = 'Not maintained in ' + lv_objnr + ' for the date ' + <ls_co_data>-postgdate.
ENDIF.
ENDLOOP.
提前谢谢大家!
...
LOOP AT lt_cost ASSIGNING FIELD-SYMBOL(<ls_cost>)
WHERE objnr = lv_objnr
AND gjahr = lv_gjahr
AND wrttp = 1
AND versn = 0.
ASSIGN COMPONENT lv_tkfxxx OF STRUCTURE <ls_cost> TO FIELD-SYMBOL(<v_tkfxxx>).
IF sy-subrc = 0 AND <v_tkfxxx> IS NOT INITIAL.
lv_text = 'Not maintained in ' + lv_objnr + ' for the date ' + <ls_co_data>-postgdate.
ENDIF.
ENDLOOP.
我正在尝试针对某些情况显示错误消息。目标是从 table COST,对于对象编号(包含 TEST + 成本中心 + activity 类型),gjahr,值类型(WRTTP)和版本(VERSN),检查是否为某固定单价(TFK001-016)table中有数据。因此,如果 TFKXXX 未在 COST table 中维护,它将显示一条错误消息。
现在我所做的是使用调用函数,获取 TFK 字段的三个数字周期,因此根据 date/monmit/periv 的导出参数,我们将获得 [=20= 的字段] 也就是句号。然后我做了一个TFK和lv_poper的合并。现在我要做的是检查是否为关键参数维护了一个 TFK001-016 字段。我无法执行 <ls_co_data>-lv_tfkxxx
,因为它不存在于 table COST 中。有谁知道如何检查字段 TFK001-016 是否保留在 table COST 中?
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = lv_date
i_monmit = lv_monmit
i_periv = lv_periv
IMPORTING
e_buper = lv_poper
e_gjahr = lv_gjahr
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
lv_objnr = 'TEST' + <ls_co_data>-send_cctr + <ls_co_data>-acttype.
lv_tkfxxx = 'TKF' + lv_poper.
LOOP AT lt_cost ASSIGNING FIELD-SYMBOL(<ls_cost>)
WHERE objnr = lv_objnr
AND gjahr = lv_gjahr
AND wrttp = 1
AND versn = 0.
IF lv_tkfxxx IS NOT INITIAL. "The lv_tkfxxx should be checked in the cost table
lv_text = 'Not maintained in ' + lv_objnr + ' for the date ' + <ls_co_data>-postgdate.
ENDIF.
ENDLOOP.
提前谢谢大家!
...
LOOP AT lt_cost ASSIGNING FIELD-SYMBOL(<ls_cost>)
WHERE objnr = lv_objnr
AND gjahr = lv_gjahr
AND wrttp = 1
AND versn = 0.
ASSIGN COMPONENT lv_tkfxxx OF STRUCTURE <ls_cost> TO FIELD-SYMBOL(<v_tkfxxx>).
IF sy-subrc = 0 AND <v_tkfxxx> IS NOT INITIAL.
lv_text = 'Not maintained in ' + lv_objnr + ' for the date ' + <ls_co_data>-postgdate.
ENDIF.
ENDLOOP.