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_DOCUMENT_POST for FB50 posting

Former Member
0 Likes
6,118

Hi,

I am using BAPI_ACC_DOCUMENT_POST for FB50 posting . In return [] I am getting message saying "Document posted successfully: ZBKPF OFDOPN7111901 0000000100" . Ahter this I have used 'BAPI_TRANSACTION_COMMIT' but when I am checking in BKPF I am not getting any records. It seems the database is not getting updated

Please help me this.

Thanks,

Shweta

26 REPLIES 26
Read only

former_member404244
Active Contributor
0 Likes
4,020

Hi,

Try to pass WAIT = 'X' in the function mdoule "BAPI_TRANSACTION_COMMIT" and see.

Regards,

Nagaraj

Read only

0 Likes
4,020

Yes I am passing WAIT = X.

is it due to wait time?

Read only

0 Likes
4,020

Hi,

After doing that also the record is not updated?

Regards,

Nagaraj

Read only

0 Likes
4,020

No its not updating. I even gave Wait time of 10 secs eventhough its not

Read only

0 Likes
4,020

After executing your program, can you check transaction FB03 to see the latest accouting document created.

Read only

0 Likes
4,020

Hi ,

No it is not showing anything in FB03.

I am very confused , actually Bapi is not even updating the FI tables.

Thanks

Shweta

Edited by: Shweta . on Feb 4, 2011 6:33 AM

Read only

0 Likes
4,020

What is the contents in RETURN structure ? Does it contain the record with message id RW and message no : 605 (Document posted successfully) ?

Read only

0 Likes
4,020

Hi,

can you please paste your code..Please have alook at the below code for your reference which works perfectly.



* Prepare Header Information
      wa_dochead-bus_act    = text-018.
      wa_dochead-username   = sy-uname.
      wa_dochead-comp_code  = p_comp.
      wa_dochead-pstng_date = wa_bseg_temp-budat.
      wa_dochead-doc_date   = sy-datum.
      wa_dochead-fisc_year  = lv_year.
      wa_dochead-doc_type   = lc_zi.
      wa_dochead-ref_doc_no = text-019.
      wa_dochead-header_txt = text-027.


* Prepare Item information
      wa_accgl-itemno_acc = lv_count.
      wa_accgl-gl_account = wa_bseg_temp-hkont.
      wa_accgl-costcenter = p_cost.
      wa_accgl-pstng_date = wa_bseg_temp-budat.
      wa_accgl-value_date = sy-datum.
      wa_accgl-acct_type  = 'S'.
      wa_accgl-fisc_year  = lv_year.
      wa_accgl-de_cre_ind = wa_bseg_temp-shkzg.
      wa_accgl-bus_area   = wa_bseg_temp-gsber.
      APPEND wa_accgl TO t_accgl.

* Prepare Currency Information
      wa_curramt-itemno_acc = lv_count.
      wa_curramt-currency   = wa_bkpf-waers.
      IF wa_bseg_temp-shkzg EQ 'S'.
        wa_curramt-amt_doccur = wa_bseg_temp-wrbtr.
      ELSEIF wa_bseg_temp-shkzg EQ 'H'.
        wa_curramt-amt_doccur = wa_bseg_temp-wrbtr * -1.
      ENDIF.
      APPEND wa_curramt TO t_curramt.

      CLEAR : wa_curramt,
              wa_accgl,
              wa_bseg_temp.

      lv_count = lv_count + 1.

*    ENDLOOP.

      AT END OF budat.
*  Call bapi for posting document.
        IF t_accgl[] IS NOT INITIAL.

          CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
            EXPORTING
              documentheader = wa_dochead
            TABLES
              accountgl      = t_accgl
              currencyamount = t_curramt
              return         = t_return1.

          APPEND LINES OF t_return1 TO t_return.

          READ TABLE t_return1 WITH KEY type = 'S' TRANSPORTING NO FIELDS.
          IF sy-subrc EQ 0.
            w_success = c_x.
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                wait = 'X'.
            v_hold_time = sy-uzeit.
          ELSE.
            CLEAR w_success.
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

          ENDIF .
        ENDIF. " t_accgl IS INITIAL
        CLEAR : wa_dochead.
        REFRESH : t_accgl,
                  t_curramt,
                  t_return1.


      ENDAT.
    ENDLOOP. " bseg TMP

Regards,

Nagaraj

Read only

0 Likes
4,020

hi,

just use BAPI 'BAPI_TRANSACTION_COMMIT' without giving any exporting parameter and check it once and also check the READ statement on t_return1 whether the sy-subrc value is zero or not in debugging.

rgds

shivraj

Read only

0 Likes
4,020

I am using below code

  • Header

ls_header-obj_type = p_objtyp.

ls_header-obj_key = p_objkey.

ls_header-obj_sys = p_objsys.

ls_header-bus_act = p_busact.

ls_header-username = p_usernm.

ls_header-header_txt = p_txt.

ls_header-comp_code = p_compcd.

ls_header-doc_date = p_docdte.

ls_header-pstng_date = p_pstgdt.

ls_header-trans_date = p_trnsdt.

ls_header-fisc_year = p_fy.

ls_header-fis_period = p_period.

ls_header-doc_type = p_doctyp.

  • Accounting Table

CLEAR ls_account.

ls_account-itemno_acc = p_item.

ls_account-gl_account = p_gl_acc.

ls_account-stat_con = p_acctyp.

ls_account-co_busproc = p_busprc.

APPEND ls_account TO lt_account.

CLEAR ls_account.

ls_account-itemno_acc = p_item2.

ls_account-gl_account = p_glacc2.

ls_account-stat_con = p_actyp2.

ls_account-co_busproc = p_busprc.

ls_account-func_area = p_func.

APPEND ls_account TO lt_account.

  • Currency Table

CLEAR ls_currency.

ls_currency-itemno_acc = p_item.

ls_currency-curr_type = p_curtyp.

ls_currency-currency = p_curncy.

ls_currency-currency_iso = p_dctype.

ls_currency-amt_doccur = p_amdccr.

APPEND ls_currency TO lt_currency.

CLEAR ls_currency.

ls_currency-itemno_acc = p_item2.

ls_currency-curr_type = p_crtyp2.

ls_currency-currency = p_crncy2.

ls_currency-currency_iso = p_dcype2.

ls_currency-amt_doccur = p_amdcr2.

APPEND ls_currency TO lt_currency.

  • Criteria

CLEAR ls_criteria.

  • ls_criteria-itemno_acc = p_item2.

  • ls_criteria-fieldname = p_fldnam.

  • ls_criteria-character = p_char.

  • APPEND ls_criteria TO lt_criteria.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = ls_header

  • CUSTOMERCPD =

  • CONTRACTHEADER =

  • IMPORTING

  • OBJ_TYPE =

  • OBJ_KEY =

  • OBJ_SYS =

TABLES

accountgl = lt_account

  • ACCOUNTRECEIVABLE =

  • ACCOUNTPAYABLE =

  • ACCOUNTTAX =

currencyamount = lt_currency

CRITERIA = lt_criteria

  • VALUEFIELD =

  • EXTENSION1 =

return = lt_return

  • PAYMENTCARD =

  • CONTRACTITEM =

  • EXTENSION2 =

  • REALESTATE =

  • ACCOUNTWT =

.

if sy-subrc = 0.

  • COMMIT WORK and wait.

WAIT UP TO 10 SECONDS.

  • CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

endif.

I tried it with exporting parameter in BAPI_TRANSACTION _COMMIT also

But it is not shouing any record in BKPF.

Thanks.

Shweta

Edited by: Shweta . on Feb 4, 2011 9:37 AM

Read only

0 Likes
4,020

Hi,

Did you tried my piece of code.. comment these three and see.. Don't use sy-subrc check, go for reading return table as i have used.


ls_header-obj_type = p_objtyp.
ls_header-obj_key = p_objkey.
ls_header-obj_sys = p_objsys.

Regards,

Nagaraj

Read only

0 Likes
4,020

Hi Nagaraj,

When I commented these 3 line I am getting below error:

Error in document: BKPFF $ ERP100

FI/CO interface: Inconsistent FI/CO document header data for updating

In your code how you are getting BKPF and BSEG values.

Edited by: Shweta . on Feb 4, 2011 10:07 AM

Read only

0 Likes
4,020

Hi,

Ok then uncomment it and do the read for the return table and see if you are getting any error in the return table..

Bseg and bkpf data comes from same bseg and bkpf tables.

Regards,

Nagaraj

Read only

KiranJ
Active Participant
0 Likes
4,020
DATA: gs_documentheader  TYPE  bapiache09, "Header
      gs_accountgl  TYPE  bapiacgl09,
      gt_accountgl  TYPE TABLE OF   bapiacgl09,
      gs_currencyamount TYPE bapiaccr09 ,
      gt_currencyamount TYPE  TABLE OF  bapiaccr09,
      gs_return TYPE bapiret2,
      gt_return TYPE TABLE OF  bapiret2.
DATA: v_itemno_acc LIKE   gs_accountgl-itemno_acc,
      gv_year TYPE char04 .

TYPES : BEGIN OF ty_data,
        level TYPE i,
*        dtype like  gs_documentheader-doc_type,      " Doc Type
        bukrs LIKE  gs_documentheader-comp_code,     " Company Code
        monat LIKE  gs_documentheader-fis_period,    " Period
        year LIKE  gs_documentheader-fisc_year,      " Fiscal Year
        rmwi LIKE gs_documentheader-bus_act,         " Transaction Area

  "Item
*        ITEMNO_ACC like   gs_accountgl-ITEMNO_ACC,   " Item In GL A/C
        kostl LIKE  gs_accountgl-costcenter,         " Cost Center
*        prctr like gs_accountgl-profit_ctr ,         " Profit Center
        mat LIKE gs_accountgl-gl_account,            " Gl Account
*        pstng_date  like    gs_accountgl-pstng_date, " Psoting Date
*         ITEM_TEXT	like gs_accountgl-ITEM_TEXT,

*        cposnr like gs_currencyamount-itemno_acc,     " Item Number
*        pswsl like  gs_currencyamount-currency ,      " Currency
        amt LIKE gs_currencyamount-amt_doccur ,       "Amount

     END OF ty_data.

DATA : gt_data TYPE TABLE OF ty_data ,
       gs_data TYPE ty_data.

DATA v_int type i.


**---selection screen
PARAMETERS:p_file TYPE ibipparms-path OBLIGATORY.
*
**---f4 help for the file from PC
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
*
  PERFORM get_f4help.
*
*--start-of-selection .
START-OF-SELECTION.
*
  PERFORM upload_file_itab.
  CLEAR v_int.
  LOOP AT gt_data INTO gs_data.
    if v_int eq 3.
      v_int = 0.
    endif.
    IF gs_data-level = 0.
      v_int = v_int + 1.
*      CLEAR v_ITEMNO_ACC.
      CLEAR gs_documentheader.
* Fill the data for docheader for BAPI
      gs_documentheader-pstng_date =  '20100331'.
      gs_documentheader-doc_type =   'SA'.
      gs_documentheader-comp_code = gs_data-bukrs.          "'1947'.
      gs_documentheader-doc_date = '20100331'.
      gs_documentheader-username = sy-uname.
*      gs_documentheader-ref_doc_no = 'reference'.
      gs_documentheader-fis_period = gs_data-monat.         " '01'.
      gs_documentheader-fisc_year =  gs_data-year.          "'2009'.
      gs_documentheader-bus_act =  gs_data-rmwi.                 "'RFBU'.
*
    ELSEIF gs_data-level = 1.
*for each line item
      v_int = v_int + 1.
      v_itemno_acc = v_itemno_acc + 1.

      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = v_itemno_acc
        IMPORTING
          output = v_itemno_acc.

      gs_accountgl-itemno_acc = v_itemno_acc.          " '0000000003'.
      gs_accountgl-costcenter = gs_data-kostl.           "'DEPT A'.
*      gs_accountgl-profit_ctr = gs_data-prctr .
      gs_accountgl-gl_account = gs_data-mat.           "'0000400000'.
      gs_accountgl-pstng_date =  '20100331'." gs_data-pstng_date.           "'20090401'.
      gs_accountgl-item_text = 'Initial Upload'.
      APPEND gs_accountgl TO gt_accountgl.
      CLEAR gs_accountgl.
*
*      gs_accountgl-ITEMNO_ACC = gs_data-ITEMNO_ACC  " '0000000004'.
*      gs_accountgl-costcenter = 'DEPT A'.
*      gs_accountgl-profit_ctr = gs_data-prctr .
*      gs_accountgl-gl_account = '0000410000'.
*      gs_accountgl-pstng_date = '20090401'.
*
*      APPEND gs_accountgl TO gt_accountgl.
*      CLEAR gs_accountgl.

      gs_currencyamount-itemno_acc = v_itemno_acc. " '0000000003'.
      gs_currencyamount-currency = 'INR'.
      gs_currencyamount-amt_doccur = gs_data-amt.           " 5000.


      APPEND gs_currencyamount TO gt_currencyamount.
      CLEAR gs_currencyamount.

*      gs_currencyamount-ITEMNO_ACC = '0000000004'.
*      gs_currencyamount-currency = 'INR'.
*      gs_currencyamount-amt_doccur = -5000.
*
*      APPEND gs_currencyamount TO gt_currencyamount.
*      CLEAR gs_currencyamount.

      IF v_int EQ 3.
        CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
          EXPORTING
            documentheader = gs_documentheader
          TABLES
            accountgl      = gt_accountgl
            currencyamount = gt_currencyamount
            return         = gt_return.
        BREAK-POINT.
        READ TABLE gt_return INTO  gs_return WITH KEY type = 'E'.

        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = 'X'.
        COMMIT WORK.
      ENDIF.


    ENDIF.

  ENDLOOP.

Use this code in my this code wored fine

Read only

0 Likes
4,020

Sree99 - What object type (obj_type) are you usign in your code? BKPFF?

Read only

Former Member
0 Likes
4,020

Hi Shweta,

You can try posting a document through the BAPI itself first in SE37.

If it works then there is some problem in your code.

Thanks,

Manish

Read only

0 Likes
4,020

I have a question:

Has been recently altered a numerical range of financial documents using transaction code SNRO?

That might be one reason for the error you reported.

Regards.

Rafael Rojas.

Read only

Former Member
0 Likes
4,020

Your report is perfect you just declare and pass only extension1 as follow:


daa : extension1 LIKE bapiacextc   OCCURS 0 WITH HEADER LINE,

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
      EXPORTING
        documentheader = documentheader
      TABLES
        accountgl      = accountgl
        currencyamount = currencyamount
        return         = return
        extension1     = extension1
      EXCEPTIONS
        OTHERS         = 1.

Read only

0 Likes
4,020

Hi ,

I have a difficulty in passing the extensiom parameter.

What is this extension [] parameter for and what I would be required to pass in it.

Read only

0 Likes
4,020

Hi Krupaji

Can you please help me what I should pass in extension1 parameter.

Becoz in the documentation it is saying that its related to customer exit and the BTE event. Do we need to do any other enhancement also?

Thanks

Shweta

Read only

0 Likes
4,020

Check following example and extension1 just pass in bapi not to assign any data


LOOP AT itab.

    IF itab-shkzg = 'H'.
      CONCATENATE itab-mblnr itab-mjahr INTO documentheader-header_txt.
      documentheader-username = sy-uname.
      documentheader-comp_code = '1000'.
      documentheader-doc_date = itab-bldat.
      documentheader-pstng_date = itab-budat.
      documentheader-doc_type = 'SA'.
      documentheader-ref_doc_no = itab-xblnr.
***line item 1
      accountgl-itemno_acc = '2'.
      accountgl-gl_account = '0000230000'.
      accountgl-comp_code = '1000'.
      accountgl-pstng_date = itab-budat.
      accountgl-doc_type = 'SA'.
      accountgl-profit_ctr = itab-prctr.
      accountgl-alloc_nmbr = itab-zuonr.
      accountgl-po_number  = itab-ebeln.
      accountgl-po_item = itab-ebelp.
*    accountgL-DE_CRE_IND = 'S'.
      APPEND accountgl.

      currencyamount-itemno_acc = '2'.
      currencyamount-currency = 'USD'.
      currencyamount-amt_doccur = itab-grval.
      APPEND currencyamount.
*    zsched_line = zsched_line + 1.
***line itme 2
      accountgl-itemno_acc = '1'.
      accountgl-gl_account = '0000260000'.
*--
      accountgl-comp_code = '1000'.
      accountgl-pstng_date = itab-budat.
      accountgl-doc_type = 'SA'.
      accountgl-profit_ctr = itab-prctr.
      accountgl-alloc_nmbr = itab-zuonr.
*    accountgl-po_number  = itab-ebeln.
      accountgl-po_item = itab-ebelp.
*    accountgL-DE_CRE_IND = 'H'.
      APPEND accountgl.


      currencyamount-itemno_acc = '1'.
      currencyamount-currency = 'USD'.
      itab-grval = itab-grval * -1.
      currencyamount-amt_doccur = itab-grval.
      APPEND currencyamount.

    ELSE.

      documentheader-username = sy-uname.
      CONCATENATE itab-mblnr itab-mjahr INTO documentheader-header_txt.
      documentheader-comp_code = '1000'.
      documentheader-doc_date = itab-bldat.
      documentheader-pstng_date = itab-budat.
      documentheader-doc_type = 'SA'.
      documentheader-ref_doc_no = itab-xblnr.
*    documentheader-BUS_ACT = 'F-02'.
***line item 1
      accountgl-itemno_acc = '1'.
      accountgl-gl_account = '0000260000'.
*--.
      accountgl-comp_code = '1000'.
      accountgl-pstng_date = itab-budat.
      accountgl-doc_type = 'SA'.
      accountgl-profit_ctr = itab-prctr.
      accountgl-alloc_nmbr = itab-zuonr.
*    accountgL-DE_CRE_IND = 'S'.
      APPEND accountgl.

      currencyamount-itemno_acc = '1'.
      currencyamount-currency = 'USD'.
      currencyamount-amt_doccur = itab-grval.
      APPEND currencyamount.
*    zsched_line = zsched_line + 1.
***line itme 2
      accountgl-itemno_acc = '2'.
      accountgl-gl_account = '0000230000'.
      accountgl-comp_code = '1000'.
      accountgl-pstng_date = itab-budat.
      accountgl-doc_type = 'SA'.
      accountgl-profit_ctr = itab-prctr.
      accountgl-alloc_nmbr = itab-zuonr.
      accountgl-po_number  = itab-ebeln.
      accountgl-po_item = itab-ebelp.
*    accountgL-DE_CRE_IND = 'H'.
      APPEND accountgl.

      currencyamount-itemno_acc = '2'.
      currencyamount-currency = 'USD'.
      itab-grval = itab-grval * -1.
      currencyamount-amt_doccur = itab-grval.
      APPEND currencyamount.
    ENDIF.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
      EXPORTING
        documentheader = documentheader
      TABLES
        accountgl      = accountgl
        currencyamount = currencyamount
        return         = return
        extension1     = extension1
      EXCEPTIONS
        OTHERS         = 1.
    IF sy-subrc <> 0.
      MESSAGE e999(re) WITH 'Problem occured'.
    ELSE.
      .
      LOOP AT return.
        IF NOT return IS INITIAL.
          CLEAR bapi_retn_info.
          MOVE-CORRESPONDING return TO bapi_retn_info.
          IF return-type = 'A' OR return-type = 'E'.
            error_flag = 'X'.
          ENDIF.
          APPEND bapi_retn_info.
        ENDIF.
      ENDLOOP.
      IF error_flag = 'X'.
        MESSAGE e999(re) WITH 'Problem occured'.
        ROLLBACK WORK.
      ELSE.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait   = gs_wait
          IMPORTING
            return = wa_comm_return.
        WRITE :/ return-message+0(30),return-message+36(10).
      ENDIF.

    ENDIF.
    REFRESH: currencyamount,accountgl,return,extension1.
    CLEAR: currencyamount,accountgl,documentheader,return,extension1.

  ENDLOOP

Read only

0 Likes
4,020

Krupaji, thanks a lot for your answer, but still not working...

It's real strange!!, I received the document No and there's no error or warning messages

Let me paste the code:

data:

lw_DOCUMENTHEADER type BAPIACHE09,

lw_ACCOUNTGL type BAPIACGL09,

lt_ACCOUNTGL type standard table of BAPIACGL09,

lw_CURRENCYAMOUNT type BAPIACCR09,

lt_CURRENCYAMOUNT type standard table of BAPIACCR09,

lw_return type BAPIRET2,

lt_return type standard table of BAPIRET2,

lw_extension1 type BAPIACEXTC,

lt_extension1 type standard table of BAPIACEXTC.

  • Complete header

clear lw_DOCUMENTHEADER.

lw_DOCUMENTHEADER-USERNAME = 'CLIENTSOL'.

lw_DOCUMENTHEADER-COMP_CODE = '1000'.

lw_DOCUMENTHEADER-DOC_DATE = '20110321'.

lw_DOCUMENTHEADER-PSTNG_DATE = '20110321'.

lw_DOCUMENTHEADER-FISC_YEAR = '2011'.

lw_DOCUMENTHEADER-FIS_PERIOD = '09'.

lw_DOCUMENTHEADER-DOC_TYPE = 'DZ'.

*lw_DOCUMENTHEADER-COMPO_ACC = 'FI'.

lw_DOCUMENTHEADER-bus_act = 'RFBU'.

  • Complete ACCOUNTGL

refresh lt_ACCOUNTGL.

clear lw_ACCOUNTGL.

lw_ACCOUNTGL-ITEMNO_ACC = '0000000001'.

lw_ACCOUNTGL-GL_ACCOUNT = '0000161010'.

lw_ACCOUNTGL-DOC_TYPE = 'DZ'.

lw_ACCOUNTGL-COMP_CODE = '1000'.

lw_ACCOUNTGL-FIS_PERIOD = '09'.

lw_ACCOUNTGL-FISC_YEAR = '2011'.

lw_ACCOUNTGL-PSTNG_DATE = '20110321'.

lw_ACCOUNTGL-VALUE_DATE = '20110321'.

lw_ACCOUNTGL-CUSTOMER = 'BRO001'.

append lw_ACCOUNTGL to lt_ACCOUNTGL.

  • Complete CURRECYAMOUNT

refresh lt_CURRENCYAMOUNT.

clear lw_CURRENCYAMOUNT.

lw_CURRENCYAMOUNT-ITEMNO_ACC = '0000000001'.

lw_CURRENCYAMOUNT-CURR_TYPE = '10'.

lw_CURRENCYAMOUNT-CURRENCY = 'EUR'.

lw_CURRENCYAMOUNT-AMT_BASE = '1000.0000'.

append lw_CURRENCYAMOUNT to lt_CURRENCYAMOUNT.

refresh: lt_extension1, lt_return.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

DOCUMENTHEADER = lw_DOCUMENTHEADER

  • CUSTOMERCPD =

  • CONTRACTHEADER =

  • IMPORTING

  • OBJ_TYPE =

  • OBJ_KEY =

  • OBJ_SYS =

TABLES

ACCOUNTGL = lt_ACCOUNTGL

  • ACCOUNTRECEIVABLE =

  • ACCOUNTPAYABLE =

  • ACCOUNTTAX =

CURRENCYAMOUNT = lt_CURRENCYAMOUNT

  • CRITERIA =

  • VALUEFIELD =

EXTENSION1 = lt_extension1

RETURN = lt_return

  • PAYMENTCARD =

  • CONTRACTITEM =

  • EXTENSION2 =

  • REALESTATE =

  • ACCOUNTWT =

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'.

clear l_return.

read table lt_return into lw_return index 1.

write lw_return-MESSAGE.

Read only

0 Likes
4,020

Just copy my code which i given into ur editor and only change ur GL A/C then run that program for testing if run successful then modify according to that code because of i run successfuly

Read only

0 Likes
4,020

Hi.

I'm having exactly the same problem with BAPI_ACC_DOCUMENT_POST and F-26. I've done a program, I've force COMMIT and even if I received successful message with number of new document: "Document posted successfully: BKPFF 140000002610002011 DEVCLNT100", the document is not saved in BBDD so it's not present in table BKPF.

Did you get any solution for this?

Thanks and regards.

Alfonso.

Read only

Former Member
0 Likes
4,020

He everybody,

I have the same problem, when I look at the RETURN table, I get a successful creation message. But when I look for the document, it is not in the system.

I use the BAPI_TRANSACTION_COMMIT and it does not work, inclusive I set a Commit Work in my code but it does not work.

Please if you found any solution, please share with me.

Best regards.

Read only

Former Member
0 Likes
4,020

Please try running the FM in SE37 with your data as others have already stated.

Please ensure you are checking the return table for errors, also understand that the document Numbers will not show up in the database until the program has completed.



    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
      EXPORTING
        documentheader    = gv_doc_header2
      IMPORTING
        obj_type          = gv_doc_header2-obj_type
        obj_key           = gv_doc_header2-obj_key
        obj_sys           = gv_doc_header2-obj_sys
      TABLES
        accountgl         = gt_gl_item
        accountreceivable = gt_ar_item
        accountpayable    = gt_ap_item
        currencyamount    = gt_doc_values2
        extension1        = gt_extension2
        return            = gt_return.

    LOOP AT gt_return WHERE type = 'E'.
      error_cnt = error_cnt + 1.
      gv_post_failed = 1.
      EXIT.
    ENDLOOP.

    IF gv_post_failed = 1.
      PERFORM f_bapi_failed.
    ELSE.