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

hI

Former Member
0 Likes
811

Hi,

I am writing a program to update the record

iam getting the following error in the program that

ztab_ac is not expected.

  • TABLES WORK AREA

TABLES: ZTAB_AC.

ZTAB_AC-MANDT = SY-MANDT.

ZTAB_AC-SERAILNUMBER = '00020'.

ZTAB_AC-ACCOUNTNUMBER = 'A100'.

  • INSERTING RECORDS

INSERT ZTAB_AC.

IF SY-SUBRC EQ 0.

WRITE:/ 'NO OF RECORDS INSERTED', SY-DBCNT.

ENDIF.

  • UPDATING RECORDS

UPDATE:/ ZTAB_AC SET ACCOUNTNUMBER = 'AA100', WHERE SERAILNUMBEER = '00020'.

IF SY-SUBRC EQ 0.

WRITE:/ 'NO OF RECORDS UPDATED', SY-DBCNT.

ELSE

WRITE:/ 'NO OF RECORDS UPDATED'.

ENDIF.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
779

Hi

UPDATE<b>:/</b> ZTAB_AC SET ACCOUNTNUMBER = 'AA100', WHERE SERAILNUMBEER = '00020'.

it should be

<b>UPDATE ZTAB_AC SET ACCOUNTNUMBER = 'AA100'

WHERE SERAILNUMBEER = '00020'.</b>

The bold content (:/) is the cause for the error.

Regards

Raj

Message was edited by:

Rajasekhar Dinavahi

Hi,

I am writing a program to update the record

iam getting the following error in the program that

ztab_ac is not expected.

  • TABLES WORK AREA

TABLES: ZTAB_AC.

ZTAB_AC-MANDT = SY-MANDT.

ZTAB_AC-SERAILNUMBER = '00020'.

ZTAB_AC-ACCOUNTNUMBER = 'A100'.

  • INSERTING RECORDS

INSERT ZTAB_AC.

IF SY-SUBRC EQ 0.

WRITE:/ 'NO OF RECORDS INSERTED', SY-DBCNT.

ENDIF.

  • UPDATING RECORDS

UPDATE:/ ZTAB_AC SET ACCOUNTNUMBER = 'AA100', WHERE SERAILNUMBEER = '00020'.

IF SY-SUBRC EQ 0.

WRITE:/ 'NO OF RECORDS UPDATED', SY-DBCNT.

ELSE

WRITE:/ 'NO OF RECORDS UPDATED'.

ENDIF.

7 REPLIES 7
Read only

Former Member
0 Likes
779

HI.

Check table ztab_ac is available or not in SE12.

I think so its not avaliable in se12.

Reward all helpfull answers.

Regards.

Jay

Read only

0 Likes
779

Hi,

ZTAB_AC IS avaialble. I am getting the error in the 24th row

UPDATE:/ ZTAB_AC SET ACCOUNTNUMBER = 'AA100', WHERE SERAILNUMBEER = '00020'

Read only

0 Likes
779

Check the syntax

UPDATE:/ ZTAB_AC SET ACCOUNTNUMBER = 'AA100', WHERE SERAILNUMBEER = '00020'

and also whether the entry is 'AA100' or 'A100'...i think you are trying to insert with a different entry and your check for update is different one..

PS:Reward points if helpful!!

Regards,

Krithiga.

Read only

0 Likes
779

Hi ,

actual entry is a100, but iam trying to insert aa100

Read only

Former Member
0 Likes
779

What is thios ZTAB_AC...

If it is not a Dictionary table dont use as

TABLES: ZTAB_AC.also tell us where u r getting the error.

Reward points if usefull.

Read only

Former Member
0 Likes
779

Hi

See the documnetaion of UPDATE,INSERT and MODIFY

MODIFY

... FROM { {wa} | {TABLE itab} }.

1. ... FROM wa

2. ... FROM TABLE itab

A wa data object that is not table-type or an itab internal table can be specified after FROM. On the one hand the content of the data objects determines whether the line(s) are inserted or changed, and on the other hand, which values are inserted or used for changes.

To insert or change several lines in a database table, use the following:

MODIFY <target> FROM TABLE <itab> .

Those lines of the internal table <itab> for which there is not already a line in the database table with the same primary key are inserted into the table. Those lines of the internal table <itab> for which there is already a line in the database table with the same primary key overwrite the existing line in the database table. The same rules apply to the line type of <itab> as to the work area <wa> described above.

SY-SUBRC is always set to 0. SY-DBCNT is set to the number of lines in the internal table

INSERT

... { {VALUES wa}

| {FROM wa|{TABLE itab [ACCEPTING DUPLICATE KEYS]}} }.

1. ... {VALUES wa} | {FROM wa} ...

2. ... FROM TABLE itab [ACCEPTING DUPLICATE KEYS] ...

After FROM and VALUES, you can specify a non-table-type data object wa. After FROM, you can also specify an internal table itab. The contents of the row(s) to be inserted are taken from these data objects

UPDATE

... { {SET set_expression [WHERE sql_cond]}

| {FROM wa|{TABLE itab}} }.

1. ... SET set_expression [WHERE sql_cond]

2. ... FROM wa

3. ... FROM TABLE itab

The specifications in source define which rows and columns are changed. Either individual columns are changed using the addition SET or entire rows are overwritten using the addition FROM.

After FROM, either a non-table-type data object wa or an internal table itab can be specified. The content of these objects determines - on the one hand - which row(s) is/are changed, and - on the other hand - which values are used to overwrite the row(s).

Check out these related threads

Reward points for useful Answers

Regards

Anji

Read only

Former Member
0 Likes
780

Hi

UPDATE<b>:/</b> ZTAB_AC SET ACCOUNTNUMBER = 'AA100', WHERE SERAILNUMBEER = '00020'.

it should be

<b>UPDATE ZTAB_AC SET ACCOUNTNUMBER = 'AA100'

WHERE SERAILNUMBEER = '00020'.</b>

The bold content (:/) is the cause for the error.

Regards

Raj

Message was edited by:

Rajasekhar Dinavahi