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: 

modification of db table

Former Member
0 Kudos

hi,

i have a reuirement of updating the data base tables.

i have 2 screens , in the first screen i have 4 push buttons '\

'CREATE' 'DELETE' 'CHANGE' 'EXPIRE' 'DISPLAY'

and in 2nd screen i have tabstrip with 8 tabs, and a table control in each

tab.

now if i click on change button,

the changes which i have done in screen has to get updated in data

base tables, but only one change is getting changed.

like if i have 3 changes , only 1 is getting updated in db table.

my code is below,i have written it in PAI of the screen.

LOOP AT gt_fin_prod INTO gs_fin_prod WHERE status EQ c_old.

  • CHECK gs_admn_patnr-status EQ space.

READ TABLE gt_fin_prod_old INTO gs_fin_prod_old

WITH KEY fin_prod = gs_fin_prod-fin_prod

status = c_old.

IF sy-subrc EQ 0.

gs_fin_prod_f-fin_prod = gs_fin_prod-fin_prod.

gs_fin_prod_f-fin_prod_desc = gs_fin_prod-fin_prod_desc.

APPEND gs_fin_prod_f TO gt_fin_prod_f.

CLEAR: gs_fin_prod, gs_fin_prod_f.

ENDIF.

ENDLOOP.

CHECK NOT gt_fin_prod_f[] IS INITIAL.

  • Modify data base table Zfin_products

MODIFY zfin_products FROM TABLE gt_fin_prod_f.

IF sy-subrc EQ 0.

  • Set record status as OLD in all lines of ITAB

gv_change = c_x.

CLEAR gs_fin_prod.

REFRESH gt_fin_prod_f.

ENDIF.

please tel me any thing wrong,

its urgent.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

> LOOP AT gt_fin_prod INTO gs_fin_prod WHERE status EQ

> c_old.

>

> * CHECK gs_admn_patnr-status EQ space.

<b>> READ TABLE gt_fin_prod_old INTO gs_fin_prod_old

> WITH KEY fin_prod =

> gs_fin_prod-fin_prod

> status =

> c_old.</b>

<b>Remove the read statement as would always read only one product.</b>

> IF sy-subrc EQ 0.

> gs_fin_prod_f-fin_prod = gs_fin_prod-fin_prod.

> gs_fin_prod_f-fin_prod_desc =

> gs_fin_prod-fin_prod_desc.

>

> APPEND gs_fin_prod_f TO gt_fin_prod_f.

> CLEAR: gs_fin_prod, gs_fin_prod_f.

>

> ENDIF.

> DLOOP.

>

> CHECK NOT gt_fin_prod_f[] IS INITIAL.

> Modify data base table Zfin_products

>

> MODIFY zfin_products FROM TABLE gt_fin_prod_f.

> IF sy-subrc EQ 0.

> Set record status as OLD in all lines of ITAB

> gv_change = c_x.

> CLEAR gs_fin_prod.

> REFRESH gt_fin_prod_f.

> ENDIF.

Regards,

Srilatha.

2 REPLIES 2

Former Member
0 Kudos

Hi,

> LOOP AT gt_fin_prod INTO gs_fin_prod WHERE status EQ

> c_old.

>

> * CHECK gs_admn_patnr-status EQ space.

<b>> READ TABLE gt_fin_prod_old INTO gs_fin_prod_old

> WITH KEY fin_prod =

> gs_fin_prod-fin_prod

> status =

> c_old.</b>

<b>Remove the read statement as would always read only one product.</b>

> IF sy-subrc EQ 0.

> gs_fin_prod_f-fin_prod = gs_fin_prod-fin_prod.

> gs_fin_prod_f-fin_prod_desc =

> gs_fin_prod-fin_prod_desc.

>

> APPEND gs_fin_prod_f TO gt_fin_prod_f.

> CLEAR: gs_fin_prod, gs_fin_prod_f.

>

> ENDIF.

> DLOOP.

>

> CHECK NOT gt_fin_prod_f[] IS INITIAL.

> Modify data base table Zfin_products

>

> MODIFY zfin_products FROM TABLE gt_fin_prod_f.

> IF sy-subrc EQ 0.

> Set record status as OLD in all lines of ITAB

> gv_change = c_x.

> CLEAR gs_fin_prod.

> REFRESH gt_fin_prod_f.

> ENDIF.

Regards,

Srilatha.

Former Member
0 Kudos

Hi,

Is the problem resolved.

Regards,

Srilatha.