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

Statement Not Accessible Adding ALV Grid

Former Member
0 Likes
3,336

Hello Experts,

I am having a hard time adding a AVL grid to a program. I save the program and at the CASE TIME_DATA_ZL-BTRTL there is an error with "Statement not accessible". I copied it from another program and it is not working.

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
3,080

It's not because of the statement itself (it could be any other statement too), it's because this part of the code cannot be reached, so you have to look in the lines above (for instance if the previous statement is ENDFORM).

13 REPLIES 13
Read only

Sandra_Rossi
Active Contributor
0 Likes
3,081

It's not because of the statement itself (it could be any other statement too), it's because this part of the code cannot be reached, so you have to look in the lines above (for instance if the previous statement is ENDFORM).

Read only

0 Likes
3,080

I tried all that I can think of but no luck.

Read only

0 Likes
3,080

Sorry for not being able to help you, but my crystal ball don't see what is above your code.

Read only

0 Likes
3,080

This is how the report looks like. I am still new to ABAP.

This is what I am trying to add. I know if I add the code the it will be deleted. I added the code but it isn't working and I don't know how I can let you see the code.

Read only

0 Likes
3,080

Attach it as a file (.txt.zip)

Read only

0 Likes
3,079

The "ZPY_R_QTD_HOURS" is the one that needs to be changed. The "Z_PAYROLL_HOURS_BY_DETAIL" has the ALV grid that I am trying to add and I have been awake all night trying to figure it out and I have no idea how to get it to work. Thanks.

Read only

0 Likes
3,079

Currently, the code is out of phase compared to your initial question. I doubt you have the same error now.

Could you please provide the code for which you have the error, and indicate at which line the error is NOW ? Thx

Read only

0 Likes
3,079

I don't have an error anymore. The problem now is that the grid isn't working. Thanks.

Read only

0 Likes
3,079

Shawn,

It looks like you have inherited a terrible report. This is what you have to do to fix it:

1. define a structure (in the data dictionary SE11) that contains all the values you want to display in the ALV

2. define an internal table (in your program) based on this structure

3. write a subroutine to fill this internal table. Unfortunately that program has a separate global variable for each reportable value!

4. write another subroutine to display the internal table in ALV. All it needs is something like this:

  DATA: lv_title TYPE  lvc_title.

  lv_title = 'Workitems closed'(001).

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

      i_structure_name = 'DFKKWLI'  "structure of the internal table

      i_grid_title     = lv_title

    TABLES

      t_outtab         = gt_closed  "internal table of report data

    EXCEPTIONS

      program_error    = 1

      OTHERS           = 2.

  IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ENDIF.

All of these steps are very simple except (in your case) step 3.

If it was me, I would just rewrite the whole thing.

good luck!

Paul

Read only

0 Likes
3,079

Paul,

I'm the one that added the ALV grid to ZPY_R_QTD_HOURS. I have been trying to add the ALV grid to the program but I've been unsuccessful.

Read only

0 Likes
3,079

Hopefully the way forward is clear now 🙂

Read only

0 Likes
3,079

I need help to where I can add this code to the program.


* Check if EXEMPT 0001 OR NON-EXEMPT.
CASE EMP_DATA_1-BTRTL.

WHEN '0001'.

        X_OUTREC-RPT_CATG = '900-ADMIN'.

        CASE EMP_DATA_1-PER_AREA.
             WHEN 'FORT'.
                      X_OUTREC-RPT_LOCT = 'PAREA-1-FORT'.
             WHEN 'SHIP'.
                      X_OUTREC-RPT_LOCT = 'PAREA-2-SHIP'.
             WHEN 'RMSO'.
                      X_OUTREC-RPT_LOCT = 'PAREA-2.5-RMSO'.
             WHEN 'CHIN'.
                      X_OUTREC-RPT_LOCT = 'PAREA-3-CHIN'.
             WHEN 'TUBA'.
                      X_OUTREC-RPT_LOCT = 'PAREA-4-TUBA'.
             WHEN 'CRWN'.
                      X_OUTREC-RPT_LOCT = 'PAREA-5-CRWN'.
             WHEN 'KAYT'.
                      X_OUTREC-RPT_LOCT = 'PAREA-6-KAYT'.
             WHEN 'DILK'.
                      X_OUTREC-RPT_LOCT = 'PAREA-8-DILK'.
             WHEN OTHERS.
                      X_OUTREC-RPT_LOCT = 'PAREA-9-HQ'.
        ENDCASE.

WHEN OTHERS.

        CASE EMP_DATA_1-PER_AREA.
             WHEN 'FORT'.
                      X_OUTREC-RPT_LOCT = 'PAREA-1-FORT'.
             WHEN 'SHIP'.
                      X_OUTREC-RPT_LOCT = 'PAREA-2-SHIP'.
             WHEN 'RMSO'.
                      X_OUTREC-RPT_LOCT = 'PAREA-2.5-RMSO'.
             WHEN 'CHIN'.
                      X_OUTREC-RPT_LOCT = 'PAREA-3-CHIN'.
             WHEN 'TUBA'.
                      X_OUTREC-RPT_LOCT = 'PAREA-4-TUBA'.
             WHEN 'CRWN'.
                      X_OUTREC-RPT_LOCT = 'PAREA-5-CRWN'.
             WHEN 'KAYT'.
                      X_OUTREC-RPT_LOCT = 'PAREA-6-KAYT'.
             WHEN 'DILK'.
                      X_OUTREC-RPT_LOCT = 'PAREA-8-DILK'.
             WHEN OTHERS.
                      X_OUTREC-RPT_LOCT = 'PAREA-9-HQ'.
        ENDCASE.

        CASE EMP_DATA_1-BUS_AREA.
             WHEN '100'.
                      X_OUTREC-RPT_CATG = '100-ELECTRIC'.
             WHEN '200'.
                      X_OUTREC-RPT_CATG = '200-GAS'.
             WHEN '300'.
                      X_OUTREC-RPT_CATG = '300-WATER'.
             WHEN '350'.
                      X_OUTREC-RPT_CATG = '350-WASTEWATER'.
             WHEN '400'.
                      X_OUTREC-RPT_CATG = '400-SOLAR'.
             WHEN '500'.
                      X_OUTREC-RPT_CATG = '500-COMM SYS DIV'.
             WHEN '900'.
                      X_OUTREC-RPT_CATG = '900-ADMIN'.

        ENDCASE.

*  MECHANICS.

        CASE EMP_DATA_1-KOSTL.
             WHEN '1165' OR '1265' OR '1365' OR '1465' OR '1565' OR '1665' OR '1865' OR '2067'.
                       X_OUTREC-RPT_CATG = 'MECHANICS'.
        ENDCASE.

Read only

matt
Active Contributor
0 Likes
3,079

Thread is suffering from scope creep. When one question is resolved, close it, and ask the next question as a new question. Link to the old if necessary.

Thread locked.