07-12-2007 10:43 AM
hi
i have written the following code for alv report ..but it is going to short dump
i could not trace error ..please help me..
&----
*& Report YHARI_ALV_REP
*&
&----
*&
*&
&----
REPORT YHARI_ALV_REP NO STANDARD PAGE HEADING .
TYPE-POOLS : SLIS.
TABLES : VBAK , VBAP .
DATA : BEGIN OF I_VBAP OCCURS 100,
VBELN LIKE VBAK-VBELN ,
POSNR LIKE VBAP-POSNR ,
MATNR LIKE VBAP-MATNR ,
MATKL LIKE VBAP-MATKL ,
ARKTX LIKE VBAP-ARKTX ,
END OF I_VBAP.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
PERFORM GET_DATA.
PERFORM BUID_FIELDCAT.
PERFORM DISP_DATA.
&----
*& Form GET_DATA
&----
text
----
--> p1 text
<-- p2 text
----
FORM GET_DATA .
SELECT VBELN POSNR MATNR MATKL ARKTX
INTO TABLE I_VBAP
FROM VBAP
WHERE VBELN IN S_VBELN.
ENDFORM. " GET_DATA
&----
*& Form BUID_FIELDCAT
&----
text
----
--> p1 text
<-- p2 text
----
FORM BUID_FIELDCAT .
DATA : L_REPID LIKE SY-REPID.
L_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = L_REPID
I_INTERNAL_TABNAME = 'I_VBAP'
I_STRUCTURE_NAME = L_REPID
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " BUID_FIELDCAT
&----
*& Form DISP_DATA
&----
text
----
--> p1 text
<-- p2 text
----
FORM DISP_DATA .
DATA : L1_REPID LIKE SY-REPID.
L1_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = L1_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = IT_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = I_VBAP
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.
ENDFORM. " DISP_DATA
07-12-2007 10:50 AM
i think this is because
I_STRUCTURE_NAME = L_REPID
here you have to define the database structure if you want to build field catalog of that database structure. Instead do like this.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = L_REPID
I_INTERNAL_TABNAME = 'I_VBAP'
*I_STRUCTURE_NAME = L_REPID
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = L_REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
also check by putting break point whether field catlog is genarated by this fn module or not if not try to create manually.
regards
shiba dutta
07-12-2007 10:45 AM
Hi,
It is because of TYPE CONFLICT in variable or data passing to the FM.
REUSE_ALV_FIELDCATALOG_MERGE
I_STRUCTURE_NAME = 'I_VBAP'
Do it like this.
Reward if useful!
07-12-2007 10:47 AM
check this also,
Supports the creation of the field catalog for the ALV function modules based either on a structure or table defined in the ABAP Data Dictionary, or a program-internal table.
The program-internal table must either be in a TOP Include or its Include must be specified explicitly in the interface.
The variant based on a program-internal table should only be used for rapid prototyping since the following restrictions apply:
Performance is affected since the code of the table definition must always be read and interpreted at runtime.
Dictionary references are only considered if the keywords LIKE or INCLUDE STRUCTURE (not TYPE) are used.
If the field catalog contains more than 90 fields, the first 90 fields are output in the list by default whereas the remaining fields are only available in the field selection.
If the field catalog is passed with values, they are merged with the 'automatically' found information.
Reward if useful!
07-12-2007 10:48 AM
Hi singam,
Please go to transaction st22 and see the description of the dump and try to solve it.If u still can;t do it, post the description(what caused the dump).
Regards,
prasant
07-12-2007 10:50 AM
i think this is because
I_STRUCTURE_NAME = L_REPID
here you have to define the database structure if you want to build field catalog of that database structure. Instead do like this.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = L_REPID
I_INTERNAL_TABNAME = 'I_VBAP'
*I_STRUCTURE_NAME = L_REPID
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = L_REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
also check by putting break point whether field catlog is genarated by this fn module or not if not try to create manually.
regards
shiba dutta
07-12-2007 11:08 AM
Hi,
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = L_REPID
I_INTERNAL_TABNAME = 'I_VBAP'
I_STRUCTURE_NAME = L_REPID
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
Pass table name and structure values are like this.
I_INTERNAL_TABNAME = i_vbapmain
I_STRUCTURE_NAME = i_vbapstr
declare as
data : i_vbapmain TYPE dd02l-tabname VALUE 'I_VBAP',
i_vbapstr type dd02l-tabname value 'I_VBAP'.
try out this.
Thanks,