‎2008 Jun 30 4:27 PM
Hi all,
While clicking the cutomer no to get the order details am getting run time error. Your help will be rewarded.
REPORT Z_INTERACTIVE_ALV.
TYPE-POOLS : SLIS.
TABLES : KNA1.
TYPES : BEGIN OF TY_KNA1,
KUNNR TYPE KUNNR,
NAME1 TYPE NAME1,
ORT01 TYPE ORT01,
LAND1 TYPE LAND1,
END OF TY_KNA1.
TYPES: BEGIN OF TY_VBAK,
KUNNR TYPE KUNNR,
VBELN TYPE VBELN,
ERDAT TYPE ERDAT,
NETWR TYPE NETWR,
END OF TY_VBAK.
DATA : IT_KNA1 TYPE STANDARD TABLE OF TY_KNA1,
W_KNA1 LIKE LINE OF IT_KNA1,
IT_VBAK TYPE STANDARD TABLE OF TY_VBAK,
W_VBAK LIKE LINE OF IT_VBAK.
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
W_FCAT TYPE SLIS_FIELDCAT_ALV.
DATA : IT_FCAT1 TYPE SLIS_T_FIELDCAT_ALV,
W_FCAT1 TYPE SLIS_FIELDCAT_ALV.
DATA : IT_EVENT TYPE SLIS_T_EVENT,
W_EVENT TYPE SLIS_ALV_EVENT.
W_EVENT-NAME = 'USER_COMMAND'.
W_EVENT-FORM = 'USER_COMMAND'.
APPEND W_EVENT TO IT_EVENT.
SELECT-OPTIONS : S_CUSTNO FOR KNA1-KUNNR.
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'KUNNR'.
W_FCAT-SELTEXT_M = 'CUSTOMERNO'.
APPEND w_fcat TO IT_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'NAME1'.
W_FCAT-SELTEXT_M = 'CUSTOMERNAME'.
APPEND w_fcat TO IT_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'ORT01'.
W_FCAT-SELTEXT_M = 'CUSTOMERCITY'.
APPEND w_fcat TO IT_FCAT.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = 'LAND1'.
W_FCAT-SELTEXT_M = 'COUNTRY'.
APPEND w_fcat TO IT_FCAT.
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'KUNNR'.
W_FCAT-SELTEXT_M = 'CUSTOMERNO'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'VBELN'.
W_FCAT-SELTEXT_M = 'ORDERNO'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'ERDAT'.
W_FCAT-SELTEXT_M = 'ORDERDATE'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = 'NETWR'.
W_FCAT-SELTEXT_M = 'ORDERVALUE'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'KUNNR'.
W_FCAT-SELTEXT_M = 'CUSTOMERNO'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'VBELN'.
W_FCAT-SELTEXT_M = 'ORDERNO'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'ERDAT'.
W_FCAT-SELTEXT_M = 'ORDERDATE'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = 'NETWR'.
W_FCAT-SELTEXT_M = 'ORDERVALUE'.
APPEND w_fcat1 TO IT_FCAT1.
*PERFORM user_command.
START-OF-SELECTION.
SELECT KUNNR NAME1 ORT01 LAND1 FROM KNA1 INTO TABLE IT_KNA1 WHERE KUNNR IN S_CUSTNO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'Z_INTERACTIVE_ALV'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = '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_FCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IT_EVENT
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 = IT_KNA1
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.
&----
*& Form USER_COMM
&----
text
----
--> p1 text
<-- p2 text
----
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
READ TABLE IT_KNA1 into w_kna1 INDEX RS_SELFIELD-TABINDEX.
SELECT KUNNR VBELN ERDAT NETWR FROM VBAK INTO TABLE IT_VBAK WHERE KUNNR = rs_selfield-value.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'Z_INTERACTIVE_ALV'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = '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_FCAT1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IT_EVENT
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 = IT_VBAK
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.
Regards
Jerry
‎2008 Jun 30 4:28 PM
What does your Runtime Error say? Have you tried debugging your code by setting a break point before the error occurs and check your data?
‎2008 Jun 30 4:28 PM
What does your Runtime Error say? Have you tried debugging your code by setting a break point before the error occurs and check your data?
‎2008 Jun 30 4:34 PM
Hi Mike,
Error : Field symbol hasn't yet been assigned.
While debugging the data is fetched into it_vbak but while displaying data I'm getting error.
Regards
Jerry
‎2008 Jun 30 5:50 PM
I did cut and paste your code and it ran fine for me, as it did not short dump. You do need to change several things though. You are using a READ statement on an internal table that does not have a Header Line.
Make the following changes:
DATA : it_kna1 TYPE STANDARD TABLE OF ty_kna1 WITH HEADER LINE,
DATA: kunnr LIKE kna1-kunnr.
READ TABLE it_kna1 INDEX rs_selfield-tabindex.
kunnr = it_kna1-kunnr.
The other thing I noticed is your Code had "if sy-subrc 0". I changed to "if sy-subrc NE 0". I also commented out all the EXPORTING parameters that were empty or ' '.
All your assignements to the second field catalog were incorrect plus duplcauited, which gave 8 columns:
w_fcat1-col_pos = 1. "These were all w_fcat except the append
w_fcat1-fieldname = 'KUNNR'.
w_fcat1-seltext_m = 'CUSTOMERNO'.
APPEND w_fcat1 TO it_fcat1.
‎2008 Jul 01 10:13 AM
Hi Mike ,
I appreciate your help!! Even though I changed the code as u suggested it is still going into dump...
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
data : KUNNR1 LIKE kna1-kunnr.
READ TABLE IT_KNA1 INDEX RS_SELFIELD-TABINDEX.
*kunnr1 = it_kna1-kunnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = RS_SELFIELD-VALUE
IMPORTING
OUTPUT = KUNNR1.
SELECT KUNNR VBELN ERDAT NETWR FROM VBAK INTO TABLE IT_VBAK WHERE KUNNR = KUNNR1.
Regards
John
‎2008 Jul 01 1:02 PM
Hi Jerry.
Here is my code which does not short dump for me. I have the break-point to verify the data is correct.
report z_interactive_alv.
type-pools : slis.
tables : kna1.
types : begin of ty_kna1,
kunnr type kunnr,
name1 type name1,
ort01 type ort01,
land1 type land1,
end of ty_kna1.
types: begin of ty_vbak,
kunnr type kunnr,
vbeln type vbeln,
erdat type erdat,
netwr type netwr,
end of ty_vbak.
data : it_kna1 type standard table of ty_kna1 with header line,
w_kna1 like line of it_kna1,
it_vbak type standard table of ty_vbak,
w_vbak like line of it_vbak.
data : it_fcat type slis_t_fieldcat_alv,
w_fcat type slis_fieldcat_alv.
data : it_fcat1 type slis_t_fieldcat_alv,
w_fcat1 type slis_fieldcat_alv.
data : it_event type slis_t_event,
w_event type slis_alv_event.
w_event-name = 'USER_COMMAND'.
w_event-form = 'USER_COMMAND'.
append w_event to it_event.
select-options : s_custno for kna1-kunnr.
w_fcat-col_pos = 1.
w_fcat-fieldname = 'KUNNR'.
w_fcat-seltext_m = 'CUSTOMERNO'.
append w_fcat to it_fcat.
w_fcat-col_pos = 2.
w_fcat-fieldname = 'NAME1'.
w_fcat-seltext_m = 'CUSTOMERNAME'.
append w_fcat to it_fcat.
w_fcat-col_pos = 3.
w_fcat-fieldname = 'ORT01'.
w_fcat-seltext_m = 'CUSTOMERCITY'.
append w_fcat to it_fcat.
w_fcat-col_pos = 4.
w_fcat-fieldname = 'LAND1'.
w_fcat-seltext_m = 'COUNTRY'.
append w_fcat to it_fcat.
w_fcat1-col_pos = 1.
w_fcat1-fieldname = 'KUNNR'.
w_fcat1-seltext_m = 'CUSTOMERNO'.
append w_fcat1 to it_fcat1.
w_fcat1-col_pos = 2.
w_fcat1-fieldname = 'VBELN'.
w_fcat1-seltext_m = 'ORDERNO'.
append w_fcat1 to it_fcat1.
w_fcat1-col_pos = 3.
w_fcat1-fieldname = 'ERDAT'.
w_fcat1-seltext_m = 'ORDERDATE'.
append w_fcat1 to it_fcat1.
w_fcat1-col_pos = 4.
w_fcat1-fieldname = 'NETWR'.
w_fcat1-seltext_m = 'ORDERVALUE'.
append w_fcat1 to it_fcat1.
*PERFORM user_command.
start-of-selection.
select kunnr name1 ort01 land1 from kna1 into table it_kna1 where kunnr in s_custno.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = 'Z_INTERACTIVE_ALV'
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fcat
tables
t_outtab = it_kna1
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.
*&----
*& Form USER_COMM
*&----
*&
*& text
*& -
*&
*& --> p1 text
*& <-- p2 text
*& -
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
data: kunnr like kna1-kunnr.
read table it_kna1 index rs_selfield-tabindex.
kunnr = it_kna1-kunnr.
break-point.
select kunnr vbeln erdat netwr from vbak into table it_vbak
where kunnr = kunnr.
break-point.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = 'Z_INTERACTIVE_ALV'
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fcat1
tables
t_outtab = it_vbak
exceptions
program_error = 1
others = 2.
break-point.
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. "user_command
‎2008 Jun 30 4:31 PM
Hello Jerry,
Something not clear with you code in USER command..
Try to analyze in debug mode.. Keep break point at
READ TABLE IT_KNA1 into w_kna1 INDEX RS_SELFIELD-TABINDEX.
Check the Tabindex.. i think if it comes zero, you will get dump.
hope this helps,
ags..
‎2008 Jun 30 4:33 PM
Pl. pass I_CALLBACK_PROGRAM = your prog. name (sy-repid) in FM REUSE_ALV_GRID_DISPLAY.
Regards,
Joy.
‎2008 Jul 01 1:29 PM
Hi ,
Please check it. I think ur prod is solved.
REPORT z_interactive_alv.
TYPE-POOLS : slis.
TABLES : kna1.
TYPES : BEGIN OF ty_kna1,
kunnr TYPE kunnr,
name1 TYPE name1,
ort01 TYPE ort01,
land1 TYPE land1,
END OF ty_kna1.
TYPES: BEGIN OF ty_vbak,
kunnr TYPE kunnr,
vbeln TYPE vbeln,
erdat TYPE erdat,
netwr TYPE netwr,
END OF ty_vbak.
DATA : it_kna1 TYPE STANDARD TABLE OF ty_kna1,
w_kna1 LIKE LINE OF it_kna1,
it_vbak TYPE STANDARD TABLE OF ty_vbak,
w_vbak LIKE LINE OF it_vbak.
DATA : it_fcat TYPE slis_t_fieldcat_alv,
w_fcat TYPE slis_fieldcat_alv.
DATA : it_fcat1 TYPE slis_t_fieldcat_alv,
w_fcat1 TYPE slis_fieldcat_alv.
DATA : it_event TYPE slis_t_event,
w_event TYPE slis_alv_event.
w_event-name = 'USER_COMMAND'.
w_event-form = 'USER_COMMAND'.
APPEND w_event TO it_event.
SELECT-OPTIONS : s_custno FOR kna1-kunnr.
w_fcat-col_pos = 1.
w_fcat-fieldname = 'KUNNR'.
w_fcat-seltext_m = 'CUSTOMERNO'.
APPEND w_fcat TO it_fcat.
w_fcat-col_pos = 2.
w_fcat-fieldname = 'NAME1'.
w_fcat-seltext_m = 'CUSTOMERNAME'.
APPEND w_fcat TO it_fcat.
w_fcat-col_pos = 3.
w_fcat-fieldname = 'ORT01'.
w_fcat-seltext_m = 'CUSTOMERCITY'.
APPEND w_fcat TO it_fcat.
w_fcat-col_pos = 4.
w_fcat-fieldname = 'LAND1'.
w_fcat-seltext_m = 'COUNTRY'.
APPEND w_fcat TO it_fcat.
w_fcat-col_pos = 1.
w_fcat-fieldname = 'KUNNR'.
w_fcat-seltext_m = 'CUSTOMERNO'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 2.
w_fcat-fieldname = 'VBELN'.
w_fcat-seltext_m = 'ORDERNO'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 3.
w_fcat-fieldname = 'ERDAT'.
w_fcat-seltext_m = 'ORDERDATE'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 4.
w_fcat-fieldname = 'NETWR'.
w_fcat-seltext_m = 'ORDERVALUE'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 1.
w_fcat-fieldname = 'KUNNR'.
w_fcat-seltext_m = 'CUSTOMERNO'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 2.
w_fcat-fieldname = 'VBELN'.
w_fcat-seltext_m = 'ORDERNO'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 3.
w_fcat-fieldname = 'ERDAT'.
w_fcat-seltext_m = 'ORDERDATE'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 4.
w_fcat-fieldname = 'NETWR'.
w_fcat-seltext_m = 'ORDERVALUE'.
APPEND w_fcat1 TO it_fcat1.
*PERFORM user_command.
START-OF-SELECTION.
SELECT kunnr name1 ort01 land1
FROM kna1
INTO TABLE it_kna1
WHERE
kunnr IN s_custno.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fcat[]
it_events = it_event
TABLES
t_outtab = it_kna1[]
EXCEPTIONS
program_error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
ENDIF.
.
IF sy-subrc <> 0.
ENDIF.
*&----
**& Form USER_COMM
*&----
* text
*----
* --> p1 text
* <-- p2 text
*----
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
READ TABLE it_kna1 INTO w_kna1 INDEX rs_selfield-tabindex.
SELECT kunnr vbeln erdat netwr FROM vbak INTO TABLE it_vbak WHERE
kunnr = rs_selfield-value.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fcat1
it_events = it_event
TABLES
t_outtab = it_vbak
EXCEPTIONS
program_error = 1
OTHERS = 2 .
IF sy-subrc <> 0.
ENDIF.
ENDFORM. "user_command