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

BDC or BAPI for FB09

Former Member
0 Likes
4,243

Hi all,

I need to update the field 'WITH_ITEM-WT_WITHCD(01)' in screen SAPMF05L , 0100 . It has to update the with_item table.

I did the recording through SHDB and wrote the BDC. But it does not work. Is there any BAPI available ? The BAPI change document is not working.

Any idea will be helpful.

Thanks,

Sindhu

13 REPLIES 13
Read only

Former Member
0 Likes
3,135

This message was moderated.

Read only

0 Likes
3,135

Hi Amol,

The function module CHANGE_DOCUMENT updates only BSEG table. I need to update WITH_ITEM table to update the tax codes.

Regards,

Sindhu

Read only

0 Likes
3,135

Change document is a standard update FM, not to call in your report (no check, no databse consistency, never use in customer program)

Regards,

Raymond

Read only

matt
Active Contributor
0 Likes
3,135

For that reason, the post you replied to has been rejected. To reiterate

DO NOT USE UPDATE FUNCTION MODULES IN YOUR PROGRAMS.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
3,135

During your search (before posting ) did you find my answer in BAPI for FB02 or similar threads/discussions ?

Regards,

Raymond

Read only

0 Likes
3,135

Hi Raymond,

I did go through the link given by you. I have to update only the field WT_WITHCD  in screen

'SAPLFWTD'  '0110'. 

I will pass the document number, company code and fiscal year as input parameters and I need to update WT_WITHCD based on few conditions.

I tried doing recording with both FB09 and FB02.

Is there any other way.

Thanks & Regards,

Sindhu

Read only

0 Likes
3,135

Hi Sinthu,

first use FM FI_DOCUMENT_READ for reading the items into your BSEG table parameter based on GJAHR,BUKRS and BELNR.

then use FM FI_ITEMS_MASS_CHANGE  as raymond suggested .

it will solve your purpose.

regards,

Read only

0 Likes
3,135

Apart BDC, I also called FM FI_ITEMS_MASS_CHANGE (no longer calling FI_DOCUMENT_CHANGE) , check if your field is allowed / available, but if FB02 and FB09 do not allow this (*), there should be no chance for that and you could have to reverse and post again documents...

Regards,

Raymond

(*) Is this what you described "it does not work". then read 545362 - FAQ: When is a field ready for input?, 827413 - FI: Changeability of fields in FI documents, 1874979 - FB02 Fields of the accounting interface cannot be changed, etc.

Read only

0 Likes
3,135

Hi Raymond, Naren,

Thanks for your reply.

I had already checked the FM FI_ITEMS_MASS_CHANGE .  The BDC written inside the FM, does not call the screen SAPMF05L , 0100 . (Change withholding tax information ).

The field WT_WITHCD is not mentioned in the notes given below.

But, if I go to FB02/FB09, I am able to edit the field.

Any insight?

Thanks and Regards,

Sindhu

Read only

0 Likes
3,135

So why were you unable to success with a BDC, could you elaborate on this ?

Regards,

Raymond

Read only

0 Likes
3,135

Hi Sinthu,

Try this

CALL FUNCTION 'FI_DOCUMENT_READ'
     EXPORTING
       i_bukrs     = gc_bukrs
       i_belnr     = gd_belnr
       i_gjahr     = gd_gjahr
     TABLES

       t_bkpf      = ist_bkpf
       t_bseg      = ist_bseg
     EXCEPTIONS
       wrong_input = 1
       not_found   = 2
       OTHERS      = 3.
   IF sy-subrc <> 0.


Here u will get the field QSSKZ(which is with holding tax field) in table IT_BSEG for your Line item


READ TABLE ist_BSEG INTO wa_bseg INDEX 1( or according to ur line item number).
   IF sy-subrc = 0.
     MOVE-CORRESPONDING wa_bseg TO wa_buztab.
     APPEND wa_buztab TO ist_buztab.
     wa_fldtab-fname = 'QSSKZ'.
     wa_fldtab-aenkz = gc_x.
     APPEND wa_fldtab TO ist_fldtab.
     wa_bseg-QSSKZ = UR  NEW VALUE .
   ENDIF.


Now again call FM.


CALL FUNCTION 'FI_ITEMS_MASS_CHANGE'
     EXPORTING
       s_bseg     = wa_bseg
     TABLES
       it_buztab  = ist_buztab
       it_fldtab  = ist_fldtab
     EXCEPTIONS
       bdc_errors = 1
       OTHERS     = 2.


this will change ur Tax code.



Read only

Former Member
0 Likes
3,135

Hi

Why doesn't it work?

Max

Read only

Former Member
0 Likes
3,135

This message was moderated.