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: 

updation of ztable

Former Member
0 Kudos

hi,

1)how to insert new record into the z table and

2)how to update the existing record in the ztable.

please provide me the solution for this.

it is very urgent...........

thanks in advance...........

6 REPLIES 6

Former Member
0 Kudos

<b>1.FOr inserting</b>

Inserting a new airline company in the database table SCARR. 

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.

<b>2. FOR Updating </b>

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.

reward points if it is usefull ......

Girish

former_member196280
Active Contributor
0 Kudos

Mainly table contents are inserted thru transaction.

1) Ex. D/B table name TEMP.

with field name a1, a2, a3.

Now you have data in internal table. Ex, ITAB.

field b1, b2, b3, b4.

Now,

LOOP at itab.

temp-a1 = itab-b1.

temp-a2 = itab-b2.

temp-a3 = itab-b4.

INSERT temp.

ENDLOOP.

2) update

UPDATE temp SET a1 = '234' where a1 = '123'.

Reward points.

Regards,

Sairam

Former Member
0 Kudos

You can use <b>MODIFY</b> for insert and update both...

always keep in mind the primary key of DB table.. it should be unique...

o.w MODIFY, INSERT or UPDATE statement will fail..

reward if useful...

Former Member
0 Kudos

hi

good

use BDC to insert new record into the ztable and use UPDATE statement to update the ztable.

thanks

mrutyun^

former_member235056
Active Contributor
0 Kudos

Hi,

If u want to do this in se11,the,

1)how to insert new record into the z table.

There's + sign on the top of the table for adding fields.

2)how to update the existing record in the ztable.

There's change/display option in the standard toolbar at top.

If u want to do this in program,then,

1)how to insert new record into the z table.

Use inset statement.

2)how to update the existing record in the ztable.

Use update command.

All the syntax for the same can be made available when u type the keyword in the program and then click f1 on that.

Pls reward points.

Regards,

Ameet

Former Member
0 Kudos

Hi Sudarsan,

You can insert records in several ways.

1. insert single records at dataditionary(SE11) level by manually

2.insert through the program using internal tables or direct.

data itab like ztable occurs 0 with header line.

itab-field1 = 'xyz'.

itab-field2 = '123'.

append itab.

insert into ztab values itab.

or

ztable-field1 = 'xyz'.

ztable-field2 = '123'.

insert ztable.

3. using data migration methods like BDC(Call transaction , session and dialague), lsmw,bapi,idoc.

update:

you can update using through the program is good for permormance wise.

update table ztable where -


or update using internal table to ztable.

add points helpful

sekhar