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

Code review

Former Member
0 Likes
736

Hi all,

I was doing Code review for a report, when I was checking code through extended program check it was giving a warning as below

Program: ZCSRE_HU_PRODUCTION_REPORT Include: ZCSRM_HU_PRD_PROCESS_FORMS Line : 149

P_FIELDCAT stands for 2 fields: Table P_FIELDCAT[] and its header line

Field P_FIELDCAT is not referenced statically in the program

Can you please suggest me how to remove this warning.

Thanks in advance

7 REPLIES 7
Read only

Former Member
0 Likes
710

Hi,

U might not used P_FIELDCAT field in the program. Comment the field, error will be rectified.

Regards

kannaiah

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
710

Hi,

P_FIELDCAT is an internal table with headerline in your case. SO P_FILEDCAT[] is the internal table and P_FILEDCAT is the header line. I think in your program there is not static (IN the code) reference to it. Just try and comment the declaration of thisP_FIELDCAT and see if you still get this warninig.

Regards,

Sesh

Read only

0 Likes
710

Thanks for you response below is the code where it is using it please see it

FORM f9004_display_data TABLES p_output

p_fieldcat.

CALL METHOD o_alvgrid->set_table_for_first_display

EXPORTING

is_variant = w_variant

i_save = c_a

is_layout = w_layout

CHANGING

it_outtab = p_output[]

it_fieldcatalog = p_fieldcat[]

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE i000 WITH text-e06."Error in ALV report display

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " f9004_display_data

Read only

0 Likes
710

Hi,

Write the form like below:

FORM f_populate_item TABLES P_OUTPUT structure ....

P_fieldcat STRUCTURE ....

Regards

Kannaiah

Read only

0 Likes
710

Hi Ranjith,

Replace your code by following code.And it would work.

In GLOBAL DATA or TOP Include add the following line:-

Data: GT_FIELDCAT type table of <STRUCTURE_NAME>.

FORM f9004_display_data CHANGING p_fieldcat LIKE GT_FIELDCAT

TABLES p_output.

CALL METHOD o_alvgrid->set_table_for_first_display

EXPORTING

is_variant = w_variant

i_save = c_a

is_layout = w_layout

CHANGING

it_outtab = p_output[]

it_fieldcatalog = p_fieldcat[]

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE i000 WITH text-e06."Error in ALV report display

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " f9004_display_data

Thanks and regards,

Ravi .

Read only

0 Likes
710

Hi Ravi,

and iam getting another warnig for the same line please go through it

<b>Program: ZCSRE_HU_PRODUCTION_REPORT Include: ZCSRM_HU_PRD_PROCESS_FORMS Line : 149

P_OUTPUT stands for 2 fields: Table P_OUTPUT[] and its header line

Field P_OUTPUT is not referenced statically in the program</b>

PERFORM f9004_display_data TABLES i_final

i_fieldcat.

FORM f9004_display_data TABLES p_output

p_fieldcat.

CALL METHOD o_alvgrid->set_table_for_first_display

EXPORTING

is_variant = w_variant

i_save = c_a

is_layout = w_layout

CHANGING

it_outtab = p_output[]

it_fieldcatalog = p_fieldcat[]

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE i000 WITH text-e06."Error in ALV report display

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " f9004_display_data

Please see this code

Read only

raviprakash
Product and Topic Expert
Product and Topic Expert
0 Likes
710

Hi Ranjith,

I have faced the similar problem. It happens due to the usage of the TABLE parameter in the SUBROUTINE interface. Your TABLE PARAMETER is : P_FIELDCAT.

You can eliminate this by using the changing parameter instead. For this, create a GLOBAL DATA in TOP include of the report as:-

DATA: GT_FIELDCAT Type Table of ..... .

Then in the subroutine defination write:-

FORM <SUBROUTINE NAME> Changing P_FIELDCAT TYPE GT_FIELDCAT.

.....

ENDFORM.

Then in program call subroutine as following:-

PERFORM <SUBROUTINE NAME> changing p_fieldcat.

NOTE: This would DEFINITELY solve your problem. Also restrict using TABLE

PARAMETER as it creates a header line by default. Instead use

CHANGING AND USING.

NOTE: Please award points if you feel satisfied with the solution :D.

Thanks and regards,

Ravi .