‎2007 Jun 05 5:15 AM
Hi experts,
i m getting a error when i m populating the internal table.
in debugging it showing all records comming in proper way but in final i m getting a error in form of dump.
error is::::
The lines of source code must not be longer than the width of the
internal table. The internal table is 72 characters wide. The source
code line is 76 wide.
::::::::::::::::::::::::::::::
my code is :
REPORT ZQMR_MIXDESIGN NO STANDARD PAGE HEADING LINE-SIZE 255 LINE-COUNT 65.
----
DECLARATION FOR TABLE
----
TABLES: MAST,STPO,MAKT,STKO.
----
Type-pools
----
Type pools for ALV display
TYPE-POOLS: SLIS.
----
Global variables
----
data: G_REPID LIKE SY-REPID,
G_EVENTS TYPE SLIS_T_EVENT,
G_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
G_EXIT_CAUSED_BY_CALLER,
G_EXIT_CAUSED_BY_USER TYPE SLIS_EXIT_BY_USER,
G_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
*g_variant like disvariant.
*G_SAVE.
----
Declaration for Constants
----
CONSTANTS : C_X TYPE C VALUE 'X', " Flag
C_C TYPE C VALUE 'C', " Flag
C_L TYPE C VALUE 'L', " Flag
C_A TYPE C VALUE 'A', " Line Type
C_H TYPE C VALUE 'H', " Dr/Cr
C_S TYPE C VALUE 'S'. " Line Type
----
Declaration of Internal Tables
----
DATA: BEGIN OF T_MAST OCCURS 0,
MATNR LIKE MAST-MATNR,
WERKS LIKE MAST-WERKS,
STLAN LIKE MAST-STLAN,
STLNR LIKE MAST-STLNR,
STLAL LIKE MAST-STLAL,
ANDAT LIKE MAST-ANDAT,
END OF T_MAST.
*DATA: T_MAST LIKE MAST OCCURS 0 WITH HEADER LINE.
Internal Table for STPO Table data
DATA: BEGIN OF T_STPO OCCURS 0,
STLTY LIKE STPO-STLTY,
STLNR LIKE STPO-STLNR,
ANDAT LIKE STPO-ANDAT,
IDNRK LIKE STPO-IDNRK,
MEINS LIKE STPO-MEINS,
MENGE LIKE STPO-MENGE,
MENGE1 LIKE STPO-MENGE,
MENGE1 LIKE STPO-MENGE,
MENGE1 LIKE STPO-MENGE,
END OF T_STPO.
DATA: BEGIN OF T_MAKT OCCURS 0,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
END OF T_MAKT.
*DATA: BEGIN OF T_STKO OCCURS 0,
STLTY LIKE STKO-STLTY,
STLNR LIKE STKO-STLNR,
STKTX
DATA: BEGIN OF T_FINAL OCCURS 0,
IDNRK LIKE STPO-IDNRK,
MAKTX LIKE MAKT-MAKTX,
MEINS LIKE STPO-MEINS,
MENGE1 LIKE STPO-MENGE,
MENGE2 LIKE STPO-MENGE,
MENGE3 LIKE STPO-MENGE,
MENGE4 LIKE STPO-MENGE,
END OF T_FINAL.
* Internal table to hold field catgory data
DATA: I_FLDCAT TYPE SLIS_T_FIELDCAT_ALV. " Table - field catgory
Internal table to hold Sort/Subtotals criteria data
DATA: I_SORT TYPE SLIS_T_SORTINFO_ALV. " Table - sort/Subtotals
----
Structure
----
DATA: X_LAYOUT TYPE SLIS_LAYOUT_ALV, " Structure-layout
X_FLDCAT LIKE LINE OF I_FLDCAT, " Structure-field catagory
X_SORT LIKE LINE OF I_SORT. " Structure-Sort/Subtotals
----
Selection screen
----
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-050.
PARAMETERS: MATNR LIKE MAST-MATNR OBLIGATORY,
WERKS LIKE MAST-WERKS OBLIGATORY,
STLAN LIKE MAST-STLAN.
SELECT-OPTIONS:
STLAL FOR MAST-STLAL.
SELECTION-SCREEN : END OF BLOCK B1.
----
Initialization
----
INITIALIZATION.
g_repid = sy-repid.
perform layout_init using x_layout.
perform eventtab_build using g_events[].
g_save = 'A'.
----
At selection screen
----
AT SELECTION-SCREEN.
Validation of Selection Screen Fields
PERFORM VALIDATE_SCREEN.
----
Start of selection
----
START-OF-SELECTION.
Read Data from Database Tables
PERFORM READ_DATA.
----
End of selection
----
END-OF-SELECTION.
Build layout report layout.
PERFORM populate_layout_stucture.
Perform build_field_catalog and Sort Table
PERFORM BUILD_FIELD_CATALOG.
PERFORM BUILD_SORT_TOTALS.
List Header for Top-Of-Page
PERFORM COMMENT_BUILD USING G_LIST_TOP_OF_PAGE[].
Call list viewer function module
PERFORM CALL_LIST_VIEWER .
****************Form - Routines**************************************
----
Form : layout_init
Description : Form to Build layout for list display
----
form layout_init using rs_layout type slis_layout_alv.
rs_layout-detail_popup = c_x.
endform. "layout_init
----
Form : Eventtab_build
Description : Registration of events to happen during list display
----
FORM EVENTTAB_BUILD USING RT_EVENTS TYPE SLIS_T_EVENT.
Registration of events to happen during list display
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = rt_events.
read table rt_events with key name = slis_ev_top_of_page
into ls_event.
if sy-subrc = 0.
move g_top_of_page to ls_event-form.
append ls_event to rt_events.
endif.
endform. "eventtab_build
----
Form : top_of_page
----
*
form TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = g_list_top_of_page.
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
.
endform. "top_of_page
----
Form validate_screen
----
Validation of Selection Screen fields
----
form VALIDATE_SCREEN.
Validation of Session Start Date
CLEAR MAST.
IF NOT MATNR IS INITIAL.
SELECT SINGLE MATNR
INTO MAST-MATNR
FROM MAST
WHERE MATNR EQ MATNR.
IF SY-SUBRC <> 0.
MESSAGE 'Enter Valid Material Number' type 'E'.
ENDIF.
ENDIF.
Validation of Plant code
CLEAR MAST.
IF NOT WERKS IS INITIAL.
SELECT SINGLE WERKS
INTO MAST-WERKS
FROM MAST
WHERE WERKS EQ WERKS.
IF SY-SUBRC <> 0.
MESSAGE 'Enter Valid Plant' TYPE 'E'.
ENDIF.
ENDIF.
CLEAR MAST.
IF NOT STLAN IS INITIAL.
SELECT SINGLE STLAN
INTO MAST-STLAN
FROM MAST
WHERE STLAN EQ STLAN.
IF SY-SUBRC <> 0.
MESSAGE 'Enter Valid Usage' TYPE 'E'.
ENDIF.
endif.
CLEAR MAST.
IF NOT STLAL IS INITIAL.
SELECT STLAL
INTO MAST-STLAL
FROM MAST
WHERE STLAL IN STLAL.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE 'Enter Valid Alternative BOM' TYPE 'E'.
ENDIF.
ENDIF.
endform. "validate_screen
&----
*& Form read_data
&----
Read the Data from the database Tables
----
form read_data.
Selection Screen
CLEAR T_MAST.
REFRESH T_MAST.
SELECT MATNR WERKS STLAN STLNR STLAL ANDAT
INTO CORRESPONDING FIELDS OF TABLE T_MAST
FROM MAST
WHERE MATNR = MATNR
AND WERKS = WERKS
and STLAN = STLAN
AND STLAL IN STLAL.
if sy-subrc <> 0.
message 'No data found' type 'I'.
stop.
endif.
SORT T_MAST BY MATNR WERKS STLAN STLAL.
IF NOT T_MAST[] IS INITIAL.
CLEAR T_STPO.
REFRESH T_STPO.
SELECT
STLTY
STLNR
ANDAT
IDNRK
MEINS
MENGE
INTO TABLE T_STPO
FROM STPO
FOR ALL ENTRIES IN T_MAST
WHERE STLNR = T_MAST-STLNR.
ENDIF.
SORT T_STPO BY STLTY STLNR ANDAT IDNRK.
IF NOT T_MAST[] IS INITIAL.
CLEAR T_MAKT.
REFRESH T_MAKT.
SELECT MATNR MAKTX INTO
TABLE T_MAKT
FROM MAKT
FOR ALL ENTRIES IN T_MAST
WHERE MATNR = T_MAST-MATNR.
ENDIF.
LOOP AT T_MAST .
READ TABLE T_STPO WITH KEY STLNR = T_MAST-STLNR
ANDAT = T_MAST-ANDAT BINARY SEARCH.
IF SY-SUBRC = 0.
T_FINAL-IDNRK = T_STPO-IDNRK.
T_FINAL-MEINS = T_STPO-MEINS.
ENDIF.
READ TABLE T_MAKT WITH KEY MATNR = T_MAST-MATNR BINARY SEARCH.
IF SY-SUBRC = 0.
T_FINAL-MAKTX = T_MAKT-MAKTX.
ENDIF.
ENDLOOP.
endform. "Read Data
----
Form : populate_layout_stucture
Description : Populating the layout structure
----
form populate_layout_stucture.
clear x_layout .
Layout properties
x_layout-zebra = c_x.
x_layout-detail_popup = c_x.
x_layout-detail_initial_lines = c_x.
x_layout-colwidth_optimize = c_x.
endform. " populate_layout_stucture
----
Form : build_field_catalog
Description : Building the field catalog data
----
form build_field_catalog.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = g_repid
I_INTERNAL_TABNAME = 'T_FINAL'
I_INCLNAME = g_repid
CHANGING
CT_FIELDCAT = i_fldcat
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.
Getting the Header text for the coloums
loop at i_fldcat into x_fldcat where
fieldname = 'IDNRK' or
fieldname = 'MAKTX' or
fieldname = 'MEINS'." or
fieldname = 'MENGE1' or
fieldname = 'MENGE2' or
fieldname = 'MENGE3' or
fieldname = 'MENGE4' .
*
if x_fldcat-fieldname = 'IDNRK'.
x_fldcat-seltext_l = 'COMPONENT'.
x_fldcat-seltext_m = 'COMPONENT'.
x_fldcat-seltext_s = 'COMPONENT'.
x_fldcat-reptext_ddic = 'COMPONENT'.
x_fldcat-inttype = c_c.
endif.
if x_fldcat-fieldname = 'MAKTX'.
x_fldcat-seltext_l = 'COMPONENT DESCRIPTION'.
x_fldcat-seltext_m = 'COMPONENT DESCRIPTION'.
x_fldcat-seltext_s = 'COMPONENT DESCRIPTION'.
x_fldcat-reptext_ddic = 'COMPONENT DESCRIPTION'.
x_fldcat-inttype = c_c.
endif.
if x_fldcat-fieldname = 'MEINS'.
x_fldcat-seltext_l = 'UOM'.
x_fldcat-seltext_m = 'UOM'.
x_fldcat-seltext_s = 'UOM'.
x_fldcat-reptext_ddic = 'UOM'.
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'MENGE1'.
x_fldcat-seltext_l = 'ALT BOM1'.
x_fldcat-seltext_m = 'ALT BOM1'.
x_fldcat-seltext_s = 'ALT BOM1'.
x_fldcat-reptext_ddic = 'ALT BOM1'.
x_fldcat-ddictxt = c_l.
endif.
*
if x_fldcat-fieldname = 'MENGE2'.
x_fldcat-seltext_l = 'ALT BOM2'.
x_fldcat-seltext_m = 'ALT BOM2'.
x_fldcat-seltext_s = 'ALT BOM2'.
x_fldcat-reptext_ddic = 'ALT BOM2'.
x_fldcat-ddictxt = c_l.
endif.
*
if x_fldcat-fieldname = 'MENGE3'.
x_fldcat-seltext_l = 'ALT BOM3'.
x_fldcat-seltext_m = 'ALT BOM3'.
x_fldcat-seltext_s = 'ALT BOM3'.
x_fldcat-reptext_ddic = 'ALT BOM3'.
x_fldcat-ddictxt = c_l.
endif.
*
if x_fldcat-fieldname = 'MENGE4'.
x_fldcat-seltext_l = 'ALT BOM4'.
x_fldcat-seltext_m = 'ALT BOM4'.
x_fldcat-seltext_s = 'ALT BOM4'.
x_fldcat-reptext_ddic = 'ALT BOM4'.
x_fldcat-ddictxt = c_l.
endif.
*
*
modify i_fldcat from x_fldcat index sy-tabix.
endloop.
endform. " build_field_catalog
----
Form : build_sort_totals
Description : Building the Criteria for Sort/Subtotals
----
form build_sort_totals.
x_sort-fieldname = 'IDNRK'.
x_sort-tabname = 'T_FINAL'.
x_sort-spos = 1.
x_sort-up = c_x.
*x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
x_sort-fieldname = 'MAKTX'.
x_sort-tabname = 'T_FINAL'.
x_sort-spos = 2.
x_sort-up = c_x.
*x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
x_sort-fieldname = 'MEINS'.
x_sort-tabname = 'T_FINAL'.
x_sort-spos = 3.
x_sort-up = c_x.
*x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
x_sort-fieldname = 'MENGE1'.
x_sort-tabname = 'T_FINAL'.
x_sort-spos = 4.
x_sort-up = c_x.
**x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
*
x_sort-fieldname = 'MENGE2'.
x_sort-tabname = 'T_FINAL'.
x_sort-spos = 5.
x_sort-up = c_x.
**x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
*
x_sort-fieldname = 'MENGE3'.
x_sort-tabname = 'T_FINAL'.
x_sort-spos = 6.
x_sort-up = c_x.
**x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
*
x_sort-fieldname = 'MENGE4'.
x_sort-tabname = 'T_FINAL'.
x_sort-spos = 7.
x_sort-up = c_x.
**x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
x_sort-fieldname = 'CONSUM'.
x_sort-tabname = 'T_ZPMT_FFM'.
x_sort-spos = 8.
x_sort-up = c_x.
x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
*
x_sort-fieldname = 'ZS_LATITUDE'.
x_sort-tabname = 'T_ZPMT_FFM'.
x_sort-spos = 9.
x_sort-up = c_x.
**x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
*
x_sort-fieldname = 'ZE_LATITUDE'.
x_sort-tabname = 'T_ZPMT_FFM'.
x_sort-spos = 10.
x_sort-up = c_x.
**x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
*
x_sort-fieldname = 'ZS_LONGITUDE'.
x_sort-tabname = 'T_ZPMT_FFM'.
x_sort-spos = 11.
x_sort-up = c_x.
**x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
*
x_sort-fieldname = 'ZE_LONGITUDE'.
x_sort-tabname = 'T_ZPMT_FFM'.
x_sort-spos = 12.
x_sort-up = c_x.
**x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
endform. " build_sort_totals
----
Form : comment_build
Description : This form is used to display the Report Header(ALV)
----
*
form comment_build using lt_top_of_page type
slis_t_listheader.
data: l_line type slis_listheader,
l_heading1 like rs38m-repti.
clear l_line.
l_heading1 = 'Fuel Consumption Report'.
g_repid = sy-repid.
l_line-typ = c_h.
move l_heading1 to l_line-info.
append l_line to lt_top_of_page.
DATA: GD_DATE(10), HD_DATE(10).
*
l_line-TYP = c_s.
IF date-LOW IS NOT INITIAL AND date-HIGH IS NOT INITIAL.
WRITE date-LOW TO GD_DATE DD/MM/YYYY.
WRITE date-HIGH TO HD_DATE DD/MM/YYYY.
CONCATENATE 'Date From :' GD_DATE 'to' HD_DATE INTO l_line-INFO
SEPARATED BY SPACE.
append l_line to lt_top_of_page.
endif.
CLEAR: l_line, GD_DATE, HD_DATE .
*
l_line-TYP = c_s.
concatenate ' Plant : ' Plant-low
' To: ' Plant-high into l_line-info.
append l_line to lt_top_of_page.
endform. "comment_build
----
Form : call_list_viewer
Description : This form is used to display the grid through ALV
----
form call_list_viewer.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = g_repid
IS_LAYOUT = x_layout
IT_FIELDCAT = i_fldcat[]
IT_SORT = i_sort[]
I_DEFAULT = c_x
I_SAVE = g_save
IT_EVENTS = g_events[]
IMPORTING
E_EXIT_CAUSED_BY_CALLER = g_exit_caused_by_caller
ES_EXIT_CAUSED_BY_USER = g_exit_caused_by_user
TABLES
T_OUTTAB = T_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
write: / 'Problem in calling the ALV report'(042).
ENDIF.
endform. " call_list_viewer
please suggest me the solution*
thanks in advance
regards
vijay
points will be sure for all helpfull answer*
‎2007 Jun 05 5:25 AM
Hi,
Just write the REPORT statement in 2 lines instead of a single line like follows .
REPORT ZQMR_MIXDESIGN NO STANDARD PAGE HEADING
LINE-SIZE 255 LINE-COUNT 65.
This will solve the problem of short dump.
The cause for this is that REPORT statement is taking 76 characters while maximum allowed length of report while reading it into an internal table is 72 chars.
In the dump, u will see that the report is being read into the internal table where it fails and gives dump.
Regards,
Himanshu.
‎2007 Jun 05 5:20 AM
Hi Vijay ,
At which statement are you getting the dump , my assumption is that the dump must be on some select statement.
I executed your program in my system but it did not give any dump.
Regards
Arun
Message was edited by:
Arun R
‎2007 Jun 05 5:23 AM
Hi,
Maybe you should show out the dump place.
Pls using ST22 get your dump and take the dump place here.
Bob
‎2007 Jun 05 5:25 AM
Hi,
Just write the REPORT statement in 2 lines instead of a single line like follows .
REPORT ZQMR_MIXDESIGN NO STANDARD PAGE HEADING
LINE-SIZE 255 LINE-COUNT 65.
This will solve the problem of short dump.
The cause for this is that REPORT statement is taking 76 characters while maximum allowed length of report while reading it into an internal table is 72 chars.
In the dump, u will see that the report is being read into the internal table where it fails and gives dump.
Regards,
Himanshu.
‎2007 Jun 05 5:29 AM
Hi Vijay,
Please check the use of assigning value to the header and not using it T_FINAL.
LOOP AT T_MAST .
READ TABLE T_STPO WITH KEY STLNR = T_MAST-STLNR
ANDAT = T_MAST-ANDAT BINARY SEARCH.
IF SY-SUBRC = 0.
T_FINAL-IDNRK = T_STPO-IDNRK.
T_FINAL-MEINS = T_STPO-MEINS.
ENDIF.
READ TABLE T_MAKT WITH KEY MATNR = T_MAST-MATNR BINARY SEARCH.
IF SY-SUBRC = 0.
T_FINAL-MAKTX = T_MAKT-MAKTX.
ENDIF.
ENDLOOP.
Regards,
George
‎2007 Jun 05 5:32 AM
Hi,
I runned the report you give out, and in my system it is also dump.
The reason is in your report, the header line is too long.
modify this way:
REPORT ZQMR_MIXDESIGN NO STANDARD PAGE HEADING
LINE-SIZE 255 LINE-COUNT 65.
Hope this helps
Bob