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: 

Modify bseg-hkont - Sap Substitution

Former Member
0 Kudos

Hi Gurus,

I have a doubt about updating Bseg-hkont (i want to change the account number for a certain situation).

I have the following code:

IF sy-tcode = 'MIGO' OR

sy-tcode = 'MBST' OR

sy-tcode = 'MB01' OR

sy-tcode = 'MB1A' OR

sy-tcode = 'MB1C'.

IF ( lv_bwart = '161' OR

lv_bwart = '162' OR

lv_bwart = '123' OR

lv_bwart = '122' ) AND

bseg-hkont = '3120010000'.

bseg-hkont = '3170010000'.

IF SY-SUBRC EQ 0.

MODIFY BSEG.

IF SY-SUBRC EQ 0.

COMMIT WORK.

endif.

endif.

endif.

Is it possible / reliable to update BSEG-hkont with this code?

In another hand it's better to update this field with a bapi ? which bapi?

Full points if useful !!

Best Regards,

Mário.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

It looks like you are directly modifying BSEG. Where have you placed this code? If it is in Substitution rule (OBBH), you do not need to modify BSEG. You just subsititute the values based on pre-conditions and SAP will take care of the update when Accounting document is generated.

Thanks,

Venu

3 REPLIES 3

Former Member
0 Kudos

Hello,

It looks like you are directly modifying BSEG. Where have you placed this code? If it is in Substitution rule (OBBH), you do not need to modify BSEG. You just subsititute the values based on pre-conditions and SAP will take care of the update when Accounting document is generated.

Thanks,

Venu

Former Member
0 Kudos

Hi Venu,

Your right, it's a really bad idea to "modify" Bseg like this, i found the solution. I was not updating BSEG because in table GB01 Field HKONT was locked for updating. this solution was refered in a SAP note.

Thanks anyway for your help,

Best Regards,

Mário.

0 Kudos

Hi Mario,

Can you let me know what the solution is?

I need to do this too & HKONT is locked.

Rory