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: 

can any one advice me, how can i update a field in BSEG,

Former Member
0 Kudos
528

hi there all,

i would like to seek for you help, to resolve a problem.

i need to know how can i update the zterm field in the BSEG table.

currently the field dont hold any data's in it, but the field is there in the table. i need to assign payment term(ZV*) to the zterm field.

i have managed to do for other tables, but im having difficulties with this BSEG

thank you.

4 REPLIES 4

former_member386202
Active Contributor
0 Kudos
149

Hi,

Refer this code

&----


*& Form SUB_READ_UPDATE_BSEG

&----


  • text

----


FORM sub_read_update_bseg.

IF NOT it_final[] IS INITIAL.

LOOP AT it_final INTO wa_final.

UPDATE bseg SET zuonr = wa_final-ccnum

WHERE bukrs EQ wa_final-bukrs

AND belnr EQ wa_final-vbeln

AND rfzei EQ wa_final-rfzei

AND saknr NE ' '.

ENDLOOP.

*--Message data updated successfully

MESSAGE i888 WITH text-002.

LEAVE LIST-PROCESSING.

ELSE.

*--Message No data found

MESSAGE i888 WITH text-003.

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " SUB_READ_UPDATE_BSEG

Regards,

Prashant

0 Kudos
149

hi Prashant,

thanks for ur advice,

if you dont mind can u advice me on this also, thank you.

i actually need to update the field zterm in bseg, the record is coming from IDOC.

the zterm field beign captured in LFB1 table,

now i want it to be captured in BSEG,

is there any way that i could capture it, using select statement?

Former Member
0 Kudos
149

Hi

U need to implement a FI substitution in order to place a value in that field: trx OBBH

Max

Former Member
0 Kudos
149

Hello,

You should NOT update a standard table directly. Use BAPI or function module instead.

For this change, you can use function module FUNCTION 'CHANGE_DOCUMENT'

TABLES

t_bkdf = lt_bkdf

t_bkpf = lt_bkpf

t_bsec = lt_bsec

t_bsed = lt_bsed

t_bseg = lt_bseg

t_bset = lt_bset.

In the internal table lt_bseg, change the fields you want to change. The FM will than change the document in all underlying tables.

Note that some fields are stored in multiple tables. Field ZUONR for example is stored both in BSEG as BSIS. If you do a table update directly, you should update both tables in order not to create inconsistencies. The above FM does this for you.

Kind Regards,

Bart