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

Question with database table

Former Member
0 Likes
885

I want to update a z custom table with a set of new rows and also modify some of the rows. Do you have any sample code for this?

Also can you tell me what is the check table for states in usa?

Thanks,

Krishen

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
853

Hi

DATA: T_DATA TYPE STANDARD TABLE OF ZTABLE WITH HEADER

LINE.

MODIFY ZTABLE FROM TABLE T_DATA.

INSERT ZTABLE FROM TABLE T_DATA.

The check table for state for US is T005S..

Thanks,

Naren

9 REPLIES 9
Read only

Former Member
0 Likes
853

U can use MODIFY ZTABLE to either insert/update the row in your custom ztable.

Read only

Former Member
0 Likes
854

Hi

DATA: T_DATA TYPE STANDARD TABLE OF ZTABLE WITH HEADER

LINE.

MODIFY ZTABLE FROM TABLE T_DATA.

INSERT ZTABLE FROM TABLE T_DATA.

The check table for state for US is T005S..

Thanks,

Naren

Read only

0 Likes
853

Hi naren,

I understand. But i am just looking for states. That T005S has the details about land1 also. So, I could not figure out how to attach just the 'states' part of that check table to my 'state' field in custom table.

Any input?

Thanks a lot

Read only

Former Member
0 Likes
853

HI KRISHEN,

do this way ..

    it_zprtow-own_balance  = it_zprtow-own_balance
                               + it_ossl-gl_trans_am.

     IF NOT it_zprtow[] IS INITIAL.
      MODIFY zprtow_eom_babal FROM TABLE it_zprtow.
      IF sy-subrc = 0.
        COMMIT WORK.
        WRITE : 'Number of Entries Updated', sy-dbcnt.
      ENDIF.

Regards,

Santosh

Read only

0 Likes
853

Do I always have to 'commit' when I insert/modify databse tables?

Thanks.

Read only

Former Member
0 Likes
853

Hi,

If you have land1 in your table while defining the foreign key, it will automatically take the value based on the field land1..Since the states is dependant in country..

Thanks,

Naren

Read only

0 Likes
853

Naren,

I don't have land1 field. I just have states field. The problem is when I am attaching this check table, and when I select the value from F4, only the land1 value is coming in my states field. What I am looking is just the state to come into that field. Any idea?

Thanks for your input.

Read only

Former Member
0 Likes
853

Yes. You have to give commit work..

THanks,

Naren

Read only

Former Member
0 Likes
853

Hi,

You can add a field for country in the table..

For more details check the table ADRC for the fields COUNTRY and REGION...You need to have the same setup in your custom table..

GOTO SE16 for ADRC..in the country field enter US and press F4 on the region field...you will get the states only for US...

Thanks,

Naren