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

Check Values Dynamically in ALV GRID

Former Member
0 Likes
1,641

Hi,

How do I check the values contained in an ALV grid dynamically? In this case the number of lines is variable.

Best Regards.

Diovani.

Hi,

How do I check the values contained in an ALV grid dynamically? In this case the number of lines is variable.

Best Regards.

Diovani.

10 REPLIES 10
Read only

Former Member
0 Likes
1,579

Hi

What do you mean?

Max

Read only

0 Likes
1,579

I want to create check point with the values contained in an alv grid in a report, did you get?

Read only

0 Likes
1,579

How have u created the GRID, by fm or OOA?

Max

Read only

0 Likes
1,579

By FM.

Thnx.

Diovani.

Read only

0 Likes
1,579

Hi

So u can check the table in the user_command routine after the user has pressed a but of status:

how to check depends on what u need to do.

Anyway u can check the records by LOOP statament

Max

Read only

0 Likes
1,579

OK, but how is this done? What commands should I use?

Best Regards.

Diovani.

Read only

0 Likes
1,579

Hi

U should call your grid about in this way:

V_REPID = SY-REPID.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM                   = V_REPID
*      I_CALLBACK_PF_STATUS_SET       = 'SET_PF_STATUS'
      I_CALLBACK_USER_COMMAND        = ' USER_COMMAND'
....................................................................................................
    TABLES
      T_OUTTAB                                         = ITAB.

USER_COMMD is a form like this:

FORM user_command  USING r_ucomm LIKE sy-ucomm
                                                rs_selfield TYPE slis_selfield.
ENDFORM.

R_UCOMM has the value of OK-CODE, in this FORM u can place all code u need to check your table.

If you use the standard status, u can indicate which OK-CODE has to call your user_command routine in the exporting parameter IT_EVENT_EXIT.

It has the following fields:

- ucomm: OK-CODE

- before: 'X' = The application gets control before the ALV executes the function.

- after: 'X' = The application gets control after the ALV has executed the function, but before the list is output.

So your code could be:

FORM user_command  USING r_ucomm LIKE sy-ucomm
                                                rs_selfield TYPE slis_selfield.
     CASE R_UCOMM.
         WHEN <......>.
            LOOP AT ITAB.  " Here u can LOOP itab
            ENDLOOP.
         WHEN <......>.
             READ ITAB INDEX RS_SELFIED-TABINDEX. "Here u can READ itab
         WHEN <......>.
     ENDACASE.
ENDFORM.

If you use IT_EVENT_EXIT, rs_selfield returns the value of flag BEFORE and AFTER

Max

Read only

0 Likes
1,579

Sorry Friend,

I think I was not so clear.

But I want to make check points from an ALV GRID result with ecatt . I am not creating an ALV GRID.

Regards.

Diovani.

Read only

sachin_b
Product and Topic Expert
Product and Topic Expert
0 Likes
1,579

Hi,

I hope you are using SAPGUI to record and replay. In the interface you will have to check for the command line where you have selected the data record in the ALV.

Steps

  • Split the SAPGUI recoding on a dialogue level, ( CHEGUI to be implemented to check the field element content / check mechanism to be implemented by coding )

  • Make the record selection dynamic by replacing the row index with a loop counter, enclose the corresponding SAPGUI + CHEGUI or SAPGUI + check coding withing a loop.

Please ensure that only relevant part of the SAPGUI commands ( recording ) is put within the loop. The rest should be kept out.

Hope this gives you an idea to proceed.

Regards,

Sachin

Read only

Former Member
0 Likes
1,579

Thank you Sachin,

Its work fine.

Regards.

Diovani.