Application Development 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: 

Problem with Interactive - ALV

Former Member
0 Kudos

Hi Experts,

Again I am facing probelm with in this interactive report (ALV).

This time I am getting the O/P correctly...but each time when I come back to first screen then go to

second screen O/P of second screen is extending..

Eg; If my O/P in second screen is ,

first time ( which is correct O/P )

A B C

second time

A B C A B C

third time

A B C A B C A B C like soon..

I am pasting my code, please have a look on it and advice me..

FORM USER_COMM USING P_UCOMM LIKE SY-UCOMM
                           R_SELFIELD TYPE SLIS_SELFIELD.

  DATA : OK_CODE TYPE SY-UCOMM.
  OK_CODE = P_UCOMM.
  CASE OK_CODE.

    WHEN '&IC1'.
      IF R_SELFIELD-FIELDNAME = 'MATNR'.
        READ TABLE IT_FIRST INDEX R_SELFIELD-TABINDEX.

        REFRESH IT_FINAL.
        CLEAR IT_FINAL.


        LOOP AT IT_EBAN WHERE MATNR = IT_FIRST-MATNR
                          AND WERKS = IT_FIRST-WERKS.

          MOVE IT_EBAN-MATNR TO IT_FINAL-MATNR.
          MOVE IT_EBAN-BANFN TO IT_FINAL-BANFN.
          MOVE IT_EBAN-FKZTX TO IT_FINAL-FKZTX.
          MOVE IT_EBAN-MENGE TO IT_FINAL-MENGE.
          MOVE IT_EBAN-MEINS TO IT_FINAL-MEINS.
          APPEND IT_FINAL.
          CLEAR IT_EBAN.
          CLEAR IT_FINAL.
        ENDLOOP.


        S_LAYOUT-ZEBRA = 'X' .
        S_LAYOUT-COLWIDTH_OPTIMIZE = 'X' .

        PERFORM FIELD_CATALOG1 TABLES IT_FIELDCAT1

        USING: 'IT_FINAL' 'MATNR' 'X' 'MATERIAL NO:' 'X',
               'IT_FINAL' 'BANFN' ' ' 'PR NUMBER' ' ',
               'IT_FINAL' 'FKZTX' ' ' 'RELEASE STATUS' ' ',
               'IT_FINAL' 'MENGE' ' ' 'QUANTITY' 'X',
               'IT_FINAL' 'MEINS' ' ' 'UoM' 'X'.

        PERFORM SORT_BUILD1 USING TB_SORT1[].

        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
        I_CALLBACK_PROGRAM                = SY-CPROG
*        I_CALLBACK_USER_COMMAND           = 'USER_COMM'
*     IS_LAYOUT                         = S_LAYOUT
        IT_FIELDCAT                       = IT_FIELDCAT1[]
        IT_SORT                           = TB_SORT1[]

*      I_DEFAULT                         = 'X'
        TABLES
         T_OUTTAB                          = IT_FINAL[].

      ENDIF.
  ENDCASE.
ENDFORM.                    "user_comm

Please advice

Karthik

Edited by: Karthik R on Apr 16, 2009 2:01 PM

1 ACCEPTED SOLUTION

former_member305388
Active Contributor
0 Kudos

Hi Karthik,

Try refreshing fieldcatelog IT_FIELDCAT1

5 REPLIES 5

Former Member
0 Kudos

The IT_EBAN table is not getting cleared properly and hence twice entries are geting appended in IT_FINAL. After appending to IT_FINAL try refreshing IT_EBAN.

former_member305388
Active Contributor
0 Kudos

Hi Karthik,

Try refreshing fieldcatelog IT_FIELDCAT1

0 Kudos

Thank u Srinivas !! Just a simple thing ......but I did'nt notice that, U Rock !!

Former Member
0 Kudos

>

> Hi Experts,

>

> Again I am facing probelm with in this interactive report (ALV).

> This time I am getting the O/P correctly...but each time when I come back to first screen then go to

> second screen O/P of second screen is extending..

>

> Eg; If my O/P in second screen is ,

>

> first time ( which is correct O/P )

> A B C

> second time

> A B C A B C

> third time

> A B C A B C A B C like soon..

>

> I am pasting my code, please have a look on it and advice me..

>

>

FORM USER_COMM USING P_UCOMM LIKE SY-UCOMM
>                            R_SELFIELD TYPE SLIS_SELFIELD.
> 
>   DATA : OK_CODE TYPE SY-UCOMM.
>   OK_CODE = P_UCOMM.
>   CASE OK_CODE.
> 
>     WHEN '&IC1'.
>       IF R_SELFIELD-FIELDNAME = 'MATNR'.
>         READ TABLE IT_FIRST INDEX R_SELFIELD-TABINDEX.
> 
>         REFRESH IT_FINAL.
>         CLEAR IT_FINAL.
> 
> 
>         LOOP AT IT_EBAN WHERE MATNR = IT_FIRST-MATNR
>                           AND WERKS = IT_FIRST-WERKS.
> 
>           MOVE IT_EBAN-MATNR TO IT_FINAL-MATNR.
>           MOVE IT_EBAN-BANFN TO IT_FINAL-BANFN.
>           MOVE IT_EBAN-FKZTX TO IT_FINAL-FKZTX.
>           MOVE IT_EBAN-MENGE TO IT_FINAL-MENGE.
>           MOVE IT_EBAN-MEINS TO IT_FINAL-MEINS.
>           APPEND IT_FINAL.
>           CLEAR IT_EBAN.
>           CLEAR IT_FINAL.
>         ENDLOOP.
> 
> 
>         S_LAYOUT-ZEBRA = 'X' .
>         S_LAYOUT-COLWIDTH_OPTIMIZE = 'X' .
> 
>         PERFORM FIELD_CATALOG1 TABLES IT_FIELDCAT1
> 
>         USING: 'IT_FINAL' 'MATNR' 'X' 'MATERIAL NO:' 'X',
>                'IT_FINAL' 'BANFN' ' ' 'PR NUMBER' ' ',
>                'IT_FINAL' 'FKZTX' ' ' 'RELEASE STATUS' ' ',
>                'IT_FINAL' 'MENGE' ' ' 'QUANTITY' 'X',
>                'IT_FINAL' 'MEINS' ' ' 'UoM' 'X'.
> 
>         PERFORM SORT_BUILD1 USING TB_SORT1[].
> 
>         CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
>         EXPORTING
>         I_CALLBACK_PROGRAM                = SY-CPROG
> *        I_CALLBACK_USER_COMMAND           = 'USER_COMM'
> *     IS_LAYOUT                         = S_LAYOUT
>         IT_FIELDCAT                       = IT_FIELDCAT1[]
>         IT_SORT                           = TB_SORT1[]
> 
> *      I_DEFAULT                         = 'X'
>         TABLES
>          T_OUTTAB                          = IT_FINAL[].
> 
>       ENDIF.
   *refresh it_final[]*. "change accordingly 
>   ENDCASE.
> ENDFORM.                    "user_comm

>

> Please advice

> Karthik

>

> Edited by: Karthik R on Apr 16, 2009 2:01 PM

Former Member
0 Kudos

Hi,

This problem is occuring because your final table it_final is not refreshing....

You have written refresh it_final.

But it_final is table with header line...so only the header is getting cleared...

use REFRESH IT_FINAL[].

Regards

Debarshi