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

Interactive Report

Former Member
0 Likes
638

What is the difference between <b>Get Cursor</b> & <b>Hide</b> use in the interactive reports?

Please send me the answer. Thanks.

Kind Regards,

Chandan.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
620

GET CURSOR statement transfers the name of the screen element on which the cursor is positioned during a user action into the variable <f>.

GET CURSOR FIELD <f> [OFFSET <off>] [LINE <lin>] [VALUE <val>] LENGTH <len>].

To prevent the user from selecting invalid lines, ABAP/4 offers several possibilities. At the end of the processing block END-OF-SELECTION, delete the contents of one or more fields you previously stored for valid lines using the HIDE statement. At the event AT LINE-SELECTION, check whether the work area is initial or whether the HIDE statement stored field contents there. After processing the secondary list, clear the work area again. This prevents the user from trying to create further secondary lists from the secondary list displayed.

See the example programs :

REPORT zprem_interactive .

TYPES : BEGIN OF ty_test,

code TYPE i,

name(10) TYPE c,

amount TYPE p DECIMALS 2,

END OF ty_test.

DATA : it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE INITIAL SIZE 10.

DATA : wa TYPE ty_test,

chk1 TYPE c,

fldname(30), fldval(50).

*set pf-status 'PF01'.

*set titlebar 'PF01'.

*

INITIALIZATION.

it_test-code = 300.

it_test-name = 'Ramesh'.

it_test-amount = 5500.

APPEND it_test.

wa-code = 207.

wa-name = 'Prem'.

wa-amount = 5000.

APPEND wa TO it_test.

it_test-code = 117.

it_test-name = 'James Bond'.

it_test-amount = 9900.

INSERT it_test INDEX 3.

it_test-code = 217.

it_test-name = 'Sivaraman'.

it_test-amount = 9900.

INSERT it_test INDEX 3.

it_test-code = 201.

it_test-name = 'Saravanan'.

it_test-amount = 1000.

APPEND it_test.

it_test-code = 210.

it_test-name = 'Shanmugam'.

it_test-amount = 6000.

APPEND it_test.

WRITE : / 'Loop Display ( Appended rows ) :-'.

LOOP AT it_test.

WRITE : / chk1 AS CHECKBOX,

sy-tabix, sy-vline, it_test-code, it_test-name, it_test-amount.

HIDE : it_test-code, it_test-name.

ENDLOOP.

SKIP.

END-OF-SELECTION.

CLEAR : it_test-code, it_test-name.

WRITE : / 'this from end of selection'.

&----


*& Form DISP1

&----


  • text

----


FORM disp1.

WINDOW STARTING AT 15 10

ENDING AT 80 15.

DO.

CLEAR chk1.

READ LINE sy-index FIELD VALUE chk1.

IF sy-subrc NE 0.

EXIT.

ELSE.

CHECK chk1 NE space.

WRITE : / it_test-code, it_test-name.

MODIFY CURRENT LINE :

FIELD VALUE chk1 FROM ' '

FIELD FORMAT chk1 INPUT OFF.

ENDIF.

ENDDO.

ENDFORM. "DISP1

***line double click ****

AT LINE-SELECTION.

CHECK sy-lsind = 1.

WINDOW STARTING AT 5 4

ENDING AT 85 20.

WRITE: / 'THE USER DOUBLE-CLICKED A LINE IN THE REPORT'.

WRITE: / sy-lisel.

WRITE : / 'Sometime ',it_test-name, ' is good '.

WRITE : / 'Sometime ',it_test-name, ' is bad '.

WRITE : / 'Sometime ',it_test-name, ' is rich '.

WRITE : / 'Sometime ',it_test-name, ' is poor '.

WRITE : / 'Who knows, who is ',it_test-name, ' ? '.

WRITE : /, / 'we can also use this in SELECT statement'.

CLEAR : it_test-code, it_test-name.

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ULINE.

SKIP.

SKIP.

WRITE : / 'Below from Get Cursor Field...'.

GET CURSOR FIELD fldname VALUE fldval.

CONDENSE fldname.

CONDENSE fldval.

WRITE : / 'You have clicked ', fldname, ' & its value is ', fldval.

***function key press F6 ****

AT PF06.

PERFORM disp1.

*AT USER-COMMAND.

  • CASE SY-UCOMM.

  • WHEN 'STOP' OR 'CANCEL'.

  • LEAVE TO SCREEN 0.

  • WHEN 'TESTME'.

  • PERFORM DISP1.

  • ENDCASE.

5 REPLIES 5
Read only

Former Member
0 Likes
620

hi,

<b>GET CURSOR</b>

<b>Use the statements GET CURSOR FIELD and GET CURSOR LINE to pass the output field or output line on which the cursor was positioned during the interactive event to the ABAP program</b>

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>].

<b>HIDE</b>

<b>You use the HIDE technique while creating a list level to store line-specific information for later use</b>. To do so, use the HIDE statement as follows:

<b>HIDE <f>.</b>

This statement places the contents of the variable <f> for the current output line (system field SY-LINNO) into the HIDE area. The variable <f> must not necessarily appear on the current line.

To make your program more readable, always place the HIDE statement directly after the output statement for the variable <f> or after the last output statement for the current line.

regards,

Ashokreddy

Read only

0 Likes
620

Thanks Ashok for your answer.

Kind Regards,

Chandan.

Read only

Former Member
0 Likes
621

GET CURSOR statement transfers the name of the screen element on which the cursor is positioned during a user action into the variable <f>.

GET CURSOR FIELD <f> [OFFSET <off>] [LINE <lin>] [VALUE <val>] LENGTH <len>].

To prevent the user from selecting invalid lines, ABAP/4 offers several possibilities. At the end of the processing block END-OF-SELECTION, delete the contents of one or more fields you previously stored for valid lines using the HIDE statement. At the event AT LINE-SELECTION, check whether the work area is initial or whether the HIDE statement stored field contents there. After processing the secondary list, clear the work area again. This prevents the user from trying to create further secondary lists from the secondary list displayed.

See the example programs :

REPORT zprem_interactive .

TYPES : BEGIN OF ty_test,

code TYPE i,

name(10) TYPE c,

amount TYPE p DECIMALS 2,

END OF ty_test.

DATA : it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE INITIAL SIZE 10.

DATA : wa TYPE ty_test,

chk1 TYPE c,

fldname(30), fldval(50).

*set pf-status 'PF01'.

*set titlebar 'PF01'.

*

INITIALIZATION.

it_test-code = 300.

it_test-name = 'Ramesh'.

it_test-amount = 5500.

APPEND it_test.

wa-code = 207.

wa-name = 'Prem'.

wa-amount = 5000.

APPEND wa TO it_test.

it_test-code = 117.

it_test-name = 'James Bond'.

it_test-amount = 9900.

INSERT it_test INDEX 3.

it_test-code = 217.

it_test-name = 'Sivaraman'.

it_test-amount = 9900.

INSERT it_test INDEX 3.

it_test-code = 201.

it_test-name = 'Saravanan'.

it_test-amount = 1000.

APPEND it_test.

it_test-code = 210.

it_test-name = 'Shanmugam'.

it_test-amount = 6000.

APPEND it_test.

WRITE : / 'Loop Display ( Appended rows ) :-'.

LOOP AT it_test.

WRITE : / chk1 AS CHECKBOX,

sy-tabix, sy-vline, it_test-code, it_test-name, it_test-amount.

HIDE : it_test-code, it_test-name.

ENDLOOP.

SKIP.

END-OF-SELECTION.

CLEAR : it_test-code, it_test-name.

WRITE : / 'this from end of selection'.

&----


*& Form DISP1

&----


  • text

----


FORM disp1.

WINDOW STARTING AT 15 10

ENDING AT 80 15.

DO.

CLEAR chk1.

READ LINE sy-index FIELD VALUE chk1.

IF sy-subrc NE 0.

EXIT.

ELSE.

CHECK chk1 NE space.

WRITE : / it_test-code, it_test-name.

MODIFY CURRENT LINE :

FIELD VALUE chk1 FROM ' '

FIELD FORMAT chk1 INPUT OFF.

ENDIF.

ENDDO.

ENDFORM. "DISP1

***line double click ****

AT LINE-SELECTION.

CHECK sy-lsind = 1.

WINDOW STARTING AT 5 4

ENDING AT 85 20.

WRITE: / 'THE USER DOUBLE-CLICKED A LINE IN THE REPORT'.

WRITE: / sy-lisel.

WRITE : / 'Sometime ',it_test-name, ' is good '.

WRITE : / 'Sometime ',it_test-name, ' is bad '.

WRITE : / 'Sometime ',it_test-name, ' is rich '.

WRITE : / 'Sometime ',it_test-name, ' is poor '.

WRITE : / 'Who knows, who is ',it_test-name, ' ? '.

WRITE : /, / 'we can also use this in SELECT statement'.

CLEAR : it_test-code, it_test-name.

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ULINE.

SKIP.

SKIP.

WRITE : / 'Below from Get Cursor Field...'.

GET CURSOR FIELD fldname VALUE fldval.

CONDENSE fldname.

CONDENSE fldval.

WRITE : / 'You have clicked ', fldname, ' & its value is ', fldval.

***function key press F6 ****

AT PF06.

PERFORM disp1.

*AT USER-COMMAND.

  • CASE SY-UCOMM.

  • WHEN 'STOP' OR 'CANCEL'.

  • LEAVE TO SCREEN 0.

  • WHEN 'TESTME'.

  • PERFORM DISP1.

  • ENDCASE.

Read only

0 Likes
620

hi Seshu,

thanks for the feedback.

but is there any other differences. because interviewer was expecting some thing more information.

Kind Regards,

Chandan.

Read only

0 Likes
620

Hello Chandan,

Explain in simple terms :

Hide : it hides the complete line ,when you double click on line ( anywhere in the line ) ,it will trigger and shows secondary list.

some times Customer requirement is he want to have on field ( not like complete line),then we go for cursor field ( it hides only certain fields - here we use hot spot on that field)

Hope you got it.

Thanks

Seshu