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

ALV Grid Display in Loop.

Former Member
0 Likes
3,330

Hello experts,

I need your help to resolve the issue.

I have made a report:

On selection screen, Release group and release strategy is taken in select options:

SELECT-OPTIONS : S_FRGGR FOR T16FS-FRGGR,
                               S_FRGSX FOR T16FS-FRGSX.

if s_frgsx is not initial.
select frggr frgsx from t16fs into table i_t16fs where frggr in s_frggr and frgsx in s_frgsx.


else.

select frggr frgsx from t16fs into table i_t16fs where frggr in s_frggr.

endif.

loop at i_t16fs into wa_t16fs.

Inside this all code is written.

endloop.

I have to display the output (from table CDHDR and CDPOS) same as the output of transaction CL24N but in ALV GRID DISPLAY.

I have written all the code to fetch the values and passed final internal table to ALV GRID DISPLAY.

The problem is :

We can select a range of values for release group and release strategy as it is in select-options.

For every release group, more than 10 strategies are present.

For example :

For release group 62, 710 release strategies are present.

In output, I can see output of 1st strategy. When I press the back button, I can see the output of 1st strategy (but values from only CDPOS not from CDHDR) and second strategy (Both values from CDHDR and CDPOS). When I press the back button, I can see the output of 1st (but values from only CDPOS not from CDHDR), second strategy (but values from only CDPOS not from CDHDR)) and third strategy (Both values from CDHDR and CDPOS). Like this…. So on… upto 710th entry.

I want the output of all 710 entries in single ALV GRID DISPLAY.

What can be done?

Regards,

Titiksha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,753

Hi Titiksha,

you can append to Final ITAB and Display as ALV out side LOOP.

Eg.

loop.

APPEND LINES OF ITAB TO IT_FINAL.

CLEAR:  ITAB      " (Use the Same ITAB for second Loop)

endloop.

REUSE_ALV_GRID_DISPLAY .

TABLES
         T_OUTTAB               = IT_FINAL

Hello experts,

I need your help to resolve the issue.

I have made a report:

On selection screen, Release group and release strategy is taken in select options:

SELECT-OPTIONS : S_FRGGR FOR T16FS-FRGGR,
                               S_FRGSX FOR T16FS-FRGSX.

if s_frgsx is not initial.
select frggr frgsx from t16fs into table i_t16fs where frggr in s_frggr and frgsx in s_frgsx.


else.

select frggr frgsx from t16fs into table i_t16fs where frggr in s_frggr.

endif.

loop at i_t16fs into wa_t16fs.

Inside this all code is written.

endloop.

I have to display the output (from table CDHDR and CDPOS) same as the output of transaction CL24N but in ALV GRID DISPLAY.

I have written all the code to fetch the values and passed final internal table to ALV GRID DISPLAY.

The problem is :

We can select a range of values for release group and release strategy as it is in select-options.

For every release group, more than 10 strategies are present.

For example :

For release group 62, 710 release strategies are present.

In output, I can see output of 1st strategy. When I press the back button, I can see the output of 1st strategy (but values from only CDPOS not from CDHDR) and second strategy (Both values from CDHDR and CDPOS). When I press the back button, I can see the output of 1st (but values from only CDPOS not from CDHDR), second strategy (but values from only CDPOS not from CDHDR)) and third strategy (Both values from CDHDR and CDPOS). Like this…. So on… upto 710th entry.

I want the output of all 710 entries in single ALV GRID DISPLAY.

What can be done?

Regards,

Titiksha

6 REPLIES 6
Read only

Former Member
0 Likes
1,753

Your ALV displaying logic is probably inside the loop. Take it out of the loop so that it is called once when all 710 entries are ready.

Read only

0 Likes
1,753


That is true. But for 1st loop whatever the entirs m getting, where should I put it.?

Regards,

Titiksha

Read only

0 Likes
1,753

Umm.. In every loop pass you can append the entries in final internal table that will be displayed once loop is over.

Read only

0 Likes
1,753

Hello Manish,

Following is some code for final internal table.

   LOOP AT I1_CDPOS ASSIGNING <FS_GT_OUTPUT_ITEM>.

    WA_FINAL-CHANGENO    = <FS_GT_OUTPUT_ITEM>-CHANGENR.
    WA_FINAL-FRGGR       = S_FRGGR.
    WA_FINAL-FRGSX       = S_FRGSX.
    WA_FINAL-CLASS       =  V_CLASS. "<FS_GT_OUTPUT_ITEM>-CLASS.  "    LIKE KLAH-CLASS,
    WA_FINAL-VALUE_OLD   = <FS_GT_OUTPUT_ITEM>-VALUE_OLD.      " LIKE AUSP-ATWRT,
    WA_FINAL-VALUE_NEW   = <FS_GT_OUTPUT_ITEM>-VALUE_NEW.

    IF WA_FINAL-VALUE_OLD IS NOT INITIAL.

      WA_FINAL-ACTION    =  'DELETED'"<FS_GT_OUTPUT_ITEM>-ACTION."    TYPE C,
    ELSE.
      WA_FINAL-ACTION    =  'CREATED'.
    ENDIF.

    IF WA_FINAL-VALUE_OLD IS NOT INITIAL.
      WA_FINAL-VALUE     = <FS_GT_OUTPUT_ITEM>-VALUE_OLD.
    ELSE.
      WA_FINAL-VALUE     = <FS_GT_OUTPUT_ITEM>-VALUE_NEW.
    ENDIF.


    READ TABLE I_GT_OUTPUT_HEADER ASSIGNING  <FS_GT_OUTPUT_HEADER> WITH KEY CHANGENO = <FS_GT_OUTPUT_ITEM>-CHANGENR.

    IF SY-SUBRC = 0.

      WA_FINAL-DATE  =  <FS_GT_OUTPUT_HEADER>-DATE."        LIKE CDHDR-UDATE,
      WA_FINAL-TIME  = <FS_GT_OUTPUT_HEADER>-TIME."          LIKE CDHDR-UTIME,
      WA_FINAL-USER  = <FS_GT_OUTPUT_HEADER>-USER."         LIKE CDHDR-USERNAME,
      WA_FINAL-TCODE = <FS_GT_OUTPUT_HEADER>-TCODE."          LIKE CDHDR-TCODE,
    ENDIF.

    APPEND WA_FINAL TO I_FINAL.

    UNASSIGN <FS_WA_FINAL>.

    READ TABLE I_FINAL ASSIGNING <FS_WA_FINAL> WITH KEY CHANGENO  = <FS_GT_OUTPUT_ITEM>-CHANGENR
                                                        VALUE_OLD = <FS_GT_OUTPUT_ITEM>-VALUE_OLD
                                                        VALUE_NEW = <FS_GT_OUTPUT_ITEM>-VALUE_NEW.
    IF SY-SUBRC EQ 0.
      UNASSIGN <FS_WA_CABNT>.
      READ TABLE I_CABNT ASSIGNING <FS_WA_CABNT> WITH KEY ATINN = <FS_GT_OUTPUT_ITEM>-TABKEY+18(10).
      IF SY-SUBRC EQ 0.
        <FS_WA_FINAL>-ATBEZ = <FS_WA_CABNT>-ATBEZ.

      ENDIF.

    ENDIF.

  ENDLOOP.

And I_FINAL is passed to ALV.

Here the line which is in BOLD and UNDERLINED, data after that is getting displayed only for the last value of Realese strategy and release group, not for others.

Please help.

Regards,

Titiksha

Read only

0 Likes
1,753

Hi,

Loop at Items and read the header and other required internal table by using the READ TABLE.

Make sure that common field is there in the all Itabs. If you are not fetch the field, please change your Select query too.

Finally Append those records to Final internal table which we are displaying as a ALV report.

If you write ALV in the LOOP , it displays one record as a ALV, till the end.

BR,

Bharani

Read only

Former Member
0 Likes
1,754

Hi Titiksha,

you can append to Final ITAB and Display as ALV out side LOOP.

Eg.

loop.

APPEND LINES OF ITAB TO IT_FINAL.

CLEAR:  ITAB      " (Use the Same ITAB for second Loop)

endloop.

REUSE_ALV_GRID_DISPLAY .

TABLES
         T_OUTTAB               = IT_FINAL