Application Development and Automation 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: 
Read only

AT LINE-SELECTION

Former Member
0 Likes
4,450

Hi,

what is the use of AT LINE-SELECTION

where we use this what is the use of GET CURSOR FIELD.

Thanks,

Kalyani..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,937

Hello,

AT LINE SELECTION is basically used when you are displaying in the Interactive reports. This is used once the BASIC list is generated.

GET CURSOR FIELD is used to capture the cursor field in the output list and it is stored in the Field value " FVAL ".

Sample Program :

Just copy n paste this program and execute, you will come to know


REPORT z_find_userexit NO STANDARD PAGE HEADING.
 
*&---------------------------------------------------------------------*
*& Enter the transaction code that you want to search through in order
*& to find which Standard SAP User Exits exists.
*&
*&---------------------------------------------------------------------*
 
*&---------------------------------------------------------------------*
*& Tables
*&---------------------------------------------------------------------*
 
TABLES : tstc, "SAP Transaction Codes
tadir, "Directory of Repository Objects
modsapt, "SAP Enhancements - Short Texts
modact, "Modifications
trdir, "System table TRDIR
tfdir, "Function Module
enlfdir, "Additional Attributes for Function Modules
tstct. "Transaction Code Texts
 
*&---------------------------------------------------------------------*
*& Variables
*&---------------------------------------------------------------------*
 
DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
DATA : field1(30).
DATA : v_devclass LIKE tadir-devclass.
 
*&---------------------------------------------------------------------*
*& Selection Screen Parameters
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK a01.
 
*&---------------------------------------------------------------------*
*& Start of main program
*&---------------------------------------------------------------------*
 
START-OF-SELECTION.
 
* Validate Transaction Code
SELECT SINGLE * FROM tstc
WHERE tcode EQ p_tcode.
 
* Find Repository Objects for transaction code
IF sy-subrc EQ 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna.
 
MOVE : tadir-devclass TO v_devclass.
 
IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.
 
IF trdir-subc EQ 'F'.
 
SELECT SINGLE * FROM tfdir
WHERE pname = tstc-pgmna.
 
SELECT SINGLE * FROM enlfdir
WHERE funcname = tfdir-funcname.
 
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'FUGR'
AND obj_name = enlfdir-area.
 
MOVE : tadir-devclass TO v_devclass.
ENDIF.
ENDIF.
 
* Find SAP Modifactions
SELECT * FROM tadir
INTO TABLE jtab
WHERE pgmid = 'R3TR'
AND object = 'SMOD'
AND devclass = v_devclass.
 
SELECT SINGLE * FROM tstct
WHERE sprsl EQ sy-langu
AND tcode EQ p_tcode.
 
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
SKIP.
IF NOT jtab[] IS INITIAL.
WRITE:/(95) sy-uline.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
WRITE:/(95) sy-uline.
 
LOOP AT jtab.
SELECT SINGLE * FROM modsapt
WHERE sprsl = sy-langu AND
name = jtab-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE:/1 sy-vline,
2 jtab-obj_name HOTSPOT ON,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
ENDLOOP.
 
WRITE:/(95) sy-uline.
DESCRIBE TABLE jtab.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No of Exits:' , sy-tfill.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'No User Exit exists'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'Transaction Code Does Not Exist'.
ENDIF.
 
* Take the user to SMOD for the Exit that was selected.
AT LINE-SELECTION.
GET CURSOR FIELD field1.
CHECK field1(4) EQ 'JTAB'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

Regards

Deepu.k

Hi,

what is the use of AT LINE-SELECTION

where we use this what is the use of GET CURSOR FIELD.

Thanks,

Kalyani..

9 REPLIES 9
Read only

Former Member
0 Likes
2,938

Hello,

AT LINE SELECTION is basically used when you are displaying in the Interactive reports. This is used once the BASIC list is generated.

GET CURSOR FIELD is used to capture the cursor field in the output list and it is stored in the Field value " FVAL ".

Sample Program :

Just copy n paste this program and execute, you will come to know


REPORT z_find_userexit NO STANDARD PAGE HEADING.
 
*&---------------------------------------------------------------------*
*& Enter the transaction code that you want to search through in order
*& to find which Standard SAP User Exits exists.
*&
*&---------------------------------------------------------------------*
 
*&---------------------------------------------------------------------*
*& Tables
*&---------------------------------------------------------------------*
 
TABLES : tstc, "SAP Transaction Codes
tadir, "Directory of Repository Objects
modsapt, "SAP Enhancements - Short Texts
modact, "Modifications
trdir, "System table TRDIR
tfdir, "Function Module
enlfdir, "Additional Attributes for Function Modules
tstct. "Transaction Code Texts
 
*&---------------------------------------------------------------------*
*& Variables
*&---------------------------------------------------------------------*
 
DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
DATA : field1(30).
DATA : v_devclass LIKE tadir-devclass.
 
*&---------------------------------------------------------------------*
*& Selection Screen Parameters
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK a01.
 
*&---------------------------------------------------------------------*
*& Start of main program
*&---------------------------------------------------------------------*
 
START-OF-SELECTION.
 
* Validate Transaction Code
SELECT SINGLE * FROM tstc
WHERE tcode EQ p_tcode.
 
* Find Repository Objects for transaction code
IF sy-subrc EQ 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna.
 
MOVE : tadir-devclass TO v_devclass.
 
IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.
 
IF trdir-subc EQ 'F'.
 
SELECT SINGLE * FROM tfdir
WHERE pname = tstc-pgmna.
 
SELECT SINGLE * FROM enlfdir
WHERE funcname = tfdir-funcname.
 
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'FUGR'
AND obj_name = enlfdir-area.
 
MOVE : tadir-devclass TO v_devclass.
ENDIF.
ENDIF.
 
* Find SAP Modifactions
SELECT * FROM tadir
INTO TABLE jtab
WHERE pgmid = 'R3TR'
AND object = 'SMOD'
AND devclass = v_devclass.
 
SELECT SINGLE * FROM tstct
WHERE sprsl EQ sy-langu
AND tcode EQ p_tcode.
 
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
SKIP.
IF NOT jtab[] IS INITIAL.
WRITE:/(95) sy-uline.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
WRITE:/(95) sy-uline.
 
LOOP AT jtab.
SELECT SINGLE * FROM modsapt
WHERE sprsl = sy-langu AND
name = jtab-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE:/1 sy-vline,
2 jtab-obj_name HOTSPOT ON,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
ENDLOOP.
 
WRITE:/(95) sy-uline.
DESCRIBE TABLE jtab.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No of Exits:' , sy-tfill.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'No User Exit exists'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'Transaction Code Does Not Exist'.
ENDIF.
 
* Take the user to SMOD for the Exit that was selected.
AT LINE-SELECTION.
GET CURSOR FIELD field1.
CHECK field1(4) EQ 'JTAB'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

Regards

Deepu.k

Read only

Former Member
0 Likes
2,937

hi

<b>AT LINE-SELECTION.</b>

When the user triggers the function code PICK, AT LINE-SELECTION is always triggered if the cursor is positioned on a list line. The function code PICK is, by default, always linked with function key F2 and hence with the mouse double-click. Consequently, if you have a simple program that does not react to any further user actions, you only need to write this event block.

AT LINE-SELECTION.

<statements>.

As described in the section Dialog Status for Lists, the function code PICK is always added to the standard list status when you have an AT LINE-SELECTION event in your program.

If you assign PICK to other function keys or menu entries, AT LINE-SELECTION is also triggered when the user chooses then. You should avoid this for the sake of the semantics.

Conversely, if you have a more extensive program that does not react to line selection, you should not use the function code PICK. Instead you should assign a different function code to F2 , to ensure that as many events as possible trigger the AT USER-COMMAND event.

<b>GET CURSOR FIELD field</b>

[OFFSET offset]

[LINE line]

[VALUE value]

[LENGTH length]

[AREA area].

You use this command to return the name of the field on which the cursor currently stands. The additions also give information about the cursor’s offset within the field, the number of any step loop line or absolute list line present, the current value, the field’s output length or the name of a control, if present. You can use this command both in dialog processing and in interactive reporting.

go to this link, it will be helpful.

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba3ae35c111d1829f0000e829fbfe/content.htm

<b>reward points for useful ans</b>

regards

Aarti

Read only

Former Member
0 Likes
2,937

Hi,

<b>AT LINE-SELECTION</b> : This Event triggers when we double click a line on the list, when the event is triggered a new sublist is going to be generated. Under this event what ever the statements that are been return will be displayed on newly generated sublist.

After user interaction with the screen, you may need to know the position of the cursor when the action occurred. This is particularly important if the user chooses the Choose function (F2 or mouse double-click).

To find out the cursor position, use the following statement:

GET CURSOR FIELD <f> [OFFSET <off>]

[LINE <lin>]

[VALUE <val>]

[LENGTH <len>].

Read only

Former Member
0 Likes
2,937

hi,

AT LINE-SELECTION is used for the interactive reporting.

GET CURSOR is to get the secondary list only when we click a particular field.

Look at the sample code with AT LINE-SELECTION and GET CURSOR

*-----Tables declaration

TABLES:EKKO. "PO Header

*-----Data Declaration

INITIALIZATION.

TYPES:BEGIN OF X_EKKO,

EBELN TYPE EKKO-EBELN, "PO Number

BUKRS TYPE EKKO-BUKRS, "Company code

BSART TYPE EKKO-BSART, "Document type

LIFNR TYPE EKKO-LIFNR, "Vendor

SPRAS TYPE EKKO-SPRAS, "Language key

ZTERM TYPE EKKO-ZTERM, "Terms of payment

END OF X_EKKO,

BEGIN OF X_EKPO,

EBELN TYPE EKPO-EBELN,

EBELP TYPE EKPO-EBELP, "PO Item

WERKS TYPE EKPO-WERKS, "Plant

MATNR TYPE EKPO-MATNR, "Material Number

MATKL TYPE EKPO-MATKL, "Material Group

END OF X_EKPO.

DATA:IT_EKKO TYPE TABLE OF X_EKKO,

WA_EKKO TYPE X_EKKO,

IT_EKPO TYPE TABLE OF X_EKPO,

WA_EKPO TYPE X_EKPO,

V TYPE EKKO-EBELN.

*-----Selection-screen design

SELECTION-SCREEN BEGIN OF BLOCK B1.

SELECT-OPTIONS:S_EBELN FOR EKKO-EBELN.

SELECTION-SCREEN END OF BLOCK B1.

*-----Selection-screen validation

AT SELECTION-SCREEN.

*-----retrieving data from the PO Header

SELECT EBELN

FROM EKKO

INTO TABLE IT_EKKO

WHERE EBELN IN S_EBELN.

*-----if there are no records display an error

IF SY-SUBRC NE 0.

MESSAGE E009.

ENDIF.

*-----Data retrieval

START-OF-SELECTION.

*-----To retrieve the header information

SELECT EBELN BUKRS BSART LIFNR SPRAS ZTERM

FROM EKKO

INTO TABLE IT_EKKO

WHERE EBELN IN S_EBELN

AND SPRAS = 'EN'.

*-----Top-of-page

TOP-OF-PAGE.

WRITE:/30 TEXT-012.

ULINE (100).

*-----Top-of-page for the secondary list

TOP-OF-PAGE DURING LINE-SELECTION.

WRITE:/30 TEXT-013.

SKIP.

ULINE (80).

*-----Displaying the data

END-OF-SELECTION.

WRITE:/01 SY-VLINE,02 TEXT-001,

19 SY-VLINE,20 TEXT-002,

32 SY-VLINE,33 TEXT-003,

57 SY-VLINE,58 TEXT-004,

70 SY-VLINE,71 TEXT-005,

91 SY-VLINE,92 TEXT-006,

100 SY-VLINE.

ULINE (100).

LOOP AT IT_EKKO INTO WA_EKKO.

WRITE:/01 SY-VLINE,02 WA_EKKO-EBELN,

19 SY-VLINE,20 WA_EKKO-BUKRS,

32 SY-VLINE,33 WA_EKKO-BSART,

57 SY-VLINE,58 WA_EKKO-LIFNR,

70 SY-VLINE,71 WA_EKKO-SPRAS,

91 SY-VLINE,92 WA_EKKO-ZTERM,

100 SY-VLINE.

ULINE (100).

ENDLOOP.

*-----To get the secondary list.

AT LINE-SELECTION.

GET CURSOR FIELD WA_EKKO-EBELN VALUE V.

*-----To retrieve the item information

SELECT EBELN EBELP WERKS MATNR MATKL

FROM EKPO

INTO TABLE IT_EKPO

WHERE EBELN = V.

*-----To display an error if the user clicks on any other header detail

IF SY-SUBRC NE 0.

MESSAGE E001.

ENDIF.

WRITE:/01 SY-VLINE,02 TEXT-007,

19 SY-VLINE,20 TEXT-008,

42 SY-VLINE,43 TEXT-009,

48 SY-VLINE,49 TEXT-010,

67 SY-VLINE,68 TEXT-011,

80 SY-VLINE.

ULINE (80).

LOOP AT IT_EKPO INTO WA_EKPO.

WRITE:/01 SY-VLINE,02 WA_EKPO-EBELN,

19 SY-VLINE,20 WA_EKPO-EBELP,

42 SY-VLINE,43 WA_EKPO-WERKS,

48 SY-VLINE,49 WA_EKPO-MATNR,

67 SY-VLINE,68 WA_EKPO-MATKL,

80 SY-VLINE.

ULINE (80).

ENDLOOP.

Message was edited by:

Roja Velagapudi

Read only

Former Member
0 Likes
2,937

Hi Kalyani,

In the report, if the user double clicks on a word or clicks on a hot spot, and you want to perform some operation based this input. in this case you go for AT line selection event.

get cursor field will return the field name and the value which the user has clicked.

see the sample program below

-


report ztest.

data: f(20) type c,

v(20) type c.

&----


*& START-OF-SELECTION *

&----


start-of-selection.

write: /, at 50 'Yahoo' hotspot on.

skip.

write: /, at 50 'Google' hotspot on.

skip.

write: /, at 50 'Yahoomail' hotspot on.

&----


*& AT LINE-SELECTION *

&----


at line-selection.

get cursor field f value v.

case v.

when 'Yahoo'.

write: 'You have pressed Yahoo'.

when 'Google'.

write: 'You have pressed google'.

when 'Yahoomail'.

write: 'You have pressed Yahoo Mail'.

endcase.

Regards,

Niyaz

Read only

Former Member
0 Likes
2,937

Hi,

AT LINE-SELECTION is generally used when u go for interactive report and u want to insert detailed list within the basic list.

GET CURSOR FIELD is used to get the position of cursor at a particular point in the program.

For any further help u can get the syntax and more detailed description on help,sap.com

Pls reward points if useful.

Regards,

Ameet

Read only

Former Member
0 Likes
2,937

Hi,

AT LINE SELECTION is basically used when you are displaying in the Interactive reports. This is used once the BASIC list is generated.

GET CURSOR FIELD is used to capture the cursor field in the output list and it is stored in the Field value " FVAL ".

Refer to this sample program

http://www.sap-img.com/abap/a-sample-hide-get-cursor-in-interactive-programming.htm

REPORT z_find_userexit NO STANDARD PAGE HEADING.

&----


*& Enter the transaction code that you want to search through in order

*& to find which Standard SAP User Exits exists.

*&

&----


&----


*& Tables

&----


TABLES : tstc, "SAP Transaction Codes

tadir, "Directory of Repository Objects

modsapt, "SAP Enhancements - Short Texts

modact, "Modifications

trdir, "System table TRDIR

tfdir, "Function Module

enlfdir, "Additional Attributes for Function Modules

tstct. "Transaction Code Texts

&----


*& Variables

&----


DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.

DATA : field1(30).

DATA : v_devclass LIKE tadir-devclass.

&----


*& Selection Screen Parameters

&----


SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.

SELECTION-SCREEN SKIP.

PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN END OF BLOCK a01.

&----


*& Start of main program

&----


START-OF-SELECTION.

  • Validate Transaction Code

SELECT SINGLE * FROM tstc

WHERE tcode EQ p_tcode.

  • Find Repository Objects for transaction code

IF sy-subrc EQ 0.

SELECT SINGLE * FROM tadir

WHERE pgmid = 'R3TR'

AND object = 'PROG'

AND obj_name = tstc-pgmna.

MOVE : tadir-devclass TO v_devclass.

IF sy-subrc NE 0.

SELECT SINGLE * FROM trdir

WHERE name = tstc-pgmna.

IF trdir-subc EQ 'F'.

SELECT SINGLE * FROM tfdir

WHERE pname = tstc-pgmna.

SELECT SINGLE * FROM enlfdir

WHERE funcname = tfdir-funcname.

SELECT SINGLE * FROM tadir

WHERE pgmid = 'R3TR'

AND object = 'FUGR'

AND obj_name = enlfdir-area.

MOVE : tadir-devclass TO v_devclass.

ENDIF.

ENDIF.

  • Find SAP Modifactions

SELECT * FROM tadir

INTO TABLE jtab

WHERE pgmid = 'R3TR'

AND object = 'SMOD'

AND devclass = v_devclass.

SELECT SINGLE * FROM tstct

WHERE sprsl EQ sy-langu

AND tcode EQ p_tcode.

FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.

WRITE:/(19) 'Transaction Code - ',

20(20) p_tcode,

45(50) tstct-ttext.

SKIP.

IF NOT jtab[] IS INITIAL.

WRITE:/(95) sy-uline.

FORMAT COLOR COL_HEADING INTENSIFIED ON.

WRITE:/1 sy-vline,

2 'Exit Name',

21 sy-vline ,

22 'Description',

95 sy-vline.

WRITE:/(95) sy-uline.

LOOP AT jtab.

SELECT SINGLE * FROM modsapt

WHERE sprsl = sy-langu AND

name = jtab-obj_name.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

WRITE:/1 sy-vline,

2 jtab-obj_name HOTSPOT ON,

21 sy-vline ,

22 modsapt-modtext,

95 sy-vline.

ENDLOOP.

WRITE:/(95) sy-uline.

DESCRIBE TABLE jtab.

SKIP.

FORMAT COLOR COL_TOTAL INTENSIFIED ON.

WRITE:/ 'No of Exits:' , sy-tfill.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(95) 'No User Exit exists'.

ENDIF.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(95) 'Transaction Code Does Not Exist'.

ENDIF.

  • Take the user to SMOD for the Exit that was selected.

AT LINE-SELECTION.

GET CURSOR FIELD field1.

CHECK field1(4) EQ 'JTAB'.

SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).

CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

Regards,

Priyanka.

Read only

Former Member
0 Likes
2,937

at line selection is used in interactive reports to move from one list to another.

get cursor field returns the name of the field upon which the cursor is placed.

regards,

srinivas

<b>*reward for useful answers*</b>

Read only

Former Member
0 Likes
2,937

Hi,

GET CURSOR FIELD and GET CURSOR LINE commnad is used to to pass the output field or output line on which the cursor was positioned during the interactive event to the processing block.

Syntax

GET CURSOR FIELD <f> [OFFSET <off>] [LINE <lin>]

[VALUE <val>] [LENGTH <len>].

AT LINE-SELECTION

Moment at which the user selects a line by double-clicking on it or by positioning the cursor on it and pressing F2.

Thanks,

Sandeep