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: 

screen to display 1 or more record.

Former Member
0 Kudos

hello..

i want to do this..

i am searching for a department head (dept_head) thru department id (dept_id) on screen 1 by user input.

so i have a select statement on PAI (1st screen)

then a loop on PBO of 2nd screen to populate the record. (im done on this)

ideally there's only one, but sometimes the dept head is more than one.. that's why there's a NEXT and BACK button on 2nd screen..how would i be able to do that if i have more than 1 record (dept_head), the NEXT and BACK buttons will display the records respectively.. thanks for the help..

2 REPLIES 2

Former Member
0 Kudos

Hi

>> You have to first define the PREVIOUS and NEXT buttons on the second screen.

>> Assign some OK_CODE to this button on the second screen.

>> In the PBO of the second screen check if there are more then one department head for the department id entered by the user

>> If yes then enable the two buttons in the application tool bar.

>> So lets assume we have 2 records so on the next screen you can display 1 record and enable the NEXT buton but not the previous button.

>> Once the user clicks on the NEXT button add 1 to the index and read the next entry and display the next screen and while displaying the next screen you can disable the NEXT button and enable the PREVIOUS button.

You can take a look at any std SAP programs which has this functionality and leverage the code.

Cheers

VJ

Former Member
0 Kudos

Hi Lang,

On the 2nd Screen,

have three buttons..

BACK, PREVIOUS and NEXT.

in the PAI event of the 1st screen, populate the data in internal table..

select dept_head into table itab from table where dept_id = user_input_id.

maintain the counter..

cnt = 1.

and no of records in no_of_records.

In PBO event of the screen 2,

display 1st record of itab.

Read table itab into wa_itab index cnt.

now when next or previous is clicked ,

check it in PAI event of screen 2..

case sy-ucomm.

when 'BACK'.

call screen1.

when 'NEXT'.

cnt1 = cnt + 1.

if cnt1 > no_of_records.

write 'Last record'.

else.

cnt = cnt1.

call screen2.

endif.

when 'PREVIOUS'.

cnt1 = cnt - 1.

if cnt1 < 0.

write 'First record'.

else.

cnt = cnt1.

call screen2.

endif.

Hope that helps..

Regards,

Tanveer.

<b>Please mark helpful answers</b>