Skip to Content
avatar image
Former Member

BAPI_ACC_DOCUMENT_POST (EXTENSION)

Has anybody used the extension for this BAPI to post F-02.

I want to populate 12 Z fields using this extension.

Please send me the sample code on how to do it.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Nov 14, 2005 at 09:56 PM

    Rajiv,

    First create a structure say ZFGLEXT with field names field1 to field 12.

    define Internal table it_zfglext like ZFGLEXT.

    now populate extension field value into internal table IT_zfglext.

    exmple : it_zfglext-field1 = some value

    it_zfglex-field2 = value

    ........... so on

    Now in the it_extension-field1 = 'ZFGLEXT'.

    it_extension-field2 = IT_zfglext.

    append it_extension.

    now call the bapi & fill the repective data

    BAPI_ACC_DOCUMENT_POST.

    In the Customer exist write the below code

    • Internal table to hold field attributes

    it_dfies LIKE dfies OCCURS 0 WITH HEADER LINE,

    tabname TYPE ddobjname, " Table Name

    *Fields in the Structure

    field1(10),

    field2(10),

    field3(10),

    field4(10),

    field5(10),

    field6(10),

    field7(10),

    field8(10),

    field9(10),

    field10(10),

    *-- Internal table to store the extension field values

    DATA : BEGIN OF it_extension OCCURS 0,

    field1(10),

    field2(10),

    field3(10),

    field4(10),

    field5(10),

    field6(10),

    field7(10),

    field8(10),

    field9(10),

    field10(10),

    END OF it_extension.

    CLEAR : it_extension.

    REFRESH : it_extension.

    tabname = extension-field1.

    READ TABLE extension INDEX 1.

    • Get field attributes

    CALL FUNCTION 'DDIF_FIELDINFO_GET'

    EXPORTING

    tabname = tabname

    TABLES

    dfies_tab = it_dfies

    EXCEPTIONS

    not_found = 1

    internal_error = 2

    OTHERS = 3.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    LOOP AT extension.

    LOOP AT it_dfies.

    CASE sy-tabix.

    WHEN 1.

    it_extension-field1 = extension-field2+it_dfies-offset(it_dfies-leng).

    WHEN 2.

    it_extension-field2 = extension-field2+it_dfies-offset(it_dfies-leng).

    WHEN 3.

    it_extension-field3 = extension-field2+it_dfies-offset(it_dfies-leng).

    WHEN 4.

    it_extension-field4 = extension-field2+it_dfies-offset(it_dfies-leng).

    WHEN 5.

    it_extension-field5 = extension-field2+it_dfies-offset(it_dfies-leng).

    WHEN 6.

    it_extension-field6 = extension-field2+it_dfies-offset(it_dfies-leng).

    WHEN 7.

    it_extension-field7 = extension-field2+it_dfies-offset(it_dfies-leng).

    WHEN 8.

    it_extension-field8 = extension-field2+it_dfies-offset(it_dfies-leng).

    WHEN 9.

    it_extension-field9 = extension-field2+it_dfies-offset(it_dfies-leng).

    *-- Populating value for Calculate Tax

    WHEN 10.

    it_extension-field10 = extension-field2+it_dfies-offset(it_dfies-leng).

    ENDCASE.

    ENDLOOP.

    APPEND it_extension.

    Hope this will solve your problem.

    Thanks

    Rajeev Mohan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 13, 2005 at 08:15 PM

    I think you should have already extended BSEG & BKPF tables to storing those 12 custom fields. Similarly you need to extend bapi table structures also. You have decide when to extend like if it is G/L account item details then BAPIACGL09.

    Cheers,

    Satya

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 13, 2005 at 09:28 PM

    Rajiiv,

    You should pass the value of customized fields using EXTENSION1 table to this BAPI.

    After you have extended the necessary customized fields (In your case 12) in BSEG,BKPF,ACCIT,ACCHD structures ,you need to use an user exit in the following subroutine(Line 45) to populate the fields in ACCIT or ACCHD structures.

    PERFORM call_customer_function

    TABLES extension1.

    Cheers

    Raghava

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 14, 2005 at 03:49 PM

    I have to populate 12 text lines at the document level. How can I do this using the extension.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Rajiv,

      I faced same problem when I did this because you can not pass field name & value to the EXTENSION1 table.

      However here is one of the solutions for your problem.

      Define a customized structure with all your 12 text lines.

      Zstructure

      Text1

      Text2

      Text3

      ;

      ;

      Text12

      Pass that structure name as FIELD1 to the EXTENSION1 table

      And pass the all the values to the other fields (FIELD2, FIELD3 & FIELD4) of the EXTENSION1 table.

      In the user exit can read the 12 text lines as field name & values are available to you.