10-09-2007 7:46 AM
hi experts...
plzzz solve the query...
i am facing a problem in Module pool programming...
i want the coding for previous button...
WHEN 'FPREVIOUS'.
read table itab with key sy-index
*SELECT SINGLE STU_ID STU_NAME STU_COURSE STU_RESULT STU_ADDRESS FROM ZSTUDENT99 INTO CORRESPONDING FIELDS OF ITAB WHERE STU_ID = ITAB-STU_ID.
ZSTUDENT99-STU_ID = ITAB-STU_ID .
ZSTUDENT99-STU_NAME = ITAB-STU_NAME .
ZSTUDENT99-STU_COURSE = ITAB-STU_COURSE .
ZSTUDENT99-STU_RESULT = ITAB-STU_RESULT .
ZSTUDENT99-STU_ADDRESS = ITAB-STU_ADDRESS .
plzz give me the correct code for 'PREVIOUS button
10-09-2007 7:49 AM
Hi,
READ statement should be like this,
read table itab index sy-index . or
read table itab with key field1 = field1
field2 = field2 etc
10-09-2007 7:55 AM
Hi Rashmi ,
Actually in this Select statement , you hav already moved all the values to the table ITAB depending on the STUD_ID.
But then why have you moved it again after tha select statement?
Second problem is the Read statement.
It should be , read table index sy-index.
I think that is the reason for Error.
Reward if Helpful.
Regards,
Chitra
Message was edited by:
Chitra Parameswaran
10-09-2007 8:03 AM
thanx fo ur reply...
but actually i want the previous value of ztable by clicking on the PREVIOUS button.....
10-09-2007 8:05 AM
thanx fo ur reply...
but actually i want the previous value of ztable by clicking on the PREVIOUS button.....
10-09-2007 8:12 AM
Using your key field, the one you select using if it is chronological then you can use that to determine what you want to pick!
Tatenda Chaibva.
10-09-2007 8:12 AM
Hi Rashmi,
i suggest you do the following. Please create a global internal table say y_tablename. select the orignal values from the database in PBO into this table.
What ever changes you make on the screen, update the changes to another internal table say X_tablename.
Use the internal table Y_tablename to read the old values.
Upon exit, save the new values from table x_tablename to database.
10-09-2007 8:13 AM
Take the original table in a temporary table of same structure.
Describe your ztable and store in a variable. Loop at ztable(temporary table) and use the take the sy-tabix in variable.Check the value of these to variable accordingly and read from the table.
10-09-2007 8:08 AM
10-09-2007 8:12 AM
Hi Rashmi,
Before Executing this query u need to be clear of following things.
1) This select statement will pick one record at a time, so u need to keep appending every record in the itab, using "append itab" command.
2)In where Clause u wrote STU_ID = ITAB-STU_ID , means ur itab already have the value of student ID n u r compairing each value one by one .... so this query should be in loop.
You are saying that you are writting a code for PREVIOUS button to get previous values of transparent table ZSTUDENT99, what do u mean by previous values,
if u could explain this then we could help.
If useful kindly reward.
Rohit G
10-09-2007 8:14 AM
hi
try it like this
SELECT SINGLE STU_ID STU_NAME STU_COURSE STU_RESULT STU_ADDRESS FROM ZSTUDENT99 INTO CORRESPONDING FIELDS OF ITAB .
loop at itab.
at last.
SELECT SINGLE STU_ID STU_NAME STU_COURSE STU_RESULT STU_ADDRESS FROM ZSTUDENT99 INTO CORRESPONDING FIELDS OF ITAB WHERE STU_ID = ITAB-STU_ID.
ZSTUDENT99-STU_ID = ITAB-STU_ID .
ZSTUDENT99-STU_NAME = ITAB-STU_NAME .
ZSTUDENT99-STU_COURSE = ITAB-STU_COURSE .
ZSTUDENT99-STU_RESULT = ITAB-STU_RESULT .
ZSTUDENT99-STU_ADDRESS = ITAB-STU_ADDRESS .
endloop.
i hope its work fine..
regards
baskaran
10-09-2007 3:06 PM
Hii Rashmi,
In PBO define a module . and write the code in this module.
module PREVIOUS_BUTTON output.
DESCRIBE TABLE ITAB LINES COUNT. " you have to declare count type i.
CASE SY-UCOMM.
WHEN 'PREV'.
C_COUNT = COUNT - 1. " you have to declare c_count type i.
IF C_COUNT > 1 OR C_COUNT = 1.
READ TABLE ITAB INDEX C_COUNT. "
ZSTUDENT99-STU_ID = ITAB-STU_ID .
ZSTUDENT99-STU_NAME = ITAB-STU_NAME .
ZSTUDENT99-STU_COURSE = ITAB-STU_COURSE .
ZSTUDENT99-STU_RESULT = ITAB-STU_RESULT .
ZSTUDENT99-STU_ADDRESS = ITAB-STU_ADDRESS .
COUNT = C_COUNT.
ENDIF.
Regards,
Arti
10-10-2007 8:12 AM
10-10-2007 8:20 AM
Hi,
did u assign function codes in PF-STATUS.
SET PF_STATUS 'STAT1'.
double click and assign function code to your button.
and activate it. Thia will work fine.
10-10-2007 8:33 AM
no...its not working....
i have done all the possible query.....
plzzz give the exact coding...
10-10-2007 8:38 AM
when previous:
data v_index like sy-index.
v_index = sy-index - 1.
read table itab index v_index.