‎2006 Dec 01 1:29 PM
Main difference between the GET CURSOR and HIDE usage in reporting.
and how does they are used..
‎2006 Dec 01 1:32 PM
hi,
Check the programs to understand how to make use of hide and get cursor statements.
<b>demo_list_hide</b>
<b>DEMO_LIST_GET_CURSOR</b>
Regards,
Sailaja.
‎2006 Dec 01 1:33 PM
GET CURSOR : Transfers the name of the field at the cursor position to the field f.
DATA: CURSORFIELD(20),
GLOB_FIELD(20) VALUE 'global field',
REF_PARAMETER(30) VALUE 'parameter by reference',
VAL_PARAMETER(30) VALUE 'parameter by value',
FIELD_SYMBOL(20) VALUE 'field symbol'.
FIELD-SYMBOLS: <F> TYPE ANY.
PERFORM WRITE_LIST USING REF_PARAMETER VAL_PARAMETER.
ASSIGN GLOB_FIELD TO <F>.
AT LINE-SELECTION.
GET CURSOR FIELD CURSORFIELD.
WRITE: / CURSORFIELD, SY-SUBRC.
FORM WRITE_LIST USING RP VALUE(VP).
DATA: LOK_FIELD(20) VALUE 'local field'.
ASSIGN FIELD_SYMBOL TO <F>.
WRITE: / GLOB_FIELD, / LOC_FIELD,
/ RP, / VP,
/ 'literal', / FIELD_SYMBOL.
ENDFORM.
HIDE : The contents of f related to the current output line are stored. If this line is selected, f is filled automatically with the stored value.
You do not have to output the field with WRITE in order to be able to store its value.
The HIDE statement does not support structures that contain tables (deep structures).
‎2006 Dec 01 1:33 PM
hi
when the user double-clicks on the list,
HIDE stores the value in the memory.
GET CURSOR stores the value in the variable we declare in our code.
‎2006 Dec 01 1:35 PM
Check this sample code on hhow to use HIDE.
http://www.sap-img.com/abap/a-sample-hide-get-cursor-in-interactive-programming.htm
Regards,
Santosh
‎2006 Dec 01 1:38 PM
hi,
When we use Get cursor statement, we get the contents of line (clicked by user).
Based on our requiremetn, we can get offset of the contents captured in sy-lisel.
EX: to get matnr on a line..
v_matnr = sy-lisel+0(18).
As we are making use of offset, we need to know the position of the field displayed on the output screen.
If we use HIDE, the field gets back into the HIDE variable.
position of the field doesnt matter.
Regards,
Sailaja.
‎2006 Dec 01 1:43 PM
hi
good
A Sample Hide & Get Cursor in Interactive Programming ->
***PROG.BEGIN**************************************************************
&----
*& Report ZPREM_INTERACTIVE *
*& *
&----
*& *
*& *
&----
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.
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbabf135c111d1829f0000e829fbfe/content.htm
thanks
mrutyun^