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: 

Difference between slis_selfield and slis_t_extab.

Former Member
0 Kudos

Hi friends,

Enlighten me on this, as to

when am I using this------

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

and when am I using this------

FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'ZNEWSTATUS'.

My question is .. in what situation am I using the former and the later..

Thanking you all in advance,

Hari Kiran.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Hari Kiran,

both FORMs have very different purposes.

"FORM user_command" is run every time you press a button, a menu, or more generically an ok-coe into your ALV. "rs_selfield TYPE slis_selfield" holds the data of the field on which the cursor was when the ok-code was triggered.

"FORM set_pf_status" is run once for every run of the ALV listing. It sets the available ok-codes. These are allocated into an internal table "rt_extab TYPE slis_t_extab".

I hope this helps. Best regards,

Alvaro

10 REPLIES 10

Former Member
0 Kudos

Hi Hari Kiran,

both FORMs have very different purposes.

"FORM user_command" is run every time you press a button, a menu, or more generically an ok-coe into your ALV. "rs_selfield TYPE slis_selfield" holds the data of the field on which the cursor was when the ok-code was triggered.

"FORM set_pf_status" is run once for every run of the ALV listing. It sets the available ok-codes. These are allocated into an internal table "rt_extab TYPE slis_t_extab".

I hope this helps. Best regards,

Alvaro

0 Kudos

Hi Alvaro

I do know the following....

"rs_selfield TYPE slis_selfield" holds the data of the field on which the cursor was when the ok-code was triggered.

but I didnt understand this.....

FORM set_pf_status" is run once for every run of the ALV listing. It sets the available ok-codes.

What I know is that when we use Set_pf_status.. we do create buttons. Dont we????? I mean in both the scenarios there are butons created by use. Isnt that true???

Please , throw some more light.

Thank you for replying.

Regards,

Hari Kiran

0 Kudos

Hi again, Hari Kiran,

you are saying:

>

> What I know is that when we use Set_pf_status.. we do create buttons. Dont we?????

Well, that's not quite true. When we use SET_PF_STATUS, we do NOT create buttons, the buttons are created in a status GUI via transaction SE41. Via SET_PF_STATUS we activate/inactivate these buttons, but the must be previously created.

On the other hand, you say:

>

> I mean in both the scenarios there are butons created by use. Isnt that true???

Well, USER_COMMAND and SET_PF_STATUS do very different things. The first one controls what actions are to be performed when the user clicks on a button or selects a menu option or just double-clicks on a line. The second one prepares what buttons are to be available for the user and which are not.

I hope this helps. Please don't hesitate to answer back if you need further information. Kind regards,

Alvaro

0 Kudos

My confusion was arised because I felt we were creating buttons in both the scenarios ..in SE41 by goin to the screen painter.

like ..if i say..

SET PF-STATUS 'BASIC' and then double click on it, it take us to the screen painter

"and i do the necessary things there... and then..

AT USER-COMMAND.

CASE SY-UCOMM.

WHEN 'BASIC'.

SET PARAMETER ID 'BAN' FIELD PUR_REQ-BANFN.

CALL TRANSACTION 'ME52' AND SKIP FIRST SCREEN.

this line of yours has cleared a lot of things for me---

"Via SET_PF_STATUS we activate/inactivate these buttons, but the must be previously created."

i am attaching code ... have a look at it..and tell me the difference. My main question is...arent we creating buttons in both the situations to be able to use the above 2 codes.------

scenario 1.

In order to add user command functioality to the ALV grid you need to perform the following steps:

1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'USER_COMMAND' FORM

2. Create 'USER_COMMAND' FORM

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP-OF-PAGE'

I_callback_user_command = 'USER_COMMAND' "see FORM

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

i_save = 'X'

tables

t_outtab = it_ekko

exceptions

program_error = 1

others = 2.

----


  • FORM USER_COMMAND *

----


  • --> R_UCOMM *

  • --> RS_SELFIELD *

----


FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

  • Check function code

CASE r_ucomm.

WHEN '&IC1'.

  • Check field clicked on within ALVgrid report

IF rs_selfield-fieldname = 'EBELN'.

  • Read data table, using index of row user clicked on

READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.

  • Set parameter ID for transaction screen field

SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.

  • Sxecute transaction ME23N, and skip initial data entry screen

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

ENDFORM.

scenario 2

**************

Add User command functionality to ALVgrid report

In order modify PF_STATUS of ALV grid report you need to perform the following steps:

1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include:

i_callback_pf_status_set = 'SET_PF_STATUS' statement.

2. Create 'SET_PF_STATUS' FORM

3. Create pf_status (i.e. 'ZNEWSTATUS').

- It is recommend that you copy standard status'STANDARD' from function group SALV

and modify it accordingly. ALV standard function codes always start with '&'.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP-OF-PAGE'

i_callback_pf_status_set = 'SET_PF_STATUS' "see FORM

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

i_save = 'X'

tables

t_outtab = it_ekko

exceptions

program_error = 1

others = 2.

----


  • FORM SET_PF_STATUS *

----


FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'ZNEWSTATUS'.

"Copy of 'STANDARD' pf_status from fgroup SALV

ENDFORM.

Thank u so much Alvaro for sparing ur time to reply,

Warm regards,

Hari Kiran

0 Kudos

from the above code i have been able to understand one thing.....

in the first scenario i am fetching further data based on the field clicked on the list....

'&IC1' i believe stands for " when clicked"

so, i am kinda fetching further data, using index of row user clicked on ..

am i right???? and i also believe there is no need to create any buttons over there....

in the second scenario... in pf status.....ur input has helped me realise that the table RT_EXTAB contains the function codes which are hidden in the standard interface.

Please, throw light in any way u can.

regards,

hari kiran

0 Kudos

Hi Alvaro,

are u tryin to say that there can be many buttons which i may create using screen painter,

but by using set pf_status i am activating a particular button.... ??

If thats what u meant, then i have been able to understand the differences between these two.

please reply to confirm it.

Thanking u once again for replying.

regards,

hari kiran

0 Kudos

Hi Hari Kiran,

in order to create your own ALV report, you should do the following:

1. I assume you have already selected the data

2.


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  ...
  i_callback_pf_status_set       = 'SET_PF_STATUS'
  i_callback_user_command        = 'USER_COMMAND'
  ...

3. Go to transaction SE41 and create a status GUI for the report you are developing. I strongly recommend that you create this new status GUI with reference to the model ALV. Let's say you give to the status GUI the name 'MAIN'.

This will have buttons/menus with ok-codes '&IC1', '&ALL', '&SAL', and many more. Plus, you can add more custom ok-codes, if you want. In my example, one of these custom ok-codes will be 'BORR', which will be handled on step 5.

4. Create a FORM set_pf_status to set the status GUI you just created in step 3:


FORM set_pf_status USING rt_extab TYPE slis_t_extab.
*
  SET PF-STATUS 'MAIN' EXCLUDING rt_extab.
*
ENDFORM.                    " set_pf_status

This will show all the ok-codes (buttons) that you created in step 3. If you populate internal table rt_extab, you may exclude some of these ok-codes (standard and/or custom).

5. Create a FORM user_command to handle the possible action that can perform the user once the list is displayed:


FORM user_command  USING r_ucomm LIKE sy-ucomm
                         rs_selfield TYPE slis_selfield.
*
  CASE r_ucomm.
    WHEN 'BORR'.
      ...

  rs_selfield-refresh    = c_yes.
  rs_selfield-col_stable = c_yes.
  rs_selfield-row_stable = c_yes.
*
ENDFORM.                    " set_pf_status

The other standard ok-codes are already handled by the function REUSE_ALV_GRID_DISPLAY.

...and that's it!

I hope this is clear enough. If not, please answer back and I will try to give more details. Best regards,

Alvaro

0 Kudos

Hi Alvaro,

Your answer has cleared most of my doubts.

I need to work on a sample program to totally clear it.

Ya, I would appreciate it a lot if u can tell me how to create the GUI status [ex:- Main]

for my report in SE 41.

i felt , the coding part in ALV is simple.

thanking you in advance,

Hari Kiran

0 Kudos

Hi again, Hari Kiran

Well, that's the easiest part of all!!!

- Go to transaction SE41, enter the program name, and the status name, for example MAIN

- Push "Create"

- Then go to Extras > Adjust template, and check radio-button "List viewer". This will automatically create all the icons/buttons for handling an ALV.

- If needed, feel free to add new buttons, or to remove standard ones.

- Activate the result

...and that's it!

I hope this helps. Kind regards,

Alvaro

0 Kudos

Yup,Yup,yup

Thank U,

warm regards,

Hari kiran