SAP ABAP Posting Invoice From Parked Document Using BAPI
REPORT ZPOST_INVOICE.
DATA :
I_BELNR TYPE RBKP_V-BELNR,
I_GJAHR TYPE RBKP_V-GJAHR,
E_RBKPV TYPE MRM_RBKPV,
I_RBKPV TYPE MRM_RBKPV,
T_DRSEG TYPE MMCR_TDRSEG,
TI_DRSEG TYPE MMCR_TDRSEG,
I_EDITOR TYPE REF TO C_TEXTEDIT_CONTROL,
I_DO_PRICING TYPE BOOLE-BOOLE,
I_BOPF_CALL TYPE BOOLE-BOOLE.
DATA:
EX_OBJECT_CX_ROOT TYPE REF TO CX_ROOT,
EX_TEXT TYPE STRING,
EX_TEXT_LONG TYPE STRING.
I_BELNR = '5105603952'.
I_GJAHR = '2021'.
CALL FUNCTION 'MRM_INVOICE_READ'
EXPORTING
I_BELNR = I_BELNR
I_GJAHR = I_GJAHR
* I_XSELK = ' '
* I_BUFFER_ON = X
* I_LOCK = ' '
* I_DISPL = ' '
IMPORTING
E_RBKPV = E_RBKPV
* T_RBSELCONTRACT =
* T_RBSELTRANSPMNG =
* T_RBSELTM =
TABLES
T_DRSEG = T_DRSEG
* T_KONV =
* T_RBSELBEST =
* T_RBSELLIFS =
* T_RBSELFRBR =
* T_RBSELWERK =
* T_RBSELERFB =
* T_RBSELTRAN =
* EXCEPTIONS
* ENTRY_NOT_FOUND = 1
* LOCK_ERROR = 2
* OTHERS = 3
.
IF SY-SUBRC = 0.
TI_DRSEG = T_DRSEG.
I_RBKPV = E_RBKPV.
TRY .
CALL FUNCTION 'MRM_PARKED_INVOICE_POST'
EXPORTING
I_RBKPV = I_RBKPV
TI_DRSEG = TI_DRSEG.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
CATCH CX_ROOT INTO EX_OBJECT_CX_ROOT.
EX_TEXT = EX_OBJECT_CX_ROOT->GET_TEXT( ).
EX_TEXT_LONG = EX_OBJECT_CX_ROOT->GET_LONGTEXT( ).
ENDTRY.
WRITE 'Posted'.
ENDIF.
Comments
Post a Comment