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 bseg table

Former Member
0 Kudos

Hi all,

In bseg table, i need to updated the 'zuonr' field from my internal table... requirement is i need to take records from bseg using doc. no, and for a certain hkont ( g/l ) i need to modify the zuonr field in bseg standard sap table. i have collected the value in an internal table... now, how shall i update the value from internal table to standard table... plz give me some tips...

With thanks,

subbu....

2 REPLIES 2

Former Member
0 Kudos

Hi,

When an internal table itab is specified, the system processes all the rows of the internal table in accordance with the rules for the work area wa. The row type of the internal table must meet the requirements for use in Open-SQL statements.

If, in the database, there is no row with the same content of the primary key for a row in the internal table, or if the change would lead to a double entry in a unique secondary key, the respective row is not changed and sy-subrc is set to 4. If the internal table is empty, sy-subrc is set to 0. The system field sy-dbcnt is always set to the number of rows actually inserted.

Example

Reduction of the flight cost for all of today's flights of an airline carrier in the database table SFLIGHT by the percentage percent. The calculation of the new price is always done in an internal table sflight_tab and the database table is changed accordingly.

PARAMETERS: p_carrid TYPE sflight-carrid,

percent TYPE p LENGTH 1 DECIMALS 0.

DATA sflight_tab TYPE TABLE OF sflight.

FIELD-SYMBOLS <sflight> TYPE sflight.

SELECT *

FROM sflight

INTO TABLE sflight_tab

WHERE carrid = p_carrid AND

fldate = sy-datum.

IF sy-subrc = 0.

LOOP AT sflight_tab ASSIGNING <sflight>.

<sflight>-price =

<sflight>-price * ( 1 - percent / 100 ).

ENDLOOP.

ENDIF.

UPDATE sflight FROM TABLE sflight_tab.

regards

Kannaiah

former_member183994
Active Participant
0 Kudos

SAP highly recommends NOT to make updates or any maintenance in standard tables, but instead use SAP transaction for this. You can use BTE user exits to affect zuonr field in BSEG table BEFORE the document is posted. If the documents already exist in BKPF/BSEG, then my recommendation is to cancel the documents via FB08 and re-post them