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

Hide statement not working

Former Member
0 Likes
2,043

Hi experts,

i am using hide statement but it is not working..The problem with it is that after line selection the variable on which i have used hide is carrying the last value of internal table always..<< Removed >>

Regards,

Raman

Edited by: Rob Burbank on Jun 30, 2009 10:41 AM

19 REPLIES 19
Read only

Former Member
0 Likes
1,953

Hi Raman,

It will be better if you paste your Loop code here so that your requirement will be more clear.

Use Hide statement in loop after write statement.

Regards,

Vijay

Read only

Former Member
0 Likes
1,953

can you explain in detailed please...

Read only

Former Member
0 Likes
1,953

Hint:

instead of Hide, use Get cursor always.

Read only

0 Likes
1,953

BUT GET CURSOR IS SPECIFICALLY USED FOR ONLY PARTICULAR FIELD...IF USER SELECTS ANOTHER FIELD IN THE SAME LINE IT WILL GIVE DIFF DATA....

Read only

0 Likes
1,953

thats true,

you can have case after

get cursor field <fname> value <value>.

based on fieldname you can have different logic. will it be a show stooper..??

Read only

0 Likes
1,953

But i need the same output for the whole line selection.....

Read only

0 Likes
1,953

Hi Raman,

Use this GET CURSOR command


GET CURSOR LINE <var_for_line_no> VALUE val.

<li> You can pass SY-LILLI system variable value to <var_for_line_no> at runtime

<li> SY-LILLI -Selected list row

Thanks

Venkat.O

Read only

venkat_o
Active Contributor
0 Likes
1,953

Hi Raman,

Try this in AT LINE-SELECTION event


"Lets say field is Matnr in the table ITAB
GET CURSOR FIELD 'ITAB-MATNR' VALUE itab-matnr.

Thanks

Venkat.O

Read only

Former Member
0 Likes
1,953

are you sure..??

Read only

Former Member
0 Likes
1,953

yaa vijay...m sure

Read only

Former Member
0 Likes
1,953

You might have used your HIDE statment outside LOOP...ENDLOOP.

That is why you are getting always last value of ITAB.

use HIDE with in LOOP..ENDLOOP.

Read only

venkat_o
Active Contributor
0 Likes
1,953

Hi Raman, Have a look at this sample program. It works fine. Can you try this way .


REPORT ztest_notepad.
DATA: BEGIN OF it_t001 OCCURS 0,
        bukrs TYPE t001-bukrs,
        butxt TYPE t001-butxt,
        ort01 TYPE t001-ort01,
      END OF it_t001.

START-OF-SELECTION.
  "Select data
  SELECT *
  FROM t001
  INTO CORRESPONDING FIELDS OF TABLE it_t001
  UP TO 20 ROWS.
  "Loop data and send it to Hide area
  FORMAT HOTSPOT.
  LOOP AT it_t001.
    WRITE:/ it_t001-bukrs,
            it_t001-butxt,
            it_t001-ort01.
    HIDE: it_t001-bukrs,
        it_t001-butxt,
        it_t001-ort01.
  ENDLOOP.
  "Secondary list

AT LINE-SELECTION.
  WRITE:/ it_t001-bukrs,
          it_t001-butxt,
          it_t001-ort01.
Thanks Venkat.O

Read only

Former Member
0 Likes
1,953

I am sending a test program with same problem...iin this after line selection the field variable emp-name is displayin only last entry of internal table...

&----


*& Report ZBASICX12

*&

&----


*&

*&

&----


REPORT ZBASICX12.

INITIALIZATION.

DATA: BEGIN OF ITAB OCCURS 0,

EMPID TYPE ZTEMP-EMPID,

EMPNAME TYPE ZTEMP-EMPNAME,

END OF ITAB.

START-OF-SELECTION.

SELECT EMPID EMPNAME FROM ZTEMP INTO TABLE ITAB.

SORT ITAB BY EMPID.

LOOP AT ITAB.

WRITE: / ITAB-EMPID HOTSPOT.

HIDE ITAB-EMPID.

ENDLOOP.

END-OF-SELECTION.

AT LINE-SELECTION.

CASE SY-LSIND.

WHEN 1.

WRITE: ITAB-EMPNAME.

ENDCASE.

Read only

Former Member
0 Likes
1,953

LOOP AT ITAB.
WRITE: / ITAB-EMPID HOTSPOT.

*HIDE ITAB-EMPID.

"Here you are hiding only EMPID and NOT EMPNAME.
"But in display you are using EMPNAME, so HIDE EMPNAME as well then it 'll work.
"OR you can hide whole work area as well 
"ex:  HIDE ITAB.

HIDE : ITAB-EMPID, ITAB-EMPNAME.

ENDLOOP.

Read only

Former Member
0 Likes
1,953

Hi Raman,

try hiding the whole work area.

LOOP AT ITAB.

WRITE: / ITAB-EMPID HOTSPOT.

HIDE ITAB.

ENDLOOP.

Read only

Former Member
0 Likes
1,953

Raman,

Perez answered your question in less than 10 minutes after you finally posted your code. This is a classic example of why it is so important to post your code, when there is a question about code.

Read only

Former Member
0 Likes
1,953

Befor READ LINE statement did you use CLEAR <variable> Statement??

Read only

faisalatsap
Active Contributor
0 Likes
1,953

Hi, Sharma

Please Test the following Sample Code Hope will help you to solve out your problem,

DATA: it_t247 LIKE STANDARD TABLE OF t247 WITH HEADER LINE,
      wa_t247 LIKE LINE OF it_t247.

SELECT * FROM t247
  INTO CORRESPONDING FIELDS OF TABLE it_t247
  WHERE spras = 'E'.

LOOP AT it_t247.
  WRITE: / it_t247-mnr HOTSPOT ON. HIDE it_t247.
ENDLOOP.

AT LINE-SELECTION.

  READ TABLE it_t247 INTO wa_t247 WITH KEY mnr = it_t247-mnr.
  IF sy-subrc EQ 0.
    WRITE: wa_t247-mnr, wa_t247-ktx, wa_t247-ltx.
  ENDIF.

Best Regards,

Faisal

Read only

0 Likes
1,953

HI FAISAL,

I have also used hide statement like this..but after line selection the corresponding field is picking up the last value of internal table....

Regards,

Raman