Application Development 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: 

Updating WITH_ITEM table through BAPI_ACC_DOCUMENT_POST

Former Member
0 Kudos

Hi all,

I have a query on posting a document. When a document is posted through F-43 t-code, it's creating antries in BSEG table as well as WITH_ITEM table too. Now, we need a report which calls BAPI_ACC_DOCUMENT_POST for posting a document through which BSEG will be updated. But when we do this, WITH_ITEM is not getting updated. Can anyone explain me why it's happening so and how to get this solved.

Thanks a lot.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi all,

Checking whether I can get any more help...

Please help me out.

Thanks a lot.

18 REPLIES 18

Former Member
0 Kudos

are u populating table params BAPIACWT09 ? for WT u need to pass those data to this tables of that BAPI.

regards

Prabhu

0 Kudos

The main requirement is QSSHB (Withholding Tax Base Amount) in BSEG has to be updated through the BAPI. For this there was no logic in the standard bapi and hence we are using an user-exit which solved the problem and updating that field succesfully. But normally from standard t-code whenever withholding tax data is mentioned it was making an entry in WITH_ITEM table. But when we were doing it through the BAPI it was not happening so.

Can you please tell me what the issue is? The functional consultant was asking for the entry for some future calculation.

0 Kudos

Hi Abapdev,

We have a similar requirement to update Withholding tax base amount QSSHB using an user exit. Can you let me know what user user exit were you using to update the tax base amount. We are using F-43 for creating a vendor invoice.

Thanks,

Former Member
0 Kudos

Check whether ur filling the internal ACCOUNTWT or not . If not please fill this appropriately.

Former Member
0 Kudos

Hi,

First of all, are you calculating Tax Data? If you are calculating the Witholding tax per line item, then the table WITH_ITEM is updated. If you have not flagged Calculate Tax on F-43 and directly posting the documents, then it will only update BSEG not WITH_ITEM. Check this.

Regards,

-Syed.

Former Member
0 Kudos

Hi,

I think some missing configuration. Please check with the Functional Consultant.

Regards,

Jayanth g

Former Member
0 Kudos

Hi all,

@ Prabhu and Poorna Chandrasekhar:

You have mentioned about populating BAPIACWT09 or ACCOUNTWT. But I couldn't find both in the BAPI_ACC_DOCUMENT_POST. Can you please be a little more explanatory?

@ Wahid Hussain:

You are right. In f-43 we checked that calculate tax. Is there any way of making this possib;e through the mantioned BAPI, or shall we go for some other BAPI for that?

Please help. Thanks a lot.

0 Kudos

Hi,

When you check the Flag in F-43, the params BAPIACWT09 is populated appropriately filling the table of type ACCOUNTWT structure. Define the exact Profit Center and mention proper Witholding Tax base data. It should come. I've worked on that and it has populated data in WITH_ITEM.

Remember it is per line item. The same bapi BAPI_ACC_DOCUMENT_POST will suffice your requirement.

Regards,

-Syed.

0 Kudos

I am sorry to say, the BAPI doesn't have either BAPIACWT09 or ACCOUNTWT structure. I am working in ECC 4.6C environment. Moreover, I couldn't find the structure itself.

FUNCTION bapi_acc_document_post.

*"----


""Lokale Schnittstelle:

*" IMPORTING

*" VALUE(DOCUMENTHEADER) LIKE BAPIACHE09 STRUCTURE BAPIACHE09

*" VALUE(CUSTOMERCPD) LIKE BAPIACPA09 STRUCTURE BAPIACPA09

*" OPTIONAL

*" VALUE(CONTRACTHEADER) LIKE BAPIACCAHD STRUCTURE BAPIACCAHD

*" OPTIONAL

*" EXPORTING

*" VALUE(OBJ_TYPE) LIKE BAPIACHE09-OBJ_TYPE

*" VALUE(OBJ_KEY) LIKE BAPIACHE09-OBJ_KEY

*" VALUE(OBJ_SYS) LIKE BAPIACHE09-OBJ_SYS

*" TABLES

*" ACCOUNTGL STRUCTURE BAPIACGL09 OPTIONAL

*" ACCOUNTRECEIVABLE STRUCTURE BAPIACAR09 OPTIONAL

*" ACCOUNTPAYABLE STRUCTURE BAPIACAP09 OPTIONAL

*" ACCOUNTTAX STRUCTURE BAPIACTX09 OPTIONAL

*" CURRENCYAMOUNT STRUCTURE BAPIACCR09

*" CRITERIA STRUCTURE BAPIACKEC9 OPTIONAL

*" VALUEFIELD STRUCTURE BAPIACKEV9 OPTIONAL

*" EXTENSION1 STRUCTURE BAPIACEXTC OPTIONAL

*" RETURN STRUCTURE BAPIRET2

*" PAYMENTCARD STRUCTURE BAPIACPC09 OPTIONAL

*" CONTRACTITEM STRUCTURE BAPIACCAIT OPTIONAL

*"----


Can you please suggest me something else? Thanks a lot.

Edited by: abapdev on May 27, 2009 2:59 PM

Edited by: abapdev on May 27, 2009 3:03 PM

0 Kudos

if u wont find any then try FM AC_DOCUMENT_DIRECT_INPUT & see its documentation.

regards

Prabhu

0 Kudos

Hi,

If you go inside the FM ...goto line number 60. There you will find the below perform routine.

perform fill_with_tax
                   Tables accountwt.

If you go inside this, you will find the mentioned structures and BAPI Params.

*----------------------------------------------------------------------*
***INCLUDE LACC9F80 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  fill_with_tax
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_ACCOUNTWT  text
*----------------------------------------------------------------------*
FORM fill_with_tax  TABLES   ACCOUNTWT STRUCTURE bapiacwt09.

  FIELD-SYMBOLS: <wt> LIKE bapiacwt09,
                 <it> like accit.

  CHECK NOT ACCOUNTWT[] IS INITIAL.

  SORT it_accit BY posnr.

  LOOP AT ACCOUNTWT ASSIGNING <wt>.
    CLEAR gs_accwt.
*  accit_wt items fill
    gs_accwt-WITHT =   <wt>-WT_TYPE.
    gs_accwt-WT_WITHCD = <wt>-WT_CODE.
    gs_accwt-WT_QSSHH = <wt>-BAS_AMT_LC.
    gs_accwt-WT_QSSHB = <wt>-BAS_AMT_TC.
    gs_accwt-WT_QSSH2 = <wt>-BAS_AMT_L2.
    gs_accwt-WT_QSSH3 = <wt>-BAS_AMT_L3.
    gs_accwt-WT_QBUIHH = <wt>-MAN_AMT_LC.
    gs_accwt-WT_QBUIHB = <wt>-MAN_AMT_TC.
    gs_accwt-WT_QBUIH2 = <wt>-MAN_AMT_L2.
    gs_accwt-WT_QBUIH3 = <wt>-MAN_AMT_L3.
    gs_accwt-WT_WDMBTR = <wt>-AWH_AMT_LC.
    gs_accwt-WT_WWRBTR = <wt>-AWH_AMT_TC.
    gs_accwt-WT_WDMBT2 = <wt>-AWH_AMT_L2.
    gs_accwt-WT_WDMBT3 = <wt>-AWH_AMT_L3.
    gs_accwt-WT_BASMAN = <wt>-BAS_AMT_IND.
    gs_accwt-WT_AMNMAN = <wt>-MAN_AMT_IND.

    READ TABLE it_accit assigning <it>
                   WITH KEY posnr = <wt>-itemno_acc
                   BINARY SEARCH.
    CHECK sy-subrc IS INITIAL
    and  <it>-koart CA 'DK'.

    gs_accwt-wt_key = sy-tabix.
    append gs_accwt to it_accwt.

*   update ACCIT
    if <it>-wt_key <> gs_accwt-wt_key.
      <it>-wt_key = gs_accwt-wt_key.
    endif.
  ENDLOOP.
ENDFORM.                    " fill_with_tax

Regards,

-Syed.

Edited by: wahid hussain syed on May 27, 2009 11:56 AM

Edited by: wahid hussain syed on May 27, 2009 11:57 AM

0 Kudos

Hi Syed,

In the FM, I couldn't see the code written by you at all. We are using 4.6C version. Are you in the same version too? And as pasted by you, the logic is present in the include LACC9F80. This include itself is not present for us. Can you please suggest some other BAPI or some other way to get this done?

Thanks a lot for your help.

Former Member
0 Kudos

Hi all,

Can anybody give me some solution on this? I tried using AC_DOCUMENT_DIRECT_INPUT. This is, once executed, creating a document but I couldn't find that document in any of the tables BSEG, BKPF or WITH_ITEM though I committed it through BAPI_TRANSACTION_COMMIT. And I couldn't find any documentation for AC_DOCUMENT_DIRECT_INPUT in EN too. Can anybody help me out?

Thanks a lot.

Former Member
0 Kudos

Hi all,

Checking whether I can get any more help...

Please help me out.

Thanks a lot.

0 Kudos

Hi,

As you said, you are working on 4.6c. Why don't you debugg the standard screen?? Put a watchpoint when that BKPF-XMWST = 'X' . This is the check box for the Calculate Tax.

And try to find out which standard function module has been used by SAP for the same operation, with that you can find a way for your problem.

I'm also trying to find out the actual FM which is used for this operation by debugging, meanwhile you start from your end.

Regards,

-Syed.

0 Kudos

Hi Syed,

I debugged the standard method of posting a document through t-code and found that the following FMs are being used for withholding tax details:

FI_WT_ASSIGN_BELNR_TO_WITH

FI_WT_ASSIGN_CLEARINGINFO

FI_CHECK_EXTENDED_WT

FI_WT_CERTIFICATE_NUMBERING

FI_WT_WRITE_EVERYTHING_TO_DB

But these can't be used separately as they hold the data in structures while processing.

Can anybody tell me any other function module which can be used for posting a document with even creating an entry in WITH_ITEM table too?

Thanks a lot.

0 Kudos

Hi,

Check the below mentioned FMs.

APAR_OPEN_ITEMS_PREPARE
FI_WT_ARCHIVE_DOCUMENT_GET
FI_WT_ARCHIVE_DOCUMENT_READ
FI_WT_READ_WT_INFO
FM_FI_DOCS_READ_WITH_LOTKZ
FM_IFMPDOC_DISPLAY

Regards,

-Syed.

0 Kudos

Hi Syed,

The problem is not solved by the BAPI BAPI_ACC_DOCUMENT_POST. I found some other BAPI BAPI_ACC_INVOICE_RECEIPT_POST which is posting the document and even making an entry in WITH_ITEM. But I still have some other problem with this BAPI, which I am going to post as a new query.

Whatever thanks a lot for your help, with patience

Thanks everybody.