Hi,
I
have created Program for the report ,But it does ,not selecting all foelds,
What will the possible reason.
I have created report for rows as
Notification Inspection lot qty Ok Qty Rejected Qty Defect Group Defect Code Code Qty Code Description.
But Report is picking data for the coloumns of NOTIFICATION and CODE QTY.
Is there i am missing in program?
Details as following
*&---------------------------------------------------------------------*
*& Report ZQMLOTDTL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZQMLOTDTL.
***********************************************************************
*Table Declarations.
************************************************************************
TABLES:QALS,QMEL,QMFE,QPCT.
************************************************************************
*Data Declarations
************************************************************************
TYPE-POOLS : slis.
TYPES : BEGIN OF ty_qals,
werk TYPE qals-werk,
budat TYPE qals-budat,
prueflos TYPE qals-prueflos,
matnr TYPE qals-matnr,"'Part Number'.
maktx TYPE makt-maktx,
mblnr TYPE qals-mblnr,
zeile TYPE qals-zeile,
losmenge TYPE qals-losmenge,
lmenge01 TYPE qals-lmenge01,
lmenge04 TYPE qals-lmenge04,
compd TYPE makt-maktx,
END OF ty_qals.
DATA :it_qals TYPE STANDARD TABLE OF ty_qals WITH HEADER LINE.
TYPES:BEGIN OF ty_qmfe,
qmnum TYPE qmfe-qmnum,
fegrp TYPE qmfe-fegrp,
fecod TYPE qmfe-fecod,
kurztext TYPE qpct-kurztext,
anzfehler TYPE qmfe-anzfehler,
werks TYPE qmfe-werks,
compd1 TYPE qpct-kurztext,
END OF ty_qmfe.
DATA:it_qmfe TYPE STANDARD TABLE OF ty_qmfe WITH HEADER LINE.
TYPES:BEGIN OF ty_qmel,
qmnum TYPE qmel-qmnum,
erdat TYPE qmel-erdat,
matnr TYPE qmel-matnr,
maktx TYPE makt-maktx,
prueflos TYPE qmel-prueflos,
mblnr TYPE qmel-mblnr,
mblpo TYPE qmel-mblpo,
compd TYPE makt-maktx,
END OF ty_qmel.
DATA:it_qmel TYPE STANDARD TABLE OF ty_qmel WITH HEADER LINE.
*------------------------------------------------------------
*----------------------FINAL ITAB------------------------
TYPES:BEGIN OF itab,
werk TYPE qals-werk,
budat TYPE qals-budat,
prueflos TYPE qals-prueflos,
matnr TYPE qals-matnr,
maktx TYPE makt-maktx,
mblnr TYPE qals-mblnr,
zeile TYPE qals-zeile,
losmenge TYPE qals-losmenge,
lmenge01 TYPE qals-lmenge01,
lmenge04 TYPE qals-lmenge04,
qmnum TYPE qmfe-qmnum,
fegrp TYPE qmfe-fegrp,
fecod TYPE qmfe-fecod,
kurztext TYPE qpct-kurztext,
anzfehler TYPE qmfe-anzfehler,
werks TYPE qmfe-werks,
compd TYPE makt-maktx,
compd1 TYPE qpct-kurztext,
erdat TYPE qmel-erdat,
mblpo TYPE qmel-mblpo,
END OF itab.
DATA : it_itab TYPE STANDARD TABLE OF itab with HEADER LINE.
*Internal Table for field catalog
DATA : t_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA : fs_layout TYPE slis_layout_alv.
*Internal Table for sorting
DATA : t_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
"For Variant.
DATA : g_variant LIKE disvariant,
g_save(1) TYPE c,
gx_variant LIKE disvariant,
g_exit(1) TYPE c,
g_tabname_header TYPE slis_tabname,
g_tabname_item TYPE slis_tabname.
**********************SELECTION-SCREEN**************************
SELECTION-SCREEN:BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:s_werk FOR qals-werk.
SELECT-OPTIONS:s_budat FOR qals-budat.
SELECTION-SCREEN:END OF BLOCK b1.
" Added By Mayur% on 07.03.2013.
"For Variant
SELECTION-SCREEN BEGIN OF BLOCK 0 WITH FRAME TITLE text-p01.
PARAMETERS: s_var TYPE slis_vari.
SELECTION-SCREEN END OF BLOCK 0.
"Get the default variant
"F4-Help for variant
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_var.
INITIALIZATION.
PERFORM default_var.
"Validates the diplay variant
*********************END-OF-SELECTION**************************
START-OF-SELECTION.
PERFORM data_select.
PERFORM data_collect.
PERFORM sort_list.
PERFORM data_fieldcat.
*&---------------------------------------------------------------------*
*& Form DATA_SELECT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM data_select.
SELECT
qmnum
fegrp
fecod
anzfehler
werks
FROM qmfe INTO CORRESPONDING FIELDS OF TABLE it_itab
WHERE werks = it_itab-werks.
SORT it_qmfe BY qmnum.
IF it_qmfe IS NOT INITIAL.
SELECT
qmel~qmnum
qmel~erdat
qmel~prueflos
qmel~matnr
makt~matnr
qmel~mblnr
qmel~mblpo
* makt~compd
INTO CORRESPONDING FIELDS OF TABLE it_itab
FROM qmel INNER JOIN makt ON qmel~matnr = makt~matnr
FOR ALL ENTRIES IN it_itab
WHERE qmnum = it_itab-qmnum
AND prueflos = it_qals-prueflos.
SORT it_qmel BY prueflos.
SELECT
prueflos
FROM qals INTO CORRESPONDING FIELDS OF TABLE it_itab
FOR ALL ENTRIES IN it_qmfe
WHERE prueflos = it_qmel-prueflos
AND werk = it_qmfe-werks
AND matnr = it_qmel-matnr
AND mblnr = it_qmel-mblnr
AND zeile = it_qmel-mblpo
AND losmenge = it_itab-losmenge
AND lmenge01 = it_itab-lmenge01
AND lmenge04 = it_itab-lmenge04.
ENDIF.
ENDFORM. " SELECT_DATA
*&---------------------------------------------------------------------*
*& Form fill_fieldcatalog
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM data_fieldcat.
PERFORM f_fieldcatalog USING '1' 'QMNUM' 'Notification number'.
PERFORM f_fieldcatalog USING '2' 'PRUEFLOS' 'Inspection Lot Number'.
PERFORM f_fieldcatalog USING '3' 'LOSMENGE' 'Inspection Lot Quantity'.
PERFORM f_fieldcatalog USING '4' 'MBLNR' 'Material Document'.
perform f_fieldcatalog USING '5' 'ZEILE' 'Item Number'.
PERFORM f_fieldcatalog USING '6' 'MATNR' 'Material Number'.
PERFORM f_fieldcatalog USING '7' 'MAKTX' 'Material Description'.
PERFORM f_fieldcatalog USING '8' 'WERK' 'Plant'.
PERFORM f_fieldcatalog USING '9' 'BUDAT' 'Date'.
PERFORM f_fieldcatalog USING '10' 'LMENGE01' 'OK'.
PERFORM f_fieldcatalog USING '11' 'LMENGE04' 'Rejected'.
PERFORM f_fieldcatalog USING '12' 'FRGRP' 'Codegroup'.
PERFORM f_fieldcatalog USING '13' 'FRCOD' 'Code'.
PERFORM f_fieldcatalog USING '14' 'kurztext' 'Code Text'.
PERFORM f_fieldcatalog USING '14' 'ANZFEHLER' 'DefectQty'.
PERFORM g_display_grid.
ENDFORM. " DATA_FIELDCAT
*&---------------------------------------------------------------------*
*& Form f_fieldcatalog
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->VALUE(X) text
* -->VALUE(Y) text
* -->VALUE(Z) text
* -->VALUE(W) text
*----------------------------------------------------------------------*
FORM f_fieldcatalog USING value(x) value(y) value(z).
t_fieldcat-col_pos = x.
t_fieldcat-fieldname = y.
t_fieldcat-seltext_l = z.
t_fieldcat-no_zero = 'X'.
APPEND t_fieldcat.
CLEAR t_fieldcat.
ENDFORM. "f_fieldcatalog
*&---------------------------------------------------------------------*
*& Form COLLECT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM DATA_COLLECT.
LOOP AT it_qmfe.
it_itab-qmnum = it_qmfe-qmnum.
it_itab-fegrp = it_qmfe-fegrp.
it_itab-fecod = it_qmfe-fecod.
it_itab-anzfehler = it_qmfe-anzfehler.
READ TABLE it_qmel WITH KEY qmnum = it_qmfe-qmnum.
it_itab-prueflos = it_qmel-prueflos.
it_itab-qmnum = it_qmel-qmnum.
READ TABLE it_qals WITH KEY prueflos = it_qmel-prueflos.
it_itab-werk = it_qals-werk.
it_itab-matnr = it_qals-matnr .
It_itab-mblnr = it_qals-mblnr.
It_itab-zeile = it_qals-zeile.
it_itab-losmenge = it_qals-losmenge.
it_itab-lmenge01 = it_qals-lmenge01.
it_itab-lmenge04 = it_qals-lmenge04.
APPEND it_itab.
CLEAR :it_itab,it_qals,it_qmel,it_qmfe.
ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form SORT_LIST
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM sort_list .
* t_sort-spos = '1'.
* t_sort-fieldname = 'werk'.
* t_sort-tabname = 'it_itab[]'.
* t_sort-up = 'X'.
* t_sort-subtot = 'X'.
* append t_sort.
*
* t_sort-spos = '2'.
* t_sort-fieldname = 'BUKRS'.
* t_sort-tabname = 'it_itab[]'.
* t_sort-up = 'X'.
* t_sort-subtot = 'X'.
* append t_sort.
ENDFORM. " SORT_LIST
*&---------------------------------------------------------------------*
*& Form G_DISPLAY_GRID
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM g_display_grid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = fs_layout
i_callback_top_of_page = 'TOP-OF-PAGE'
it_fieldcat = t_fieldcat[]
it_sort = t_sort[]
i_save = 'X'
TABLES
t_outtab = it_itab[]
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 4.
ENDIF.
ENDFORM. " G_DISPLAY_GRID
*&---------------------------------------------------------------------*
*& Form top-of-page
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
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.
* Title
wa_header-typ = 'H'.
wa_header-info = 'QMLOTDTL'.
APPEND wa_header TO t_header.
CLEAR wa_header.
DESCRIBE TABLE it_itab LINES ld_lines.
ld_linesc = ld_lines.
CONCATENATE 'Total No. of Records Selected: ' ld_linesc
INTO t_line SEPARATED BY space.
wa_header-typ = 'A'.
wa_header-info = t_line.
APPEND wa_header TO t_header.
CLEAR: wa_header, t_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
ENDFORM.
"top-of-page
*&---------------------------------------------------------------------*
*& Form SORT_LIST
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form DEFAULT_VAR
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DEFAULT_VAR .
g_variant-report = sy-repid.
g_variant-username = sy-uname.
g_variant-variant = s_var.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = 'A'
CHANGING
cs_variant = g_variant
EXCEPTIONS
NOT_FOUND = 2.
IF sy-subrc = 0.
s_var = g_variant-variant.
ENDIF.
" DEFAULT_VAR
*&---------------------------------------------------------------------*
*& Form VARIANT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*form VARIANT .
g_variant-report = sy-repid.
g_variant-username = sy-uname.
g_variant-variant = s_var.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = g_variant
* I_TABNAME_HEADER =
* I_TABNAME_ITEM =
* IT_DEFAULT_FIELDCAT =
I_SAVE = 'A'
* I_DISPLAY_VIA_GRID = ' '
IMPORTING
E_EXIT = g_exit
ES_VARIANT = g_variant
EXCEPTIONS
NOT_FOUND = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF g_exit = space.
s_var = g_variant-variant.
ENDIF.
ENDIF.
ENDFORM.
With Regards,
Dev