Skip to Content

Introduction

Fund Management Documents are generated based on Budgeting Process defined as per customizing. Following Budgeting Process have been pre-configured in SAP:

Process Meaning
Enter Enter new budget data
Balanced Entry Balanced budget increase
Carryover Carry over budget data from one year to another
Revenues Increasing Budget Transfer budget data using a Revenues Increasing the Budget (RIB) rule
Transfer Transfer budget data
Return Return budget data
Supplement Supplement for budget data
Transfer Cover Eligibility Transfer budget data using a manual cover eligibility rule

The process of managing the Fund Management Documents is primarily done using the Transaction Code FMBB which is called as Budgeting Workbench. All the activities from Preposting an Fund Management Document, to Posting a Preposted Fund Management Document, from Undone a Prepost Document to Helding a Posted Document.

fm_01.JPG


The scope of this document is Handling the Posting of Fund Management Document using ABAP. It includes following an Object Oriented approach in handling the relevant Documents.


Overview

For handling Fund Management Documents, SAP has provided the Object Orient way by giving the class CL_FMKU_ENTRYDOC_HANDLER (FM entry document handler) which is used to handle all the activities related to Fund Management Documents. Activities / methods include Mass Reversal Check and Post, Document Get Contents and Post, Held Create, delete etc.and FM Prepost Document handling.

fm_02.JPG

Digging Deep

Simple ABAP Objects concept can be used to create the Reference Objects and use the relevant methods provided for Fund Management Document handling. Lets walk through the basic steps for the same taking the example here as Posting a PrePost Document or Undone a Prepost Document.

1. Declaring the basic data for class before action.

DATA: REFOBJ TYPE REF TO CL_FMKU_ENTRYDOC_HANDLER,

       F_DOCID TYPE FMED_S_DOCID,

       E_F_HEADER  TYPE FMED_S_HEADER,

       E_T_LINES  TYPE FMED_T_LINES,

       E_T_LINE  TYPE FMED_S_LINE,

       E_FLG_FROM_ARCHIVE  TYPE XFELD,

       I_REF_MSG  TYPE REF TO CL_BUBAS_APPL_LOG_CTX,

       I_LOG_HEADER TYPE BAL_S_LOG,

       E_LOG_HANDLE  TYPE BALLOGHNDL.

2. Creating required objects for the functioning.

CREATE OBJECT REFOBJ

     EXPORTING

       I_FM_AREA = ‘XXXX’.   “=> XXX here is FM Area

   CREATE OBJECT I_REF_MSG.

3. Making Log Handler ready for the call.

CALL METHOD I_REF_MSG->CREATE_LOG_HANDLE

     EXPORTING

       I_LOG_HEADER            = I_LOG_HEADER

*     I_ONLY_ERROR            =

     IMPORTING

       E_LOG_HANDLE            = E_LOG_HANDLE

     EXCEPTIONS

       LOG_HEADER_INCONSISTENT = 1

       OTHERS                  = 2.

   IF SYSUBRC <> 0.

*   Implement suitable error handling here

   ENDIF.

4. Reading the contents of an existing FM Document.

   F_DOCIDFM_AREA  = ‘XXXX’.            “-> Same as above

   F_DOCIDDOCYEAR  = FDOCYEAR. “-> From Screen

   F_DOCIDDOCNR  = DOCNR.            “-> From Screen

CALL METHOD REFOBJ->DOC_GET_CONTENTS

     EXPORTING

       I_F_DOCID            = F_DOCID

*     I_FLG_ALLOW_ARCHIVED = ‘ ‘

     IMPORTING

       E_F_HEADER           = E_F_HEADER

       E_T_LINES            = E_T_LINES

       E_FLG_FROM_ARCHIVE   = E_FLG_FROM_ARCHIVE

     EXCEPTIONS

       NOT_FOUND            = 1

       OTHERS               = 2.

   IF SYSUBRC <> 0.

* Implement suitable error handling here

   ENDIF.

5. Now after reading the FM documents content, now its time to change the document state from PrePost to Post or Undone.

*1  Posted

*2  Preposted

*3  Preposted posted

*4  Preposted undone


  E_F_HEADERDOCSTATE = 4.

6. Calling Prepost document to be Posted or Prepost document to be Undone.

CALL METHOD REFOBJ->PREPOSTED_POST

     EXPORTING

       I_F_DOCID          = F_DOCID

       I_F_HEADER         = E_F_HEADER

       I_REF_MSG          = I_REF_MSG

       I_FLG_POPUP        = ‘X’

       I_POST_W           = ‘X’

     CHANGING

       C_T_LINES          = E_T_LINES

     EXCEPTIONS

       NOT_PREPOSTED      = 1

       ORIGINAL_NOT_FOUND = 2

       REF_MSG_INITIAL    = 3

       DOCNR_ERROR        = 4

       LOCK_ERROR         = 5

       OTHERS             = 6.

   IF SYSUBRC <> 0.

* Implement suitable error handling here

   ENDIF.


Or


CALL METHOD REFOBJ->PREPOSTED_UNDO

     EXPORTING

       I_F_DOCID          = F_DOCID

       I_F_HEADER         = E_F_HEADER

       I_T_LINES          = E_T_LINES

       I_REF_MSG          = I_REF_MSG

     EXCEPTIONS

       NOT_PREPOSTED      = 1

       ORIGINAL_NOT_FOUND = 2

       ALREADY_LOCKED     = 3

       DOCNR_ERROR        = 4

       OTHERS             = 5.

   IF SYSUBRC <> 0.

* Implement suitable error handling here

   ENDIF.

7. At the end, don’t forget to commit the document after changes.

CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’.

   IF SYSUBRC IS INITIAL.

     MESSAGE S001(00) WITH ‘Document:’ DOCNR ‘ updated successfully.’.

   ENDIF.

Concluding Remarks


For handling the Fund Management Documents in ABAP, ABAP Objects makes the work very simple. As in this case, Class  CL_FMKU_ENTRYDOC_HANDLER provided by SAP proves savior and helps in handling pretty easy and smooth.

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply