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

Update vendor master

Former Member
0 Likes
1,853

Hi Experts,

I have requirement where I want to automatically update bank details.

  1. Update Bank account number with “-” at second last position only for preferred bank account.

I have used BADI ‘VENDOR_ADD_DATA’ and method ‘CHECK_ALL_DATA’ but it is
giving syntax error as : ‘The field "T_LFBK" cannot be changed’

Following is my sample code:

  loop at t_lfbk into ls_lfbk.
    clear: len.
    len = strlen( ls_lfbk-bankn ).
      if ls_lfbk-bvtyp = '0001'.
            len = strlen( ls_lfbk-bankn ).
            len = len - 1.
            concatenate ls_lfbk-bankn(len) '-' ls_lfbk-bankn+len(1) into ls_lfbk-bankn.
            clear len.
      endif.

    modify t_lfbk from ls_lfbk.
  endloop.

Hi Experts,

I have requirement where I want to automatically update bank details.

  1. Update Bank account number with “-” at second last position only for preferred bank account.

I have used BADI ‘VENDOR_ADD_DATA’ and method ‘CHECK_ALL_DATA’ but it is
giving syntax error as : ‘The field "T_LFBK" cannot be changed’

Following is my sample code:

  loop at t_lfbk into ls_lfbk.
    clear: len.
    len = strlen( ls_lfbk-bankn ).
      if ls_lfbk-bvtyp = '0001'.
            len = strlen( ls_lfbk-bankn ).
            len = len - 1.
            concatenate ls_lfbk-bankn(len) '-' ls_lfbk-bankn+len(1) into ls_lfbk-bankn.
            clear len.
      endif.

    modify t_lfbk from ls_lfbk.
  endloop.

8 REPLIES 8
Read only

Former Member
0 Likes
1,461

Hi,

The field "T_LFBK" is importing parameter of the method CHECK_ALL_DATA

You can only change the parameters with attribute 'Changing'.

You can chose a suitable method in the same BADI, I think MODIFY_ACCOUNT_NUMBER should work for you.

Regards

Bikas

Read only

0 Likes
1,461

This method only allow changing the number rule for the vendor id LFA1-LIFNR, no effect on account bank numbers LFBK-BANKN.

Regards,

Raymond

Read only

0 Likes
1,461

Hi Bikas,

Thanks for reply, but method 'MODIFY_ACCOUNT_NUMBER' does not have table LFBK in changing parameters which I want to update.

Any other solution to achive this.

Br,

Omkar

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,461

Look at method signature, those "Importing" parameters cannot be changed.

You could start analyzing FM BANK_ACCOUNT_CHECK its where-called and implicit enhancement options. Also with BTE 00003000 (called in the FM) you may raise an error if account number does not respect your rule.

Else try to "play" with the additional data VENDOR_ADD_DATA[_CS] (*) those BAdI intended to manage customer fields in customer screen, allow modificaiton of fields of main screen, so you get a better chance there.

Regards,

Raymond

(*) Look at SET and GET_DATA.

Read only

0 Likes
1,461

Hi Raymond,

Thanks for ur suggestions, but for FM BANK_ACCOUNT_CHECK we don’t have any exporting
parameters so we cannot use this FM.

And BADI VENDOR_ADD_DATA_CS is not getting called while changing Vendor master data.

Kindly suggest any other possible way to do this.

Br,

Omkar

Read only

former_member202818
Active Contributor
0 Likes
1,461

Hi,

Try this,

FIELD-SYMBOL <fs> like t_lfbk.

ASSIGN t_lfbk to <fs>.

Now use <fs> instead of  t_lfbk.

Regards

Read only

0 Likes
1,461

Hi Sreekanth,

I have tried this code, but it gives run time error as follows :

Short Text
    Error at assignment: Overwritten protected field.

What happened?
    Error in the ABAP Application Program

    The current ABAP program "ZCL_IM_VENDOR_ADD_DATA========CP" had to be
     terminated because it has
    come across a statement that unfortunately cannot be executed.

Error analysis
    A new value is to be assigned to the field "<FS>", although this field is
    entirely or partly protected against changes.

    The following are protected against changes:
    - Character literals or numeric literals
    - Constants (CONSTANTS)
    - Parameters of the category IMPORTING REFERENCE for functions and
    methods
    - Untyped field symbols not yet assigned a field using ASSIGN
    - TABLES parameters if the actual parameter is protected against changes
    - USING reference parameters and CHANGING parameters for FORMs, if the
    actual parameter is protected against changes and
    - Accesses using field symbols if the field assigned using ASSIGN is
    protected (or partially protected, e.g. key components of an internal
    table with the type SORTED or HASHED TABLE) against changes
    - Accesses using references, if the field bound to the reference is
    protected (or partially protected) against changes
    - External write accesses to READ-ONLY attributes,
    - Content of a shared object area instance accessed using a shared lock
    (ATTACH_FOR_READ).

Read only

Former Member
0 Likes
1,461

HI Omkar,

I have also faced this issue before some time and as per my experience 1 way is to use the BDC for the same.

( BDC of Bank data change of Vendor )

Thanks & regards,

Susheel Joshi