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_ACC_GL_POSTING_POST Problem

Former Member
0 Likes
1,045

When the document is posted in BKPF and BSEG, the BAPI_ACC_GL_POSTING_POST generating a internal BELNR number.

My problem is how will I know what will be the BELNR number getting generated, whereas in OBJ_KEY, I need to provide the '1000000000ES012007'.

Can any one say How can we know what will be the Internal Number Generated?

Thanx in Advance.

Vijayanand.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
954

Thanx for your reply, But My problem has not been addressed.

When I am using the BAPI Function Module, We need to provide DOCUMENTHEADER Structure, OBJ_KEY(Mandatory) to the BAPI, Which will be in fashion of (BELNR, ORGANISATION CODE, FISCAL YEAR).

Assume that I am giving a BELNR which is 2000000008 via BAPI, But in table BKPF the serial might be 2000000003. Here the RETURN Table gives me information that 2000000008 has been created.

In original, internal number generated 2000000003 has been created in BKPF and BSEG Table.

How will I know what will be the NEXT NUMBER GENERATED in BKPF.

Thanx in Advance.

Vijayanand.

8 REPLIES 8
Read only

Former Member
0 Likes
954

Hi

U can read the number of document generated in the message returned by the BAPI, if you need to know the number before calling the BAPI u need to read the last number of the range.

The range is linked to the document type (BKPF-BLART): table T003 field NUMKR.

The table for the range is NRIV.

ANyway you won't be able to make sure to know the number will be used, because the FI ranges are usually buffered.

Max

Read only

Former Member
0 Likes
954

Are you planning to call BAPI_ACC_GL_POSTING_POST in an exit ?

If so the Document number should be available already.

Pls note this is the reference document number.

Pls explain where exactly you want to call this BAPI... I mean at what stage of document creation process..

Read only

Former Member
0 Likes
955

Thanx for your reply, But My problem has not been addressed.

When I am using the BAPI Function Module, We need to provide DOCUMENTHEADER Structure, OBJ_KEY(Mandatory) to the BAPI, Which will be in fashion of (BELNR, ORGANISATION CODE, FISCAL YEAR).

Assume that I am giving a BELNR which is 2000000008 via BAPI, But in table BKPF the serial might be 2000000003. Here the RETURN Table gives me information that 2000000008 has been created.

In original, internal number generated 2000000003 has been created in BKPF and BSEG Table.

How will I know what will be the NEXT NUMBER GENERATED in BKPF.

Thanx in Advance.

Vijayanand.

Read only

0 Likes
954

Hi

I can't understand your problem because those fields should be filled automatically by the system.

Anyway try to check fm NUMBER_GET_INFO or fm of function group SNR3, but remember the range should be buffered.

Max

Read only

0 Likes
954

Hi Max,

Thanx.

Yes, as you said it is getting populated.

Vijayanand.

Read only

Former Member
0 Likes
954

Hello!

I'm trying to use this BAPI to post a provision but am unable so far to get the information to feed in the header. Can you share the info you're using to make it work?

Thanks a million in advance.

Jean-Marie

Read only

0 Likes
954

Hi,

The following code I got it from SDN.

Pls check with this.

Pls do search on "BAPI_ACC_GL_POSTING_POST", you can get lot of sample code.

REPORT znam_bapi_test_2 .

DATA: g_documentheader TYPE bapiache08,

g_bapi_wait LIKE bapita-wait,

ta_accountgl TYPE STANDARD TABLE OF bapiacgl08,

ta_currencyamount TYPE STANDARD TABLE OF bapiaccr08,

ta_return TYPE STANDARD TABLE OF bapiret2,

ta_extension1 TYPE STANDARD TABLE OF bapiextc,

wa_accountgl TYPE bapiacgl08,

wa_currencyamount TYPE bapiaccr08,

wa_extension1 TYPE bapiextc,

wa_return TYPE bapiret2.

Parameters:

  • c1_item LIKE wa_currencyamount-itemno_acc DEFAULT '0000000001',

  • c1_type LIKE wa_currencyamount-curr_type DEFAULT '00',

  • c1_curr LIKE wa_currencyamount-currency DEFAULT 'EUR',

c1_amt LIKE wa_currencyamount-amt_doccur DEFAULT '1',

c1_sign TYPE char1 DEFAULT '-',

  • c2_item LIKE wa_currencyamount-itemno_acc DEFAULT '0000000002',

  • c2_type LIKE wa_currencyamount-curr_type DEFAULT '00',

  • c2_curr LIKE wa_currencyamount-currency DEFAULT 'EUR',

c2_amt LIKE wa_currencyamount-amt_doccur DEFAULT '1',

c2_sign TYPE char1 DEFAULT '+',

field1 LIKE wa_extension1-field1 DEFAULT '1'.

g_documentheader-username = 'LKS'.

g_documentheader-header_txt = 'Default text in header'.

g_documentheader-comp_code = '1005'.

g_documentheader-ac_doc_no = ' '.

g_documentheader-fisc_year = '2006'.

g_documentheader-doc_date = '20060818'.

g_documentheader-pstng_date = '20060818'.

g_documentheader-doc_type = 'SA'.

g_documentheader-ref_doc_no = ' '.

wa_accountgl-itemno_acc = '0000000001'.

wa_accountgl-gl_account = '0000220000'.

wa_accountgl-item_text = 'ITEM TEXT Default 1'.

APPEND wa_accountgl TO ta_accountgl.

wa_accountgl-itemno_acc = '0000000002'.

wa_accountgl-gl_account = '0000220000'.

wa_accountgl-item_text = 'ITEM TEXT Default 2'.

APPEND wa_accountgl TO ta_accountgl.

wa_currencyamount-itemno_acc = '0000000001'.

wa_currencyamount-curr_type = '00'.

wa_currencyamount-currency = 'EUR'.

IF c1_sign = '-'.

wa_currencyamount-amt_doccur = c1_amt * -1.

ELSE.

wa_currencyamount-amt_doccur = c1_amt.

ENDIF.

APPEND wa_currencyamount TO ta_currencyamount.

wa_currencyamount-itemno_acc = '0000000002'.

wa_currencyamount-curr_type = '00'.

wa_currencyamount-currency = 'EUR'.

wa_currencyamount-amt_doccur = c2_amt.

IF c2_sign = '-'.

wa_currencyamount-amt_doccur = c1_amt * -1.

ELSE.

wa_currencyamount-amt_doccur = c1_amt.

ENDIF.

APPEND wa_currencyamount TO ta_currencyamount.

IF field1 IS NOT INITIAL.

wa_extension1-field1 = field1.

APPEND wa_extension1 TO ta_extension1.

ENDIF.

CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'

EXPORTING

documentheader = g_documentheader

  • IMPORTING

  • OBJ_TYPE =

  • OBJ_KEY =

  • OBJ_SYS =

TABLES

accountgl = ta_accountgl

currencyamount = ta_currencyamount

return = ta_return

extension1 = ta_extension1.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = g_bapi_wait

IMPORTING

return = wa_return.

LOOP AT ta_return INTO wa_return.

WRITE: / wa_return-type, wa_return-id, wa_return-number,

wa_return-message.

ENDLOOP.

Vijayanand.

Read only

0 Likes
954

Thanks Vajayanand.

I'll give it a try.

Jean-Marie