cancel
Showing results for 
Search instead for 
Did you mean: 

sy-lsind / sy-listi and sy-lsind = 0

Former Member
0 Kudos
452

First of all I would like to know the difference between sy-lsind and sy-listi.

Below is one code snippet wherein my requirement is that when I click on list number 5 it should take me to basic list.

But when I click on list number 5, it takes me to list number 1.

How should I go about this to come from top level list to basic one again ?

REPORT Test.

AT LINE-SELECTION.

WRITE : 'Current Index', sy-lsind.

WRITE : 'Current List',sy-listi.

IF sy-lsind = 5.

sy-lsind = 0.

ENDIF.

START-OF-SELECTION.

Write : 'This is Basic List'.

WRITE : 'Current Index', sy-lsind.

WRITE : 'Current List', sy-listi.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

hey man this is very simple, just play with LSIND.

subtract -n to go back

and add +n to go forward, try it .

n = 1,2,3.....n

regards.

Former Member
0 Kudos

Hi Nitin,

Sy-lsind = Index of the list being created.

sy-listi = Index of the list from which an event was fired.

Look at the code below :

START-OF-SELECTION.

Write : 'This is Basic List'.

WRITE : 'Current Index', sy-lsind.

WRITE : 'Current List', sy-listi.

AT LINE-SELECTION.

IF sy-listi = 5.

sy-lsind = 0.

else.

WRITE : 'Current Index', sy-lsind.

WRITE : 'Current List',sy-listi.

ENDIF.

So, if you want to go to basic list after clicking on list number 5, you will have to use sy-listi in your condition.

I have added an additional else part in my code. This will make it easier to understand.

Regards

Mitesh

Former Member
0 Kudos

Hi,

Change the position of the if clause

AT LINE-SELECTION.

IF sy-lsind = 5.

sy-lsind = 0.

ENDIF.

WRITE : 'Current Index', sy-lsind.

WRITE : 'Current List',sy-listi.

START-OF-SELECTION.

Write : 'This is Basic List'.

WRITE : 'Current Index', sy-lsind.

WRITE : 'Current List', sy-listi.

SY-LSIND - Index of the list created during the current event (basic list = 0)

SY-LISTI - Index of the list level from which the event was triggered

Svetlin

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Regards.

Rich Heilman