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: 

button in ALV grid display

Former Member
0 Kudos

Hi frenz,

I have a requirement in PS module.The problem is, i am fetching 'lessons learned from the project' from CJ20N tcode which i have to display in ALV.If it is one line or two line i can display in the ALV but if it is of 1 or 2 pages ? here i have to place an icon or button for that and upon clicking that it shud go to that long text(cj20n tcode).pls help me .

reward is guaranteed.

BR,

ANIl.

5 REPLIES 5

Former Member
0 Kudos

frenz plssssssssss help

uwe_schieferstein
Active Contributor
0 Kudos

Hello Anil

Here is an example of how to display the long text of a PSP project.

*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_PS_LONGTEXT_DISPLAY
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zus_sdn_ps_longtext_display.


DATA:
  go_docking     TYPE REF TO cl_gui_docking_container,
  go_textedit    TYPE REF TO cl_gui_textedit,
*
  gd_name        TYPE thead-tdname,
  gs_header      TYPE thead,
  gd_langu       TYPE thead-tdspras,
  gt_lines       TYPE STANDARD TABLE OF tline.


PARAMETERS:
  p_pspnr    TYPE prps-pspnr.




START-OF-SELECTION.

* Get the text object
  gs_header-tdid = 'LTXT'.  " long text
  gs_header-tdspras = syst-langu.
  CONCATENATE syst-langu p_pspnr
      INTO gs_header-tdname.
  gs_header-tdobject = 'PMS'.


  CALL FUNCTION 'READ_TEXT'
    EXPORTING
*     CLIENT                        = SY-MANDT
      id                            = gs_header-tdid
      language                      = gs_header-tdspras
      name                          = gs_header-tdname
      object                        = gs_header-tdobject
*     ARCHIVE_HANDLE                = 0
*     LOCAL_CAT                     = ' '
*   IMPORTING
*     HEADER                        =
    TABLES
      lines                         = gt_lines
    EXCEPTIONS
      id                            = 1
      language                      = 2
      name                          = 3
      not_found                     = 4
      object                        = 5
      reference_check               = 6
      wrong_access_to_archive       = 7
      OTHERS                        = 8.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


  CALL SCREEN '0100'.


END-OF-SELECTION.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.

  IF ( go_textedit IS NOT BOUND ).
    CREATE OBJECT go_docking
       EXPORTING
         parent                      = cl_gui_container=>screen0
*        REPID                       =
*        DYNNR                       =
*        SIDE                        = DOCK_AT_LEFT
*        EXTENSION                   = 50
*        STYLE                       =
*        LIFETIME                    = lifetime_default
*        CAPTION                     =
*        METRIC                      = 0
        RATIO                       = 90
*        NO_AUTODEF_PROGID_DYNNR     =
*        NAME                        =
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5
        OTHERS                      = 6.
    IF sy-subrc <> 0.
*     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CREATE OBJECT go_textedit
      EXPORTING
*        MAX_NUMBER_CHARS       =
*        STYLE                  = 0
        wordwrap_mode          =
            c_textedit_control=>wordwrap_at_windowborder
*        WORDWRAP_POSITION      =
        wordwrap_to_linebreak_mode =
           c_textedit_control=>true
*        FILEDROP_MODE          = DROPFILE_EVENT_OFF
        parent                 = go_docking
*        LIFETIME               =
*        NAME                   =
      EXCEPTIONS
        error_cntl_create      = 1
        error_cntl_init        = 2
        error_cntl_link        = 3
        error_dp_create        = 4
        gui_type_not_supported = 5
        OTHERS                 = 6.
    IF sy-subrc <> 0.
*     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CALL METHOD go_textedit->set_text_as_r3table
      EXPORTING
        table           = gt_lines
      EXCEPTIONS
        error_dp        = 1
        error_dp_create = 2
        OTHERS          = 3.
    IF sy-subrc <> 0.
*     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CALL METHOD go_textedit->set_enable
      EXPORTING
        enable            = CL_GUI_cfw=>false
       EXCEPTIONS
         CNTL_ERROR        = 1
         CNTL_SYSTEM_ERROR = 2
         others            = 3
            .
    IF sy-subrc <> 0.
*     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.


  ENDIF.

ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

  SET SCREEN 0. LEAVE SCREEN.

ENDMODULE.                 " USER_COMMAND_0100  INPUT

Dynpro '0100' has no elements with the following flow logic:

PROCESS BEFORE OUTPUT.
 MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
 MODULE USER_COMMAND_0100.

You simply add the button on your ALV list. When the user pushes this button you have to handle event BUTTON_CLICK. There you could call a function module containing the sample code above (has to be adjusted a little bit) which displays the long text.

Regards

Uwe

Former Member
0 Kudos

u have to handle the user_command event.

example:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = sy-repid

I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS1'

I_CALLBACK_USER_COMMAND = 'ACTION'

IS_LAYOUT = LAYOUT

IT_FIELDCAT = FIELDCAT[]

IT_SORT = SORT[]

IT_EVENTS = events[]

TABLES

T_OUTTAB = T_ITAB.

&----


*& Form set_pf_status1

&----


  • text

----


  • -->RT_EXTAB text

----


FORM set_pf_status1 USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'STANDARD'.

ENDFORM. "SET_PF_STATUS1

&----


*& Form ACTION

&----


  • text

----


  • -->UCOMM text

  • -->SEL text

----


FORM ACTION USING UCOMM TYPE SYUCOMM SEL TYPE SLIS_SELFIELD.

CASE UCOMM.

WHEN 'ATORDER'.

perform atorder.

REFRESH FIELDCAT1.

ENDCASE.

ENDFORM. "ACTION

Former Member
0 Kudos

hiii..

I don't know much about PS..

Can I know whether u need help in placing a button in the grid and performing an action based on its function code..

Regards..

Simy

Former Member
0 Kudos

Hii..

Do u want it to happen in a grid ctrl (OOPs).

If so notify..

I'll help to my maximum then..

If it is using Function Module I think they have already answered ur query..

regards..

Message was edited by: Simy Abraham