cancel
Showing results for 
Search instead for 
Did you mean: 

Default value in the parameter which pops up the table

Former Member
0 Kudos

Hi Everyone,

I have a parameter id which is of type id of one table. I pop up this table values the entire table there are around 25 records in it.

My requirement is i have to make the latest id of this table as the default value in the screen for this parameter.

The id is generated automatically when i perform some jobs and it inserts it in this table in a sequence.

So i have to display the latest value in the display screen for this parameter. How do i achieve this.

Any help will be of great use.

Thanks,

Prabs.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Do you store the date and time when you update the table?

Rob

Former Member
0 Kudos

Yes Rob I also store the data and time. But as a default value i want only the id number of this table to be displayed.

Regards,

Prabs.

Former Member
0 Kudos

Do you want to do a subquery?


SELECT parm FROM ztable INTO wa
WHERE date = ( SELECT MAX( date ) FROM ztable ).
ENDSELECT.

Or since the table is small, select everything, sort the table descending by date and take the first entry.

Rob

Former Member
0 Kudos

Hello Rob,

See in my selection screen i have a parm

parameter id type table-id.

So at selection screen when i click on this the entire table comes up.

As a default value I want the lastest id to be displayed in screen output. This id of the table is generated automatically.

Thanks

Prabs.

Former Member
0 Kudos

Sorry, I'm afraid I don't quite understand. Maybe you could post some code.

Are you trying to set the value of a PID based on the latest contents of the table?

Rob

Former Member
0 Kudos

yes ,

Here is my code.

PARAMETER ls_id TYPE TABLE2-ID.

WHERE ID IS A PRIMARY KEY OF TABLE1 AND ITS A FOREIGN KEY OF TABLE1.

So in my selection screen i am able to pop up the values of table1.

The id in table1 is generated auotmatically is a sequence so i have the values like from 1 to 25. when i perform some functions.

My requirement is the latest i.e max(id) must display in the parameter field in the screen.

I hope u can understand what i am trying to tell.

Thanks,

Prabs.

Former Member
0 Kudos

Something like:


PARAMETER ls_id TYPE TABLE2-ID.

at selection-screen output.

SELECT id FROM table1 INTO ls_id
WHERE date = ( SELECT max( date ) FROM table1 ).
ENDSELECT.

Rob

Former Member
0 Kudos

Thanks a lot Rob

You solved my problem.

Thanks,

Prabs.

Answers (0)