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 Table

Former Member
0 Likes
1,062

Hi all,

If i do this I am not inserting a new line on table ADR6? I need to update this table with one new entry. How can i do that?

The code bellow is not working.

  • LOOP AT lt_xvbpa.

  • UPDATE adr6

  • SET addrnumber = lt_xvbpa-adrnr

  • flgdefault = c_mark

  • home_flag = c_mark

  • WHERE .

  • COMMIT WORK AND WAIT.

Thanks a lot

Best regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,019

update table dbname.

insert new line

DATA scarr_wa TYPE scarr.

scarr_wa-carrid = 'FF'.

scarr_wa-carrname = 'Funny Flyers'.

scarr_wa-currcode = 'EUR'.

scarr_wa-url = 'http://www.funnyfly.com'.

INSERT INTO scarr VALUES scarr_wa.

6 REPLIES 6
Read only

Former Member
0 Likes
1,020

update table dbname.

insert new line

DATA scarr_wa TYPE scarr.

scarr_wa-carrid = 'FF'.

scarr_wa-carrname = 'Funny Flyers'.

scarr_wa-currcode = 'EUR'.

scarr_wa-url = 'http://www.funnyfly.com'.

INSERT INTO scarr VALUES scarr_wa.

Read only

Former Member
0 Likes
1,019

Hi,

If u dont have any conditions in WHERE clause just remove it.

  • LOOP AT lt_xvbpa.

  • UPDATE adr6

  • SET addrnumber = lt_xvbpa-adrnr

  • flgdefault = c_mark

  • home_flag = c_mark.

COMMIT WORK AND WAIT.

ENDLOOP.

The above code will do.

Tnx,

Read only

former_member386202
Active Contributor
0 Likes
1,019

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

Read only

Former Member
0 Likes
1,019

here one more thing is addrnumber is a primary key field...which will not allow your updates..i hope....

anyhow try this....

LOOP AT lt_xvbpa.

UPDATE adr6

SET addrnumber = lt_xvbpa-adrnr flgdefault = c_mark home_flag = c_mark where addrnumber = '30938'.

COMMIT WORK AND WAIT.

Message was edited by:

Muthurajan Ramkumar

Read only

0 Likes
1,019

Hum, i see your point Muthurajan Ramkumar.

I can't insert new lines in table ADR6 because I have addrnumber like a primay key field.

I tried all the examples and didn't worked. So I am not able to insert new lines in this table.

Thanks all.

Read only

0 Likes
1,019

Hi,

If u want insert new entry, then try with INSERT command.This will insert a new line if there is no matching record found else it updates the table.

Tnx,