‎2008 Nov 11 12:51 PM
the program is throwing a dump when sort is used if we comment the sort fields the prog is running fine.
REPORT zdan_demo.
TYPE-POOLS : slis.
TABLES : ekpo,lips.
TYPES : BEGIN OF ty_ekpo,
ebeln TYPE ekpo-ebeln, " PO
ebelp TYPE ekpo-ebelp," PO Item
bukrs TYPE ekpo-bukrs, " Company Code
END OF ty_ekpo.
TYPES : BEGIN OF ty_t001,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
END OF ty_t001.
TYPES : BEGIN OF ty_lips,
vbeln TYPE lips-vbeln," Delivery
posnr TYPE lips-posnr," Delivery Item
vgbel TYPE lips-vgbel," PO
vgpos TYPE lips-vgpos," PO item
lfimg TYPE lips-lfimg," Quantity
j_3asize TYPE lips-j_3asize, " Grid Value
END OF ty_lips.
TYPES : BEGIN OF ty_vttp,
vbeln TYPE vttp-vbeln," Delivery
tknum TYPE vttp-tknum," Shipment Number
END OF ty_vttp.
TYPES : BEGIN OF ty_final,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
vbeln TYPE lips-vbeln,
lfimg TYPE lips-lfimg,
vlfimg1 TYPE lips-lfimg,
j_3asize TYPE lips-j_3asize,
tknum TYPE vttp-tknum,
END OF ty_final.
DATA : it_ekpo TYPE TABLE OF ty_ekpo,
wa_ekpo LIKE LINE OF it_ekpo,
it_t001 TYPE TABLE OF ty_t001,
wa_t001 LIKE LINE OF it_t001,
it_lips TYPE TABLE OF ty_lips,
wa_lips LIKE LINE OF it_lips,
it_vttp TYPE TABLE OF ty_vttp,
wa_vttp LIKE LINE OF it_vttp,
it_final TYPE TABLE OF ty_final,
wa_final LIKE LINE OF it_final,
vbutxt TYPE t001-butxt.
DATA : it_fclog TYPE slis_t_fieldcat_alv,
wa_fclog LIKE LINE OF it_fclog,
it_sort TYPE slis_t_sortinfo_alv,
wa_sort LIKE LINE OF it_sort,
gd_layout TYPE slis_layout_alv,
gd_print TYPE slis_print_alv,
gd_repid LIKE sy-repid,
gt_events TYPE slis_t_event.
SELECTION-SCREEN BEGIN OF BLOCK sodisp WITH FRAME TITLE text-001.
PARAMETERS p_org TYPE ekpo-bukrs OBLIGATORY.
SELECT-OPTIONS: ponum FOR ekpo-ebeln.
SELECTION-SCREEN END OF BLOCK sodisp.
PERFORM data_retv.
PERFORM fclog.
PERFORM blayout.
PERFORM disp_rpt.
FORM data_retv.
SELECT ebeln ebelp bukrs
FROM ekpo
INTO TABLE it_ekpo
WHERE ebeln IN ponum
AND bukrs = p_org.
SORT it_ekpo BY ebeln ebelp.
delete ADJACENT DUPLICATES FROM it_ekpo.
SELECT bukrs butxt
FROM t001
INTO TABLE it_t001
FOR ALL ENTRIES IN it_ekpo
WHERE bukrs EQ it_ekpo-bukrs.
SELECT vbeln posnr vgbel vgpos lfimg j_3asize
FROM lips
INTO TABLE it_lips
FOR ALL ENTRIES IN it_ekpo
WHERE vgbel EQ it_ekpo-ebeln
AND lfimg <> 0.
SORT it_lips BY vbeln vgbel vgpos lfimg .
SELECT vbeln tknum
FROM vttp
INTO TABLE it_vttp
FOR ALL ENTRIES IN it_lips
WHERE vbeln EQ it_lips-vbeln.
LOOP AT it_ekpo INTO wa_ekpo .
LOOP AT it_lips INTO wa_lips WHERE vgbel = wa_ekpo-ebeln AND vgpos = wa_ekpo-ebelp.
wa_final-ebeln = wa_ekpo-ebeln.
wa_final-ebelp = wa_ekpo-ebelp.
wa_final-vbeln = wa_lips-vbeln.
wa_final-lfimg = wa_lips-lfimg.
wa_final-j_3asize = wa_lips-j_3asize.
loop at it_vttp INTO wa_vttp where vbeln = wa_lips-vbeln.
wa_final-tknum = wa_vttp-tknum.
IF wa_vttp-tknum IS INITIAL.
wa_final-vlfimg1 = ' '.
ELSE.
wa_final-vlfimg1 = wa_lips-lfimg.
ENDIF.
ENDLOOP.
APPEND wa_final TO it_final.
CLEAR: wa_final.
ENDLOOP.
ENDLOOP.
ENDFORM.
FORM set_status USING rt_extab TYPE slis_t_extab .
SET PF-STATUS 'DISP_STAT'.
ENDFORM. "set_status
FORM disp_rpt.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_user_command = 'USER_COMMAND'
is_print = gd_print
i_callback_pf_status_set = 'SET_STATUS'
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
is_layout = gd_layout
it_fieldcat = it_fclog[]
it_sort = it_sort[]
i_save = 'A'
TABLES
t_outtab = it_final[].
ENDFORM. " DISPLAY_ALV_REPORT
&----
*& Form fclog
&----
text
----
FORM fclog.
wa_sort-fieldname = 'EBELN'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
wa_sort-group = 'UL'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_sort-fieldname = 'EBELP'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
wa_sort-group = 'UL'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_sort-fieldname = 'VBELN'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
wa_sort-group = 'UL'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_fclog-fieldname = 'EBELN'.
wa_fclog-tabname = 'IT_FINAL'.
wa_fclog-seltext_m = 'PO'.
wa_fclog-outputlen = 15.
wa_fclog-col_pos = 2.
APPEND wa_fclog TO it_fclog.
CLEAR wa_fclog.
wa_fclog-fieldname = ' EBELP'.
wa_fclog-tabname = 'IT_FINAL'.
wa_fclog-seltext_m = 'PO Item'.
wa_fclog-outputlen = 20.
wa_fclog-col_pos = 3.
APPEND wa_fclog TO it_fclog.
CLEAR wa_fclog.
wa_fclog-fieldname = 'VBELN'.
wa_fclog-tabname = 'IT_FINAL'.
wa_fclog-seltext_m = ' Delivery Number'.
wa_fclog-outputlen = 15.
wa_fclog-col_pos = 4.
APPEND wa_fclog TO it_fclog.
CLEAR wa_fclog.
wa_fclog-fieldname = 'J_3ASIZE'.
wa_fclog-tabname = 'IT_FINAL'.
wa_fclog-seltext_m = 'Grid Value'.
wa_fclog-outputlen = 20.
wa_fclog-col_pos = 5.
APPEND wa_fclog TO it_fclog.
CLEAR wa_fclog.
wa_fclog-fieldname = 'LFIMG'.
wa_fclog-tabname = 'IT_FINAL'.
wa_fclog-seltext_m = 'Grid Value Quantity'.
wa_fclog-outputlen = 20.
wa_fclog-col_pos = 6.
APPEND wa_fclog TO it_fclog.
CLEAR wa_fclog.
wa_fclog-fieldname = 'TKNUM'.
wa_fclog-tabname = 'IT_FINAL'.
wa_fclog-seltext_m = 'Shipment Number'.
wa_fclog-outputlen = 20.
wa_fclog-col_pos = 10.
APPEND wa_fclog TO it_fclog.
CLEAR wa_fclog.
wa_fclog-fieldname = 'VLFIMG1'.
wa_fclog-tabname = 'IT_FINAL'.
wa_fclog-seltext_m = 'Shipment Quantity'.
wa_fclog-outputlen = 20.
wa_fclog-col_pos = 12.
wa_fclog-no_zero = 'X'.
APPEND wa_fclog TO it_fclog.
CLEAR wa_fclog.
ENDFORM. "fclog
FORM blayout.
gd_print-no_coverpage = 'X'.
gd_print-no_print_listinfos = 'X'.
ENDFORM. "blayout
FORM top-of-page.
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
SELECT SINGLE butxt
INTO vbutxt
from t001
where bukrs = p_org.
CONCATENATE 'Shipment Quantity Against Delivery For : ' '' INTO wa_header-info.
wa_header-typ = 'H'.
APPEND wa_header TO t_header.
CONCATENATE '' vbutxt INTO wa_header-info.
wa_header-typ = 'H'.
APPEND wa_header TO t_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
ENDFORM. "top-of-page
‎2008 Nov 11 12:57 PM
Tell us more about that dump if you expect precise answers. Title, error analysis?
Thomas
‎2008 Nov 11 1:03 PM
it says.
Runtime Errors MESSAGE_TYPE_X
Short text
The current application triggered a termination with a short dump.
What happened?
The current application program detected a situation which really
should not occur. Therefore, a termination with a short dump was
triggered on purpose by the key word MESSAGE (type X).
Error analysis
Short text of error message:
Long text of error message:
Technical information about the message:
Message class....... "0K"
Number.............. 000
Variable 1.......... " "
Variable 2.......... " "
Variable 3.......... " "
Variable 4.......... " "
Trigger Location of Runtime Error
Program SAPLSLVC
Include LSLVCU10
Row 36
Module type (FUNCTION)
Module Name LVC_SORT_COMPLETE
*" CHANGING
*" VALUE(CT_SORT) TYPE LVC_T_SORT
*"----
8 *"----
9
10 FIELD-SYMBOLS: <LS_FIELDCAT> TYPE LVC_S_FCAT.
11 DATA: LS_SORT TYPE LVC_S_SORT.
12 DATA: LFLG_MODIFY(1) TYPE C.
13 DATA: LFLG_EXPA_DEFAULT_SET(1) TYPE C.
14 DATA: L_COUNT LIKE SY-TABIX.
15
16 SORT IT_FIELDCAT BY FIELDNAME.
17 SORT CT_SORT STABLE BY SPOS ASCENDING.
18 LOOP AT CT_SORT INTO LS_SORT.
19 LS_SORT-SPOS = SY-TABIX.
20 MODIFY CT_SORT FROM LS_SORT.
21 ENDLOOP.
22
23 SORT CT_SORT BY SPOS DESCENDING.
24
25 * Default settings for subtotals
26 READ TABLE CT_SORT WITH KEY COMP = 'X' TRANSPORTING N
27 IF SY-SUBRC NE 0.
28 LFLG_MODIFY = 'X'.
29 ENDIF.
30
31 LOOP AT CT_SORT INTO LS_SORT.
32
33 READ TABLE IT_FIELDCAT ASSIGNING <LS_FIELDCAT>
34 WITH KEY FIELDNAME = LS_SORT-FIELDNAME BINARY
35 IF SY-SUBRC NE 0.
>>>>> MESSAGE X000(0K).
37 ENDIF.
38
39 LS_SORT-SELTEXT = <LS_FIELDCAT>-SELTEXT.
40
41 * Zwischensummenstufen ermitteln
42 IF NOT LS_SORT-SUBTOT IS INITIAL.
43 L_COUNT = L_COUNT + 1.
44 ENDIF.
45
46 IF L_COUNT = 1 AND LFLG_EXPA_DEFAULT_SET = 'X'.
47 LS_SORT-EXPA = 'X'.
48 ENDIF.
49 * Default setzten (s.o.)
50 IF LFLG_MODIFY = 'X'.
51 LS_SORT-COMP = 'X'.
52 ENDIF.
53
54 MODIFY CT_SORT FROM LS_SORT.
55 ENDLOOP.
‎2008 Nov 11 12:58 PM
Try passing the internal table name as well to the sort internal fields (for all the 3 fields)
‎2008 Nov 11 1:05 PM
‎2008 Nov 11 1:35 PM
this line needs correction:
wa_fclog-fieldname = ' EBELP'.
there is an extra space just before EBELP (after the apostrophe)
PS.: pls. use the code tags next time!
‎2008 Nov 11 2:20 PM
‎2008 Nov 12 4:57 AM
hi,
I think, Entries is not there in field catalog table which fields are in sorting table.So, Debug your program and Check internal table entries for field catalog and sorting internal tables before display the grid.