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: 

PLzzzzzzzzzzz solve this query.

Former Member
0 Kudos

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

15 REPLIES 15

Former Member
0 Kudos

Hi,

READ statement should be like this,

read table itab index sy-index . or

read table itab with key field1 = field1

field2 = field2 etc

Former Member
0 Kudos

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

Former Member
0 Kudos

thanx fo ur reply...

but actually i want the previous value of ztable by clicking on the PREVIOUS button.....

Former Member
0 Kudos

thanx fo ur reply...

but actually i want the previous value of ztable by clicking on the PREVIOUS button.....

0 Kudos

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.

0 Kudos

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.

0 Kudos

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.

Former Member
0 Kudos

hi,

try with

read table itab with key sy-index-1.

Regards,

Himanshu

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

sorry arti...

this code is not working...

Former Member
0 Kudos

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.

Former Member
0 Kudos

no...its not working....

i have done all the possible query.....

plzzz give the exact coding...

hymavathi_oruganti
Active Contributor
0 Kudos

when previous:

data v_index like sy-index.

v_index = sy-index - 1.

read table itab index v_index.