3 Replies Latest reply: Jun 1, 2012 5:09 PM by Ketaki Pradhan RSS

Mapping of POSTING KEY in BAPI_ACC_DOCUMENT_POST

Currently Being Moderated

Hi,

 

can anybody help me how can I map / pass the following POSTING KEY in BAPI_ACC_DOCUMENT_POST?

 

Type     Posting Key      Positive or Negative

GL        40                       +ve (debit)

GL        50                       -ve (credit)

AP        21                       +ve (debit)

AP        31                       -ve (credit)

AR        01                       +ve (debit)

AR        11                       -ve (credit)

 

 

thank you in advance!!!

 

james evert lising

  • Re: Mapping of POSTING KEY in BAPI_ACC_DOCUMENT_POST
    Gaurav Jagya
    Currently Being Moderated

    Hi,

     

    For passing the posting key you need to use the extention structure of BAPI_ACC_DOCUMENT_POST and then use  BADI ACC_DOCUMENT

     

    with the other parameters you have to populate the extension table of bapi

    
    data : it_ bapiparex type table of bapiparex,
             wa_bapiparex  type bapiparex
    
    *     Populate the Extension table
          wa_bapiparex-structure  = 'POSTING_KEY'.
          wa_bapiparex-valuepart1 = '10'.            " Item number
          wa_bapiparex-valuepart2 = '40'.            " Posting Key
          APPEND wa_bapiparex TO it_bapiparex.
    
    
    *     Call the Bapi to post the document
          CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
          EXPORTING
            documentheader          = wa_docheader
          TABLES
            accountgl                    = it_bapiacgl09
            accountpayable           = it_bapiacap09
            currencyamount          = it_bapiaccr09
            return                         = it_bapiret2
            extension2                  = it_bapiparex
    
    

     

     

    Now create an implementation of BADI ACC_DOCUMENT in SE19 and

    write the following code in method CHANGE of BADI

     

    
      DATA:  wa_extension  TYPE  bapiparex,
                  wa_accit      TYPE  accit.
    
      LOOP AT c_extension2 INTO wa_extension.
    
    *   Extend BAPI to have Posting Keys defined by user
        IF wa_extension-structure = 'POSTING_KEY'.
          CLEAR wa_accit.
          READ TABLE c_accit INTO wa_accit
                             WITH KEY posnr = wa_extension-valuepart1.
          IF sy-subrc = 0.
            wa_accit-bschl = wa_extension-valuepart2.
            MODIFY c_accit FROM wa_accit INDEX sy-tabix TRANSPORTING bschl.
          ENDIF.
    
        ENDIF.
    
      ENDLOOP.
    

     

    Hope this solves your problem

     

    Regards,

    Gaurav

     

                  .

  • Re: Mapping of POSTING KEY in BAPI_ACC_DOCUMENT_POST
    Lance Calleberg
    Currently Being Moderated

    You do not need to pass a posting key to the BAPI - SAP knows the kind of line item by the table type (ACCOUNTGL, ACCOUNTRECEIVABLE etc.) and the sign on the dollar amount - credits are to be sent as negative dollar amounts in CURRENCYAMOUNT table.  No need to make or use an entension.

Actions