Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9164

Re: Blocked ALV Excel Download Issue

$
0
0

Hi,

 

Can you share your sample code?

 

I tried with my below code and it works fine.

 

TABLES: MARA, MAKT, MARD.

*provide type-pools

TYPE-POOLS: SLIS.

*provide select-options

SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.

*provide data objects

DATA: V_REPID TYPE SY-REPID,

      WA_MARA_FIELD TYPE SLIS_FIELDCAT_ALV,       "it is for field catalog

      WA_MAKT_FIELD TYPE SLIS_FIELDCAT_ALV,

      WA_MARD_FIELD TYPE SLIS_FIELDCAT_ALV,

      WA_MARA TYPE MARA,

      WA_MAKT TYPE MAKT,

      WA_MARD TYPE MARD,

      IT_MARA_FIELD TYPE SLIS_T_FIELDCAT_ALV,

      IT_MAKT_FIELD TYPE SLIS_T_FIELDCAT_ALV,

      IT_MARD_FIELD TYPE SLIS_T_FIELDCAT_ALV,

      IT_MARA TYPE TABLE OF MARA,

      IT_MAKT TYPE TABLE OF MAKT,

      IT_MARD TYPE TABLE OF MARD,

      V_LAYOUT TYPE SLIS_LAYOUT_ALV,

      IT_EVENTS TYPE SLIS_T_EVENT,            "it is for events

      WA_EVENTS TYPE SLIS_ALV_EVENT.

V_REPID = SY-REPID.

*provide field catalog perform

PERFORM FIELD_CAT.

*call the initial function module

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

  EXPORTING

    I_CALLBACK_PROGRAM             = V_REPID

*   I_CALLBACK_PF_STATUS_SET       = ' '

*   I_CALLBACK_USER_COMMAND        = ' '

*   IT_EXCLUDING                   =

          .

*provide perform for select the data

PERFORM SELECT_DATA.

*call mara append list

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

  EXPORTING

    IS_LAYOUT                        = V_LAYOUT

    IT_FIELDCAT                      = IT_MARA_FIELD[]

    I_TABNAME                        = 'MARA'

    IT_EVENTS                        = IT_EVENTS[]

*   IT_SORT                          =

*   I_TEXT                           = ' '

  TABLES

    T_OUTTAB                         = IT_MARA

EXCEPTIONS

   PROGRAM_ERROR                    = 1

   MAXIMUM_OF_APPENDS_REACHED       = 2

   OTHERS                           = 3.

*call makt append list

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

  EXPORTING

    IS_LAYOUT                        = V_LAYOUT

    IT_FIELDCAT                      = IT_MAKT_FIELD

    I_TABNAME                        = 'MAKT'

    IT_EVENTS                        = IT_EVENTS

*   IT_SORT                          =

*   I_TEXT                           = ' '

  TABLES

    T_OUTTAB                         = IT_MAKT

EXCEPTIONS

   PROGRAM_ERROR                    = 1

   MAXIMUM_OF_APPENDS_REACHED       = 2

   OTHERS                           = 3.

*call mard append list

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

  EXPORTING

    IS_LAYOUT                        = V_LAYOUT

    IT_FIELDCAT                      = IT_MARD_FIELD

    I_TABNAME                        = 'MARD'

    IT_EVENTS                        = IT_EVENTS

*   IT_SORT                          =

*   I_TEXT                           = ' '

  TABLES

    T_OUTTAB                         = IT_MARD

EXCEPTIONS

   PROGRAM_ERROR                    = 1

   MAXIMUM_OF_APPENDS_REACHED       = 2

   OTHERS                           = 3.

*display the data

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.

.

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

*&      Form  TOP_PAGE

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

*       text

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

FORM TOP_PAGE.

  WRITE:/ 'THIS IS BLOCKED ALV REPORT PROGRAM BASED ON 3 BLOCKS' COLOR 5.

ENDFORM.                    "TOP_PAGE

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

*&      Form  FIELD_CAT

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

*       text

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

*  -->  p1        text

*  <--  p2        text

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

FORM FIELD_CAT .

WA_MARA_FIELD-COL_POS = 1.

WA_MARA_FIELD-FIELDNAME = 'MATNR'.

WA_MARA_FIELD-REF_TABNAME = 'MARA'.

APPEND WA_MARA_FIELD TO IT_MARA_FIELD.

CLEAR WA_MARA_FIELD.

WA_MARA_FIELD-COL_POS = 2.

WA_MARA_FIELD-FIELDNAME = 'ERSDA'.

WA_MARA_FIELD-REF_TABNAME = 'MARA'.

APPEND WA_MARA_FIELD TO IT_MARA_FIELD.

CLEAR WA_MARA_FIELD.

WA_MARA_FIELD-COL_POS = 3.

WA_MARA_FIELD-FIELDNAME = 'ERNAM'.

WA_MARA_FIELD-REF_TABNAME = 'MARA'.

APPEND WA_MARA_FIELD TO IT_MARA_FIELD.

CLEAR WA_MARA_FIELD.

WA_MARA_FIELD-COL_POS = 4.

WA_MARA_FIELD-FIELDNAME = 'LAEDA'.

WA_MARA_FIELD-REF_TABNAME = 'MARA'.

APPEND WA_MARA_FIELD TO IT_MARA_FIELD.

CLEAR WA_MARA_FIELD.

WA_MAKT_FIELD-COL_POS = '1'.

WA_MAKT_FIELD-FIELDNAME = 'MATNR'.

WA_MAKT_FIELD-REF_TABNAME = 'MAKT'.

APPEND WA_MAKT_FIELD TO IT_MAKT_FIELD.

CLEAR WA_MAKT_FIELD.

WA_MAKT_FIELD-COL_POS = 2.

WA_MAKT_FIELD-FIELDNAME = 'MAKTX'.

WA_MAKT_FIELD-REF_TABNAME = 'MAKT'.

APPEND WA_MAKT_FIELD TO IT_MAKT_FIELD.

CLEAR WA_MAKT_FIELD.

WA_MAKT_FIELD-COL_POS = 3.

WA_MAKT_FIELD-FIELDNAME = 'MAKTG'.

WA_MAKT_FIELD-REF_TABNAME = 'MAKT'.

APPEND WA_MAKT_FIELD TO IT_MAKT_FIELD.

CLEAR WA_MAKT_FIELD.

WA_MARD_FIELD-COL_POS = 1.

WA_MARD_FIELD-FIELDNAME = 'MATNR'.

WA_MARD_FIELD-REF_TABNAME = 'MARD'.

APPEND WA_MARD_FIELD TO IT_MARD_FIELD.

CLEAR WA_MARD_FIELD.

WA_MARD_FIELD-COL_POS = 2.

WA_MARD_FIELD-FIELDNAME = 'WERKS'.

WA_MARD_FIELD-REF_TABNAME = 'MARD'.

APPEND WA_MARD_FIELD TO IT_MARD_FIELD.

CLEAR WA_MARD_FIELD.

WA_MARD_FIELD-COL_POS = 3.

WA_MARD_FIELD-FIELDNAME = 'LGORT'.

WA_MARD_FIELD-REF_TABNAME = 'MARD'.

APPEND WA_MARD_FIELD TO IT_MARD_FIELD.

CLEAR WA_MARD_FIELD.

WA_EVENTS-FORM = 'TOP_PAGE'.

WA_EVENTS-NAME = 'TOP_OF_PAGE'.

APPEND WA_EVENTS TO IT_EVENTS.

ENDFORM.                    " FIELD_CAT

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

*&      Form  SELECT_DATA

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

*       text

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

*  -->  p1        text

*  <--  p2        text

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

FORM SELECT_DATA .

SELECT *

FROM MARA

INTO TABLE IT_MARA

WHERE MATNR IN S_MATNR.

SELECT *

FROM MAKT

INTO TABLE IT_MAKT

WHERE MATNR IN S_MATNR.

SELECT *

FROM MARD

INTO TABLE IT_MARD

WHERE MATNR IN S_MATNR.

ENDFORM.                    " SELECT_DATA

 

 

BR

Sumeet


Viewing all articles
Browse latest Browse all 9164

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>