Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem while downloding classical report into xls file

former_member211992
Active Participant
0 Kudos
193

Dear all

I could not download all the rows in classical report into excel file in PRD server , if i run the same report in DEV server i can able to get excel sheet with all rows. in prd server classical report shows 8 pages if i download that to excel file it only shows 5 pages . for the same report in DEV server its working good i can able to get all the 8 pages in excel sheet , how to rectify that..

Thanks in advance

1 ACCEPTED SOLUTION

former_member211992
Active Participant
0 Kudos
119

Dear all

Thanks for all your replies .

I have found the sol , i just reduced column width and got all pages in the xls file.

4 REPLIES 4

gouravkumar64
Active Contributor
0 Kudos
119

So Us Your code Portion.

Thanks

Gourav.

0 Kudos
119

*&---------------------------------------------------------------------*

*& Report  ZBOMPRC01

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT  ZBOMPRC01 LINE-SIZE 300.

Tables: mara, makt, mbew, mast, stpo, t001w.

type-pools : slis.

data : gs_fieldtab         TYPE slis_fieldcat_alv,

  g_fieldtab               TYPE slis_t_fieldcat_alv,

  g_list_top_of_page       TYPE slis_t_listheader.

DATA: gs_layout TYPE slis_layout_alv.

*&---------------------------------------------------------------------*

*&  TYPES                    Begin with TY_                            *

*&---------------------------------------------------------------------*

TYPES :

*--> Selection Screen Fields

    BEGIN OF ty_screen,

    matnr                      TYPE mara-matnr,            " Material Number

    mtart                      TYPE mara-mtart,            " Material Type

    werks                      TYPE t001w-werks,           " Plant

    stlan                      TYPE mast-stlan,            " BOM Usage

    END OF ty_screen,

*--> To Fetch the Material Description

    BEGIN OF ty_makt,

    matnr                      TYPE mara-matnr,            " Material Number

    maktx                      TYPE makt-maktx,            " Material Description

    END OF ty_makt,

    BEGIN OF ty_mast,

    matnr                      TYPE mara-matnr,            " Material Number

    werks                      TYPE t001w-werks,           " Plant

    stlnr                      TYPE mast-stlnr,            " Bill of Material

    stlan                      TYPE mast-stlan,            " BOM Usage

    END OF ty_mast,

    BEGIN OF ty_mara,

    matnr                      TYPE mara-matnr,            " Material Number

    meins                      TYPE mara-meins,            " Unit

    werks                      TYPE mard-werks,            " Plant

    END OF ty_mara,

*--> To Fetch the BOM Components

    BEGIN OF ty_stpo,

    stlnr                      TYPE stpo-stlnr,            " Bil of Material

    idnrk                      TYPE mara-matnr,            " BOM Component

    posnr                      TYPE stpo-posnr,            " BOM Items

    menge                      TYPE stpo-menge,            " Quantity

    meins                      TYPE stpo-meins,            " Unit

    matnr                      TYPE mara-matnr,            " Material Number

    werks                      TYPE t001w-werks,           " Plant

    END OF ty_stpo,

    BEGIN OF ty_t001w,

    werks                      TYPE t001w-werks,           " Plant

    name1                      TYPE t001w-name1,           " Plant Description

    END OF ty_t001w,

    BEGIN OF ty_mbew,

    matnr                      TYPE mbew-matnr,

    bwkey                      TYPE mbew-bwkey,

    bwtar                      TYPE mbew-bwtar,

    vprsv                      TYPE mbew-vprsv,

    verpr                      TYPE mbew-verpr,

    stprs                      TYPE mbew-stprs,

    END OF ty_mbew,

    BEGIN OF ty_final,

    matnr                      TYPE mara-matnr,            " Material Number

    mtart                      type mara-mtart,

    mtbez                      type T134T-mtbez,

    bom_maktx                  TYPE makt-maktx,            " Short Description

    werks                      TYPE t001w-werks,           " Plant

    name1                      TYPE t001w-name1,           " Plant Description

    stlnr                      TYPE mast-stlnr,            " Bill of Material

    idnrk                      TYPE mara-matnr,            " BOM Component

    comp_maktx                 TYPE makt-maktx,            " Short Description

    menge                      TYPE stpo-menge,            " Quantity

    meins                      TYPE stpo-meins,            " Unit

    flag                       TYPE C,

    dom                        TYPE mbew-VERPR,

    dom1                       TYPE MBEW-VERPR,

    inhouse                    TYPE mbew-VERPR,

    imp                        TYPE mbew-VERPR,

    blank                      TYPE mbew-VERPR,

    dom_control                TYPE mbew-vprsv,

    dom1_control               type mbew-vprsv,

    inhouse_control            TYPE mbew-vprsv,

    imp_control                TYPE mbew-vprsv,

    blank_control              TYPE mbew-vprsv,

    dom_value                  TYPE mbew-verpr,

    dom1_value                 type mbew-verpr,

    inhouse_value              TYPE mbew-VERPR,

    imp_value                  TYPE mbew-VERPR,

    blank_value                TYPE mbew-VERPR,

    END OF ty_final.

data: begin of it_collect occurs 0,

      matnr type mara-matnr,

      blank_value type mbew-verpr,

      end of it_collect.

      data : begin of t_marat occurs 0,

      matnr type mara-matnr,

      mtart type mara-mtart,

      end of t_marat.

data : begin of t_t134t occurs 0,

mtart type t134t-mtart,

mtbez type t134t-mtbez,

end of t_t134t.

*&---------------------------------------------------------------------*

*&  C O N S T A N T S        Begin with C_                             *

*&---------------------------------------------------------------------*

CONSTANTS :

    c_e                      TYPE c VALUE 'E',                  " Error Type

    c_onli(4)                TYPE c VALUE 'ONLI',               " SYUCOMM

    c_x                      TYPE c VALUE 'X',                  " Check Box

    c_:                      TYPE c VALUE ':',                  " Colon

    c_vline                  TYPE c VALUE '|',                  " Vertical Line

    c_unit                   TYPE char3 VALUE'NOS',             " Unit

    c_i                      TYPE c VALUE 'I',                  " Error Type

    c_m                      TYPE c VALUE 'M',                  " BOM Category

    c_hyphen                 TYPE c VALUE '-'.                  " Hyphen

*&---------------------------------------------------------------------*

*&  WORK AREA                Begin with GS_                            *

*&---------------------------------------------------------------------*

DATA:

    gs_screen                TYPE ty_screen,               " Screen Fields

    gs_mara                  TYPE ty_mara,                 " To Store the Material Numbers

    gs_t001w                 TYPE ty_t001w,                " To Store the Plant

    gs_makt                  TYPE ty_makt,                 " To Store Material Description

    gs_final                 TYPE ty_final,                " To Store the Final Data for Display

    gs_final1                TYPE ty_final,               " To Store the Final Data for Display

    gs_store                 TYPE ty_final,               " To Store the Final Data for Display

    gs_final_hdr             TYPE ty_final,               " To Store the Final Data for Display

    gs_display               TYPE ty_final,

    gs_mast                  TYPE ty_mast,                 " BOM

    gs_mbew                  TYPE ty_mbew.

*&---------------------------------------------------------------------*

*&  GLOBAL FIELDS            Begin with G_                             *

*&---------------------------------------------------------------------*

DATA:

    g_bomflag                TYPE i,                      " Raw Material Indicator

    g_rawflag                TYPE i.                     " Raw Material Indicator

*&---------------------------------------------------------------------*

*&  Internal tables          Begin with T_                             *

*&---------------------------------------------------------------------*

DATA :

    t_mast                   TYPE TABLE OF ty_mast,        " To Store the BOM

    t_mast_fltrd             TYPE TABLE OF ty_mast,        " To Store the Filtered BOM

    t_mara                   TYPE TABLE OF ty_mara,        " To Store the Material Numbers

    t_t001w                  TYPE TABLE OF ty_t001w,       " To Store the Plant

    t_makt                   TYPE TABLE OF ty_makt,        " To Store the Material Description

    t_final                  TYPE TABLE OF ty_final,       " To Store the Final Data for Display

    t_final1                 TYPE TABLE OF ty_final,       " To Store the Final Data for Display

    t_store                  TYPE TABLE OF ty_final,

    t_samp                   TYPE TABLE OF ty_final,

    t_display                TYPE TABLE OF ty_final,

    t_sub                    TYPE TABLE OF ty_final,

    t_dummy                  TYPE TABLE OF ty_final,       " To Store the Final Data for Display

    t_final_hdr              TYPE TABLE OF ty_final,       " To Store the Final Data for Display

    t_mard                   TYPE TABLE OF ty_screen,      " To Find the Shortage

    t_mard1                  TYPE TABLE OF ty_screen,      " To Find the Shortage

    t_mard_hdr               TYPE TABLE OF ty_screen,      " To Find the Shortage

    t_stpo_fltrd             TYPE TABLE OF ty_stpo,        " To Store the Filtered BOM components

    t_stpo_final             TYPE TABLE OF ty_stpo,        " To Store the BOM components

    t_stpo_final1             TYPE TABLE OF ty_stpo,        " To Store the BOM components   lydia

    t_stpo                   TYPE TABLE OF ty_stpo,        " To Store the BOM components

    t_mbew                   TYPE TABLE OF ty_mbew.

*----------------------------------------------------------------------*

*   Field-Symbols            Begin with <FS_                           *

*----------------------------------------------------------------------*

FIELD-SYMBOLS:

    <fs_stpo>                TYPE ty_stpo,                 " To Store the BOM components

    <fs_final>               TYPE ty_final,                " To Store the Final Data for Display

    <fs_store>               TYPE ty_final.

*&---------------------------------------------------------------------*

*& S E L E C T I O N - S C R E E N                                     *

*& SELECT-OPTIONS            Begin with S_

*& PARAMETERS                Begin with P_

*&---------------------------------------------------------------------*

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS:

  p_werks TYPE werks_d.

*  p_stlan type mast-stlan,

*  p_mtart TYPE mara-mtart.

SELECT-OPTIONS:

  s_matnr FOR gs_screen-matnr NO-EXTENSION NO INTERVALS. " MODIF ID s1.

SELECTION-SCREEN: END OF BLOCK b1.

*parameters : c_chk as checkbox.

*&---------------------------------------------------------------------*

*& I N I T I A L I Z A T I O N                                         *

*&---------------------------------------------------------------------*

INITIALIZATION.

  PERFORM clear_tables.

*&---------------------------------------------------------------------*

*& A T  S E L E C T I O N - S C R E E N                                *

*&---------------------------------------------------------------------*

AT SELECTION-SCREEN.

  IF s_matnr IS INITIAL.

    MESSAGE text-e07 TYPE c_e.

  ELSE.

    CLEAR gs_mara.

    SELECT SINGLE matnr meins

      FROM mara

      INTO gs_mara

     WHERE matnr in s_matnr.

    IF sy-subrc IS NOT INITIAL.

      MESSAGE text-e01 TYPE c_e.

    ELSE.

      REFRESH s_matnr.

      s_matnr-sign   = 'I'.

      s_matnr-option = 'EQ'.

      s_matnr-low    = gs_mara-matnr.

      APPEND s_matnr TO s_matnr.

    ENDIF.

  ENDIF.

  CLEAR gs_t001w.

  SELECT werks name1

    FROM t001w

    INTO TABLE t_t001w

   WHERE werks = p_werks.

  IF sy-subrc IS NOT INITIAL.

    MESSAGE text-e02 TYPE c_e.

  ENDIF.

*&---------------------------------------------------------------------*

*& S T A R T - O F - S E L E C T I O N                                 *

*&---------------------------------------------------------------------*

START-OF-SELECTION.

  REFRESH t_mara.

  CLEAR gs_mara.

  PERFORM get_makt.

  PERFORM get_mast.

  PERFORM get_stpo.

  PERFORM filter_mast TABLES s_matnr.

  PERFORM get_mbew.

  PERFORM get_mtart.

  PERFORM fill_final.

*  if c_chk eq 'X'.

*

*  perform alv.

*

*  else.

  PERFORM display_output.

*endif.

*&---------------------------------------------------------------------*

*&      Form  CLEAR_TABLES

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM CLEAR_TABLES .

  CLEAR:

    gs_screen,

    gs_final,

    gs_t001w,

    gs_makt,

    gs_final_hdr,

    gs_mara.

  REFRESH:

    t_mast,

    t_mast_fltrd,

    t_stpo_final,

    t_stpo_fltrd,

    t_final,

    t_final_hdr,

    t_stpo,

    t_t001w,

    t_stpo,

    t_mara,

    t_makt,

    t_dummy.

  UNASSIGN:

      <fs_stpo>,

      <fs_final>.

ENDFORM.                    " CLEAR_TABLES

*&---------------------------------------------------------------------*

*&      Form  GET_MAKT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM GET_MAKT .

  REFRESH t_makt.

  SELECT matnr maktx

    FROM makt

    INTO TABLE t_makt

   WHERE spras = sy-langu.

  IF sy-subrc IS INITIAL.

    SORT t_makt BY matnr.

  ENDIF.

ENDFORM.                    " GET_MAKT

*&---------------------------------------------------------------------*

*&      Form  GET_MAST

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM GET_MAST .

  REFRESH: t_mast.

  SELECT matnr werks stlnr

    FROM mast

    INTO TABLE t_mast

   WHERE werks = p_werks.

  IF sy-subrc IS INITIAL.

    SORT t_mast BY matnr werks stlnr.

    DELETE ADJACENT DUPLICATES FROM t_mast COMPARING matnr werks stlnr.

  ENDIF.

ENDFORM.                    " GET_MAST

*&---------------------------------------------------------------------*

*&      Form  GET_STPO

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM GET_STPO .

  REFRESH t_stpo.

  SELECT stlnr idnrk posnr menge meins

    FROM stpo

    INTO TABLE t_stpo

   WHERE stlty = 'M'.

  IF sy-subrc IS INITIAL.

    SORT t_stpo BY stlnr idnrk posnr.

    DELETE ADJACENT DUPLICATES FROM t_stpo COMPARING stlnr idnrk.

  ENDIF.

ENDFORM.                    " GET_STPO

*&---------------------------------------------------------------------*

*&      Form  FILTER_MAST

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_S_MATNR  text

*----------------------------------------------------------------------*

FORM FILTER_MAST  TABLES   P_S_MATNR .

  REFRESH: t_mast_fltrd.

  APPEND LINES OF t_mast TO t_mast_fltrd.

  DELETE t_mast_fltrd WHERE matnr NOT IN p_s_matnr.

  SORT t_mast_fltrd BY matnr werks stlnr.

  CLEAR gs_mast.

  IF t_mast_fltrd IS NOT INITIAL.

    REFRESH s_matnr.

    LOOP AT t_mast_fltrd INTO gs_mast.

      s_matnr-low = gs_mast-stlnr.

      APPEND s_matnr TO s_matnr.

    ENDLOOP.

    g_bomflag = 1.

    PERFORM filter_stpo TABLES s_matnr.

  ELSEIF g_bomflag NE 1.

    PERFORM check_stpo TABLES s_matnr.

  ENDIF.

ENDFORM.                    " FILTER_MAST

*&---------------------------------------------------------------------*

*&      Form  FILTER_STPO

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_S_MATNR  text

*----------------------------------------------------------------------*

FORM FILTER_STPO  TABLES   P_S_MATNR.

  REFRESH: t_stpo_fltrd.

  APPEND LINES OF t_stpo TO t_stpo_fltrd.

  DELETE t_stpo_fltrd WHERE stlnr NOT IN p_s_matnr.

  SORT t_stpo_fltrd BY stlnr idnrk posnr.

  IF t_stpo_fltrd IS NOT INITIAL.

*--> To Assign the Plant to each Material

    REFRESH s_matnr.

    CLEAR gs_mast.

    LOOP AT t_stpo_fltrd ASSIGNING <fs_stpo>.

      s_matnr-low = <fs_stpo>-idnrk.

      APPEND s_matnr TO s_matnr.

      READ TABLE t_mast INTO gs_mast WITH KEY stlnr = <fs_stpo>-stlnr.

      IF sy-subrc IS INITIAL.

        <fs_stpo>-werks = gs_mast-werks.

        <fs_stpo>-matnr = gs_mast-matnr.

      ENDIF.

    ENDLOOP.

    APPEND LINES OF t_stpo_fltrd TO t_stpo_final.

*--> To Fetch the BOM Components for all the Recursive BOM's

    PERFORM filter_mast TABLES s_matnr.

  ENDIF.

ENDFORM.                    " FILTER_STPO

*&---------------------------------------------------------------------*

*&      Form  CHECK_STPO

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_S_MATNR  text

*----------------------------------------------------------------------*

FORM CHECK_STPO  TABLES   P_S_MATNR .

  REFRESH t_stpo_fltrd.

  APPEND LINES OF t_stpo TO t_stpo_fltrd.

  DELETE t_stpo_fltrd WHERE idnrk NOT IN p_s_matnr.

  IF t_stpo_fltrd IS NOT INITIAL.

    SORT t_stpo_fltrd BY stlnr idnrk posnr.

    REFRESH t_mast_fltrd.

    APPEND LINES OF t_mast TO t_mast_fltrd.

    REFRESH s_matnr.

    LOOP AT t_stpo_fltrd ASSIGNING <fs_stpo>.

      CLEAR gs_mast.

      READ TABLE t_mast INTO gs_mast WITH KEY stlnr = <fs_stpo>-stlnr.

      IF sy-subrc IS INITIAL.

        <fs_stpo>-werks = gs_mast-werks.

        <fs_stpo>-matnr = gs_mast-matnr.

      ENDIF.

    ENDLOOP.

    APPEND LINES OF t_stpo_fltrd TO t_stpo_final.

    SORT t_stpo_final BY stlnr idnrk posnr.

  ELSE.

    g_rawflag = 1.

  ENDIF.

ENDFORM.                    " CHECK_STPO

*&---------------------------------------------------------------------*

*&      Form  GET_MBEW

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM GET_MBEW .

  IF t_stpo_final IS NOT INITIAL.

    SELECT matnr bwkey bwtar vprsv verpr stprs

      FROM mbew

      INTO TABLE t_mbew

       FOR ALL ENTRIES IN t_stpo_final

     WHERE matnr = t_stpo_final-idnrk

       AND bwkey = t_stpo_final-werks

       AND BWTAR IN ('SF-DOM','SF-INHOUSE','SF-IMP', 'RM-DOM' , SPACE).

    IF sy-subrc IS INITIAL.

      SORT t_mbew BY matnr bwkey.

    ENDIF.

  ENDIF.

ENDFORM.                    " GET_MBEW

*&---------------------------------------------------------------------*

*&      Form  FILL_FINAL

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM FILL_FINAL .

  REFRESH t_final.

  CLEAR gs_final.

  data: v_dom type mbew-verpr,

  v_dom1 type mbew-verpr,

        v_inhouse type mbew-verpr,

        v_imp type mbew-verpr,

        v_blank type mbew-verpr,

        dom_control type mbew-vprsv,

        dom1_control type mbew-vprsv,

        inhouse_control type mbew-vprsv,

        imp_control type mbew-vprsv,

        blank_control type mbew-vprsv,

        dom_value TYPE mbew-verpr,

        inhouse_value TYPE mbew-VERPR,

        imp_value TYPE mbew-VERPR,

        blank_value TYPE mbew-VERPR,

        v_tot type mbew-verpr,

        v_tot1 type mbew-verpr.

  clear: v_dom, v_inhouse, v_imp, v_blank.

  IF t_stpo_final IS NOT INITIAL.

    LOOP AT t_stpo_final ASSIGNING <fs_stpo>.

      gs_final-matnr         = <fs_stpo>-matnr.

      gs_final-werks         = <fs_stpo>-werks.

      gs_final-stlnr         = <fs_stpo>-stlnr .

      gs_final-idnrk         = <fs_stpo>-idnrk.

      gs_final-menge         = <fs_stpo>-menge.

      gs_final-meins         = <fs_stpo>-meins.

      CLEAR gs_makt.

      READ TABLE t_makt INTO gs_makt WITH KEY matnr = <fs_stpo>-matnr.

      IF sy-subrc IS INITIAL.

        gs_final-bom_maktx = gs_makt-maktx.

      ENDIF.

      CLEAR gs_makt.

      READ TABLE t_makt INTO gs_makt WITH KEY matnr = <fs_stpo>-idnrk.

      IF sy-subrc IS INITIAL.

        gs_final-comp_maktx = gs_makt-maktx.

      ENDIF.

      CLEAR gs_t001w.

      READ TABLE t_t001w INTO gs_t001w WITH KEY werks = gs_final-werks.

      IF sy-subrc IS INITIAL.

        gs_final-name1 = gs_t001w-name1.

      ENDIF.

      read table t_marat with key matnr = <fs_stpo>-idnrk.

       if sy-subrc = 0.

       read table t_t134t with key mtart = t_marat-mtart.

       if sy-subrc = 0.

       gs_final-mtart = t_marat-mtart.

       gs_final-mtbez = t_t134t-mtbez.

       endif.

       endif.

      LOOP AT t_mbew INTO gs_mbew WHERE matnr = <fs_stpo>-idnrk

                                    AND bwkey = <fs_stpo>-werks.

        if gs_mbew-bwtar = 'SF-DOM'.

          if gs_mbew-vprsv = 'V'.

            v_dom = gs_mbew-verpr.

            dom_control = gs_mbew-vprsv.

          else.

            v_dom = gs_mbew-stprs.

            dom_control = gs_mbew-vprsv.

          ENDIF.

          gs_final-dom_value = gs_final-menge * v_dom.

        endif.

        if gs_mbew-bwtar = 'SF-INHOUSE'.

          if gs_mbew-vprsv = 'V'.

            v_inhouse = gs_mbew-verpr.

            inhouse_control = gs_mbew-vprsv.

          else.

            v_inhouse = gs_mbew-stprs.

            inhouse_control = gs_mbew-vprsv.

          ENDIF.

          gs_final-inhouse_value = gs_final-menge * v_inhouse.

        endif.

        if gs_mbew-bwtar = 'SF-IMP'.

          if gs_mbew-vprsv = 'V'.

            v_imp = gs_mbew-verpr.

            imp_control = gs_mbew-vprsv.

          else.

            v_imp = gs_mbew-stprs.

            imp_control = gs_mbew-vprsv.

          ENDIF.

          gs_final-imp_value = gs_final-menge * v_imp.

        endif.

        if gs_mbew-bwtar = 'RM-DOM'.

          if gs_mbew-vprsv = 'V'.

            v_dom1 = gs_mbew-verpr.

            dom1_control = gs_mbew-vprsv.

          else.

            v_dom1 = gs_mbew-stprs.

            dom1_control = gs_mbew-vprsv.

          ENDIF.

          gs_final-dom1_value = gs_final-menge * v_dom1.

        endif.

        if gs_mbew-bwtar = ' '.

          if gs_mbew-vprsv = 'V'.

            v_blank = gs_mbew-verpr.

            blank_control = gs_mbew-vprsv.

          else.

            v_blank = gs_mbew-stprs.

            blank_control = gs_mbew-vprsv.

          ENDIF.

          gs_final-blank_value = gs_final-menge * v_blank.

*          v_tot = gs_final-blank_value + v_tot.

*          on change of gs_final-matnr.

*            v_tot1 = v_tot.

*            clear v_tot.

*          endon.

        endif.

      ENDLOOP.

      gs_final-dom = v_dom.

      gs_final-inhouse = v_inhouse.

      gs_final-imp = v_imp.

      gs_final-blank = v_blank.

      gs_final-dom_control = dom_control.

      gs_final-inhouse_control = inhouse_control.

      gs_final-imp_control = imp_control.

      gs_final-blank_control = blank_control.

      gs_final-dom1 = v_dom1.

      gs_final-dom1_control = dom1_control.

      APPEND gs_final TO t_final.

      CLEAR: gs_final, dom_control, inhouse_control, imp_control, blank_control, v_dom, v_inhouse,v_imp, v_inhouse , V_DOM1 , DOM1_CONTROL  .

    ENDLOOP.

  ENDIF.

  loop at t_final into gs_final.

    it_collect-matnr = gs_final-matnr.

    it_collect-blank_value = gs_final-blank_value.

    collect it_collect.

    clear it_collect.

  endloop.

  REFRESH t_final_hdr.

  APPEND LINES OF t_final TO t_final_hdr.

*  sort t_final_hdr by matnr.

*  DELETE ADJACENT DUPLICATES FROM t_final COMPARING idnrk werks.  " Added by lydia

  DELETE ADJACENT DUPLICATES FROM t_final_hdr COMPARING matnr werks.

  loop at t_final_hdr into gs_final_hdr.

    read table it_collect with key matnr = gs_final_hdr-matnr.

    if sy-subrc = 0.

      gs_final_hdr-blank_value = it_collect-blank_value.

      modify t_final_hdr from gs_final_hdr.

      clear gs_final_hdr.

    endif.

  endloop.

ENDFORM.                    " FILL_FINAL

*&---------------------------------------------------------------------*

*&      Form  DISPLAY_OUTPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM DISPLAY_OUTPUT .

  DATA:

     l_bom_text               TYPE char50,                          " BOM Text

     lv_old_pagno             TYPE sy-datum,                        " Page No

     lv_new_pagno             TYPE sy-datum,                        " Page No

     l_plant                  TYPE char35,                          " Plant Description

     lv_meins                 TYPE char3.                           " Quantity

  IF t_final_hdr IS INITIAL.

    MESSAGE text-e04 TYPE c_i.

    EXIT.

  ELSE.

    SKIP 3.

    WRITE:/39 text-t01.

    lv_old_pagno = sy-pagno.

    LOOP AT t_final_hdr INTO gs_final_hdr.

      IF sy-linno GE 50.

        NEW-PAGE.

        lv_new_pagno = sy-pagno.

        SKIP 3.

      ENDIF.

      SKIP 3.

      CLEAR l_bom_text.

      CONCATENATE gs_final_hdr-matnr gs_final_hdr-bom_maktx INTO l_bom_text

                  SEPARATED BY c_hyphen.

      CONDENSE l_bom_text.

      CLEAR l_plant.

      CONCATENATE gs_final_hdr-werks gs_final_hdr-name1 INTO l_plant

                  SEPARATED BY c_hyphen.

      CONDENSE l_plant.

      IF t_stpo_final IS NOT INITIAL.

        WRITE:/2 text-t05,20 c_:,22 l_bom_text.

      ENDIF.

      IF lv_old_pagno NE lv_new_pagno.

        WRITE:90 text-t14, 100 c_:, 100 sy-pagno.

      ENDIF.

      WRITE:/2 text-t11,20 c_:,22 l_plant.

      IF lv_old_pagno NE lv_new_pagno.

        WRITE:90 text-t13, 100 c_:, 100 sy-datum.

      ENDIF.

      IF t_stpo_final IS NOT INITIAL.

        WRITE:/2 text-t26,20 c_:,22 gs_final_hdr-blank_value LEFT-JUSTIFIED UNIT c_unit.

*        WRITE:/2 text-t06,20 c_:,22 gs_final_hdr-bom_soh      LEFT-JUSTIFIED UNIT c_unit.

*        WRITE:/2 text-t07,20 c_:,22 gs_final_hdr-bom_shortage LEFT-JUSTIFIED UNIT c_unit.

*

      ENDIF.

      FORMAT COLOR 1 ON.

      NEW-LINE.

      ULINE (290).

      WRITE:/1(1) c_vline,  2(18) text-t03 CENTERED, 20(1) c_vline, 21(15) text-t30 CENTERED, 36(1) c_vline ,37(30) text-t10 CENTERED,

            67(1) c_vline, 68(5)  text-t04 CENTERED, 73(1) c_vline,  74(13) text-t09 CENTERED,

            87(1) c_vline, 88(13) text-t06 CENTERED, 101(1) c_vline,  102(7) text-t07 CENTERED, 109(1) c_vline,  110(11) text-t08 CENTERED,

           121(1) c_vline, 122(12) text-t18 CENTERED, 134(1) c_vline, 135(13) text-t17 CENTERED, 148(1) c_vline,  149(13) text-t19 CENTERED,

           162(1) c_vline, 163(13) text-t20 CENTERED, 176(1) c_vline, 177(13) text-t21 CENTERED, 190(1) c_vline,  191(13) text-t22 CENTERED,

           204(1) c_vline, 205(13) text-t23 CENTERED, 218(1) c_vline, 219(13) text-t24 CENTERED, 232(1) c_vline,  233(13) text-t25 CENTERED, 245(1) c_vline , 246(13) text-t27 CENTERED,

           260(1) c_vline , 261(13) text-t28 CENTERED,   275(1) c_vline , 276(13) text-t29 CENTERED,290(1) c_vline.

      ULINE (290).

      FORMAT COLOR 1 OFF.

      WRITE:/1(1) c_vline,  2(18)  text-t15,150(1) c_vline .

      IF t_stpo_final IS NOT INITIAL.

        PERFORM bom_display.

      ENDIF.

      lv_old_pagno = lv_new_pagno.

      NEW-LINE.

      ULINE (290).

    ENDLOOP.

  ENDIF.

  WRITE:/45 text-t02.

ENDFORM.                    " DISPLAY_OUTPUT

*&---------------------------------------------------------------------*

*&      Form  BOM_DISPLAY

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM BOM_DISPLAY .

  DATA:

     l_bom_text               TYPE char50,                          " BOM Text

     lv_old_pagno             TYPE sy-datum,                        " Page No

     lv_new_pagno             TYPE sy-datum,                        " Page No

     l_plant                  TYPE char35,                          " Plant Description

     lv_meins                 TYPE char3.                           " Quantit

  LOOP AT t_final INTO gs_final WHERE werks = gs_final_hdr-werks

                                  AND matnr = gs_final_hdr-matnr.

    CLEAR: lv_meins.

    WRITE gs_final-meins TO lv_meins.

    IF t_stpo_final IS NOT INITIAL.

      WRITE:1(1) c_vline,   2(18)  gs_final-idnrk CENTERED.

    ELSE.

      WRITE:1(1) c_vline,   2(18)  gs_final-matnr CENTERED.

    ENDIF.

    WRITE: 20(1) c_vline,  21(15) gs_final-mtbez,

          36(1) c_vline,  37(30) gs_final-comp_maktx,

          67(1) c_vline,  68(5)  lv_meins CENTERED,

          73(1) c_vline,  74(13)  gs_final-menge UNIT c_unit,

          87(1) c_vline,  88(13) gs_final-blank UNIT c_unit,

          101(1) c_vline,  102(7) gs_final-blank_control,

         109(1) c_vline,  110(11) gs_final-blank_value UNIT c_unit,

         121(1) c_vline,  122(12) gs_final-dom UNIT c_unit,

         134(1) c_vline,  135(13) gs_final-dom_control UNIT c_unit,

         148(1) c_vline,  149(13) gs_final-dom_value UNIT c_unit,

         162(1) c_vline,  163(13) gs_final-inhouse UNIT c_unit,

         176(1) c_vline,  177(12) gs_final-inhouse_control,

         190(1) c_vline,  191(13) gs_final-inhouse_value UNIT c_unit,

         204(1) c_vline,  205(13) gs_final-imp UNIT c_unit,

         218(1) c_vline,  219(13) gs_final-imp_control UNIT c_unit,

         232(1) c_vline,  233(13) gs_final-imp_value UNIT c_unit,

         245(1) c_vline,  246(13) gs_final-dom1 UNIT c_unit,

         260(1) c_vline,  261(13) gs_final-dom1_control UNIT c_unit,

         275(1) c_vline,  276(13) gs_final-dom1_value UNIT c_unit,

         290(1) c_vline.

    NEW-LINE.

    cleAR GS_FINAL-DOM1_VALUE.

  ENDLOOP.

ENDFORM.                    " BOM_DISPLAY

*&---------------------------------------------------------------------*

*&      Form  GET_MTART

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM GET_MTART .

select matnr mtart from mara into table t_marat for all entries in t_stpo_final

     WHERE matnr = t_stpo_final-idnrk.

select mtart mtbez from t134t into table t_t134t for all entries in t_marat where mtart = t_marat-mtart and spras = 'EN'.

ENDFORM.                    " GET_MTART

*&---------------------------------------------------------------------*

*&      Form  ALV

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM ALV .

gs_fieldtab-fieldname = 'MATNR'.

gs_fieldtab-seltext_l = 'Material Number'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '15'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'MTBEZ'.

gs_fieldtab-seltext_l = 'MATERIAL TYPE'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '15'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'COMP_MAKTX'.

gs_fieldtab-seltext_l = 'Material Description'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '15'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'MEINS'.

gs_fieldtab-seltext_l = 'UOM'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'MENGE'.

gs_fieldtab-seltext_l = 'Quantity'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '6'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'BLANK'.

gs_fieldtab-seltext_l = 'Price'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'BLANK_CONTROL'.

gs_fieldtab-seltext_l = 'Control'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'BLANK_VALUE'.

gs_fieldtab-seltext_l = 'Value'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'DOM'.

gs_fieldtab-seltext_l = 'DOM .P'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'DOM_CONTROL'.

gs_fieldtab-seltext_l = 'DOM.C'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'DOM_VALUE'.

gs_fieldtab-seltext_l = 'DOM.V'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'INHOUSE'.

gs_fieldtab-seltext_l = 'INHOUSE.P'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'INHOUSE_CONTROL'.

gs_fieldtab-seltext_l = 'INHOUSE.C'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'INHOUSE_VALUE'.

gs_fieldtab-seltext_l = 'INHOUSE.V'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'IMP'.

gs_fieldtab-seltext_l = 'IMP.P'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'IMP_CONTROL'.

gs_fieldtab-seltext_l = 'IMP.C'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'IMP_VALUE'.

gs_fieldtab-seltext_l = 'IMP.V'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'DOM1'.

gs_fieldtab-seltext_l = 'RM.P'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'DOM1_CONTROL'.

gs_fieldtab-seltext_l = 'RM.C'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

gs_fieldtab-fieldname = 'DOM1_VALUE'.

gs_fieldtab-seltext_l = 'RM.V'.

gs_fieldtab-tabname   = 't_final'.

gs_fieldtab-outputlen = '5'.

APPEND gs_fieldtab TO g_fieldtab.

CLEAR gs_fieldtab.

*gs_fieldtab-fieldname = 'XBLNR'.

*gs_fieldtab-seltext_l = 'Billing Document No'.

*gs_fieldtab-tabname   = 't_bsak'.

*gs_fieldtab-outputlen = '20'.

*

*APPEND gs_fieldtab TO g_fieldtab.

*CLEAR gs_fieldtab.

*

gs_layout-zebra = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

  EXPORTING

    i_callback_program     = SY-REPID

    is_layout              = gs_layout

    it_fieldcat            = g_fieldtab

*    I_CALLBACK_TOP_OF_PAGE = 'TOP'

    i_default              = 'X'

  TABLES

    t_outtab               = t_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.                    " ALV

Former Member
0 Kudos
119

Are you downloading from the spool? Check if the page limit is set to 5 in production.

In case you are downloading it in online mode, I don't think it should happen.

former_member211992
Active Participant
0 Kudos
120

Dear all

Thanks for all your replies .

I have found the sol , i just reduced column width and got all pages in the xls file.