04-25-2008 6:06 AM
hi experts,
iam doing one blocked alv report , the output is going to the dump. iam sending the code . rewards are helpful answers.
*&----
**& Report ZPICK_SUMMARY
**&
*&----
Description : Pick order summary
AUTHOR : N.Narasimha Rao
Req.number : DEVK900694
*----
REPORT ZPICK_SUMMARY.
**----- Tables Declaration
Tables : vbak,vbap,vbup,likp,lips,makt,vbfa.
Type-pools: slis.
*------- Types Declaration
Types: Begin of gty_vbak,
vbeln type vbak-vbeln, " Sales order number
erdat type vbak-erdat,
vkgrp type vbak-vkgrp, " Sales Group
kunnr type vbak-kunnr, " customer number
end of gty_vbak.
Types : Begin of gty_likp,
vbeln type likp-vbeln, " Delivery order number
erdat type likp-erdat, " Date on Which Record Was Created
lfdat type likp-lfdat, " Delivery Date
matnr type lips-matnr, " Material number
lgort type lips-lgort, " storage location
lfimg type lips-lfimg, " Actual quantity delivered (in sales units)
maktx type makt-maktx, " Material Description
end of gty_likp.
Types : Begin of gty_lips,
vbeln type lips-vbeln,
erdat type lips-erdat,
matnr type lips-matnr, " Material number
lgort type lips-lgort, " storage location
lfimg type lips-lfimg, " Actual quantity delivered (in sales units)
End of gty_lips,
Begin of gty_vbap,
VBELN TYPE VBAP-VBELN,
kwmeng type vbap-kwmeng, " Cumulative Order Quantity in Sales Units
end of gty_vbap,
Begin of gty_makt,
MATNR TYPE MAKT-MATNR,
maktx type makt-maktx, " Material Description
end of gty_makt,
Begin of gty_vbup,
VBELN TYPE VBUP-VBELN,
lfsta type vbup-lfsta, " Delivery status
end of gty_vbup,
begin of gty_vbfa,
vbeln type vbfa-vbeln,
vbelv type vbfa-vbelv,
end of gty_vbfa.
*----
Types declaration for out put
Types : Begin of gty_output,
vbeln type likp-vbeln,
vkgrp type vbak-vkgrp,
kunnr type vbak-kunnr,
erdat type likp-erdat,
lfdat type likp-lfdat,
matnr type lips-matnr,
lgort type lips-lgort,
lfimg type lips-lfimg,
kwmeng type vbap-kwmeng,
maktx type makt-maktx,
lfsta type vbup-lfsta,
end of gty_output.
*----
Internal table Declaration.
Data : gt_vbak type table of gty_vbak,
gt_vbfa type table of gty_vbfa,
gt_likp type table of gty_likp,
gt_lips type table of gty_lips,
gt_vbap type table of gty_vbap,
gt_vbup type table of gty_vbup,
gt_makt type table of gty_makt,
gt_output type table of gty_output.
*----
Workarea Declaration.
Data : gs_vbak type gty_vbak,
gs_vbfa type gty_vbfa,
gs_likp type gty_likp,
gs_lips type gty_lips,
gs_vbap type gty_vbap,
gs_vbup type gty_vbup,
gs_makt type gty_makt,
gs_output type gty_output.
Data: gs_layout type slis_layout_alv.
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
GS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: GT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
GS_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
Data:gt_event type slis_t_event,
gs_event type slis_alv_event.
Data : gt_event1 type slis_t_event,
gs_event1 type slis_alv_event.
data: gt_repid type sy-repid.
..........selection-screen......................*
selection-screen begin of block b1 with frame title text-001.
parameters: p_vbeln type vbak-vbeln.
parameters: p_erdat type likp-erdat.
parameters: p_kunnr type vbak-kunnr.
selection-screen end of block b1.
START-OF-SELECTION.
perform get_data.
perform lay_out.
perform field_cat1.
perform field_cat2.
perform out_display.
&----
*& Form GET_DATA
&----
text
----
--> p1 text
<-- p2 text
----
form GET_DATA .
select vbeln
vkgrp
kunnr
into corresponding fields of table gt_vbak from vbak
where vbeln = p_vbeln and
kunnr = p_kunnr.
if sy-subrc = 0.
select vbeln
vbelv
into corresponding fields of table gt_vbfa from vbfa
for all entries in gt_vbak
where vbeln = gt_vbak-vbeln.
endif.
if sy-subrc = 0.
select vbeln
erdat
lfdat
into corresponding fields of table gt_likp from likp
for all entries in gt_vbfa
where erdat = p_erdat and
vbeln = gt_vbfa-vbelv.
endif.
loop at gt_vbak into gs_vbak.
read table gt_vbfa into gs_vbfa with key vbeln = gs_vbak-vbeln binary search.
read table gt_likp into gs_likp with key vbeln = gs_vbfa-vbelv.
if sy-subrc = 0.
move: gs_vbak-vbeln to gs_output-vbeln,
gs_vbak-vkgrp to gs_output-vkgrp,
gs_vbak-kunnr to gs_output-kunnr,
gs_likp-vbeln to gs_output-vbeln,
gs_likp-erdat to gs_output-erdat,
gs_likp-lfdat to gs_output-lfdat.
append gs_output to gt_output.
endif.
endloop.
select matnr
lgort
lfimg
into corresponding fields of table gt_lips from lips
for all entries in gt_likp
where vbeln = gt_likp-vbeln.
if sy-subrc = 0.
select matnr
maktx
into corresponding fields of table gt_makt from makt
for all entries in gt_lips
where matnr = gt_lips-matnr.
endif.
if sy-subrc = 0.
select vbeln
lfsta
into corresponding fields of table gt_vbup from vbup
for all entries in gt_vbak
where vbeln = gt_vbak-vbeln.
endif.
loop at gt_lips into gs_lips.
read table gt_makt into gs_makt with key matnr = gs_lips-matnr.
read table gt_vbup into gs_vbup with key vbeln = gs_vbak-vbeln.
move: gs_lips-matnr to gs_output-matnr,
gs_lips-lgort to gs_output-lgort,
gs_lips-lfimg to gs_output-lfimg,
gs_makt-maktx to gs_output-maktx,
gs_vbup-lfsta to gs_output-lfsta.
append gs_output to gt_output.
endloop.
endform. " GET_DATA
&----
*& Form LAY_OUT
&----
text
----
--> p1 text
<-- p2 text
----
form LAY_OUT .
gs_layout-zebra = 'x'.
gs_layout-get_selinfos ='x'.
endform. " LAY_OUT
&----
*& Form FIELD_CAT1
&----
text
----
--> p1 text
<-- p2 text
----
form FIELD_CAT1 .
refresh gt_fieldcat.
clear gs_fieldcat.
gs_fieldcat-fieldname = 'vbeln'.
gs_fieldcat-seltext_l = 'sales order number'.
gs_fieldcat-datatype = 'CHAR'.
gs_fieldcat-outputlen = 30.
gs_fieldcat-tabname = 'gt_output'.
gs_fieldcat-key = 'X'.
gs_fieldcat-hotspot = 'X'.
gs_fieldcat-col_pos = 1.
gs_fieldcat-row_pos = 1.
append gs_fieldcat to gt_fieldcat.
clear gs_fieldcat.
gs_fieldcat-fieldname = 'erdat'.
gs_fieldcat-seltext_l = 'del order date'.
gs_fieldcat-datatype = 'CHAR'.
gs_fieldcat-outputlen = 30.
gs_fieldcat-tabname = 'gt_output'.
gs_fieldcat-key = 'X'.
gs_fieldcat-hotspot = 'X'.
gs_fieldcat-col_pos = 1.
gs_fieldcat-row_pos = 2.
append gs_fieldcat to gt_fieldcat.
clear gs_fieldcat.
gs_fieldcat-fieldname = 'lfdat'.
gs_fieldcat-seltext_l = 'delivery date'.
gs_fieldcat-datatype = 'CHAR'.
gs_fieldcat-outputlen = 30.
gs_fieldcat-tabname = 'gt_output'.
gs_fieldcat-key = 'X'.
gs_fieldcat-hotspot = 'X'.
gs_fieldcat-col_pos = 1.
gs_fieldcat-row_pos = 3.
append gs_fieldcat to gt_fieldcat.
clear gs_fieldcat.
gs_fieldcat-fieldname = 'vkgrp'.
gs_fieldcat-seltext_l = 'seller'.
gs_fieldcat-datatype = 'CHAR'.
gs_fieldcat-outputlen = 30.
gs_fieldcat-tabname = 'gt_output'.
gs_fieldcat-key = 'X'.
gs_fieldcat-hotspot = 'X'.
gs_fieldcat-col_pos = 4.
gs_fieldcat-row_pos = 1.
append gs_fieldcat to gt_fieldcat.
clear gs_fieldcat.
gs_fieldcat-fieldname = 'kunnr'.
gs_fieldcat-seltext_l = 'custm number'.
gs_fieldcat-datatype = 'CHAR'.
gs_fieldcat-outputlen = 30.
gs_fieldcat-tabname = 'gt_output'.
gs_fieldcat-key = 'X'.
gs_fieldcat-hotspot = 'X'.
gs_fieldcat-col_pos = 4.
gs_fieldcat-row_pos = 2.
append gs_fieldcat to gt_fieldcat.
clear gs_fieldcat.
endform. " FIELD_CAT1
&----
*& Form FIELD_CAT2
&----
text
----
--> p1 text
<-- p2 text
----
form FIELD_CAT2 .
refresh gt_fieldcat1.
clear gs_fieldcat1.
gs_fieldcat1-fieldname = 'matnr'.
gs_fieldcat1-seltext_l = 'sku'.
gs_fieldcat1-datatype = 'CHAR'.
gs_fieldcat1-outputlen = 30.
gs_fieldcat1-tabname = 'gt_output'.
gs_fieldcat1-key = 'X'.
gs_fieldcat1-hotspot = 'X'.
gs_fieldcat1-col_pos = 1.
append gs_fieldcat1 to gt_fieldcat1.
clear gs_fieldcat1.
gs_fieldcat1-fieldname = 'makt'.
gs_fieldcat1-seltext_l = 'material desc'.
gs_fieldcat1-datatype = 'CHAR'.
gs_fieldcat1-outputlen = 30.
gs_fieldcat1-tabname = 'gt_output'.
gs_fieldcat1-key = 'X'.
gs_fieldcat1-hotspot = 'X'.
gs_fieldcat1-col_pos = 2.
append gs_fieldcat1 to gt_fieldcat1.
clear gs_fieldcat1.
gs_fieldcat1-fieldname = 'lgort'.
gs_fieldcat1-seltext_l = 's.location'.
gs_fieldcat1-datatype = 'CHAR'.
gs_fieldcat1-outputlen = 30.
gs_fieldcat1-tabname = 'gt_output'.
gs_fieldcat1-key = 'X'.
gs_fieldcat1-hotspot = 'X'.
gs_fieldcat1-col_pos = 3.
append gs_fieldcat1 to gt_fieldcat1.
clear gs_fieldcat1.
gs_fieldcat1-fieldname = 'kwmeng'.
gs_fieldcat1-seltext_l = 'ord.quan'.
gs_fieldcat1-datatype = 'CHAR'.
gs_fieldcat1-outputlen = 30.
gs_fieldcat1-tabname = 'gt_output'.
gs_fieldcat1-key = 'X'.
gs_fieldcat1-hotspot = 'X'.
gs_fieldcat1-col_pos = 4.
append gs_fieldcat1 to gt_fieldcat1.
clear gs_fieldcat1.
gs_fieldcat1-fieldname = 'lfimg'.
gs_fieldcat1-seltext_l = 's.quan'.
gs_fieldcat1-datatype = 'CHAR'.
gs_fieldcat1-outputlen = 30.
gs_fieldcat1-tabname = 'gt_output'.
gs_fieldcat1-key = 'X'.
gs_fieldcat1-hotspot = 'X'.
gs_fieldcat1-col_pos = 5.
append gs_fieldcat1 to gt_fieldcat1.
clear gs_fieldcat1.
gs_fieldcat1-fieldname = 'lfsta'.
gs_fieldcat1-seltext_l = 'delivery status'.
gs_fieldcat1-datatype = 'CHAR'.
gs_fieldcat1-outputlen = 30.
gs_fieldcat1-tabname = 'gt_output'.
gs_fieldcat1-key = 'X'.
gs_fieldcat1-hotspot = 'X'.
gs_fieldcat1-col_pos = 6.
append gs_fieldcat1 to gt_fieldcat1.
clear gs_fieldcat1.
endform. " FIELD_CAT2
&----
*& Form OUT_DISPLAY
&----
text
----
--> p1 text
<-- p2 text
----
form OUT_DISPLAY .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = sy-repid.
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IT_EXCLUDING =
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gs_layout
it_fieldcat = gt_fieldcat
i_tabname = 'gt_output'
it_events = gt_event
IT_SORT =
I_TEXT = ' '
tables
t_outtab = gt_output
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gs_layout
it_fieldcat = gt_fieldcat1
i_tabname = 'gt_output'
it_events = gt_event1
IT_SORT =
I_TEXT = ' '
tables
t_outtab = gt_output
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
IS_PRINT =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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. " OUT_DISPLAY
04-25-2008 6:51 AM
hi,
you gave small letters in the single quotes try changing to caps
gs_fieldcat-fieldname = 'erdat'.
.
give as
gs_fieldcat-fieldname = 'ERDAT'. etc
regards
prasanth
04-25-2008 6:47 AM
Hi,
In the types declaration 'gty_output' u have used
maktx type makt-maktx,
and in fieldcatalog
gs_fieldcat1-fieldname = 'makt'.
gs_fieldcat1-seltext_l = 'material desc'.
gs_fieldcat1-datatype = 'CHAR'.
'makt' is used..
just check it.
Regards,
Nisha
04-25-2008 6:51 AM
hi,
you gave small letters in the single quotes try changing to caps
gs_fieldcat-fieldname = 'erdat'.
.
give as
gs_fieldcat-fieldname = 'ERDAT'. etc
regards
prasanth