Skip to Content
author's profile photo Former Member
Former Member

what is the o/p of this program (hide statement)

hi

this is a small program asked in an interview.

the program is as follows

data: wa type i.

do 5 times.

wa = sy-index.

hide wa.

write:/ wa.

endloop.

at line-selection.

write:/ wa.

they said that when the user clicks on the 2 no. which comes on the basic list then what will be the value of the wa in the secondary list. is it ( 0, 2,3,5)

and explain the logic.

i want to know the logic behind it i.e. internally whats is happening. the debugging can not help in this case.

i think the person who knows exactly the hide concept can tell the right answer to it and also the logic.

regards,

maqsood

Add a comment
10|10000 characters needed characters exceeded

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 30, 2005 at 03:55 PM

    Maqsood,

    There is a bug in the program.

    DO statement ends with ENDDO not endloop.

    When you double click on 2 the output will be 3 as wa holds 3 at that point.

    Because HIDE statement retains the contents of wa related to the current output line. When the user selects the line from the list wa is automatically filled with the retained value.

    Thanks

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Maqsood

      Look at this

      DO 5 TIMES.

      wa = sy-index.

      HIDE wa.

      WRITE:/ wa.

      ENDDO.

      First loop:

      WA = 1: when hide runs, nothing is wroten,

      Second loop

      WA = 2: when hide runs, 2 isn't wroten yet, but 1 is just wroten (in the prevoius loop): so hide links 1 to 2 and when you do a doubleclick on 1 you'll see 2

      ......

      Max

      Message was edited by: max bianchi

  • author's profile photo Former Member
    Former Member
    Posted on Sep 30, 2005 at 03:45 PM

    Hi

    The command HIDE stores in memroy the part of string it wants to use after doubleclik.

    So in the AT LINE-SELCTION event the system sets WA with the value of row where doubleclick is done.

    You can do the same thing by this way:

    WRITE: / SY-LISEL.

    Infact SY-LISEL is system variable where the value of selected line is stored.

    Max

    Message was edited by: max bianchi

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi

      because the command hide'll link the value of selected line to writed line:

      DO 5 TIMES.

      wa = sy-index.

      HIDE wa.

      WRITE:/ wa.

      ENDDO.

      In this case HIDE runs before WRITE, so when you do a doubleclick on row you'll see the value of nex row.

      You can understand better if you try to run this code

      DO 5 TIMES.

      wa = sy-index.

      WRITE:/ wa.

      HIDE wa.

      ENDDO.

      Max

  • author's profile photo Former Member
    Former Member
    Posted on Sep 30, 2005 at 03:52 PM

    Hi,

    In this case it sores in memory the line number that

    user clicks and writes that <b>Line number</b>.

    Please reward points if this explanation is useful.

    Regards,

    Siva

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 30, 2005 at 03:53 PM

    Hi,

    <b>Hide f</b>

    Retains the contents of f related to the current output line. When the user selects the line from the list f is automatically filled with the retained value.

    The selection can occur in:

    <b>AT LINE-SELECTION

    AT PFx

    AT USER-COMMAND

    READ LINE</b>

    The contents of the field do not have to have been displayed using WRITE in order for you to retain them.

    The HIDE statement does not support deep structures (structures that contain internal tables).

    Useful system fields for interactive reporting are listed in the System Fields for Lists documentation.

    data: wa type i.
    
    do 5 times.
    wa = sy-index.
    hide wa.
    write:/ wa.
    enddo. 
    <b>*here not endloop but it is enddo.</b>
    
    at line-selection.
    write:/ wa.

    this gives the output.

    1

    2

    3

    4

    5

    and at double-click of at any number the total output is hide and the next no is displayed.

    if you double-click at 3 then the output will be 4.

    to display the same no

    data: wa type i.
    
    do 5 times.
    wa = sy-index.
    write:/ wa.
    hide wa.
    enddo.
    
    at line-selection.
    write:/ wa.

    if you double-click at 3 then the output will be 3.

    regards,

    venu-

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 01, 2005 at 11:25 AM

    hi masood,

    this was my interpretation ,

    first of all hide area could be stored only after write statement,

    so as per your code, when user clicks on 2 from the basic list, the o/p should be 1. I havent tested it, i could be wrong.

    when initially wa is '1' hide is empty, then '1' is written on basic list.

    when wa is '2' hide stores '1' as it found a record on basic list, and so on...

    so

    when user clicks 1 from basic list there will be no o/p

    when user clicks 2 from basic list o/p should be 1, and so on...

    i dont know i might be wrong, do reply if i am wrong, atleast i can correct myself...

    cheers...

    Aditya.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Maqsood,

      Your question made me to refresh the basic stuff over the HIDE statment.

      I had been palying around witht he code.

      Just try to shift the statement

      wa = sy-ndex

      after the statement

      HIDE wa.

      then check the result.

      Do a clear on wa after the ENDDO statement check the result.

      and also include a clear wa at the end in at line selection event and compare the results.

      If you keep on changing you will surely come to know why and how the HIDE statement is working.

      May be it is bit difficult to make yo understand by typing some words here, but play around with the code and you will surely undestand.

      Good luck.

  • author's profile photo Former Member
    Former Member
    Posted on Oct 03, 2005 at 07:28 AM

    Hi Maqsood,

    data: wa type i.

    do 5 times.

    wa = sy-index.

    hide wa.

    write:/ wa.

    endloop.

    at line-selection.

    write:/ wa.

    when the user clicks on the 2 then the output will be 3 because the hide statement is after the increment, it is something like this:

    Initially the sy-index will be 1 and it hides the number 1 before any value is printed in the output , once if it starts printing the values in the output screen the first value i.e number 1 is having the values 2 because the hide statement is after increment of the sy-index and moreover the write statement is also after the hide statement. and so on upto 5. In the output screen when 1-5 is displayed when the user clicks on the 2 the output will be 3 because, it values is already incremented by one and also hide.

    Hope you understood.

    Sriram.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 05, 2005 at 04:42 AM

    hi guys,

    my interpretation was wrong,

    please pardon me. 😊

    cheers,

    Aditya.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.