alv and line-selection

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Locked
abaper4u
Posts: 245
Joined: Thu Dec 05, 2002 8:05 am
Contact:

alv and line-selection

Post by abaper4u » Thu Dec 19, 2002 5:57 am

hi group


Is it possible to capture events like line-selection or user-command on alv ?


Regards
Nimesh

wjanssen

Post by wjanssen » Thu Dec 19, 2002 6:19 am

Hi,

Yes you can.
When using creating ALV with FM: REUSE_ALV_GRID_DISPLAY you can pass an itab with event in it thrue parameter: IT_FIELDCAT

You can fill this itab with FM: REUSE_ALV_EVENTS_GET
After this call, there will be an entry in it with NAME = USER_COMMAND
and FROM = USER_COMMAND

Now in your ABAP, create the form USER_COMMAND like this:
FORM user_command using ucomm LIKE sy-ucomm
selfied TYPE slis_selfield.

If an at line selection takes place in the ALV, this form will be performed.
Check the value of field ucomm in your form.

Regards
Wim

Guest

Post by Guest » Fri Dec 20, 2002 7:15 am

wjanssen wrote:Hi,

Yes you can.
When using creating ALV with FM: REUSE_ALV_GRID_DISPLAY you can pass an itab with event in it thrue parameter: IT_FIELDCAT

You can fill this itab with FM: REUSE_ALV_EVENTS_GET
After this call, there will be an entry in it with NAME = USER_COMMAND
and FROM = USER_COMMAND

Now in your ABAP, create the form USER_COMMAND like this:
FORM user_command using ucomm LIKE sy-ucomm
selfied TYPE slis_selfield.

If an at line selection takes place in the ALV, this form will be performed.
Check the value of field ucomm in your form.

Regards
Wim
Can you stick you code in brief ?thanks!

nara

Post by nara » Fri Dec 20, 2002 2:26 pm

Hello


Interactive list Only for Selected Fields.
IF r_ucomm = '&IC1' OR r_ucomm = '&ETA'.
IF rs_selfield-fieldname = 'VBELN' OR
rs_selfield-fieldname = 'POSNR' OR
rs_selfield-fieldname = 'ETENR'.

READ TABLE iout INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'AUN' FIELD iout-vbeln.
CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
ENDIF.
CLEAR: r_ucomm, iout.

saps

Post by saps » Fri Dec 20, 2002 10:48 pm

can you tell me in detail ??i can't settle it.
thanks!

saps

Post by saps » Sat Dec 21, 2002 8:26 am

help me ? thanks .
paste you codes .???

saps

Post by saps » Sat Dec 21, 2002 8:26 am

help me ?thanks.paste you codes.

ulysis
Posts: 22
Joined: Thu Nov 28, 2002 9:38 pm
Location: seoul, korea

alv - double click - code example

Post by ulysis » Sun Dec 22, 2002 9:24 pm

8)
data : GT_EVENTS TYPE SLIS_T_EVENT.

constants : C_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.


* get event
PERFORM BUILD_EVENT_TOPOFPAGE USING GT_EVENTS[].

* display alv data
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_xxxxx
IT_FIELDCAT = GT_xxxx
IT_EVENTS = GT_EVENTS[]
TABLES
T_OUTTAB = T_xxxx
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.


* get event perform
FORM BUILD_EVENT_TOPOFPAGE USING LT_EVENTS TYPE SLIS_T_EVENT.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
*
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.

* DOUBLE CLICK EVENT
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE C_USER_COMMAND TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
ENDFORM. " BUILD_EVENT_TOPOFPAGE


* define user_command ( perform user_command -> x )
* only form user_command ........ endform -> o )

FORM USER_COMMAND USING L_UCOMM LIKE SY-UCOMM
LS_SELFIELD TYPE SLIS_SELFIELD.

CASE L_UCOMM.
WHEN '&IC1'. "f2code
READ TABLE T_xxxxx INDEX LS_SELFIELD-TABINDEX.
CASE LS_SELFIELD-SEL_TAB_FIELD. "select Column
WHEN 'T_xxx-xxx'. " double click column
WHEN 'T_xxxx-xxxx'. " double click column
ENDCASE.
ENDCASE.
ENDFORM. " USER_COMMAND


have a nice day ~!! & merry christmas

chandradeepika
Posts: 3
Joined: Sun Oct 23, 2011 10:07 pm

Re: alv and line-selection

Post by chandradeepika » Sun Oct 23, 2011 10:23 pm

hi..Am having a doubt. plz anyone help me to solve this..
Actually when i double click the vbeln in the basic list, the secondary list with the item details of that corresponding sales order no should be displayed. Am getting all this but even when i double click on the secondary list, once again a secondary list is displayed without header.
In code where i need to do the modification?

FORM user_command USING r_ucomm LIKE sy-ucomm "#EC CALLED
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE i_output INTO w_output
INDEX rs_selfield-tabindex.
PERFORM build_fieldcatlog_items.
PERFORM data_retrieval_items.
PERFORM display_alv_items.
ENDCASE.
ENDFORM.

Baz
Posts: 4748
Joined: Fri Nov 08, 2002 5:54 am
Location: He's out there! somewhere!!!!
Contact:

Re: alv and line-selection

Post by Baz » Sun Oct 23, 2011 11:09 pm

locked for many reasons.... take your pick!
Baz

AsPiRiNg tUlY iDiOt Image

http://www.catb.org/~esr/faqs/smart-questions.html

Image

check out my Podcasts http://dj-baz.podomatic.com

Locked