Application Development and Automation 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: 
Read only

parameters on ALV header

Former Member
0 Likes
1,783

Hi there,

I need some help on having parameter(input fields) on the Header of the ALV.

I am able to display normal text on the header now but how do you put parameters?

also I have some buttons on the Application tool bar but the ALV is taking up the whole screen.

All help are greatly appreciated and points will be given. Thanks alot everyone!

Below are my codes


PROCESS BEFORE OUTPUT.
  MODULE STATUS_0100.

  MODULE INITIALIZATION_100.

PROCESS AFTER INPUT.
  MODULE USER_COMMAND_0100.


*&---------------------------------------------------------------------*
*&      Module  INITIALIZATION_100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE INITIALIZATION_100 OUTPUT.

DATA: IT_OUTTAB LIKE T001W OCCURS 0.

DATA: IT_VARIANT LIKE DISVARIANT,
      IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA: K_FIELDCAT LIKE LINE OF IT_FIELDCAT.

PERFORM TOP_OF_PAGE.

K_FIELDCAT-fieldname = 'WEKRS'.
K_FIELDCAT-tabname   = 'IT_OUTTAB'.
APPEND K_FIELDCAT TO IT_FIELDCAT.


IT_VARIANT-REPORT = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
   I_CALLBACK_PROGRAM                = IT_VARIANT-REPORT
   I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
   IT_FIELDCAT                       = IT_FIELDCAT
   I_SAVE                            = 'A'
   IS_VARIANT                        =  IT_VARIANT
  TABLES
    T_OUTTAB                          = IT_OUTTAB.
* 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.

*&---------------------------------------------------------------------*
*&      Form  TOP_OF_PAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM TOP_OF_PAGE .

DATA:IT_COMMENTARY TYPE SLIS_T_LISTHEADER.
DATA: K_COMMENTARY LIKE LINE OF IT_COMMENTARY.

K_COMMENTARY-TYP = 'S'.
K_COMMENTARY-KEY = 'Date'.
K_COMMENTARY-INFO = SY-DATUM.
APPEND K_COMMENTARY TO IT_COMMENTARY.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
  EXPORTING
    IT_LIST_COMMENTARY       = IT_COMMENTARY
   I_LOGO                      = 'ENJOYSAP_LOGO'.

ENDFORM.                    " TOP_OF_PAGE

Hi there,

I need some help on having parameter(input fields) on the Header of the ALV.

I am able to display normal text on the header now but how do you put parameters?

also I have some buttons on the Application tool bar but the ALV is taking up the whole screen.

All help are greatly appreciated and points will be given. Thanks alot everyone!

Below are my codes


PROCESS BEFORE OUTPUT.
  MODULE STATUS_0100.

  MODULE INITIALIZATION_100.

PROCESS AFTER INPUT.
  MODULE USER_COMMAND_0100.


*&---------------------------------------------------------------------*
*&      Module  INITIALIZATION_100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE INITIALIZATION_100 OUTPUT.

DATA: IT_OUTTAB LIKE T001W OCCURS 0.

DATA: IT_VARIANT LIKE DISVARIANT,
      IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA: K_FIELDCAT LIKE LINE OF IT_FIELDCAT.

PERFORM TOP_OF_PAGE.

K_FIELDCAT-fieldname = 'WEKRS'.
K_FIELDCAT-tabname   = 'IT_OUTTAB'.
APPEND K_FIELDCAT TO IT_FIELDCAT.


IT_VARIANT-REPORT = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
   I_CALLBACK_PROGRAM                = IT_VARIANT-REPORT
   I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
   IT_FIELDCAT                       = IT_FIELDCAT
   I_SAVE                            = 'A'
   IS_VARIANT                        =  IT_VARIANT
  TABLES
    T_OUTTAB                          = IT_OUTTAB.
* 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.

*&---------------------------------------------------------------------*
*&      Form  TOP_OF_PAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM TOP_OF_PAGE .

DATA:IT_COMMENTARY TYPE SLIS_T_LISTHEADER.
DATA: K_COMMENTARY LIKE LINE OF IT_COMMENTARY.

K_COMMENTARY-TYP = 'S'.
K_COMMENTARY-KEY = 'Date'.
K_COMMENTARY-INFO = SY-DATUM.
APPEND K_COMMENTARY TO IT_COMMENTARY.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
  EXPORTING
    IT_LIST_COMMENTARY       = IT_COMMENTARY
   I_LOGO                      = 'ENJOYSAP_LOGO'.

ENDFORM.                    " TOP_OF_PAGE

8 REPLIES 8
Read only

Former Member
0 Likes
1,205

Hi,

You can't put the parameters on the header of the ALV.

Revert back if you some more query.

Regards,

Atish

Read only

Former Member
0 Likes
1,205

you can concatenate the parameter name and parameter value into K_COMMENTARY-INFO . and append it to IT_COMMENTRY.

Thanks,

MGS.

Read only

0 Likes
1,205

Hi

thanks for the replies but

I need these fields to be input

DATA: P_WERKS TYPE T001W-WERKS.

K_COMMENTARY-TYP = 'S'.

K_COMMENTARY-KEY = 'Plant'.

K_COMMENTARY-INFO = P_WERKS.

APPEND K_COMMENTARY TO IT_COMMENTARY. ?

Can you give an example?

Read only

0 Likes
1,205

Hi,

Parameter cannot have an input at header level. The other 2 options are

1. Put it as a parameter on your Selection Screen.

2. Else bring to the item level and use editable ALV (where the user can give his input).

Regards,

Bharati

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,205

Well, your first problem is that you appear to be using a dynpro and the REUSE function module within the PBO of the screen. This is not right. The REUSE function module calls its own screen internally, so there is no need to call this funciton within your screen, you should remove your screen and call the function directly after retrieving your data.

Or instead of calling the function module, you can use the class based approach with your dynpro and use the class CL_GUI_ALV_GRID.

Regards,

RIch Heilman

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,205

A nice example of using the function module based ALV is here.

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abapInteractiveALV+Program&

Regards,

RIch Heilman

Read only

0 Likes
1,205

If you want to use the class based approach, see any programs that start with BCALV*

Regards,

RIch Heilman

Read only

0 Likes
1,205

Thanks man. I'll give it a go and I'll update this post. thanks alot