2011 Nov 14 2:36 AM
Hi,
I am using FM BAPI_ACC_GL_POSTING_POST to post a document. Where do I pass material in this FM ? I tried below extension code but I don't see material being populated in the posting.
wa_extension-FIELD1 = L_COUNT. "ITEMNO_ACC
wa_extension-FIELD2 = 'COBL-MATNR'. "Data, not in standard interface
wa_extension-FIELD3 = DETAIL-MATERSL.
APPEND wa_extension TO it_extension.
Regards
Sudhaker
2011 Nov 14 6:18 AM
Hi Sudhaker,
The material information can be inputted in the following way:
Extension-field1 = 'MATNR'.
Extension-field2 = 'MENGE'.
Extension-field3 = <Give Material No>
Extension-field4 = <Gve Menge Value>
Thanks,
Atanu
2011 Nov 14 6:18 AM
Hi Sudhaker,
The material information can be inputted in the following way:
Extension-field1 = 'MATNR'.
Extension-field2 = 'MENGE'.
Extension-field3 = <Give Material No>
Extension-field4 = <Gve Menge Value>
Thanks,
Atanu
2011 Nov 14 7:16 AM
Hi Sudhaker,
The FM 'BAPI_ACC_GL_POSTING_POST' might not have all the fields available in the structures used in Importing/exporting parameters. However SAP provides a way of populating fields that are not there in the importing or Tables parameters by introducing the concept of extensions.
In case of every such BAPI that contains an extension structure, there would be a structure consisting of the "extra" fields that are not present in the standard import parameters. The structure used by this'BAPI_ACC_GL_POSTING_POST' is 'ACCIT'. If you have a look at this structure, there is a field called MATNR here. The key to correct population is to correctly count the number of characters (field length) of the fields that are coming before MATNR. Leave those many number of spaces in 'FIELD1' and then populate the material number. You would also need to pass the item number (POSNR). Check in ACCIT the occurrence of POSNR, and leave the number of characters as calculated by summing up the field length of all the fields coming before POSNR.
So in all you woule be passing POSNR and MATNR values properly placed in FIELD1, respecting the blank spaces as counted using the field length of all the fields coming before POSNR and between POSNR and MATNR. Incase the fiele length calculated is greater than 255, you need to use FIELD2 for population. Just keep in mind that the structure ACCIT is a continuous string of fields, and you need to pass the field values at the correct position, so as to populate correctly the values.