IT干货网

【ABAP系列】SAP ABAP MRKO增强

qq123 2022年03月17日 SAP 348 0

以下为正文

MRKO其实是个报表程序

这个报表程序存在着很多问题

很多时候满足不了使用

1:做增强

2:拷贝重写

我现在暂时做了增强

1:出口RMVKON00

2:隐士增强

出口增强借鉴了网上的例子

寄售记录表:
rkwa , "Consignment Withdrawals
rkwa-stauts = '00' 为未结算
rkwa-status = '01'为己结算
寄售结算时相关信息从这张表取得,包括价格、税码等信息。
如果需要在过账时更改相应的取数逻辑,比如:过账日期,税码等可以使用RMVKON00这个增强。
具体由两个EXIT:
EXIT_RMVKON00_001  : 财务凭证(发票),BKPF,BSEG中信息
EXIT_RMVKON00_002  : RKWA中信息
另外寄售结算冲销时比较麻烦,应为没有物料凭证所以不能用FB08或者MR8M冲销,必须先冲销寄售消耗(入库凭证),然后用MRKO把这张冲销的入库结算掉,再去FI使用F-03或者F.13等做清帐。(具体参考NOTES: Note 356130)

Summary

Symptom

A consignment withdrawal is settled with Transaction MRKO. Only an FI Financial Accounting document is posted. If you try to reverse this document in FI, the system displays error message F5673 'Not possible to reverse the document in financial accounting'.

Additional key words

Reversal, MRKO, consignment, F5673, 673

Cause and prerequisites

This works as designed.

Solution

The consignment document should be cancelled in inventory management. The reversal document should then be settled using Transaction MRKO. As a result, a credit memo is posted. The FI document and this credit memo should then be cleared against each other in FI.

Header Data

​ 
增强范例(改抬头参考): 
*&---------------------------------------------------------------------* 
*&  包括                ZXM08U11 
*&---------------------------------------------------------------------* 
 
IF sy-tcode = 'MRKO'." AND i_bukrs = '1400'. 
  LOOP AT t_bkpf. 
    CONCATENATE sy-datum sy-uzeit INTO t_bkpf-xblnr SEPARATED BY '-'. 
    MODIFY t_bkpf TRANSPORTING xblnr. 
  ENDLOOP. 
ENDIF. 
 
​
​ 
增强范例(改过账日期): 
*&---------------------------------------------------------------------* 
*&  包括                ZXM08U11 
*&---------------------------------------------------------------------* 
DATA: wa_rkwa TYPE rkwa, 
      wa_bseg TYPE bseg, 
      wa_bkpf TYPE bkpf, 
      fieldname(80), 
      myidx TYPE i, 
      ex_poper LIKE t009b-poper, 
      ex_gjahr LIKE t009b-bdatj. 
FIELD-SYMBOLS: <fs_date> TYPE rkwa-bldat. 
 
 
  MOVE '(RMVKON00)SO_BUDAT-HIGH' TO fieldname.  "<fs_bkpf>-budat. 
  ASSIGN (fieldname) TO <fs_date>. 
 
  LOOP AT t_rkwa INTO wa_rkwa. 
 
*    CALL FUNCTION 'DATE_TO_PERIOD_CONVERT' 
*      EXPORTING 
*        i_date         = <fs_date> 
*        i_periv        = 'V3' 
*      IMPORTING 
*        e_buper        = ex_poper 
*        e_gjahr        = ex_gjahr 
*      EXCEPTIONS 
*        input_false    = 1 
*        t009_notfound  = 2 
*        t009b_notfound = 3 
*        OTHERS         = 4. 
    ex_gjahr = <fs_date>+0(4). 
    ex_poper+0(1) = '0'. 
    ex_poper+1(2) = <fs_date>+4(2). 
 
    IF sy-subrc <> 0. 
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno 
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. 
    ENDIF. 
 
    READ TABLE t_bkpf INTO wa_bkpf 
                  WITH KEY bukrs = '' 
                           belnr = wa_rkwa-belnr 
                           gjahr = wa_rkwa-mjahr. 
    IF sy-subrc EQ 0. 
      myidx = sy-tabix. 
      wa_bkpf-monat = ex_poper. 
      wa_bkpf-gjahr = ex_gjahr. 
      wa_bkpf-budat = <fs_date>. 
      wa_bkpf-bldat = <fs_date>. 
      MODIFY t_bkpf FROM wa_bkpf INDEX myidx. " TRANSPORTING bldat budat. 
    ENDIF. 
  ENDLOOP. 
 
​

评论关闭
IT干货网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!

【ABAP系列】SAP ABAP BDC_OKCODE 解释