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: 

pf status & fetching datas

Former Member
0 Kudos

FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

CASE R_UCOMM.

WHEN '&ENT'.

LOOP AT IT_MARD.

IF IT_MARD-RP_MONTH <> 0.

IT_MARD-COVER = ( IT_MARD-T_STOCK * 26 ) / IT_MARD-RP_MONTH.

ELSE.

IT_MARD-COVER = 0.

ENDIF.

MODIFY IT_MARD.

ENDLOOP.

WHEN '&SAVE'.

LOOP AT IT_MARD.

MOVE-CORRESPONDING IT_MARD TO ZROC.

MODIFY ZROC.

ENDLOOP.

MESSAGE 'Entries are saved in table' TYPE 'I'.

ENDCASE.

in the above zroc is the table created by me for storing datas.

initially i am saving 5000 as default to it_mard-rp_month which is updating in zroc-rp_month.

if i give save it is saving in particular table.if i again execute the same program i should get the

save values.for that how i have to write query for getting it from zroc table.

8 REPLIES 8

Former Member
0 Kudos

Hi...

with the statement MODIFY ZROC u r modifing internal table not DB table. so that u r getting same old entries when u execute again.

update DB table. so that u won't get this problem.

MODITY ZROC FROM TABLE ZROC

and end of the program clear and free momory associated to all internal tables and work areas used in program.

Regards,

KP.

Former Member
0 Kudos

Hi,

Before looping the table u just clear the table like

IT_MARD[]

Modified code:

CASE R_UCOMM.

WHEN '&ENT'.

clear IT_MARD[].

LOOP AT IT_MARD.

IF IT_MARD-RP_MONTH 0.

IT_MARD-COVER = ( IT_MARD-T_STOCK * 26 ) / IT_MARD-RP_MONTH.

ELSE.

IT_MARD-COVER = 0.

ENDIF.

MODIFY IT_MARD.

ENDLOOP.

WHEN '&SAVE'.

IT_MARD[].

LOOP AT IT_MARD.

MOVE-CORRESPONDING IT_MARD TO ZROC.

MODIFY ZROC.

ENDLOOP.

MESSAGE 'Entries are saved in table' TYPE 'I'.

ENDCASE.

Regards

Kiran

Edited by: Kiran Saka on Feb 9, 2009 5:06 AM

Former Member
0 Kudos

Hi

In order to get the saved entries from zroc table, you must use a select query and populate your internal table:

select * from zroc into table it_mard.

I am assuming that the fields in both itab and db table are same.

Use this stmt to populate your it_mard and then you would get the saved values.

Hope this helps

Regards,

Jayanthi.K

Former Member
0 Kudos

Hi,

try this .

FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

CASE R_UCOMM.

WHEN '&ENT'.

clear it_mard[].

LOOP AT IT_MARD.

IF IT_MARD-RP_MONTH IS NOT INITIAL.

IT_MARD-COVER = ( IT_MARD-T_STOCK * 26 ) / IT_MARD-RP_MONTH.

ELSE.

IT_MARD-COVER = 0.

ENDIF.

MODIFY IT_MARD from table zroc.

ENDLOOP.

WHEN '&SAVE'.

LOOP AT IT_MARD.

MOVE-CORRESPONDING IT_MARD TO ZROC.

MODIFY ZROC from table zroc.

ENDLOOP.

MESSAGE 'Entries are saved in table' TYPE 'I'.

ENDCASE.

dev_parbutteea
Active Contributor
0 Kudos

Hi,

WHEN '&SAVE'.

LOOP AT IT_MARD.

MOVE-CORRESPONDING IT_MARD TO ZROC.

MODIFY ZROC.

Lock table ZROC. " using a lock object

MODIFY ZROC FROM ZROC

UNLOCK table ZROC. " using a lock object

ENDLOOP.

Former Member
0 Kudos

Hi Bathrinath,

create a display push button and at user command u can give the code to retreive data from zorc.

Select *

from zorc

into table i_tab2.

loop at i_tab2 into work_area.

write......

endloop.

Regards,

Mdi.Deeba

Former Member
0 Kudos

Hi,

To make myself clear, I would just like to confirm certain doubts...

Is it like the next time you run a program it creates extra entries.....

if so could you please paste the structure of both the tables, and if you are fetching records pleasae paste that code as well.

Regards,

Siddarth

Former Member
0 Kudos

closed