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: 

Update BKTXT field of table BKPF

Former Member
0 Kudos

Hello,

I have a requirement where I need to update the BKTXT field of table BKPF, to do this I have written the following but when I execute it I am getting the error and looks like this is not the way to do it. Do you know any other BAPI/FM that I can use to update the BXTXT field of table BKPF based on the document number.

data: i_accchg TYPE STANDARD TABLE OF accchg,

       wa_accchg LIKE LINE OF i_accchg,

       wa_belnr TYPE bkpf-belnr.

wa_accchg-fdname = 'BKTXT'.                " field that need to be updated

wa_accchg-oldval = ' '.            " old value in that field if any

wa_accchg-newval = 'TEST'.            " value that need to be updated

APPEND wa_accchg to i_accchg.

wa_belnr = '0990883998'.

CALL FUNCTION 'FI_DOCUMENT_CHANGE'

   EXPORTING

     i_awtyp                    = 'BKPF'

     i_awref                    = wa_belnr

*   I_AWORG                    = ' '

*   I_AWSYS                    = ' '

*   I_KUNNR                    = ' '

*   I_LIFNR                    = ' '

*   I_OBZEI                    = ' '

*   I_BUZEI                    =

*   I_BSEGC                    =

*   X_LOCK                     = 'X'

   TABLES

     t_accchg                   = i_accchg

* EXCEPTIONS

*   NO_REFERENCE               = 1

*   NO_DOCUMENT                = 2

*   MANY_DOCUMENTS             = 3

*   WRONG_INPUT                = 4

*   OVERWRITE_CREDITCARD       = 5

*   OTHERS                     = 6

           .

IF sy-subrc <> 0.

* Implement suitable error handling here

ENDIF.

to byu

b

1 ACCEPTED SOLUTION

Former Member
0 Kudos

I used FM 'CHANGE_DOCUMENT'

Thanks,

8 REPLIES 8

Former Member
0 Kudos

Hi Rajat,

Can you let us know based on what condition does the Header Text needs to be updated? Since this can be even done through configuration. There is an User Exit EXIT_SAPLV60B_001.

0 Kudos

I have an internal table that has BELNR and BKTXT field in it, so what I need to do is loop through this internal table and update the BKTXT field for the corresponding record in table BKPF>

0 Kudos

Hi

You can write a little BI for FB02 trx

Max

0 Kudos

Hi Max,

ya i can try that but was just trying to avoid that and looking for FM/BAPI for the same.

0 Kudos

Hi

I don't believe there's a function or BAPI to change the data header of FI.

Max

raymond_giuseppi
Active Contributor
0 Kudos

As BKPF-BKTXT (with XBLNR ) is delivered by SAP as a changeable field of document header (SPRO ...Document Change Rules, Document Header), this FM should have well performed, did the FM raise an error ?

Regards,

Raymond

Former Member
0 Kudos

Hi Rajat,

maybe the problem are the parameters you are passibg to the FM. FI document has  a more complex key than the sole documente number. 

When I use this FM I always  pass the values AWTYP, AWREF and AWORG taking them from BKPF (fields AWTYP and AWKEY that you sholu add to your internal table), or else something like that,

DATA: w_awtyp  LIKE acchd-awtyp,

           w_awref  LIKE acchd-awref,

           w_aworg  LIKE acchd-aworg.

w_awtyp = bkpf-awtyp.

w_awref  = bkpf-awkey(10).

w_aworg = bkpf-awkey+10(10).

  CALL FUNCTION 'FI_DOCUMENT_CHANGE'

    EXPORTING

      i_awtyp              = w_awtyp

      i_awref              = w_awref

      i_aworg              = w_aworg

.....

Try to change your report and let us know if it worked for you too.

Moody

Former Member
0 Kudos

I used FM 'CHANGE_DOCUMENT'

Thanks,