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: 

keep holding data of internal table?

Former Member
0 Kudos

Hi all,

I have a requirement in my module pool program.

in my screen i have created two button one is NEXT and other is PREVIOUS

it is kind of loop iteration first screen acts as a LOOP no. 1 then when i click next LOOP no becomes to 2 like this goes on

for 1st loop some calculation is being done as attached snap then when i click NEXT button again its is loop 2 and again i did some calculation there

when user clicks PREVIOUS button it should show Previous data same as vice-verse but in my case it is clearing

Can anyone help me in holding the value of internal table for each loops ans simultaneously it can be fetched AS the Button being pressed.

6 REPLIES 6

karun_prabhu
Active Contributor
0 Kudos

Hello Vipin Saraika.

     In the business logic that you had written for Prev Loop & Next Loop, take a backup of the internal table in a temporary internal table, so that it can be used when control comes back.

Regards.

0 Kudos

CAN YOU HELP ME WITH THE CODE PLEASE???

0 Kudos

actually i have an internal table it_final

if i run for first loop it comes in it_final1

for second loop again it come iin it_final1 it overwrites the previous one

before overwritng the previous loop values in IT_FINAL1 i want it to be moved to it_final each time for every loop so that i can fetch from there

0 Kudos

For instance,

     Assume itab is the internal table mapped to table control.

     Declare a temporary itab of same structure as itab:

     DATA: tmp_itab like line of itab OCCURS 0 WITH HEADER LINE.

    

     WHEN 'NEXT_LOOP'.

          tmp_itab[ ] = itab[ ]. "Saves current table control data to temporary itab

          ...YOUR CALCULATION LOGIC FOR NEXT LOOP.

     Now, when you call 'PREV_LOOP'.

          if tmp_itab[ ] is not initial.

               itab[ ] = tmp_itab[ ]. "Retrieves the old saved data for display via table control

          endif.

          ...

Regards.

0 Kudos

loop at it_final1 into ls_final1.
     if ls_final1-flag = 'DC'.
       perform cal_date changing ls_final1.
     endif.
     if ls_final1-flag = 'DR'.
       perform cal_dr changing ls_final1.
     endif.
     if ls_final1-flag = 'PR'.
       perform cal_pr changing ls_final1.
     endif.
     if ls_final1-flag = 'VR'.
       perform cal_vr changing ls_final1.
     endif.
     if ls_final1-flag = 'VM'.
       perform cal_vm changing ls_final1.
     endif.

     modify it_final1 from ls_final1.
   endloop.


after above code i will always have prepared data for one loop so the data in above it_final1 needs to be moved in other it_final like this it should keep appending below it_final only for every loops

0 Kudos

Hi Vipin,

Use flag to hold data for next and previous button in table and take one more temp. table to hold data for previous button .

Thanks & Regard

Vivek