Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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.

Tags:
Former Member replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question