Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI for transaction code 'f-02'.

Former Member
0 Likes
4,405

Hello exoerts,

  Good Morning...

             I foun the BAPI for the transaction code 'F-02' i.e 'BAPI_ACC_DOCUMENT_POST'. In this BAPI , under the table tab it have two parameters like 'EXTENSION1' and 'EXTENSION2'. Here i am facing problem how to pass input data to those parameters. In SDN already search for this those post says implement BADI, I donot know how implement the BADI and how to pass input to the two parameters 'EXTENSION1' and 'EXTENSION2'. <text removed>

Thanks in advance.

Message was edited by: Matthew Billingham - do not say your requirement is urgent.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,536

Extension parameters are used to pass some information to the BAPI for processing inside probably some user exit.

    

DATA: it_extension TYPE STANDARD TABLE OF bapiacextc,          

          wa_extension TYPE bapiacextc.

For example, if you want to pass the withholding tax information.

  wt_item_th = wt_item_th + 1.

  wa_extension-field1 = 'WHT'.          "Identifier to distinguish the type of information that is passed

  wa_extension-field2+0(6) = wt_item_th .        "ACCWT-WT_KEY

  wa_extension-field2+6(2) = t059z-witht.        "ACCWT-WITHT

  wa_extension-field2+8(2) = t059z-wt_withcd.    "ACCWT-WT_WITHCD

  wa_extension-field3 = wa_data-witht.          "Withholding tax base amount from input file.

  APPEND wa_extension TO it_extension.

Now you have all the required details for calculating withholding tax passed in the BAPI.

If you want to pass some other information,  you can do so, by providing an appropriate identifier, to distinguish them within the BAPI.

Also check SAP Note 487722 for more details on using this parameter.

11 REPLIES 11
Read only

Former Member
0 Likes
3,537

Extension parameters are used to pass some information to the BAPI for processing inside probably some user exit.

    

DATA: it_extension TYPE STANDARD TABLE OF bapiacextc,          

          wa_extension TYPE bapiacextc.

For example, if you want to pass the withholding tax information.

  wt_item_th = wt_item_th + 1.

  wa_extension-field1 = 'WHT'.          "Identifier to distinguish the type of information that is passed

  wa_extension-field2+0(6) = wt_item_th .        "ACCWT-WT_KEY

  wa_extension-field2+6(2) = t059z-witht.        "ACCWT-WITHT

  wa_extension-field2+8(2) = t059z-wt_withcd.    "ACCWT-WT_WITHCD

  wa_extension-field3 = wa_data-witht.          "Withholding tax base amount from input file.

  APPEND wa_extension TO it_extension.

Now you have all the required details for calculating withholding tax passed in the BAPI.

If you want to pass some other information,  you can do so, by providing an appropriate identifier, to distinguish them within the BAPI.

Also check SAP Note 487722 for more details on using this parameter.

Read only

0 Likes
3,536

Hi Susmitha,

      For  G/L account posting i want to pass information about 'posting key(BSCHL)' then how i write.

Read only

0 Likes
3,536

Hi

For GL account posting you can use BAPI_ACC_GL_POSTING_POST

Nabheet

Read only

0 Likes
3,536

Hi Krishna,

Check this code to pass it using the other extension parameter - extension2 of type bapiparex.

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 FUNCTION 'BAPI_ACC_DOCUMENT_POST'

      EXPORTING

        documentheader          = wa_docheader

      TABLES

        accountgl                    = it_bapi_acgl

        accountpayable           = it_bapi_acpl

        currencyamount          = it_bapi_camt

        return                         = it_bapiret2

        extension2                  = it_bapiparex

Implement the method CHANGE of BADI ACC_DOCUMENT (SE19).

  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.

Read only

0 Likes
3,536

Hi Susmitha,

    While implementing badi it asks the 'filter' value and shows the error like 'The field "C_EXTENSION2" is unknown'.

Read only

0 Likes
3,536

Hi - Are the posting key are restricted to 40 / 50 or more than that in your case ?

Regards,

Atul Mohanty

Read only

0 Likes
3,536

Hi Atul,

    the posting key are restricted to 40 / 50 only

Read only

0 Likes
3,536

In the Attributes tab, down there is the provision for entering the filter values. Click on create entries button. Open the drop down and select the appropriate value. Try BKPFF.

Or go to SE18 and uncheck the filter dependency option for this BADI.

In your BADI, make sure that the parameter of change method is c_extenstion2. My system shows c_extension2 as the parameter for this badi.  Anyways please confirm and see that you followed the right steps while implementing the BADI.

Read only

0 Likes
3,536

Hi Krishna -

If you are using FM : BAPI_ACC_DOCUMENT_POST to create these GL Posting, you do not need any enahancement for Posting key (BSCHL).

You need to balance the currency amount in the structure of   CURRENCYAMOUNT in the BAPI_ACC_DOCUMENT_POST . The posting key will automatically derived as 40 / 50.

Example -

Two line items should have corresponidng  CURRENCYAMOUNT

ITEMNO_ACC = '000001'

CURRENCY = 'USD'

AMT_DOCCUR = '1,000'.

ITEMNO_ACC = '000002'

CURRENCY = 'USD'

AMT_DOCCUR = '-1,000'.

Please check this. Hope it helps.

Regards,

Atul Mohanty

Read only

0 Likes
3,536

Hi Susmitha,

                      Thank You very much for your wonderful effort . Finally i got it.

Read only

former_member188282
Active Participant
0 Likes
3,536

Hi Krishna,

Use the BAPI "BAPI_ACC_DOCUMENT_POST"

Regards,

Rajesh.B