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 Run time error !

former_member622718
Participant
0 Likes
2,970

TABLES mara.

TYPE-POOLS:slis.



TYPES: BEGIN OF manoj,

         client    TYPE usr02-mandt,

         name      TYPE usr02-bname,

         validfrom TYPE usr02-gltgv,

         validto   TYPE usr02-gltgb,

         userlock  TYPE usr02-uflag,

       END OF manoj.





DATA : it      TYPE TABLE OF manoj,

       wa      TYPE manoj,

       it_fcat TYPE slis_t_fieldcat_alv,

       wa_fcat LIKE LINE OF it_fcat.





PARAMETERS name TYPE usr02-bname.



SELECT mandt bname gltgv gltgb uflag FROM usr02 INTO TABLE it WHERE bname = name.



wa_fcat-col_pos = '1' .

wa_fcat-fieldname = 'mandt' .

wa_fcat-tabname = 'it' .

wa_fcat-seltext_m = 'client' .

wa_fcat-key = 'X' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .



wa_fcat-col_pos = '2' .

wa_fcat-fieldname = 'bname' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'name' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .



wa_fcat-col_pos = '3' .

wa_fcat-fieldname = 'gltgv' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'validfrom' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .







wa_fcat-col_pos = '4' .

wa_fcat-fieldname = 'gltgb' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'validto' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .



wa_fcat-col_pos = '5' .

wa_fcat-fieldname = 'uflag' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'lock' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .



CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

  EXPORTING

    i_callback_program = sy-repid

    it_fieldcat        = it_fcat

  TABLES

    t_outtab           = it.
1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,868

*&---------------------------------------------------------------------*
*& Report Z_TEST_1
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT Z_TEST_VEDA1.

TABLES mara.

TYPE-POOLS:slis.



TYPES: BEGIN OF manoj,

client TYPE usr02-mandt,

name TYPE usr02-bname,

validfrom TYPE usr02-gltgv,

validto TYPE usr02-gltgb,

userlock TYPE usr02-uflag,

END OF manoj.





DATA : it TYPE TABLE OF manoj,

wa TYPE manoj,

it_fcat TYPE slis_t_fieldcat_alv,

wa_fcat LIKE LINE OF it_fcat.


PARAMETERS name TYPE usr02-bname.

SELECT mandt bname gltgv gltgb uflag FROM usr02 INTO TABLE it WHERE bname = name.

wa_fcat-col_pos = '1' .

wa_fcat-fieldname = 'CLIENT' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'CLIENT' .

wa_fcat-key = 'X' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .


wa_fcat-col_pos = '2' .

wa_fcat-fieldname = 'NAME' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'NAME' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .


wa_fcat-col_pos = '3' .

wa_fcat-fieldname = 'VAlIDFROM' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'VAlIDFROM' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .


wa_fcat-col_pos = '4' .

wa_fcat-fieldname = 'VALIDTO' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'VALIDTO' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .


wa_fcat-col_pos = '5' .

wa_fcat-fieldname = 'LOCK' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'LOCK' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = it_fcat

TABLES

t_outtab = it.

10 REPLIES 10
Read only

Former Member
0 Likes
2,869

*&---------------------------------------------------------------------*
*& Report Z_TEST_1
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT Z_TEST_VEDA1.

TABLES mara.

TYPE-POOLS:slis.



TYPES: BEGIN OF manoj,

client TYPE usr02-mandt,

name TYPE usr02-bname,

validfrom TYPE usr02-gltgv,

validto TYPE usr02-gltgb,

userlock TYPE usr02-uflag,

END OF manoj.





DATA : it TYPE TABLE OF manoj,

wa TYPE manoj,

it_fcat TYPE slis_t_fieldcat_alv,

wa_fcat LIKE LINE OF it_fcat.


PARAMETERS name TYPE usr02-bname.

SELECT mandt bname gltgv gltgb uflag FROM usr02 INTO TABLE it WHERE bname = name.

wa_fcat-col_pos = '1' .

wa_fcat-fieldname = 'CLIENT' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'CLIENT' .

wa_fcat-key = 'X' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .


wa_fcat-col_pos = '2' .

wa_fcat-fieldname = 'NAME' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'NAME' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .


wa_fcat-col_pos = '3' .

wa_fcat-fieldname = 'VAlIDFROM' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'VAlIDFROM' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .


wa_fcat-col_pos = '4' .

wa_fcat-fieldname = 'VALIDTO' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'VALIDTO' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .


wa_fcat-col_pos = '5' .

wa_fcat-fieldname = 'LOCK' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'LOCK' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = it_fcat

TABLES

t_outtab = it.

Read only

0 Likes
2,868

@manoj16393 use this code

Read only

0 Likes
2,868

Thank you i am getting output

Read only

0 Likes
2,868

for above code i am not getting output.

i have used parameters if i enter value in parameters then i will get output.

after output displayes if i click on execute above output apperies

Read only

Former Member
2,868

Hi Manoj,

Please share the dump details also before share to correct fieldcatlog values in capital letter ( ex. fieldname, tabname etc., )

Read only

Former Member
0 Likes
2,868

@manoj16393 in the columns that you were filling for your ALV , you must use fieldnames of the structure.

TYPES: BEGIN OF manoj,

client TYPE usr02-mandt,

name TYPE usr02-bname,

validfrom TYPE usr02-gltgv,

validto TYPE usr02-gltgb,

userlock TYPE usr02-uflag,

END OF manoj.

Read only

0 Likes
2,868

CAN U SHOW SAME CODE

Read only

former_member622718
Participant
0 Likes
2,868

REPORT zmanoj6.

TABLES mara.

TYPE-POOLS:slis.



TYPES: BEGIN OF manoj,

         serverclient    TYPE usr02-mandt,

         name      TYPE usr02-bname,

         validfrom TYPE usr02-gltgv,

         validto   TYPE usr02-gltgb,

         userlock  TYPE usr02-uflag,

       END OF manoj.





DATA : it      TYPE TABLE OF manoj,

       wa      TYPE manoj,

       it_fcat TYPE slis_t_fieldcat_alv,

       wa_fcat LIKE LINE OF it_fcat.





PARAMETERS name TYPE usr02-bname.



SELECT mandt bname gltgv gltgb uflag FROM usr02 INTO TABLE it WHERE bname = name.



wa_fcat-col_pos = '1' .

wa_fcat-fieldname = 'MANDT' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'SERVERCLIENT' .

wa_fcat-key = 'X' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .



wa_fcat-col_pos = '2' .

wa_fcat-fieldname = 'BNAME' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'NAME' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .



wa_fcat-col_pos = '3' .

wa_fcat-fieldname = 'GLTGV' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'VALIDFROM' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .







wa_fcat-col_pos = '4' .

wa_fcat-fieldname = 'GLTGB' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'VALIDTO' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .



wa_fcat-col_pos = '5' .

wa_fcat-fieldname = 'UFLAG' .

wa_fcat-tabname = 'IT' .

wa_fcat-seltext_m = 'USERLOCK' .

wa_fcat-hotspot = 'X' .

APPEND wa_fcat TO it_fcat .

CLEAR wa_fcat .



CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

  EXPORTING

    i_callback_program = sy-repid

    it_fieldcat        = it_fcat

  TABLES

    t_outtab        
Read only

Sandra_Rossi
Active Contributor
0 Likes
2,868

Enter the values of fields FIELDNAME and TABNAME in UPPER CASE (*).

(by the way you don't need to use TABNAME, and COL_POS is useless because by default the order of lines of the field catalog corresponds by default to the order of columns... and REUSE_ALV_GRID_DISPLAY has been superseded by CL_SALV_TABLE fifteen years ago).

(*) probably you had a short dump GETWA_NOT_ASSIGNED (field symbol not assigned) during the execution of REUSE_ALV_GRID_DISPLAY, but next time you ask something, please share all relevant information, like the short dump itself! (as already asked by karthikeyan.s4)

Read only

0 Likes
2,868

Hi Manoj,

As you used parameters, you will not get any data if you don't enter any value in the selection screen. If you pass the parameters in the where condition it checks for the exact match and in your case as you didn't enter any value you didn't any output.

You can use select-options with no intervals and no-extensions.

Ex: select-options name for wa-name no intervals no-extensions.

And in your select query

SELECT mandt bname gltgv gltgb uflag FROM usr02 INTO TABLE it WHERE bname IN name.

Note: In this case, this select query will fetch complete table data of usr02 if you do not pass any value in the selection screen