Skip to Content
author's profile photo Former Member
Former Member

Amount is repeating in a zreport

I have written a report for stockdetails .In this report the amount field is repeating .It is displaying the first value for all.

*&---------------------------------------------------------------------*
*& Report YSTOCK
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT YSTOCK.
TABLES:MARD,MARC,MAKT.
TYPE-POOLS:SLIS.

DATA : FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
* WA_FIELDCAT TYPE slis_fieldcat_alv .

DATA: GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
GD_REPID LIKE SY-REPID,
GT_EVENTS TYPE SLIS_T_EVENT,
GD_PRNTPARAMS TYPE SLIS_PRINT_ALV.


TYPES: BEGIN OF TY_MARD,
MATNR LIKE MARD-MATNR,
WERKS LIKE MARD-WERKS,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
VERPR TYPE MBEW-VERPR,
MAKTX TYPE MAKT-MAKTX,
END OF TY_MARD.

TYPES: BEGIN OF TY_MBEW,
MATNR LIKE MBEW-MATNR,
VERPR LIKE MBEW-VERPR,
END OF TY_MBEW.

TYPES:BEGIN OF TY_MAKT,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
END OF TY_MAKT.

DATA:WA_FINAL TYPE TY_MARD,
IT_FINAL TYPE TABLE OF TY_MARD.

DATA:WA_MBEW TYPE TY_MBEW,
IT_MBEW TYPE TABLE OF TY_MBEW.

DATA:WA_MAKT TYPE TY_MAKT,
IT_MAKT TYPE TABLE OF TY_MAKT.

SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS S_MATNR FOR MARD-MATNR.
SELECT-OPTIONS S_PLANT FOR MARD-WERKS.
SELECT-OPTIONS S_LGORT FOR MARD-LGORT.
SELECTION-SCREEN END OF BLOCK BLK1.

START-OF-SELECTION.

PERFORM DATA_RETRIEVAL.
PERFORM DATA_RETRIEVAL1.
PERFORM DATA_RETRIEVAL2.
PERFORM BUILD_FIELDCATALOG.
PERFORM BUILD_LAYOUT.
PERFORM DISPLAY_ALV_REPORT.
PERFORM BUILD_EVENTS.
*&---------------------------------------------------------------------*
*& Form DATA_RETRIEVAL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DATA_RETRIEVAL .
SELECT MATNR WERKS LGORT LABST
FROM MARD INTO CORRESPONDING FIELDS OF TABLE IT_FINAL
WHERE MATNR IN S_MATNR
AND WERKS IN S_PLANT
AND LGORT IN S_LGORT.
ENDFORM. " DATA_RETRIEVAL
*&---------------------------------------------------------------------*
*& Form DATA_RETRIEVAL1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DATA_RETRIEVAL1 .
IF NOT IT_FINAL IS INITIAL.
SELECT MATNR VERPR FROM MBEW
INTO CORRESPONDING FIELDS OF TABLE IT_MBEW
FOR ALL ENTRIES IN IT_FINAL
WHERE MATNR = IT_FINAL-MATNR.
ENDIF.

LOOP AT IT_FINAL INTO WA_FINAL.
READ TABLE IT_MBEW INTO WA_MBEW WITH KEY MATNR = WA_FINAL-MATNR.
IF SY-SUBRC EQ 0.
WA_FINAL-VERPR = WA_MBEW-VERPR.

MODIFY IT_FINAL FROM WA_FINAL.
ENDIF.
ENDLOOP.
ENDFORM. " DATA_RETRIEVAL1
*&---------------------------------------------------------------------*
*& Form DATA_RETRIEVAL2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DATA_RETRIEVAL2 .

ENDFORM. " DATA_RETRIEVAL2
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM BUILD_FIELDCATALOG .

FIELDCATALOG-FIELDNAME = 'MATNR'. " field Name
FIELDCATALOG-SELTEXT_M = 'MATERIAL NO'. " Field heading
FIELDCATALOG-COL_POS = 0. " col position
FIELDCATALOG-OUTPUTLEN = 10. " output Lenght
FIELDCATALOG-EMPHASIZE = 'X'. " Emphasize (highlight columns in color)
*fieldcatalog-key = 'X'.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.



FIELDCATALOG-FIELDNAME = 'WERKS'. " field Name
FIELDCATALOG-SELTEXT_M = 'PLANT'. " Field heading
FIELDCATALOG-COL_POS = 1. " col position
FIELDCATALOG-OUTPUTLEN = 10. " output Lenght
*fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color)
*fieldcatalog-key = 'X'.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.



FIELDCATALOG-FIELDNAME = 'LGORT'. " field Name
FIELDCATALOG-SELTEXT_M = 'STORAGE LOC'. " Field heading
FIELDCATALOG-COL_POS = 2. " col position
FIELDCATALOG-OUTPUTLEN = 25. " output Lenght
*fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color)
*fieldcatalog-key = 'X'.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.


FIELDCATALOG-FIELDNAME = 'LABST'. " field Name
FIELDCATALOG-SELTEXT_M = 'CLOSING STCK'. " Field heading
FIELDCATALOG-COL_POS = 3. " col position
FIELDCATALOG-OUTPUTLEN = 10. " output Lenght
FIELDCATALOG-EMPHASIZE = 'X'. " Emphasize (highlight columns in color)
*fieldcatalog-key = 'X'.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.



FIELDCATALOG-FIELDNAME = 'VERPR'. " field Name
FIELDCATALOG-SELTEXT_M = 'AMOUNT'. " Field heading
FIELDCATALOG-COL_POS = 4. " col position
FIELDCATALOG-OUTPUTLEN = 10. " output Lenght
*fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color)
*fieldcatalog-key = 'X'.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.




ENDFORM. " BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
*& Form BUILD_LAYOUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM BUILD_LAYOUT .
GD_LAYOUT-NO_INPUT = 'X'.
GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GD_LAYOUT-TOTALS_TEXT = 'Totals'(201).
GD_LAYOUT-TOTALS_ONLY = 'X'.
GD_LAYOUT-ZEBRA = 'X'.
* gd_layout-group_change_edit = 'X'.
ENDFORM. " BUILD_LAYOUT
*&---------------------------------------------------------------------*
*& Form BUILD_EVENTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM BUILD_EVENTS .
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = GT_EVENTS.

READ TABLE GT_EVENTS
WITH KEY NAME = SLIS_EV_USER_COMMAND
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE SLIS_EV_USER_COMMAND TO LS_EVENT-FORM.
APPEND LS_EVENT TO GT_EVENTS.
ENDIF.
READ TABLE GT_EVENTS
WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE SLIS_EV_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO GT_EVENTS.
ENDIF.
ENDFORM. " BUILD_EVENTS
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY_ALV_REPORT .
GD_REPID = SY-REPID.



CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE' "see FORM
* I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
* i_grid_title = outtext
IS_LAYOUT = GD_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
* it_special_groups = gd_tabgroup
IT_EVENTS = GT_EVENTS
IS_PRINT = GD_PRNTPARAMS
I_SAVE = 'A'
I_DEFAULT = 'X'
* is_variant = z_template
TABLES
T_OUTTAB = IT_FINAL
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. " DISPLAY_ALV_REPORT


FORM TOP-OF-PAGE.
*ALV Header declarations
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 = 'STOCK DETAILS'.

APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.



* Date
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'DATE: '.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO WA_HEADER-INFO. "todays date
APPEND WA_HEADER TO T_HEADER.
CLEAR: WA_HEADER.


DESCRIBE TABLE IT_FINAL LINES LD_LINES.


* describe table wa_eban 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
I_LOGO = 'ZSHIV_LOGO'."'ZSHIV_LOGO'.




ENDFORM. " DISPLAY_ALV_REPORT

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Nov 07, 2012 at 11:29 AM

    What ever you have written is correct, if you execute it for single material then the value for all record will be same.

    Un-marking the discussion as question due to its basic nature.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 07, 2012 at 11:39 AM

    Hi Durgeshk,

    in IT_mbew verpr getting 1 value for single material and below loop ur passing same verpr so because of this its repeating.

    FORM DATA_RETRIEVAL1 .

    IF NOT IT_FINAL IS INITIAL.

    SELECT MATNR VERPR FROM MBEW

    INTO CORRESPONDING FIELDS OF TABLE IT_MBEW

    FOR ALL ENTRIES IN IT_FINAL

    WHERE MATNR = IT_FINAL-MATNR.

    ENDIF.

    LOOP AT IT_FINAL INTO WA_FINAL.

    READ TABLE IT_MBEW INTO WA_MBEW WITH KEY MATNR = WA_FINAL-MATNR.

    IF SY-SUBRC EQ 0.

    WA_FINAL-VERPR = WA_MBEW-VERPR.

    MODIFY IT_FINAL FROM WA_FINAL.

    ENDIF.

    ENDLOOP.

    ENDFORM. " DATA_RETRIEVAL1

    Regards,

    Amol.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 07, 2012 at 05:34 PM

    Logic corrected in the below code by adding a BWKEY field to MBEW table and aded teh same condition during the it_MBEW READ statement.

    Execute the below code now it should work properly.

    TABLES:mard,marc,makt.
    TYPE-POOLS:slis.

    DATA : fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.

    DATA: gd_tab_group TYPE slis_t_sp_group_alv,
    gd_layout TYPE slis_layout_alv,
    gd_repid LIKE sy-repid,
    gt_events TYPE slis_t_event,
    gd_prntparams TYPE slis_print_alv.


    TYPES: BEGIN OF ty_mard,
    matnr LIKE mard-matnr,
    werks LIKE mard-werks,
    lgort LIKE mard-lgort,
    labst LIKE mard-labst,
    verpr TYPE mbew-verpr,
    maktx TYPE makt-maktx,
    END OF ty_mard.

    TYPES: BEGIN OF ty_mbew,
    matnr LIKE mbew-matnr,
    werks type mbew-bwkey,
    verpr LIKE mbew-verpr,
    END OF ty_mbew.

    TYPES:BEGIN OF ty_makt,
    matnr LIKE makt-matnr,
    maktx LIKE makt-maktx,
    END OF ty_makt.

    DATA:wa_final TYPE ty_mard,
    it_final TYPE TABLE OF ty_mard.

    DATA:wa_mbew TYPE ty_mbew,
    it_mbew TYPE TABLE OF ty_mbew.

    DATA:wa_makt TYPE ty_makt,
    it_makt TYPE TABLE OF ty_makt.

    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS s_matnr FOR mard-matnr.
    SELECT-OPTIONS s_plant FOR mard-werks.
    SELECT-OPTIONS s_lgort FOR mard-lgort.
    SELECTION-SCREEN END OF BLOCK blk1.

    START-OF-SELECTION.

    PERFORM data_retrieval.
    PERFORM data_retrieval1.
    PERFORM data_retrieval2.
    PERFORM build_fieldcatalog.
    PERFORM build_layout.
    PERFORM display_alv_report.
    PERFORM build_events.
    *&---------------------------------------------------------------------*
    *& Form DATA_RETRIEVAL
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    * --> p1 text
    * <-- p2 text
    *----------------------------------------------------------------------*
    FORM data_retrieval .
    SELECT matnr werks lgort labst
    FROM mard INTO CORRESPONDING FIELDS OF TABLE it_final
    WHERE matnr IN s_matnr
    AND werks IN s_plant
    AND lgort IN s_lgort.
    ENDFORM. " DATA_RETRIEVAL
    *&---------------------------------------------------------------------*
    *& Form DATA_RETRIEVAL1
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    * --> p1 text
    * <-- p2 text
    *----------------------------------------------------------------------*
    FORM data_retrieval1 .
    IF NOT it_final IS INITIAL.
    SELECT matnr bwkey verpr FROM mbew
    INTO CORRESPONDING FIELDS OF TABLE it_mbew
    FOR ALL ENTRIES IN it_final
    WHERE matnr = it_final-matnr.
    ENDIF.

    LOOP AT it_final INTO wa_final.
    READ TABLE it_mbew INTO wa_mbew WITH KEY matnr = wa_final-matnr
    werks = wa_final-werks.
    IF sy-subrc EQ 0.
    wa_final-verpr = wa_mbew-verpr.

    MODIFY it_final FROM wa_final.
    ENDIF.
    ENDLOOP.
    ENDFORM. " DATA_RETRIEVAL1
    *&---------------------------------------------------------------------*
    *& Form DATA_RETRIEVAL2
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    * --> p1 text
    * <-- p2 text
    *----------------------------------------------------------------------*
    FORM data_retrieval2 .

    ENDFORM. " DATA_RETRIEVAL2
    *&---------------------------------------------------------------------*
    *& Form BUILD_FIELDCATALOG
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    * --> p1 text
    * <-- p2 text
    *----------------------------------------------------------------------*
    FORM build_fieldcatalog .

    fieldcatalog-fieldname = 'MATNR'. " field Name
    fieldcatalog-seltext_m = 'MATERIAL NO'. " Field heading
    fieldcatalog-col_pos = 0. " col position
    fieldcatalog-outputlen = 10. " output Lenght
    fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color)
    *fieldcatalog-key = 'X'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.



    fieldcatalog-fieldname = 'WERKS'. " field Name
    fieldcatalog-seltext_m = 'PLANT'. " Field heading
    fieldcatalog-col_pos = 1. " col position
    fieldcatalog-outputlen = 10. " output Lenght
    *fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color)
    *fieldcatalog-key = 'X'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.



    fieldcatalog-fieldname = 'LGORT'. " field Name
    fieldcatalog-seltext_m = 'STORAGE LOC'. " Field heading
    fieldcatalog-col_pos = 2. " col position
    fieldcatalog-outputlen = 25. " output Lenght
    *fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color)
    *fieldcatalog-key = 'X'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.


    fieldcatalog-fieldname = 'LABST'. " field Name
    fieldcatalog-seltext_m = 'CLOSING STCK'. " Field heading
    fieldcatalog-col_pos = 3. " col position
    fieldcatalog-outputlen = 10. " output Lenght
    fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color)
    *fieldcatalog-key = 'X'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.



    fieldcatalog-fieldname = 'VERPR'. " field Name
    fieldcatalog-seltext_m = 'AMOUNT'. " Field heading
    fieldcatalog-col_pos = 4. " col position
    fieldcatalog-outputlen = 10. " output Lenght
    *fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color)
    *fieldcatalog-key = 'X'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.




    ENDFORM. " BUILD_FIELDCATALOG
    *&---------------------------------------------------------------------*
    *& Form BUILD_LAYOUT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    * --> p1 text
    * <-- p2 text
    *----------------------------------------------------------------------*
    FORM build_layout .
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text = 'Totals'(201).
    gd_layout-totals_only = 'X'.
    gd_layout-zebra = 'X'.
    * gd_layout-group_change_edit = 'X'.
    ENDFORM. " BUILD_LAYOUT
    *&---------------------------------------------------------------------*
    *& Form BUILD_EVENTS
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    * --> p1 text
    * <-- p2 text
    *----------------------------------------------------------------------*
    FORM build_events .
    DATA: ls_event TYPE slis_alv_event.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    i_list_type = 0
    IMPORTING
    et_events = gt_events.

    READ TABLE gt_events
    WITH KEY name = slis_ev_user_command
    INTO ls_event.
    IF sy-subrc = 0.
    MOVE slis_ev_user_command TO ls_event-form.
    APPEND ls_event TO gt_events.
    ENDIF.
    READ TABLE gt_events
    WITH KEY name = slis_ev_top_of_page
    INTO ls_event.
    IF sy-subrc = 0.
    MOVE slis_ev_top_of_page TO ls_event-form.
    APPEND ls_event TO gt_events.
    ENDIF.
    ENDFORM. " BUILD_EVENTS
    *&---------------------------------------------------------------------*
    *& Form DISPLAY_ALV_REPORT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    * --> p1 text
    * <-- p2 text
    *----------------------------------------------------------------------*
    FORM display_alv_report .
    gd_repid = sy-repid.



    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = gd_repid
    i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
    * I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    * i_grid_title = outtext
    is_layout = gd_layout
    it_fieldcat = fieldcatalog[]
    * it_special_groups = gd_tabgroup
    it_events = gt_events
    is_print = gd_prntparams
    i_save = 'A'
    i_default = 'X'
    * is_variant = z_template
    TABLES
    t_outtab = it_final
    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. " DISPLAY_ALV_REPORT


    *&---------------------------------------------------------------------*
    *& Form TOP-OF-PAGE
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    FORM top-of-page.
    *ALV Header declarations
    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 = 'STOCK DETAILS'.

    APPEND wa_header TO t_header.
    CLEAR wa_header.



    * Date
    wa_header-typ = 'S'.
    wa_header-key = 'DATE: '.
    CONCATENATE sy-datum+6(2) '.'
    sy-datum+4(2) '.'
    sy-datum(4) INTO wa_header-info. "todays date
    APPEND wa_header TO t_header.
    CLEAR: wa_header.


    DESCRIBE TABLE it_final LINES ld_lines.


    * describe table wa_eban 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
    i_logo = 'ZSHIV_LOGO'."'ZSHIV_LOGO'.




    ENDFORM. " DISPLAY_ALV_REPORT

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 09, 2012 at 06:30 AM

    Hi Durgesh ,

    You need to fetch Plantwise from MBEW as well , BWKEY ( Is Plant ).

    While selecting from MARD ,

    FROM MARD INTO CORRESPONDING FIELDS OF TABLE IT_FINAL

    WHERE MATNR IN S_MATNR

    AND WERKS IN S_PLANT

    AND LGORT IN S_LGORT.

    you are selecting based on Material and Plant so try to do the same while fetching from MBEW also ( Reason being Materials are extended Plant wise )

    SELECT MATNR VERPR FROM MBEW

    INTO CORRESPONDING FIELDS OF TABLE IT_MBEW

    FOR ALL ENTRIES IN IT_FINAL

    WHERE MATNR = IT_FINAL-MATNR

    AND BWKEY. = IT_FINAL-WERKS

    And you need to take care of this while reading data from IT_MBEW .

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.