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 statement

Former Member
0 Likes
565

update ztale_head set : send = 'X',

ttime = sy-uzeit,

ddate = sy-datum

where inveno = '227'.

here only record with 227 invoice no shud be updated in ztable but whole ztable is updated with send = 'X' and date and tiem field...

please help.

4 REPLIES 4
Read only

Former Member
0 Likes
531

Maybe a problem with the conversion exit.

Try using the conversion exit on the inveno and then pass it in the condition.

-Aarthi.

Read only

Former Member
0 Likes
531

Hello,

DO like this..

update ztale_head set : send = 'X',

ttime = sy-uzeit,

ddate = sy-datum

where inveno = '0000000227'.

If useful reward.

Vasanth

Read only

Former Member
0 Likes
531

Hi Sharma,

Check the Syntax,

UPDATE

Modifies lines in database tables.

Syntax

UPDATE <dbtab> SET <si> = <f>

|<si> = <s i> + <f>

|<si> = <s i> - <f> [WHERE <cond>].

Sets the value in <si> to <f>, increases it by <f>, or decreases it by <f> for all selected lines. The WHERE addition determines the lines that are updated. If you omit the WHERE addition, all lines are updated.

Regards,

Prashanth

Read only

Former Member
0 Likes
531

Hi,

Check these 2 things,

1)Are you giving the values (inveno = '227')

as youe see them in the DB table.

If not use <b>CONVERSION_EXIT_ALPHA_INPUT</b> to convert it to the input format.

<b>(Next 2 form Documentation)</b>

2)

If you want to change a column of the type STRING, the primary key in the WHERE condition must be fully specified.

3)Do not use the <b>colon and commas to separate chained statements</b>, since you could <b>change an entire database table without wanting</b> to, if you use them wrongly.

* FALSCH * WRONG * FALSCH * WRONG * FALSCH * WRONG * 
* UPDATE SCUSTOM SET:  DISCOUNT  = '003', 
*                      TELEPHONE = '0621/444444' 
*                WHERE ID        = '00017777'.

This code fragment is <b>not a single statement</b> that update the discount and telephone number for the customer with the customer number '00017777'. Rather, it <b>represents two statements</b> - the <b>first</b> changes the <b>discount for all customers</b>, while the <b>second changes the telephone number of the customer with the customer number '00017777'</b>.

So make the following changes and try.



In case of <b>Point 1</b>
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input  = inveno
  IMPORTING
    output = inveno.


UPDATE ztale_head SET   : send = 'X'
                          ttime = sy-uzeit
                          ddate = sy-datum
               WHERE inveno = <converted value>.


<b>Else do it in this way</b>


UPDATE ztale_head SET   : send = 'X'
                          ttime = sy-uzeit
                          ddate = sy-datum
               WHERE inveno = '227'.

Regards,

AS.