Skip to end of metadata
Go to start of metadata

Listing below the different objects in the code:

  1. DDIC Objects
  2. Report - Main ZTEST_SF_TEXTS
  3. Includes
    1. Top for data declarations - ZTEST_SF_TEXTS_TOP
    2. Selection Screen              - ZTEST_SF_TEXTS_S01
    3. Local Class                      - ZTEST_SF_TEXTS_C01
    4. Selection screen events  - ZTEST_SF_TEXTS_E01
    5. Sub-routines                    - ZTEST_SF_TEXTS_F01
    6. PBO                                 - ZTEST_SF_TEXTS_O01
    7. PAI                                   - ZTEST_SF_TEXTS_I01
  4. Screen - 9000, 9001
  5. PF-Statuses
  6. SE24 Class ZCL_SF_TEXT_EDIT & Methods

The code separation would be marked with 

***********************************************************************************************************************************
                                                                                <Topic>
***********************************************************************************************************************************

Below i'm pasting details of the code:

***********************************************************************************************************************************
                                                                               DDIC
*********************************************************************************************************************************** 

Smartforms Text Type:

Domain ZSF_TTYPE_D –

 

Data Element ZSF_TTYPE –

 

Structure for TEXT fetch ZSF_TEXT_S  –

 

Create a Table type ZSF_TEXT_T for the same structure[Screen not given here]

 

Structure for TEXT fetch ZSF_LOGO_S –


 Create a Table type ZSF_LOGO_T for the same structure[Screen not given here]


Structure for ZSF_TTYPE_S -


***********************************************************************************************************************************
                                                                             REPORT MAIN
*********************************************************************************************************************************** 

*&---------------------------------------------------------------------*
*& Report ZTEST_SF_TEXTS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ztest_sf_texts
MESSAGE-ID ztest_msg.

************************************************************************
* Include for Data Declaration *
************************************************************************
INCLUDE ztest_sf_texts_top.

************************************************************************
* Include for Selection Screen *
************************************************************************
INCLUDE ztest_sf_texts_s01.

************************************************************************
* Include for Local Class *
************************************************************************
INCLUDE ztest_sf_texts_c01.
*
************************************************************************
* Include for Selection Screen Events *
************************************************************************
INCLUDE ztest_sf_texts_e01.
*
************************************************************************
* Include for Forms *
************************************************************************
INCLUDE ztest_sf_texts_f01.

************************************************************************
* Include for PBO *
************************************************************************
INCLUDE ztest_sf_texts_o01.

************************************************************************
* Include for PAI *
************************************************************************
INCLUDE ztest_sf_texts_i01.

************************************************************************
* Initialization *
************************************************************************
INITIALIZATION.
* Initialize variables
PERFORM f_init.

************************************************************************
* Start-of-Selection Event *
************************************************************************
START-OF-SELECTION.

* Check if any of the required Fields are blank on Execution
PERFORM f_chk_blank.

* Get all the Relevant Forms to check for Texts or Logos
IF rb_conf EQ space.
PERFORM f_fetch_forms.
ENDIF.

* Fetch relevant details based on the User input
IF rb_text EQ abap_true OR rb_wutx EQ abap_true.
PERFORM f_get_details_t. " For Texts
ELSEIF rb_conf EQ abap_true.
PERFORM f_get_details_c. " For unconfigured smartforms
ELSE.
PERFORM f_get_details_l. " For Logos
ENDIF.


************************************************************************
* End-of-Selection Event *
************************************************************************
END-OF-SELECTION.
IF rb_text EQ abap_true.
* Display the Text output
PERFORM f_display_t.
* Display the Logo output
ELSEIF rb_logo EQ abap_true.
PERFORM f_display_l.
* Display the unconfigured S/Form output
ELSEIF rb_conf EQ abap_true.
PERFORM f_display_c.
* Display the WHERE-USED output
ELSE.
PERFORM f_display_w.
ENDIF.

Related Includes:

***********************************************************************************************************************************
                                                                           TOP INCLUDE
*********************************************************************************************************************************** 

*&---------------------------------------------------------------------*
*& Include ZTEST_SF_TEXTS_TOP
*&---------------------------------------------------------------------*

TABLES: stxftxt, tnapr.

TYPES: BEGIN OF ty_final_t,
sf_name TYPE tdsfname,
pg_name TYPE tdobjname,
wi_name TYPE tdobjname,
title TYPE ad_titletx,
ttype TYPE zsf_ttype,
object TYPE tdline,
name TYPE tdobname,
id TYPE tdline,
lang TYPE tdline,
tdfmt TYPE tdformat,
snap TYPE tdline,
text TYPE tlinet,
firstuser TYPE tdfuser,
firstdate TYPE tdfdate,
lastuser TYPE tdluser,
lastdate TYPE tdldate,
END OF ty_final_t,

BEGIN OF ty_final_l,
sf_name TYPE tdsfname,
pg_name TYPE tdobjname,
wi_name TYPE tdobjname,
title TYPE ad_titletx,
object TYPE tdline,
name TYPE tdline,
id TYPE tdline,
btype TYPE tdline,
firstuser TYPE tdfuser,
firstdate TYPE tdfdate,
lastuser TYPE tdluser,
lastdate TYPE tdldate,
END OF ty_final_l,

BEGIN OF ty_gph,
line(255) TYPE x,
END OF ty_gph,

BEGIN OF ty_final_w,
sf_name TYPE tdsfname,
pg_name TYPE tdobjname,
wi_name TYPE tdobjname,
title TYPE ad_titletx,
lang TYPE tdline,
firstuser TYPE tdfuser,
firstdate TYPE tdfdate,
lastuser TYPE tdluser,
lastdate TYPE tdldate,
END OF ty_final_w,

BEGIN OF ty_form,
sf_name TYPE tdsfname,
END OF ty_form,

BEGIN OF ty_form_det,
sf_name TYPE tdsfname,
firstuser TYPE tdfuser,
firstdate TYPE tdfdate,
lastuser TYPE tdluser,
lastdate TYPE tdldate,
END OF ty_form_det.

DATA: go_form TYPE REF TO cl_ssf_fb_smart_form,
gf_fmnumb TYPE tdfmnumb,
gf_fmnumb_test TYPE tdfmnumb.
DATA: gs_varheader TYPE ssfvarhdr,
go_node TYPE REF TO cl_ssf_fb_node,
gf_lang TYPE sy-langu VALUE 'EN'.

DATA: gt_text_item TYPE zsf_text_t,
gs_text_item TYPE zsf_text_s,
gt_logo TYPE zsf_logo_t,
gs_logo TYPE zsf_logo_s,
gf_sf_name TYPE tdsfname,
gf_pg_name TYPE tdobjname,
gf_wi_name TYPE tdobjname,
gf_fuser TYPE tdfuser,
gf_fdate TYPE tdfdate,
gf_luser TYPE tdluser,
gf_ldate TYPE tdldate,
gt_final_t TYPE STANDARD TABLE OF ty_final_t,
gs_final_t TYPE ty_final_t,
gt_final_l TYPE STANDARD TABLE OF ty_final_l,
gs_final_l TYPE ty_final_l,
gt_lines TYPE tlinet,
gt_text TYPE tsffields,
gt_final_w TYPE STANDARD TABLE OF ty_final_w,
gs_final_w TYPE ty_final_w,
gt_final_c TYPE STANDARD TABLE OF ty_form_det,
gt_form TYPE STANDARD TABLE OF ty_form,
* gs_form TYPE ty_form,
gt_form_det TYPE STANDARD TABLE OF ty_form_det,
gs_form TYPE ty_form_det,
gf_wrap_40 TYPE as4flag VALUE ' ',
gf_result TYPE i VALUE 1.

* For ALV Display
DATA: go_table TYPE REF TO cl_salv_table,
go_columns TYPE REF TO cl_salv_columns_table,
go_sorts TYPE REF TO cl_salv_sorts,
go_col TYPE REF TO cl_salv_column_table,
go_events TYPE REF TO cl_salv_events_table.

DATA go_cl_gui_textedit TYPE REF TO zcl_sf_text_edit.

CONSTANTS: c_status_t TYPE sypfkey VALUE 'ZPFSTATUS_STXT', " For PF-Status - TEXT
c_status_l TYPE sypfkey VALUE 'ZPFSTATUS_GRPH', " For PF-Status - LOGO
c_status_c TYPE sypfkey VALUE 'ZPFSTATUS_CONF', " For PF-Status - LOGO
c_error TYPE c VALUE 'E', " For Error Messages
c_unknown(9) TYPE c VALUE 'X-UNKNOWN',
c_txn_life TYPE c VALUE 'T',
c_text TYPE tdobject VALUE 'TEXT',
c_gph TYPE tdobjectgr VALUE 'GRAPHICS'.

DATA: gf_okcode_t TYPE sy-ucomm,
gf_okcode_l TYPE sy-ucomm.

DATA: gf_gph_url(255) TYPE c,
gf_gph_rfsh(1) TYPE c,
gt_gph TYPE STANDARD TABLE OF ty_gph,
gs_gph TYPE ty_gph.


DATA: gf_gph_size TYPE i.

DATA: go_picture TYPE REF TO cl_gui_picture,
go_pic_container TYPE REF TO cl_gui_custom_container.

 

***********************************************************************************************************************************
                                                                        SELECTION SCREEN
*********************************************************************************************************************************** 

*&---------------------------------------------------------------------*
*& Include ZTEST_SF_TEXTS_S01
*&---------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(83) text-c06." MODIF ID m1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(83) text-c07." MODIF ID m1.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t00.
PARAMETERS: rb_text RADIOBUTTON GROUP r1 DEFAULT 'X' USER-COMMAND u1,
rb_logo RADIOBUTTON GROUP r1,
rb_wutx RADIOBUTTON GROUP r1,
rb_wulo RADIOBUTTON GROUP r1,
rb_conf RADIOBUTTON GROUP r1.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t01.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(65) text-c01 MODIF ID m1.
SELECTION-SCREEN END OF LINE.
SELECT-OPTIONS: s_appl FOR tnapr-kappl MODIF ID m1 NO INTERVALS NO-EXTENSION,
s_out FOR tnapr-kschl MODIF ID m1 NO INTERVALS,
s_form FOR stxftxt-formname MODIF ID m1 NO INTERVALS VISIBLE LENGTH 30.
SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t02.
PARAMETERS: rb_st RADIOBUTTON GROUP r3 DEFAULT 'X' USER-COMMAND u2 MODIF ID m2,
rb_tm RADIOBUTTON GROUP r3 MODIF ID m2.

SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-b05.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(60) text-c02 MODIF ID m2.
SELECTION-SCREEN END OF LINE.
PARAMETERS: p_txt TYPE tdobname MODIF ID m2, " MATCHCODE OBJECT SH_STXFADM,
p_tid TYPE tdid MODIF ID m2,
p_tsp TYPE tdspras MODIF ID m2.
SELECTION-SCREEN END OF BLOCK b5.

SELECTION-SCREEN BEGIN OF BLOCK b6 WITH FRAME TITLE text-b06.
* SELECTION-SCREEN BEGIN OF LINE.
* SELECTION-SCREEN COMMENT 20(10) text-c04 MODIF ID m2.
* SELECTION-SCREEN END OF LINE.
PARAMETERS: p_tm TYPE stxftxt-formname MODIF ID m2 MATCHCODE OBJECT sh_stxfadm.
SELECTION-SCREEN END OF BLOCK b6.
SELECTION-SCREEN END OF BLOCK b3.

SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-b04.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(60) text-c03 MODIF ID m3.
SELECTION-SCREEN END OF LINE.
PARAMETERS: p_log TYPE tdobname MODIF ID m3,
p_td TYPE tdid MODIF ID m3 DEFAULT 'BMAP'.

PARAMETERS: rb_bw RADIOBUTTON GROUP r2 MODIF ID m3,
rb_cl RADIOBUTTON GROUP r2 DEFAULT 'X' MODIF ID m3.
SELECTION-SCREEN END OF BLOCK b4.

SELECTION-SCREEN BEGIN OF BLOCK b7 WITH FRAME TITLE text-b07.
SELECT-OPTIONS: s_apl FOR tnapr-kappl MODIF ID m4 NO INTERVALS NO-EXTENSION.
PARAMETERS: p_pfx TYPE char20 MODIF ID m4.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(79) text-c05 MODIF ID m4.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b7.

SELECTION-SCREEN BEGIN OF BLOCK b8 WITH FRAME TITLE text-b08.
PARAMETERS: p_prx TYPE char20 MODIF ID m5.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(79) text-c05 MODIF ID m5.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b8.

 

***********************************************************************************************************************************
                                                                           LOCAL CLASS
*********************************************************************************************************************************** 

*&---------------------------------------------------------------------*
*& Include ZTEST_SF_TEXTS_C01
*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*
*& Class LCL_HANDLE_EVENTS
*&---------------------------------------------------------------------*
* Local Class Definition
*----------------------------------------------------------------------*
CLASS lcl_handle_events DEFINITION. "#EC *
PUBLIC SECTION.

METHODS:
* For checkbox event
z_link_click FOR EVENT link_click
OF cl_salv_events_table IMPORTING row,
* To Handle user command on ALV output screen
z_user_command_t FOR EVENT added_function
OF cl_salv_events IMPORTING e_salv_function,

z_user_command_l FOR EVENT added_function
OF cl_salv_events IMPORTING e_salv_function,

z_user_command_w FOR EVENT added_function
OF cl_salv_events IMPORTING e_salv_function.

ENDCLASS. "LCL_HANDLE_EVENTS

*&---------------------------------------------------------------------*
*& Class (Implementation) lcl_handle_events
*&---------------------------------------------------------------------*
* Local class implementation
*----------------------------------------------------------------------*
CLASS lcl_handle_events IMPLEMENTATION.
* Method implementation to control check box click event
METHOD z_link_click.
PERFORM f_link_click USING row.
ENDMETHOD. "on_checkbox_click

* Method implementation for handling user command on ALV output
METHOD z_user_command_t.
PERFORM f_disp_txt USING e_salv_function.
ENDMETHOD. "on_user_command

* Method implementation for handling user command on ALV output
METHOD z_user_command_l.
PERFORM f_disp_gph USING e_salv_function.
ENDMETHOD. "on_user_command

METHOD z_user_command_w.
IF rb_wutx EQ abap_true.
PERFORM f_disp_tx USING e_salv_function.
ELSEIF rb_wulo EQ abap_true.
PERFORM f_disp_gp USING e_salv_function.
ENDIF.

ENDMETHOD. "on_user_command
ENDCLASS. "lcl_handle_events

 

***********************************************************************************************************************************
                                                                  SELECTION SCREEN EVENTS
*********************************************************************************************************************************** 

*&---------------------------------------------------------------------*
*& Include ZTEST_SF_TEXTS_E01
*&---------------------------------------------------------------------*

************************************************************************
* AT SELECTION SCREEN OUTPUT *
************************************************************************
AT SELECTION-SCREEN OUTPUT.
IF rb_text EQ 'X'.
LOOP AT SCREEN.
IF screen-group1 EQ 'M2' OR screen-group1 EQ 'M3'
OR screen-group1 EQ 'M4'OR screen-group1 EQ 'M5'.
screen-invisible = '1'.
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF rb_logo EQ 'X'.
LOOP AT SCREEN.
IF screen-group1 EQ 'M2' OR screen-group1 EQ 'M3'
OR screen-group1 EQ 'M4' OR screen-group1 EQ 'M5'.
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF rb_wutx EQ 'X'.
LOOP AT SCREEN.
IF screen-group1 EQ 'M1' OR screen-group1 EQ 'M3' OR screen-group1 EQ 'M5'.
screen-active = '0'.
MODIFY SCREEN.
ENDIF.

IF rb_st EQ 'X'
AND screen-name EQ 'P_TM'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.

IF rb_tm EQ 'X'
AND ( screen-name EQ 'P_TXT' OR screen-name EQ 'P_TID' OR screen-name EQ 'P_TSP' ).
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF rb_wulo EQ 'X'.
LOOP AT SCREEN.
IF screen-group1 EQ 'M1' OR screen-group1 EQ 'M2' OR screen-group1 EQ 'M5'.
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF rb_conf EQ 'X'.
LOOP AT SCREEN.
IF screen-group1 EQ 'M1' OR screen-group1 EQ 'M2'
OR screen-group1 EQ 'M3' OR screen-group1 EQ 'M4'.
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.

************************************************************************
* AT SELECTION SCREEN ON *
************************************************************************

AT SELECTION-SCREEN ON s_appl.
IF NOT s_appl IS INITIAL.
PERFORM f_validate_appl.
ENDIF.

AT SELECTION-SCREEN ON s_out.
IF NOT s_out IS INITIAL.
PERFORM f_validate_out.
ENDIF.

AT SELECTION-SCREEN ON s_form.
IF NOT s_form IS INITIAL.
PERFORM f_validate_form.
ENDIF.

AT SELECTION-SCREEN ON p_txt.
IF NOT p_txt IS INITIAL.
PERFORM f_validate_txt.
ENDIF.

AT SELECTION-SCREEN ON p_tid.
IF NOT p_tid IS INITIAL.
PERFORM f_validate_tid.
ENDIF.

AT SELECTION-SCREEN ON p_tsp.
IF NOT p_tsp IS INITIAL.
PERFORM f_validate_tsp.
ENDIF.

AT SELECTION-SCREEN ON p_tm.
IF NOT p_tm IS INITIAL.
PERFORM f_validate_tm.
ENDIF.

AT SELECTION-SCREEN ON p_log.
IF NOT p_log IS INITIAL.
PERFORM f_validate_log.
ENDIF.

AT SELECTION-SCREEN ON s_apl.
IF NOT s_apl IS INITIAL.
PERFORM f_validate_apl.
ENDIF.

AT SELECTION-SCREEN ON p_pfx.
IF NOT p_pfx IS INITIAL.
PERFORM f_validate_pfx.
ENDIF.

AT SELECTION-SCREEN ON p_prx.
IF NOT p_prx IS INITIAL.
PERFORM f_validate_prx.
ENDIF.

 

***********************************************************************************************************************************
                                                                           SUB-ROUTINES
*********************************************************************************************************************************** 

 

*&---------------------------------------------------------------------*
*& Include ZTEST_SF_TEXTS_F01
*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*
*& Form F_GET_DETAILS_T
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_get_details_t.

DATA: lo_item TYPE REF TO cl_ssf_fb_text_item,
ls_tkey TYPE ssftkeyl,
lt_text TYPE tsftext,
ls_text TYPE tline,
ls_name TYPE ssfname,
lf_lang TYPE string.

LOOP AT gt_form_det INTO gs_form.

CLEAR: gf_fmnumb,
gf_fmnumb_test.


* Create form object
CREATE OBJECT go_form.

TRY.

CALL METHOD go_form->load
EXPORTING
im_formname = gs_form-sf_name
im_language = gf_lang
* im_active = space
IMPORTING
ex_fmnumb = gf_fmnumb
ex_fmnumb_test = gf_fmnumb_test.
CATCH cx_ssf_fb.
CLEAR go_form.
FREE go_form.
CONTINUE.
ENDTRY.

* Get the VARHEADER
CLEAR: gs_varheader,
go_node,
gf_pg_name,
gf_wi_name,
gf_sf_name.

gf_sf_name = gs_form-sf_name.
gf_fuser = gs_form-firstuser.
gf_fdate = gs_form-firstdate.
gf_luser = gs_form-lastuser.
gf_ldate = gs_form-lastdate.

READ TABLE go_form->varheader INTO gs_varheader INDEX 1.
LOOP AT gs_varheader-pagetree->succ INTO go_node.

PERFORM f_get_texts TABLES gt_text_item
USING go_node.

ENDLOOP.

CLEAR go_form.
FREE go_form.
ENDLOOP.

* Text Items
IF NOT gt_text_item IS INITIAL.
CLEAR: gs_text_item, gs_final_t.
LOOP AT gt_text_item INTO gs_text_item.

* Fill Find Text Table
gs_final_t-sf_name = gs_text_item-sf_name.
gs_final_t-pg_name = gs_text_item-pg_name.
gs_final_t-wi_name = gs_text_item-wi_name.
* gs_final_t-firstuser = gs_text_item-firstuser.
gs_final_t-firstdate = gs_text_item-firstdate.
* gs_final_t-lastuser = gs_text_item-lastuser.
gs_final_t-lastdate = gs_text_item-lastdate.


lo_item = gs_text_item-obj.
ls_name = lo_item->name.
gs_final_t-title = ls_name-iname.
CASE lo_item->ttype.
WHEN 'I'. " Include Text
ls_tkey = lo_item->tkey.
gs_final_t-ttype = 'I'.
gs_final_t-object = ls_tkey-object.
gs_final_t-name = ls_tkey-name.
gs_final_t-id = ls_tkey-id.
CALL FUNCTION 'CONVERSION_EXIT_ISOLA_OUTPUT'
EXPORTING
input = ls_tkey-lang
IMPORTING
output = gs_final_t-lang.
IF gs_final_t-lang EQ '&'.
gs_final_t-lang = ls_tkey-lang.
ENDIF.

gs_final_t-tdfmt = ls_tkey-par.
WHEN 'R'. " Text Module
gs_final_t-ttype = 'M'.
gs_final_t-name = lo_item->ref_name.
* gs_final_t-lang = lo_item->ref_lang.
CALL FUNCTION 'CONVERSION_EXIT_ISOLA_OUTPUT'
EXPORTING
input = lo_item->ref_lang
IMPORTING
output = gs_final_t-lang.
IF gs_final_t-lang EQ '&'.
gs_final_t-lang = lo_item->ref_lang.
ENDIF.
WHEN 'D'. " Dynamic Text
gs_final_t-ttype = 'D'.
gs_final_t-name = lo_item->ref_name.
* gs_final_t-lang = lo_item->ref_lang.
CALL FUNCTION 'CONVERSION_EXIT_ISOLA_OUTPUT'
EXPORTING
input = lo_item->ref_lang
IMPORTING
output = gs_final_t-lang.
IF gs_final_t-lang EQ '&'.
gs_final_t-lang = lo_item->ref_lang.
ENDIF.
WHEN ' '. " Text Element
lt_text[] = lo_item->text[].
CLEAR ls_text.
READ TABLE lt_text INTO ls_text INDEX 1.
gs_final_t-ttype = 'E'.
gs_final_t-snap = ls_text-tdline.
gs_final_t-tdfmt = ls_text-tdformat.
* gs_final_t-lang = '&SPRAS&'.
gs_final_t-text[] = lt_text[].
WHEN OTHERS.

ENDCASE.

APPEND gs_final_t TO gt_final_t[].
CLEAR: gs_final_t, ls_name.

REFRESH lt_text[].
ENDLOOP.
ELSE.
MESSAGE s016 DISPLAY LIKE c_error. " No Texts exist in Forms for the given criteria
LEAVE LIST-PROCESSING.
ENDIF.

SORT gt_final_t BY sf_name pg_name wi_name.

IF rb_wutx EQ abap_true.
IF rb_st EQ abap_true.
LOOP AT gt_final_t INTO gs_final_t
WHERE name EQ p_txt
AND id EQ p_tid.
* AND lang EQ p_tsp.

IF NOT p_tsp IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ISOLA_OUTPUT'
EXPORTING
input = p_tsp
IMPORTING
output = lf_lang.
IF gs_final_t-lang CA '&'.
gs_final_w-sf_name = gs_final_t-sf_name.
gs_final_w-pg_name = gs_final_t-pg_name.
gs_final_w-wi_name = gs_final_t-wi_name.
gs_final_w-title = gs_final_t-title.
gs_final_w-lang = gs_final_t-lang.
gs_final_w-firstuser = gs_final_t-firstuser.
gs_final_w-firstdate = gs_final_t-firstdate.
gs_final_w-lastuser = gs_final_t-lastuser.
gs_final_w-lastdate = gs_final_t-lastdate.
APPEND gs_final_w TO gt_final_w.
CLEAR gs_final_w.
CONTINUE.
ELSEIF gs_final_t-lang NE lf_lang.
CONTINUE.
ENDIF.
ENDIF.

* Fill Where-Used for Text
gs_final_w-sf_name = gs_final_t-sf_name.
gs_final_w-pg_name = gs_final_t-pg_name.
gs_final_w-wi_name = gs_final_t-wi_name.
gs_final_w-title = gs_final_t-title.
gs_final_w-lang = gs_final_t-lang.
gs_final_w-firstuser = gs_final_t-firstuser.
gs_final_w-firstdate = gs_final_t-firstdate.
gs_final_w-lastuser = gs_final_t-lastuser.
gs_final_w-lastdate = gs_final_t-lastdate.
APPEND gs_final_w TO gt_final_w.
CLEAR gs_final_w.

ENDLOOP.
ELSE.
LOOP AT gt_final_t INTO gs_final_t
WHERE name EQ p_tm.

* Fill Where-Used for Text
gs_final_w-sf_name = gs_final_t-sf_name.
gs_final_w-pg_name = gs_final_t-pg_name.
gs_final_w-wi_name = gs_final_t-wi_name.
gs_final_w-title = gs_final_t-title.
gs_final_w-lang = gs_final_t-lang.
gs_final_w-firstuser = gs_final_t-firstuser.
gs_final_w-firstdate = gs_final_t-firstdate.
gs_final_w-lastuser = gs_final_t-lastuser.
gs_final_w-lastdate = gs_final_t-lastdate.
APPEND gs_final_w TO gt_final_w.
CLEAR gs_final_w.

ENDLOOP.
ENDIF.
ENDIF.

ENDFORM. " F_GET_DETAILS_T

*&---------------------------------------------------------------------*
*& Form F_GET_TEXTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_get_texts TABLES pt_text_item TYPE zsf_text_t
USING po_node TYPE REF TO cl_ssf_fb_node.

DATA: "gs_text_item TYPE zsf_text_s,
lf_tabix TYPE sy-tabix,
lf_counter TYPE i.

DATA: lo_page TYPE REF TO cl_ssf_fb_page,
lo_window TYPE REF TO cl_ssf_fb_window,
lo_succ TYPE REF TO cl_ssf_fb_node.
IF po_node->nodetype EQ 'PA'.
lo_page ?= po_node->obj.
gf_pg_name = lo_page->name.
ENDIF.

IF po_node->nodetype EQ 'TI'.
lf_tabix = 0.
lf_counter = 0.
LOOP AT pt_text_item INTO gs_text_item.
IF gs_text_item-obj EQ po_node->obj.
lf_tabix = sy-tabix.
ADD 1 TO gs_text_item-cnt.
MODIFY pt_text_item FROM gs_text_item INDEX lf_tabix.
lf_counter = gs_text_item-cnt.
EXIT.
ENDIF.
ENDLOOP.
IF lf_tabix = 0.
gs_text_item-obj ?= po_node->obj.
gs_text_item-cnt = 1.
gs_text_item-sf_name = gf_sf_name.
gs_text_item-pg_name = gf_pg_name.
gs_text_item-wi_name = gf_wi_name.
gs_text_item-firstuser = gf_fuser.
gs_text_item-firstdate = gf_fdate.
gs_text_item-lastuser = gf_luser.
gs_text_item-lastdate = gf_ldate.
APPEND gs_text_item TO pt_text_item.
DESCRIBE TABLE pt_text_item LINES lf_tabix.
lf_counter = 1.
ENDIF.
ENDIF.

IF po_node->nodetype = 'WI'.
lo_window ?= po_node->obj.
gf_wi_name = lo_window->name.
PERFORM f_get_texts TABLES gt_text_item
USING lo_window->proc_ctrl.
ENDIF.

LOOP AT po_node->succ INTO lo_succ.
PERFORM f_get_texts TABLES gt_text_item
USING lo_succ.
ENDLOOP.

ENDFORM. " F_GET_TEXTS

*&---------------------------------------------------------------------*
*& Form F_DISPLAY_T
*&---------------------------------------------------------------------*
* Display the Output
*----------------------------------------------------------------------*
FORM f_display_t.

DATA: lo_event TYPE REF TO lcl_handle_events,
ls_ddic TYPE salv_s_ddic_reference.

* Call factory method of Class CL_SALV_TABLE
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = go_table
CHANGING
t_table = gt_final_t.
CATCH cx_salv_msg .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Get columns
CALL METHOD go_table->get_columns
RECEIVING
value = go_columns.

* Set Columns optimized
CALL METHOD go_columns->set_optimize
EXPORTING
value = abap_true.

* Set the hotspot for Smartform Name
TRY.
go_col ?= go_columns->get_column( 'SF_NAME' ).
go_col->set_cell_type( if_salv_c_cell_type=>hotspot ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.


* Set the text for Page Name
TRY.
go_col ?= go_columns->get_column( 'PG_NAME' ).
go_col->set_short_text( text-t03 ).
go_col->set_medium_text( text-t03 ).
go_col->set_long_text( text-t03 ).
go_col->set_tooltip( text-t11 ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Set the text for Window Name
TRY.
go_col ?= go_columns->get_column( 'WI_NAME' ).
go_col->set_short_text( text-t07 ).
go_col->set_medium_text( text-t04 ).
go_col->set_long_text( text-t04 ).
go_col->set_tooltip( text-t12 ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Set the text for Object
CLEAR ls_ddic.
TRY.
go_col ?= go_columns->get_column( 'OBJECT' ).
ls_ddic-field = 'TDOBJECT'.
ls_ddic-table = 'STXH'.
go_col->set_ddic_reference( ls_ddic ).
* go_col->set_tooltip( text-t13 ). " Text Snap (for Text Element only).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

CLEAR ls_ddic.
TRY.
go_col ?= go_columns->get_column( 'ID' ).
ls_ddic-field = 'TDID'.
ls_ddic-table = 'STXH'.
go_col->set_ddic_reference( ls_ddic ).
* go_col->set_tooltip( text-t13 ). " Text Snap (for Text Element only).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

TRY.
go_col ?= go_columns->get_column( 'LANG' ).
go_col->set_short_text( text-t09 ).
go_col->set_medium_text( text-t09 ).
go_col->set_long_text( text-t09 ).
go_col->set_tooltip( text-t09 ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Set the text for Snap
TRY.
go_col ?= go_columns->get_column( 'SNAP' ).
go_col->set_short_text( text-t05 ).
go_col->set_medium_text( text-t05 ).
go_col->set_long_text( text-t05 ).
go_col->set_tooltip( text-t13 ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Set the text for TTYPE
CLEAR ls_ddic.
TRY.
go_col ?= go_columns->get_column( 'TTYPE' ).
ls_ddic-field = 'TTYPE'.
ls_ddic-table = 'ZSF_TTYPE_S'.
go_col->set_ddic_reference( ls_ddic ).
go_col->set_f4( abap_true ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Sort Output table
go_sorts = go_table->get_sorts( ).

TRY .
go_sorts->add_sort( 'SF_NAME' ).
go_sorts->add_sort( 'PG_NAME' ).
go_sorts->add_sort( 'WI_NAME' ).
CATCH cx_salv_not_found.
CATCH cx_salv_data_error.
CATCH cx_salv_existing.

ENDTRY.


* Register the Double click Event
go_events = go_table->get_event( ).
CREATE OBJECT lo_event.
SET HANDLER lo_event->z_link_click FOR go_events.
SET HANDLER lo_event->z_user_command_t FOR go_events.

* Layout

*/.. Create Top of Page
PERFORM f_top_of_page.

* Set the GUI Status
CALL METHOD go_table->set_screen_status
EXPORTING
report = sy-repid
pfstatus = c_status_t
set_functions = go_table->c_functions_all.

* Call display method of class CL_SALV_TABLE to display
CALL METHOD go_table->display.

ENDFORM. " F_DISPLAY_T

*&---------------------------------------------------------------------*
*& Form F_DISP_TXT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_SALV_FUNCTION text
*----------------------------------------------------------------------*
FORM f_disp_txt USING pf_ucomm TYPE salv_de_function.

DATA: lo_selections TYPE REF TO cl_salv_selections,
lf_row TYPE i,
lt_rows TYPE salv_t_row,
ls_final TYPE ty_final_t,
lf_spras TYPE tdspras,
lf_tdid TYPE tdid,
lf_obj TYPE tdobject,
ls_tline TYPE tline,
ls_langs TYPE ssfrlang,
lf_tm_name TYPE tdsfname,
lf_lang TYPE string.

CASE pf_ucomm.
WHEN '&GETXT'.
* WHEN .
lo_selections = go_table->get_selections( ).
lt_rows = lo_selections->get_selected_rows( ).

READ TABLE lt_rows INTO lf_row INDEX 1.
IF sy-subrc IS INITIAL.
READ TABLE gt_final_t INTO ls_final INDEX lf_row.
IF sy-subrc NE 0.
* MESSAGE
ENDIF.
ENDIF.

lf_tdid = ls_final-id.
lf_obj = ls_final-object.
REFRESH: gt_lines[], gt_text[].
* Check if Standard Text or Text Module name is dynamic
lf_lang = ls_final-name.
IF lf_lang CA '&'.
MESSAGE i004 DISPLAY LIKE c_error. " Name is Dynamic hence cannot be displayed
RETURN.
ENDIF.
* Check if Language is Dynamic
CLEAR lf_lang.
lf_lang = ls_final-lang.
IF lf_lang CA '&'.
lf_spras = sy-langu.
ELSE.
CALL FUNCTION 'CONVERSION_EXIT_ISOLA_OUTPUT'
EXPORTING
input = lf_lang
IMPORTING
output = lf_spras.
ENDIF.

CASE ls_final-ttype.
WHEN 'I'.
* Read Text values
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = lf_tdid
language = lf_spras
name = ls_final-name
object = lf_obj
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 EQ 4 AND lf_lang CA '&'.
SELECT tdspras
FROM stxh
INTO lf_spras
UP TO 1 ROWS
WHERE tdobject EQ lf_obj
AND tdname EQ ls_final-name
AND tdid EQ lf_tdid
AND tdspras NE sy-langu.
ENDSELECT.
IF sy-subrc IS INITIAL.
* Read Text values
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = lf_tdid
language = lf_spras
name = ls_final-name
object = lf_obj
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.
ENDIF.

* Implement suitable error handling here
ENDIF.

WHEN 'M'.
CLEAR ls_langs.
ls_langs-langu1 = lf_spras.
lf_tm_name = ls_final-name.
CALL FUNCTION 'SSFRT_READ_TEXTMODULE'
EXPORTING
i_textmodule = lf_tm_name
i_languages = ls_langs
IMPORTING
o_langu = lf_spras
o_text = gt_lines
EXCEPTIONS
error = 1
language_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0 AND lf_lang CA '&'.
SELECT SINGLE masterlang
FROM stxfadm
INTO lf_spras
WHERE formname EQ lf_tm_name
AND formtype EQ 'T'.
IF sy-subrc IS INITIAL.
CLEAR ls_langs.
ls_langs-langu1 = lf_spras.
CALL FUNCTION 'SSFRT_READ_TEXTMODULE'
EXPORTING
i_textmodule = lf_tm_name
i_languages = ls_langs
IMPORTING
o_langu = lf_spras
o_text = gt_lines
EXCEPTIONS
error = 1
language_not_found = 2
OTHERS = 3.
ENDIF.
ENDIF.

WHEN 'E'.
gt_lines[] = ls_final-text[].

WHEN 'D'.
MESSAGE i003 DISPLAY LIKE c_error. " Dynamic Texts cannot be displayed
RETURN.

WHEN OTHERS.
ENDCASE.

WHEN OTHERS.
ENDCASE.

* Check if Text is blank
IF gt_lines IS INITIAL.
MESSAGE i018. " Blank line or Text not available in Selection screen or Logon Language
RETURN.
ELSE.
LOOP AT gt_lines INTO ls_tline
WHERE tdline NE space.
EXIT.
ENDLOOP.
IF sy-subrc NE 0.
MESSAGE i018. " Blank line or Text not available in Selection screen or Logon Language
RETURN.
ENDIF.
ENDIF.

CLEAR ls_tline.
LOOP AT gt_lines INTO ls_tline.
APPEND ls_tline-tdline TO gt_text[].
CLEAR ls_tline.
ENDLOOP.

CALL SCREEN 9000 STARTING AT 10 1.


ENDFORM. " F_DISP_TXT

*&---------------------------------------------------------------------*
*& Form F_FILL_TEXT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_fill_text.

IF go_cl_gui_textedit IS INITIAL.

CREATE OBJECT go_cl_gui_textedit
EXPORTING
pf_container = 'ZCUST_CTRL'
pf_wrap_40 = gf_wrap_40.

CALL METHOD go_cl_gui_textedit->delete_text.

CALL METHOD go_cl_gui_textedit->set_text
EXPORTING
pt_text = gt_text.

CALL METHOD go_cl_gui_textedit->set_read_only
EXPORTING
pf_flag = abap_true.


ELSE.

CALL METHOD go_cl_gui_textedit->set_wordwrap
EXPORTING
pf_wrap_40 = gf_wrap_40
EXCEPTIONS
no_instance = 1
OTHERS = 2.

ENDIF.

ENDFORM. " F_FILL_TEXT

*&---------------------------------------------------------------------*
*& Form F_UCOMM
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_ucomm.

CASE gf_okcode_t.
WHEN 'OK'.
CALL METHOD go_cl_gui_textedit->delete_text.
CALL METHOD go_cl_gui_textedit->delete_obj.
CLEAR go_cl_gui_textedit.
FREE go_cl_gui_textedit.
LEAVE TO SCREEN 0.
* WHEN .
WHEN OTHERS.
ENDCASE.

ENDFORM. " F_UCOMM

*&---------------------------------------------------------------------*
*& Form F_GET_DETAILS_L
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_get_details_l.

DATA: lo_grph TYPE REF TO cl_ssf_fb_graphic,
ls_gkey TYPE ssfgkeybdl,
lf_btyp TYPE tdbtype,
ls_name TYPE ssfname.

LOOP AT gt_form_det INTO gs_form.

CLEAR: gf_fmnumb,
gf_fmnumb_test.
* Create form object
CREATE OBJECT go_form.

TRY.
CALL METHOD go_form->load
EXPORTING
im_formname = gs_form-sf_name
im_language = gf_lang
* im_active = space
IMPORTING
ex_fmnumb = gf_fmnumb
ex_fmnumb_test = gf_fmnumb_test.
CATCH cx_ssf_fb.
CLEAR go_form.
FREE go_form.
CONTINUE.
ENDTRY.

* Get the VARHEADER
CLEAR: gs_varheader,
go_node,
gf_pg_name,
gf_wi_name,
gf_sf_name.

gf_sf_name = gs_form-sf_name.
gf_fuser = gs_form-firstuser.
gf_fdate = gs_form-firstdate.
gf_luser = gs_form-lastuser.
gf_ldate = gs_form-lastdate.

READ TABLE go_form->varheader INTO gs_varheader INDEX 1.
LOOP AT gs_varheader-pagetree->succ INTO go_node.

PERFORM f_get_logos TABLES gt_logo
USING go_node.

ENDLOOP.

CLEAR go_form.
FREE go_form.

ENDLOOP.

IF NOT gt_logo IS INITIAL.
LOOP AT gt_logo INTO gs_logo.

gs_final_l-sf_name = gs_logo-sf_name.
gs_final_l-pg_name = gs_logo-pg_name.
gs_final_l-wi_name = gs_logo-wi_name.
* gs_final_l-firstuser = gs_logo-firstuser.
gs_final_l-firstdate = gs_logo-firstdate.
* gs_final_l-lastuser = gs_logo-lastuser.
gs_final_l-lastdate = gs_logo-lastdate.

lo_grph = gs_logo-obj.
ls_name = lo_grph->name.
gs_final_l-title = ls_name-iname.
ls_gkey = lo_grph->gkeybds.

gs_final_l-object = ls_gkey-object.
gs_final_l-name = ls_gkey-name.
gs_final_l-id = ls_gkey-id.
gs_final_l-btype = ls_gkey-btype.
APPEND gs_final_l TO gt_final_l.
CLEAR: lo_grph,
ls_gkey,
gs_final_l.
ENDLOOP.
ELSE.
MESSAGE s017 DISPLAY LIKE c_error. " No Logos exist in Forms for the given criteria
LEAVE LIST-PROCESSING.
ENDIF.

SORT gt_final_l BY sf_name pg_name wi_name.

IF rb_wulo EQ abap_true.
IF rb_bw EQ abap_true.
lf_btyp = 'BMON'.
ELSE.
lf_btyp = 'BCOL'.
ENDIF.

LOOP AT gt_final_l INTO gs_final_l
WHERE name EQ p_log
AND id EQ p_td
AND btype EQ lf_btyp.
* Fill Where-Used for Text
gs_final_w-sf_name = gs_final_l-sf_name.
gs_final_w-pg_name = gs_final_l-pg_name.
gs_final_w-wi_name = gs_final_l-wi_name.
gs_final_w-title = gs_final_l-title.
gs_final_w-firstuser = gs_final_l-firstuser.
gs_final_w-firstdate = gs_final_l-firstdate.
gs_final_w-lastuser = gs_final_l-lastuser.
gs_final_w-lastdate = gs_final_l-lastdate.
APPEND gs_final_w TO gt_final_w.
CLEAR gs_final_w.
ENDLOOP.

ENDIF.

ENDFORM. " F_GET_DETAILS_L

*&---------------------------------------------------------------------*
*& Form F_GET_LOGOS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GT_LOGO text
* -->P_GO_NODE text
*----------------------------------------------------------------------*
FORM f_get_logos TABLES pt_logos TYPE zsf_logo_t
USING po_node TYPE REF TO cl_ssf_fb_node.

DATA: "gs_text_item TYPE zsf_text_s,
lf_tabix TYPE sy-tabix,
lf_counter TYPE i.

DATA: lo_page TYPE REF TO cl_ssf_fb_page,
lo_window TYPE REF TO cl_ssf_fb_window,
lo_succ TYPE REF TO cl_ssf_fb_node.
IF po_node->nodetype EQ 'PA'.
lo_page ?= po_node->obj.
gf_pg_name = lo_page->name.
ENDIF.

IF po_node->nodetype EQ 'GR'.
lf_tabix = 0.
lf_counter = 0.
LOOP AT pt_logos INTO gs_logo.
IF gs_logo-obj EQ po_node->obj.
lf_tabix = sy-tabix.
ADD 1 TO gs_logo-cnt.
MODIFY pt_logos FROM gs_logo INDEX lf_tabix.
lf_counter = gs_logo-cnt.
EXIT.
ENDIF.
ENDLOOP.
IF lf_tabix = 0.
gs_logo-obj ?= po_node->obj.
gs_logo-cnt = 1.
gs_logo-sf_name = gf_sf_name.
gs_logo-pg_name = gf_pg_name.
gs_logo-wi_name = gf_wi_name.
gs_logo-firstuser = gf_fuser.
gs_logo-firstdate = gf_fdate.
gs_logo-lastuser = gf_luser.
gs_logo-lastdate = gf_ldate.
APPEND gs_logo TO pt_logos.
DESCRIBE TABLE pt_logos LINES lf_tabix.
lf_counter = 1.
ENDIF.
ENDIF.

IF po_node->nodetype = 'WI'.
lo_window ?= po_node->obj.
gf_wi_name = lo_window->name.
PERFORM f_get_logos TABLES gt_logo
USING lo_window->proc_ctrl.
ENDIF.

LOOP AT po_node->succ INTO lo_succ.
PERFORM f_get_logos TABLES gt_logo
USING lo_succ.
ENDLOOP.

ENDFORM. " F_GET_LOGOS

*&---------------------------------------------------------------------*
*& Form F_DISPLAY_L
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_display_l.

DATA: lo_event TYPE REF TO lcl_handle_events,
ls_ddic TYPE salv_s_ddic_reference.

* Call factory method of Class CL_SALV_TABLE
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = go_table
CHANGING
t_table = gt_final_l.
CATCH cx_salv_msg .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Get columns
CALL METHOD go_table->get_columns
RECEIVING
value = go_columns.

* Set Columns optimized
CALL METHOD go_columns->set_optimize
EXPORTING
value = abap_true.

* Set the hotspot for Smartform Name
TRY.
go_col ?= go_columns->get_column( 'SF_NAME' ).
go_col->set_cell_type( if_salv_c_cell_type=>hotspot ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Set the text for Page Name
TRY.
go_col ?= go_columns->get_column( 'PG_NAME' ).
go_col->set_short_text( text-t03 ).
go_col->set_medium_text( text-t03 ).
go_col->set_long_text( text-t03 ).
go_col->set_tooltip( text-t11 ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Set the text for Window Name
TRY.
go_col ?= go_columns->get_column( 'WI_NAME' ).
go_col->set_short_text( text-t07 ).
go_col->set_medium_text( text-t04 ).
go_col->set_long_text( text-t04 ).
go_col->set_tooltip( text-t12 ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Set the DDIC Reference for Object
CLEAR ls_ddic.
TRY.
go_col ?= go_columns->get_column( 'OBJECT' ).
ls_ddic-field = 'TDOBJECT'.
ls_ddic-table = 'STXBITMAPS'.
go_col->set_ddic_reference( ls_ddic ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Set the DDIC Reference for Graphic Name
CLEAR ls_ddic.
TRY.
go_col ?= go_columns->get_column( 'NAME' ).
ls_ddic-field = 'TDNAME'.
ls_ddic-table = 'STXBITMAPS'.
go_col->set_ddic_reference( ls_ddic ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Set the DDIC Reference for Graphic ID
CLEAR ls_ddic.
TRY.
go_col ?= go_columns->get_column( 'ID' ).
ls_ddic-field = 'TDID'.
ls_ddic-table = 'STXBITMAPS'.
go_col->set_ddic_reference( ls_ddic ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Set the DDIC Reference for Graphic ID
CLEAR ls_ddic.
TRY.
go_col ?= go_columns->get_column( 'BTYPE' ).
go_col->set_short_text( text-t14 ).
go_col->set_medium_text( text-t15 ).
go_col->set_long_text( text-t15 ).
go_col->set_tooltip( text-t15 ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Sort Output table
go_sorts = go_table->get_sorts( ).

TRY .
go_sorts->add_sort( 'SF_NAME' ).
go_sorts->add_sort( 'PG_NAME' ).
go_sorts->add_sort( 'WI_NAME' ).
CATCH cx_salv_not_found.
CATCH cx_salv_data_error.
CATCH cx_salv_existing.
ENDTRY.

* Register the Double click Event
go_events = go_table->get_event( ).
CREATE OBJECT lo_event.
SET HANDLER lo_event->z_link_click FOR go_events.
SET HANDLER lo_event->z_user_command_l FOR go_events.

* Layout
*/.. Create Top of Page
PERFORM f_top_of_page.

* Set the GUI Status
CALL METHOD go_table->set_screen_status
EXPORTING
report = sy-repid
pfstatus = c_status_l
set_functions = go_table->c_functions_all.

* Call display method of class CL_SALV_TABLE to display
CALL METHOD go_table->display.
ENDFORM. " F_DISPLAY_L

*&---------------------------------------------------------------------*
*& Form F_DISP_GPH
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_disp_gph USING pf_ucomm TYPE salv_de_function.

DATA: lo_selections TYPE REF TO cl_salv_selections,
l_row TYPE i,
lt_rows TYPE salv_t_row,
ls_final TYPE ty_final_l,
lf_obj TYPE tdobjectgr,
lf_name TYPE tdobname,
lf_id TYPE tdidgr,
lf_btyp TYPE tdbtype,
lf_lname TYPE string.

DATA: lf_graphic_xstr TYPE xstring,
lf_graphic_conv TYPE i,
lf_graphic_offs TYPE i.


CASE pf_ucomm.
WHEN '&PRVW'.
lo_selections = go_table->get_selections( ).
lt_rows = lo_selections->get_selected_rows( ).

READ TABLE lt_rows INTO l_row INDEX 1.
IF sy-subrc IS INITIAL.
READ TABLE gt_final_l INTO ls_final INDEX l_row.
IF sy-subrc NE 0.
* MESSAGE
ENDIF.
ENDIF.

lf_obj = ls_final-object.
lf_name = ls_final-name.
lf_id = ls_final-id.
lf_btyp = ls_final-btype.

* Check if Graphic name is dynamic
lf_lname = ls_final-name.
IF lf_lname CA '&'.
MESSAGE i004 DISPLAY LIKE c_error. " Name is Dynamic hence cannot be displayed
RETURN.
ENDIF.

CLEAR: gf_gph_url,
gt_gph[].
CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
EXPORTING
p_object = lf_obj
p_name = lf_name
p_id = lf_id
p_btype = lf_btyp
RECEIVING
p_bmp = lf_graphic_xstr
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 1.
MESSAGE e002 WITH lf_name. " Graphic &1 could not be found
ELSEIF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
RETURN.
ENDIF.

gf_gph_size = xstrlen( lf_graphic_xstr ).
CHECK gf_gph_size > 0.

lf_graphic_conv = gf_gph_size.
lf_graphic_offs = 0.

CLEAR gs_gph.
WHILE lf_graphic_conv > 255.
gs_gph-line = lf_graphic_xstr+lf_graphic_offs(255).
APPEND gs_gph TO gt_gph.
lf_graphic_offs = lf_graphic_offs + 255.
lf_graphic_conv = lf_graphic_conv - 255.
ENDWHILE.

gs_gph-line = lf_graphic_xstr+lf_graphic_offs(lf_graphic_conv).
APPEND gs_gph TO gt_gph.

CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image'(t24) "#EC NOTEXT
subtype = c_unknown " 'X-UNKNOWN'
size = gf_gph_size
lifetime = c_txn_life " 'T'
TABLES
data = gt_gph
CHANGING
url = gf_gph_url
EXCEPTIONS
dp_invalid_parameter = 1
dp_error_put_table = 2
dp_error_general = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
RETURN.
ENDIF.

gf_gph_rfsh = abap_true.
CALL SCREEN 9001 STARTING AT 10 1.
* WHEN .
WHEN OTHERS.
ENDCASE.

ENDFORM. " F_DISP_GPH

*&---------------------------------------------------------------------*
*& Form F_GET_PICTURE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_get_picture.

* CALL METHOD cl_gui_cfw=>dispatch.

IF go_picture IS INITIAL.
CREATE OBJECT go_pic_container
EXPORTING
container_name = 'ZCUST_CTL'.
CREATE OBJECT go_picture EXPORTING parent = go_pic_container.

CALL METHOD go_picture->set_display_mode
EXPORTING
display_mode = cl_gui_picture=>display_mode_normal_center.
*** display_mode = cl_gui_picture=>display_mode_normal_center.
ENDIF.

IF gf_gph_rfsh = abap_true.
CALL METHOD go_picture->clear_picture.
* Get Picture from URL
CALL METHOD go_picture->load_picture_from_url
EXPORTING
url = gf_gph_url.
* IMPORTING
* result = gf_result.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2.
IF sy-subrc <> 0.
*error handling
ENDIF.

gf_gph_rfsh = space.
ENDIF.

ENDFORM. " F_GET_PICTURE

*&---------------------------------------------------------------------*
*& Form F_USR_COM
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_usr_com.

CASE gf_okcode_l.
WHEN 'OK'.
CALL METHOD go_pic_container->free.
CLEAR: go_picture,
go_pic_container.
FREE: go_picture,
go_pic_container.
LEAVE TO SCREEN 0.
* WHEN .
WHEN OTHERS.
ENDCASE.

ENDFORM. " F_USR_COM

*&---------------------------------------------------------------------*
*& Form F_INIT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_init.

* Define the object to be passed to the RESTRICTION parameter
DATA ls_restrict TYPE sscr_restrict.

* Auxiliary objects for filling RESTRICT
DATA : ls_optlist TYPE sscr_opt_list,
ls_ass TYPE sscr_ass.

* Restricting the Output Type selection to only EQ and NE.
ls_optlist-name = 'OBJECTKEY1'.
ls_optlist-options-eq = abap_true.
ls_optlist-options-ne = abap_true.
ls_optlist-options-cp = abap_true.
ls_optlist-options-np = abap_true.
APPEND ls_optlist TO ls_restrict-opt_list_tab.

ls_ass-kind = 'S'.
ls_ass-name = 'S_OUT'.
ls_ass-sg_main = 'I'.
ls_ass-sg_addy = space.
ls_ass-op_main = 'OBJECTKEY1'.
APPEND ls_ass TO ls_restrict-ass_tab.

* Restricting the Form name selection to only EQ and NE.
ls_optlist-name = 'OBJECTKEY2'.
ls_optlist-options-eq = abap_true.
ls_optlist-options-ne = abap_true.
ls_optlist-options-cp = abap_true.
ls_optlist-options-np = abap_true.
APPEND ls_optlist TO ls_restrict-opt_list_tab.

ls_ass-kind = 'S'.
ls_ass-name = 'S_FORM'.
ls_ass-sg_main = 'I'.
ls_ass-sg_addy = space.
ls_ass-op_main = 'OBJECTKEY2'.
APPEND ls_ass TO ls_restrict-ass_tab.

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
EXPORTING
restriction = ls_restrict
EXCEPTIONS
too_late = 1
repeated = 2
selopt_without_options = 3
selopt_without_signs = 4
invalid_sign = 5
empty_option_list = 6
invalid_kind = 7
repeated_kind_a = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


* Initialize Variables
REFRESH:
gt_text_item,
gt_final_t,
gt_final_l,
gt_form,
gt_logo,
gt_lines,
gt_text,
gt_final_w,
gt_gph,
gt_final_c,
gt_form_det.

CLEAR:
gs_logo,
gs_final_t,
gs_text_item,
gs_final_l,
gs_final_w,
gs_form,
gs_gph,
gs_varheader,
gs_gph,
gf_sf_name,
gf_pg_name,
gf_wi_name,
gf_wrap_40,
gf_result,
gf_fmnumb,
gf_fmnumb_test,
gf_lang,
gf_fuser,
gf_fdate,
gf_luser,
gf_ldate,
gf_okcode_t,
gf_okcode_l,
gf_gph_url,
gf_gph_rfsh,
gf_gph_size.

FREE:
go_table,
go_columns,
go_sorts,
go_col,
go_events,
go_cl_gui_textedit,
go_form,
go_node,
go_picture,
go_pic_container.

ENDFORM. " F_INIT

*&---------------------------------------------------------------------*
*& Form F_FETCH_FORMS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_fetch_forms.

TYPES: BEGIN OF lty_txt,
tdname TYPE tdobname,
tdspras TYPE tdspras,
END OF lty_txt.

DATA: lf_line_t TYPE i, " From TNAPR
lf_line_s TYPE i, " From Selection screen
lf_form TYPE tdsfname,
lt_txt TYPE STANDARD TABLE OF lty_txt,
lf_obname TYPE tdobname,
lf_btyp TYPE tdbtype.


IF rb_text EQ abap_true OR rb_logo EQ abap_true.
SELECT sform
FROM tnapr
INTO TABLE gt_form
WHERE kschl IN s_out
AND kappl IN s_appl
AND sform IN s_form.
IF sy-subrc IS INITIAL AND s_form IS INITIAL.
SELECT formname
firstuser
firstdate
lastuser
lastdate
FROM stxfadm
INTO TABLE gt_form_det
FOR ALL ENTRIES IN gt_form
WHERE formname EQ gt_form-sf_name
AND formtype EQ space.
IF sy-subrc IS INITIAL.
RETURN.
ENDIF.
RETURN.
ENDIF.

IF s_out IS INITIAL AND s_appl IS INITIAL.
DESCRIBE TABLE gt_form LINES lf_line_t.
DESCRIBE TABLE s_form LINES lf_line_s.
IF lf_line_t NE lf_line_s.
SELECT formname
firstuser
firstdate
lastuser
lastdate
FROM stxfadm
INTO TABLE gt_form_det
WHERE formname IN s_form
AND formtype EQ space.
IF sy-subrc IS INITIAL.
RETURN.
ENDIF.
ENDIF.
ENDIF.

ELSE.
* Check combinations
IF rb_wutx EQ abap_true.
IF rb_st EQ abap_true.
SELECT tdname
tdspras
FROM stxh
INTO TABLE lt_txt
WHERE tdobject EQ 'TEXT'
AND tdname EQ p_txt
AND tdid EQ p_tid.
IF sy-subrc IS INITIAL.
IF NOT p_tsp IS INITIAL.
READ TABLE lt_txt TRANSPORTING NO FIELDS
WITH KEY tdspras = p_tsp.
IF sy-subrc NE 0.
MESSAGE s007 DISPLAY LIKE c_error. " Combination for SO10 Text Where-used doesn't exist. Please check
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ELSE.
MESSAGE s007 DISPLAY LIKE c_error. " Combination for SO10 Text Where-used doesn't exist. Please check
LEAVE LIST-PROCESSING.
ENDIF.
ELSEIF rb_tm EQ abap_true.
SELECT SINGLE formname
FROM stxfadm
INTO lf_form
WHERE formname EQ p_tm
AND formtype EQ 'T'.
IF sy-subrc NE 0.
MESSAGE s008 DISPLAY LIKE c_error. " Invalid Text Module. Please enter a valid value
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ELSEIF rb_wulo EQ abap_true.
IF rb_bw EQ abap_true.
lf_btyp = 'BMON'.
ELSE.
lf_btyp = 'BCOL'.
ENDIF.

SELECT SINGLE tdname
FROM stxbitmaps
INTO lf_obname
WHERE tdobject EQ 'GRAPHICS'
AND tdname EQ p_log
AND tdid EQ p_td
AND tdbtype EQ lf_btyp.
IF sy-subrc NE 0.
MESSAGE s009 DISPLAY LIKE c_error. " Combination for Graphics Where-used doesn't exist. Please check
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.

* Check if there are additional Filters for where-used
IF p_pfx IS INITIAL AND NOT s_apl IS INITIAL.
SELECT sform
FROM tnapr
INTO TABLE gt_form
WHERE kappl IN s_apl.
IF sy-subrc IS INITIAL.
SELECT formname
firstuser
firstdate
lastuser
lastdate
FROM stxfadm
INTO TABLE gt_form_det
FOR ALL ENTRIES IN gt_form
WHERE formname EQ gt_form-sf_name
AND formtype EQ space.
ENDIF.
ELSEIF NOT p_pfx IS INITIAL AND s_apl IS INITIAL.
CONCATENATE p_pfx '%' INTO lf_form.
SELECT formname
firstuser
firstdate
lastuser
lastdate
FROM stxfadm
INTO TABLE gt_form_det
WHERE formname LIKE lf_form
AND formtype EQ space.
IF sy-subrc IS INITIAL.
* Do Nothing
ENDIF.
ELSEIF NOT p_pfx IS INITIAL AND NOT s_apl IS INITIAL.
CONCATENATE p_pfx '%' INTO lf_form.
SELECT sform
FROM tnapr
INTO TABLE gt_form
WHERE kappl IN s_apl
AND sform LIKE lf_form.
IF sy-subrc IS INITIAL.
SELECT formname
firstuser
firstdate
lastuser
lastdate
FROM stxfadm
INTO TABLE gt_form_det
FOR ALL ENTRIES IN gt_form
WHERE formname EQ gt_form-sf_name
AND formtype EQ space.
ENDIF.
ELSE.
SELECT formname
firstuser
firstdate
lastuser
lastdate
FROM stxfadm
INTO TABLE gt_form_det
WHERE formtype EQ space.
IF sy-subrc IS INITIAL.
* Do Nothing
ENDIF.
ENDIF.
ENDIF.

SORT gt_form_det BY sf_name.
DELETE ADJACENT DUPLICATES FROM gt_form_det COMPARING sf_name.

IF gt_form_det IS INITIAL.
MESSAGE s006 DISPLAY LIKE c_error. " No Data found for the entered Selection Criteria
LEAVE LIST-PROCESSING.
ENDIF.

ENDFORM. " F_FETCH_FORMS

*&---------------------------------------------------------------------*
*& Form F_DISPLAY_W
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_display_w.

DATA: lo_event TYPE REF TO lcl_handle_events,
lf_stat TYPE sypfkey.

* Call factory method of Class CL_SALV_TABLE
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = go_table
CHANGING
t_table = gt_final_w.
CATCH cx_salv_msg .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Get columns
CALL METHOD go_table->get_columns
RECEIVING
value = go_columns.

* Set Columns optimized
CALL METHOD go_columns->set_optimize
EXPORTING
value = abap_true.

* Set the hotspot for Smartform Name
TRY.
go_col ?= go_columns->get_column( 'SF_NAME' ).
go_col->set_cell_type( if_salv_c_cell_type=>hotspot ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Set the text for Page Name
TRY.
go_col ?= go_columns->get_column( 'PG_NAME' ).
go_col->set_short_text( text-t03 ).
go_col->set_medium_text( text-t03 ).
go_col->set_long_text( text-t03 ).
go_col->set_tooltip( text-t11 ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Set the text for Window Name
TRY.
go_col ?= go_columns->get_column( 'WI_NAME' ).
go_col->set_short_text( text-t07 ).
go_col->set_medium_text( text-t04 ).
go_col->set_long_text( text-t04 ).
go_col->set_tooltip( text-t12 ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Set the field VENUM as Technical
IF rb_wulo EQ abap_true.
TRY.
go_col ?= go_columns->get_column( 'LANG' ).
go_col->set_technical( abap_true ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.
ELSE.
TRY.
go_col ?= go_columns->get_column( 'LANG' ).
go_col->set_short_text( text-t09 ).
go_col->set_medium_text( text-t09 ).
go_col->set_long_text( text-t09 ).
go_col->set_tooltip( text-t09 ).
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.
ENDIF.
* Sort Output table
go_sorts = go_table->get_sorts( ).

TRY .
go_sorts->add_sort( 'SF_NAME' ).
go_sorts->add_sort( 'PG_NAME' ).
go_sorts->add_sort( 'WI_NAME' ).
CATCH cx_salv_not_found.
CATCH cx_salv_data_error.
CATCH cx_salv_existing.
ENDTRY.

* Register the Double click Event
go_events = go_table->get_event( ).
CREATE OBJECT lo_event.
SET HANDLER lo_event->z_link_click FOR go_events.
SET HANDLER lo_event->z_user_command_w FOR go_events.

* Layout
*/.. Create Top of Page
PERFORM f_top_of_page.

* Determine PF-Status
IF rb_wutx EQ abap_true.
lf_stat = c_status_t.
ELSE.
lf_stat = c_status_l.
ENDIF.

* Set the GUI Status
CALL METHOD go_table->set_screen_status
EXPORTING
report = sy-repid
pfstatus = lf_stat
set_functions = go_table->c_functions_all.

* Call display method of class CL_SALV_TABLE to display
CALL METHOD go_table->display.

ENDFORM. " F_DISPLAY_W

*&---------------------------------------------------------------------*
*& Form F_DISP_TX
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_disp_tx USING pf_ucomm TYPE salv_de_function.

DATA: lo_selections TYPE REF TO cl_salv_selections,
lf_row TYPE i,
lt_rows TYPE salv_t_row,
ls_final TYPE ty_final_w,
lf_spras TYPE tdspras,
ls_tline TYPE tline,
ls_langs TYPE ssfrlang,
lf_tm_name TYPE tdsfname,
lf_lang TYPE string.

CASE pf_ucomm.
WHEN '&GETXT'.
* WHEN .
lo_selections = go_table->get_selections( ).
lt_rows = lo_selections->get_selected_rows( ).

READ TABLE lt_rows INTO lf_row INDEX 1.
IF sy-subrc IS INITIAL.
READ TABLE gt_final_w INTO ls_final INDEX lf_row.
IF sy-subrc NE 0.
* MESSAGE
ENDIF.
ENDIF.

* Check if Language is Dynamic
lf_lang = ls_final-lang.
IF lf_lang CA '&'.
lf_spras = sy-langu.
IF NOT p_tsp IS INITIAL.
lf_spras = p_tsp.
ENDIF.
ELSE.
lf_spras = lf_lang.
ENDIF.
* lf_tdid = ls_final-id.
* lf_obj = ls_final-object.
REFRESH: gt_lines[], gt_text[].

* CASE ls_final-sf_name.
IF rb_st EQ abap_true.
* Read Text values
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = p_tid
language = lf_spras
name = p_txt
object = c_text
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 EQ 4 AND lf_lang CA '&' AND p_tsp IS INITIAL.
SELECT tdspras
FROM stxh
INTO lf_spras
UP TO 1 ROWS
WHERE tdobject EQ c_text
AND tdname EQ p_txt
AND tdid EQ p_tid.
ENDSELECT.
IF sy-subrc IS INITIAL.
* Read Text values
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = p_tid
language = lf_spras
name = p_txt
object = c_text
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.
ENDIF.

* Implement suitable error handling here
ENDIF.
ELSEIF rb_tm EQ abap_true.
CLEAR ls_langs.
ls_langs-langu1 = lf_spras.
lf_tm_name = p_tm.
CALL FUNCTION 'SSFRT_READ_TEXTMODULE'
EXPORTING
i_textmodule = lf_tm_name
i_languages = ls_langs
IMPORTING
o_langu = lf_spras
o_text = gt_lines
EXCEPTIONS
error = 1
language_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0 AND lf_lang CA '&' AND p_tsp IS INITIAL.
SELECT SINGLE masterlang
FROM stxfadm
INTO lf_spras
WHERE formname EQ lf_tm_name
AND formtype EQ 'T'.
IF sy-subrc IS INITIAL.
CLEAR ls_langs.
ls_langs-langu1 = lf_spras.
CALL FUNCTION 'SSFRT_READ_TEXTMODULE'
EXPORTING
i_textmodule = lf_tm_name
i_languages = ls_langs
IMPORTING
o_langu = lf_spras
o_text = gt_lines
EXCEPTIONS
error = 1
language_not_found = 2
OTHERS = 3.
ENDIF.
ENDIF.
ENDIF.

*
WHEN OTHERS.
ENDCASE.

* Check if Text is blank
IF gt_lines IS INITIAL.
MESSAGE i018. " Blank line or Text not available in Selection screen or Logon Language
RETURN.
ELSE.
LOOP AT gt_lines INTO ls_tline
WHERE tdline NE space.
EXIT.
ENDLOOP.
IF sy-subrc NE 0.
MESSAGE i018. " Blank line or Text not available in Selection screen or Logon Language
RETURN.
ENDIF.
ENDIF.

LOOP AT gt_lines INTO ls_tline.
APPEND ls_tline-tdline TO gt_text[].
CLEAR ls_tline.
ENDLOOP.

CALL SCREEN 9000 STARTING AT 10 1.

ENDFORM. " F_DISP_TX

*&---------------------------------------------------------------------*
*& Form F_DISP_GP
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_disp_gp USING pf_ucomm TYPE salv_de_function.

DATA: lf_obj TYPE tdobjectgr,
lf_name TYPE tdobname,
lf_id TYPE tdidgr,
lf_btyp TYPE tdbtype.

DATA: lf_graphic_xstr TYPE xstring,
lf_graphic_conv TYPE i,
lf_graphic_offs TYPE i.


CASE pf_ucomm.
WHEN '&PRVW'.

lf_obj = c_gph.
lf_name = p_log.
lf_id = p_td.
IF rb_bw EQ abap_true.
lf_btyp = 'BMON'.
ELSE.
lf_btyp = 'BCOL'.
ENDIF.

CLEAR: gf_gph_url,
gt_gph[].
CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
EXPORTING
p_object = lf_obj
p_name = lf_name
p_id = lf_id
p_btype = lf_btyp
RECEIVING
p_bmp = lf_graphic_xstr
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 1.
MESSAGE e002 WITH lf_name. " Graphic &1 could not be found
ELSEIF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
RETURN.
ENDIF.

gf_gph_size = xstrlen( lf_graphic_xstr ).
CHECK gf_gph_size > 0.

lf_graphic_conv = gf_gph_size.
lf_graphic_offs = 0.

CLEAR gs_gph.
WHILE lf_graphic_conv > 255.
gs_gph-line = lf_graphic_xstr+lf_graphic_offs(255).
APPEND gs_gph TO gt_gph.
lf_graphic_offs = lf_graphic_offs + 255.
lf_graphic_conv = lf_graphic_conv - 255.
ENDWHILE.

gs_gph-line = lf_graphic_xstr+lf_graphic_offs(lf_graphic_conv).
APPEND gs_gph TO gt_gph.

CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image'(t24) "#EC NOTEXT
subtype = c_unknown " 'X-UNKNOWN'
size = gf_gph_size
lifetime = c_txn_life " 'T'
TABLES
data = gt_gph
CHANGING
url = gf_gph_url
EXCEPTIONS
dp_invalid_parameter = 1
dp_error_put_table = 2
dp_error_general = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
RETURN.
ENDIF.

gf_gph_rfsh = abap_true.
CALL SCREEN 9001 STARTING AT 10 1.
* WHEN .
WHEN OTHERS.
ENDCASE.

ENDFORM. " F_DISP_GP

*&---------------------------------------------------------------------*
*& Form F_LINK_CLICK
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_link_click USING pf_row TYPE salv_de_row.

TYPES: BEGIN OF lty_tnapr,
kschl TYPE na_kschl,
kappl TYPE kappl,
END OF lty_tnapr.

DATA: lf_sfname TYPE tdsfname,
lt_tnapr TYPE STANDARD TABLE OF lty_tnapr,
ls_tnapr TYPE lty_tnapr,
lt_vtab TYPE STANDARD TABLE OF tdline,
lt_vtab1 TYPE STANDARD TABLE OF tdline,
ls_vtab TYPE tdline,
ls_final_c TYPE ty_form_det,
lf_kappl TYPE kappl,
lt_app_t TYPE STANDARD TABLE OF t681b,
ls_app_t TYPE t681b,
lt_out_t TYPE STANDARD TABLE OF t685t,
ls_out_t TYPE t685t.

CLEAR: gs_final_t,
gs_final_l,
gs_final_w.

IF rb_text EQ abap_true.
READ TABLE gt_final_t INTO gs_final_t INDEX pf_row.
IF sy-subrc IS INITIAL.
lf_sfname = gs_final_t-sf_name.
ENDIF.
ELSEIF rb_logo EQ abap_true.
READ TABLE gt_final_l INTO gs_final_l INDEX pf_row.
IF sy-subrc IS INITIAL.
lf_sfname = gs_final_l-sf_name.
ENDIF.
ELSEIF rb_conf EQ abap_true.
READ TABLE gt_final_c INTO ls_final_c INDEX pf_row.
IF sy-subrc IS INITIAL.
lf_sfname = ls_final_c-sf_name.
ENDIF.
ELSE.
READ TABLE gt_final_w INTO gs_final_w INDEX pf_row.
IF sy-subrc IS INITIAL.
lf_sfname = gs_final_w-sf_name.
ENDIF.
ENDIF.

* Get Application and Output Types from TNAPR
SELECT kschl
kappl
FROM tnapr
INTO TABLE lt_tnapr
WHERE sform EQ lf_sfname.
IF sy-subrc IS INITIAL.
* Get the Application Description
SELECT *
FROM t681b
INTO TABLE lt_app_t
FOR ALL ENTRIES IN lt_tnapr
WHERE spras EQ sy-langu
AND kappl EQ lt_tnapr-kappl.
IF sy-subrc IS INITIAL.
SORT lt_app_t BY kappl.
ENDIF.

* Get the Output type Description
SELECT *
FROM t685t
INTO TABLE lt_out_t
FOR ALL ENTRIES IN lt_tnapr
WHERE spras EQ sy-langu
AND kappl EQ lt_tnapr-kappl
AND kschl EQ lt_tnapr-kschl.
IF sy-subrc IS INITIAL.
SORT lt_out_t BY kappl kschl.
ENDIF.
SORT lt_tnapr BY kappl kschl.
DELETE ADJACENT DUPLICATES FROM lt_tnapr COMPARING kappl kschl.
CLEAR: ls_tnapr, ls_vtab.
LOOP AT lt_tnapr INTO ls_tnapr.
IF ls_tnapr-kappl NE lf_kappl.
IF NOT lt_vtab IS INITIAL.
MOVE '--------------------------------------------' TO ls_vtab.
APPEND ls_vtab TO lt_vtab.
CLEAR lt_vtab.
ENDIF.
lf_kappl = ls_tnapr-kappl.
* Read the Application description
READ TABLE lt_app_t INTO ls_app_t WITH KEY kappl = ls_tnapr-kappl.

CONCATENATE 'Application - '(t21) lf_kappl ls_app_t-vtext INTO ls_vtab SEPARATED BY space.
APPEND ls_vtab TO lt_vtab.
CLEAR ls_vtab.

MOVE 'Output Types: '(t25) TO ls_vtab.
APPEND ls_vtab TO lt_vtab.
CLEAR ls_vtab.
ENDIF.

* Read the Application description
READ TABLE lt_out_t INTO ls_out_t WITH KEY kappl = ls_tnapr-kappl
kschl = ls_tnapr-kschl.

CONCATENATE '-- ' ls_tnapr-kschl ' ' ls_out_t-vtext INTO ls_vtab SEPARATED BY space.
APPEND ls_vtab TO lt_vtab.
CLEAR ls_vtab.
ENDLOOP.
ELSE.
MOVE 'This Smartform is not configured for any Output Type'(t22) TO ls_vtab.
APPEND ls_vtab TO lt_vtab.
CLEAR ls_vtab.
ENDIF.

LOOP AT lt_vtab INTO ls_vtab.
IF ls_vtab+15(1) = 'S' .
ls_vtab+15(1) = 's'.
ENDIF.

IF ls_vtab+15(1) = 'F' .
ls_vtab+15(1) = 'f'.
ENDIF.

APPEND ls_vtab TO lt_vtab1[].
ENDLOOP.

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY_OK'
EXPORTING
endpos_col = '85'
endpos_row = '15'
startpos_col = '30'
startpos_row = '2'
titletext = 'SF Config Details'(t23)
TABLES
valuetab = lt_vtab1
EXCEPTIONS
break_off = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

 

ENDFORM. " F_LINK_CLICK

*&---------------------------------------------------------------------*
*& Form F_VALIDATE_APPL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_validate_appl.

DATA: lf_kappl TYPE kappl.

SELECT SINGLE kappl
FROM t681a
INTO lf_kappl
WHERE kappl IN s_appl.
IF sy-subrc NE 0.
MESSAGE e005. " Invalid Value. Please enter a valid value or use F4(if available)
ENDIF.

ENDFORM. " F_VALIDATE_APPL
*&---------------------------------------------------------------------*
*& Form F_VALIDATE_APL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_validate_apl.

DATA: lf_kappl TYPE kappl.

SELECT SINGLE kappl
FROM t681a
INTO lf_kappl
WHERE kappl IN s_apl.
IF sy-subrc NE 0.
MESSAGE e005. " Invalid Value. Please enter a valid value or use F4(if available)
ENDIF.

ENDFORM. " F_VALIDATE_APL

*&---------------------------------------------------------------------*
*& Form F_VALIDATE_OUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_validate_out.

DATA: lf_kschl TYPE na_kschl.

SELECT kschl
FROM t685
INTO lf_kschl
UP TO 1 ROWS
WHERE kschl IN s_out.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e005. " Invalid Value. Please enter a valid value or use F4(if available)
ENDIF.

ENDFORM. " F_VALIDATE_OUT

*&---------------------------------------------------------------------*
*& Form F_VALIDATE_FORM
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_validate_form.

DATA: lf_form TYPE tdsfname.

SELECT SINGLE formname
FROM stxfadm
INTO lf_form
WHERE formname IN s_form
AND formtype EQ space.
IF sy-subrc NE 0.
MESSAGE e005. " Invalid Value. Please enter a valid value or use F4(if available)
ENDIF.

ENDFORM. " F_VALIDATE_FORM

*&---------------------------------------------------------------------*
*& Form F_VALIDATE_TXT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_validate_txt.

DATA: lf_txt TYPE tdobname.

SELECT tdname
FROM stxh
INTO lf_txt
UP TO 1 ROWS
WHERE tdname EQ p_txt.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e005. " Invalid Value. Please enter a valid value or use F4(if available)
ENDIF.

ENDFORM. " F_VALIDATE_TXT

*&---------------------------------------------------------------------*
*& Form F_VALIDATE_TID
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_validate_tid.

DATA: lf_tdid TYPE tdid.

SELECT tdid
FROM ttxid
INTO lf_tdid
UP TO 1 ROWS
WHERE tdid EQ p_tid.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e005. " Invalid Value. Please enter a valid value or use F4(if available)
ENDIF.

ENDFORM. " F_VALIDATE_TID

*&---------------------------------------------------------------------*
*& Form F_VALIDATE_TSP
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_validate_tsp.

DATA: lf_spras TYPE spras.

SELECT SINGLE spras
FROM t002
INTO lf_spras
WHERE spras EQ p_tsp.
IF sy-subrc NE 0.
MESSAGE e005. " Invalid Value. Please enter a valid value or use F4(if available)
ENDIF.

ENDFORM. " F_VALIDATE_TSP

*&---------------------------------------------------------------------*
*& Form F_VALIDATE_TM
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_validate_tm.

DATA: lf_tm TYPE tdsfname.

SELECT SINGLE formname
FROM stxfadm
INTO lf_tm
WHERE formname EQ p_tm
AND formtype EQ 'T'.
IF sy-subrc NE 0.
MESSAGE e005. " Invalid Value. Please enter a valid value or use F4(if available)
ENDIF.

ENDFORM. " F_VALIDATE_TM

*&---------------------------------------------------------------------*
*& Form F_VALIDATE_LOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_validate_log.

DATA: lf_log TYPE tdobname.

SELECT tdname
FROM stxbitmaps
INTO lf_log
UP TO 1 ROWS
WHERE tdname EQ p_log.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e005. " Invalid Value. Please enter a valid value or use F4(if available)
ENDIF.

ENDFORM. " F_VALIDATE_LOG

*&---------------------------------------------------------------------*
*& Form F_VALIDATE_TD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_validate_td.

DATA: lf_tdid TYPE tdid.

SELECT tdid
FROM ttxid
INTO lf_tdid
UP TO 1 ROWS
WHERE tdid EQ p_td.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e005. " Invalid Value. Please enter a valid value or use F4(if available)
ENDIF.

ENDFORM. " F_VALIDATE_TD

*&---------------------------------------------------------------------*
*& Form F_CHK_BLANK
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_chk_blank.

IF rb_text EQ abap_true OR rb_logo EQ abap_true.
IF s_appl IS INITIAL AND s_out IS INITIAL AND s_form IS INITIAL.
MESSAGE s010 DISPLAY LIKE c_error. " Please enter atleast one field value out of Application, o/p type or Form
LEAVE LIST-PROCESSING.
ENDIF.
ELSEIF rb_wutx EQ abap_true.
IF rb_st EQ abap_true.
IF p_txt IS INITIAL OR p_tid IS INITIAL.
MESSAGE s011 DISPLAY LIKE c_error. " Text name and Text ID cannot be blank for SO10 Text Where-used
LEAVE LIST-PROCESSING.
ENDIF.
ELSEIF rb_tm EQ abap_true.
IF p_tm IS INITIAL.
MESSAGE s012 DISPLAY LIKE c_error. " Please enter the Text Module name
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ELSEIF rb_wulo EQ abap_true.
IF p_log IS INITIAL OR p_td IS INITIAL.
MESSAGE s013 DISPLAY LIKE c_error. " Graphics/Logo name and Graphic ID cannot be blank for Graphics Where-used
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.

ENDFORM. " F_CHK_BLANK

*&---------------------------------------------------------------------*
*& Form F_VALIDATE_PFX
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_validate_pfx.

DATA: lf_str TYPE string.

lf_str = p_pfx.

IF lf_str CA '*'.
MESSAGE e014. " Wild Card i.e. * not allowed. Please re-enter
ENDIF.

ENDFORM. " F_VALIDATE_PFX

*&---------------------------------------------------------------------*
*& Form F_TOP_OF_PAGE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_top_of_page.

DATA: ls_kappl TYPE kappl_ran.

DATA: lo_header TYPE REF TO cl_salv_form_layout_grid,
lo_header_grid TYPE REF TO cl_salv_form_layout_grid,
lo_header_det TYPE REF TO cl_salv_form_header_info, "#EC NEEDED
lo_label TYPE REF TO cl_salv_form_label, "#EC NEEDED
lf_total TYPE i,
lf_text TYPE char50,
lf_bmap TYPE char20.

CLEAR lf_text.
IF rb_text EQ abap_true.
DESCRIBE TABLE gt_final_t LINES lf_total.
lf_text = 'Find Text in Smartforms'(001).
ELSEIF rb_logo EQ abap_true.
DESCRIBE TABLE gt_final_l LINES lf_total.
lf_text = 'Find Graphics/Logo in Smartforms'(002).
ELSEIF rb_wutx EQ abap_true.
DESCRIBE TABLE gt_final_w LINES lf_total.
IF rb_st EQ abap_true.
lf_text = 'WHERE-USED for SO10 Text in Smartforms'(003).
ELSEIF rb_tm EQ abap_true.
lf_text = 'WHERE-USED for Text Module in Smartforms'(004).
ENDIF.
ELSEIF rb_wulo EQ abap_true.
DESCRIBE TABLE gt_final_w LINES lf_total.
lf_text = 'WHERE-USED for Graphics/Logo in Smartforms'(005).
ELSEIF rb_conf EQ abap_true.
DESCRIBE TABLE gt_final_c LINES lf_total.
lf_text = 'Smartforms not Configured in NACE'(006).
ENDIF.

CREATE OBJECT lo_header.

CALL METHOD lo_header->create_grid
EXPORTING
row = 1
column = 5
colspan = 6
RECEIVING
r_value = lo_header_grid.

CALL METHOD lo_header_grid->create_header_information
EXPORTING
row = 1
column = 15
text = lf_text
RECEIVING
r_value = lo_header_det.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 5
column = 3
text = 'Total No of Records :'(020)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 5
column = 5
text = lf_total
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 6
column = 3
text = 'User Name :'(021)
RECEIVING
r_value = lo_label.

* CALL METHOD lo_header_grid->create_label
* EXPORTING
* row = 6
* column = 5
* text = sy-uname
* RECEIVING
* r_value = lo_label.

* Include WHERE-USED Selection criteria in output TOP-OF-PAGE
IF rb_wutx EQ abap_true.
IF rb_st EQ abap_true.
CALL METHOD lo_header_grid->create_label
EXPORTING
row = 7
column = 3
text = 'Text Name :'(007)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 7
column = 5
text = p_txt
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 8
column = 3
text = 'Text ID :'(008)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 8
column = 5
text = p_tid
RECEIVING
r_value = lo_label.

IF NOT p_tsp IS INITIAL.
CALL METHOD lo_header_grid->create_label
EXPORTING
row = 9
column = 3
text = 'Language :'(009)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 9
column = 5
text = p_tsp
RECEIVING
r_value = lo_label.
ENDIF.

IF NOT p_pfx IS INITIAL.
CALL METHOD lo_header_grid->create_label
EXPORTING
row = 10
column = 3
text = 'Prefix Restrict:'(016)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 10
column = 5
text = p_pfx
RECEIVING
r_value = lo_label.
ENDIF.

IF NOT s_apl IS INITIAL.
READ TABLE s_apl INTO ls_kappl INDEX 1.
CALL METHOD lo_header_grid->create_label
EXPORTING
row = 11
column = 3
text = 'Application Restrict:'(017)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 11
column = 5
text = s_apl-low
RECEIVING
r_value = lo_label.
ENDIF.

ELSEIF rb_tm EQ abap_true.
CALL METHOD lo_header_grid->create_label
EXPORTING
row = 7
column = 3
text = 'Text Module :'(010)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 7
column = 5
text = p_tm
RECEIVING
r_value = lo_label.

IF NOT p_pfx IS INITIAL.
CALL METHOD lo_header_grid->create_label
EXPORTING
row = 8
column = 3
text = 'Prefix Restrict:'(016)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 8
column = 5
text = p_pfx
RECEIVING
r_value = lo_label.
ENDIF.

IF NOT s_apl IS INITIAL.
READ TABLE s_apl INTO ls_kappl INDEX 1.
CALL METHOD lo_header_grid->create_label
EXPORTING
row = 9
column = 3
text = 'Application Restrict:'(017)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 9
column = 5
text = s_apl-low
RECEIVING
r_value = lo_label.
ENDIF.
ENDIF.

ELSEIF rb_wulo EQ abap_true.
CALL METHOD lo_header_grid->create_label
EXPORTING
row = 7
column = 3
text = 'Graphic/Logo Name :'(011)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 7
column = 5
text = p_log
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 8
column = 3
text = 'Graphic ID :'(012)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 8
column = 5
text = p_td
RECEIVING
r_value = lo_label.

IF rb_bw EQ abap_true.
lf_bmap = 'Black & White'(013).
ELSEIF rb_cl EQ abap_true.
lf_bmap = 'Colour'(014).
ENDIF.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 9
column = 3
text = 'Graphic Type :'(015)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 9
column = 5
text = lf_bmap
RECEIVING
r_value = lo_label.

IF NOT p_pfx IS INITIAL.
CALL METHOD lo_header_grid->create_label
EXPORTING
row = 10
column = 3
text = 'Prefix Restrict:'(016)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 10
column = 5
text = p_pfx
RECEIVING
r_value = lo_label.
ENDIF.

IF NOT s_apl IS INITIAL.
READ TABLE s_apl INTO ls_kappl INDEX 1.
CALL METHOD lo_header_grid->create_label
EXPORTING
row = 11
column = 3
text = 'Application Restrict:'(017)
RECEIVING
r_value = lo_label.

CALL METHOD lo_header_grid->create_label
EXPORTING
row = 11
column = 5
text = s_apl-low
RECEIVING
r_value = lo_label.
ENDIF.
ENDIF.

go_table->set_top_of_list( lo_header ).

ENDFORM. " F_TOP_OF_PAGE

*&---------------------------------------------------------------------*
*& Form F_GET_DETAILS_C
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_get_details_c.

DATA: lt_form TYPE STANDARD TABLE OF ty_form,
lt_form_det TYPE STANDARD TABLE OF ty_form_det,
ls_form_det TYPE ty_form_det,
lf_form TYPE tdsfname.

IF NOT p_prx IS INITIAL.
CONCATENATE p_prx '%' INTO lf_form.

SELECT formname
firstuser
firstdate
lastuser
lastdate
FROM stxfadm
INTO TABLE lt_form_det
WHERE formname LIKE lf_form
AND formtype EQ space.
ELSE.
SELECT formname
firstuser
firstdate
lastuser
lastdate
FROM stxfadm
INTO TABLE lt_form_det
WHERE formtype EQ space.
ENDIF.
IF NOT lt_form_det IS INITIAL.
SELECT sform
FROM tnapr
INTO TABLE lt_form
FOR ALL ENTRIES IN lt_form_det
WHERE sform EQ lt_form_det-sf_name.
IF sy-subrc IS INITIAL.
SORT lt_form.
DELETE ADJACENT DUPLICATES FROM lt_form.

LOOP AT lt_form_det INTO ls_form_det.
READ TABLE lt_form TRANSPORTING NO FIELDS
WITH KEY sf_name = ls_form_det-sf_name.
IF sy-subrc IS INITIAL.
CONTINUE.
ELSE.
APPEND ls_form_det TO gt_final_c.
ENDIF.
ENDLOOP.
ELSE.
APPEND LINES OF lt_form_det TO gt_final_c.
LOOP AT gt_final_c INTO ls_form_det.
CLEAR: ls_form_det-firstuser,
ls_form_det-lastuser.
MODIFY gt_final_c FROM ls_form_det INDEX sy-tabix.
ENDLOOP.
ENDIF.
ELSE.
MESSAGE s015 DISPLAY LIKE c_error. " No Smartform exists for the Selection Criteria
LEAVE LIST-PROCESSING.
ENDIF.

ENDFORM. " F_GET_DETAILS_C

*&---------------------------------------------------------------------*
*& Form F_DISPLAY_C
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_display_c.

DATA: lo_event TYPE REF TO lcl_handle_events.

* Call factory method of Class CL_SALV_TABLE
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = go_table
CHANGING
t_table = gt_final_c.
CATCH cx_salv_msg .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Get columns
CALL METHOD go_table->get_columns
RECEIVING
value = go_columns.

* Set Columns optimized
CALL METHOD go_columns->set_optimize
EXPORTING
value = abap_true.

* Set the hotspot for Smartform Name
TRY.
go_col ?= go_columns->get_column( 'SF_NAME' ). " SF_NAME
go_col->set_cell_type( if_salv_c_cell_type=>hotspot ). " Set Hotspot
CATCH cx_salv_not_found .
MESSAGE text-e01 TYPE c_error. " Error while Formatting ALV Columns
ENDTRY.

* Register the Double click Event
go_events = go_table->get_event( ).
CREATE OBJECT lo_event.
SET HANDLER lo_event->z_link_click FOR go_events.

*/.. Create Top of Page
PERFORM f_top_of_page.

* Set the GUI Status
CALL METHOD go_table->set_screen_status
EXPORTING
report = sy-repid
pfstatus = c_status_c
set_functions = go_table->c_functions_all.

* Call display method of class CL_SALV_TABLE to display
CALL METHOD go_table->display.

ENDFORM. " F_DISPLAY_C

*&---------------------------------------------------------------------*
*& Form F_VALIDATE_PRX
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_validate_prx.

DATA: lf_str TYPE string.

lf_str = p_prx.

IF lf_str CA '*'.
MESSAGE e014. " Wild Card i.e. * not allowed. Please re-enter
ENDIF.

ENDFORM. " F_VALIDATE_PRX

 

***********************************************************************************************************************************
                                                                                PBO
*********************************************************************************************************************************** 

*&---------------------------------------------------------------------*
*& Include ZTEST_SF_TEXTS_O01
*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*
*& Module STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_9000 OUTPUT.
SET PF-STATUS 'PF_9000'.
SET TITLEBAR 'TL2'.

PERFORM f_fill_text.

ENDMODULE. " STATUS_9000 OUTPUT

*&---------------------------------------------------------------------*
*& Module STATUS_9001 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_9001 OUTPUT.
SET PF-STATUS 'PF_9000'.
SET TITLEBAR 'TL3'.

PERFORM f_get_picture.

ENDMODULE. " STATUS_9001 OUTPUT

 

***********************************************************************************************************************************
                                                                                PAI
*********************************************************************************************************************************** 

*&---------------------------------------------------------------------*
*& Include ZTEST_SF_TEXTS_I01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_9000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_9000 INPUT.

PERFORM f_ucomm.

ENDMODULE. " USER_COMMAND_9000 INPUT

*&---------------------------------------------------------------------*
*& Module USER_COMMAND_9001 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_9001 INPUT.

PERFORM f_usr_com.

ENDMODULE. " USER_COMMAND_9001 INPUT

*************************************************************************************************************************************************************************************************************   

Report Texts:

Text Symbols
B04 WHERE-USED Graphics/Logo(Consider Background execution in case of poor performance)
B05 SO10 Text Where-Used
B06 Text Module Where-Used
B07 Additional Filter for WHERE-USED(Use this to reduce processing time)
B08 Filter to restrict Non-Configured Smartforms
C01 Enter atleast one field below or a combination if known to you
C02 First 2 fields below are mandatory for SO10
C03 Please fill Logo Name
C04 OR
C05 For eg. ZTEST_ , ZSF_SD etc. Only enter prefix and do not use Wild card i.e. *
C06 - In general WHERE-USED would take considerably more time than Find text/Logo would
C07 - Click on Hotspot of Form name in o/p to check Application & o/p type it belongs
E01 Error while Formatting ALV Columns
T00 Find Form Texts/Logos or WHERE-USED for Texts/Logos
T01 Output Type or FORM Name
T02 WHERE-USED Text(Consider Background execution in case of poor performance)
T03 Page Name
T04 Window Name
T05 Text Snap
T06 Text Type
T07 Windw Name
T08 Ln
T09 Language
T11 Page Name in Form
T12 Window Name in Form
T13 Text Snap (for Text Element only)
T21 Application -
T22 This Smartform is not configured for any Output Type
T23 SF Config Details
T24 image


Selection Texts

P_LOG            Logo Name
P_PFX             Prefix Restrict
P_PRX             Prefix
P_TD               Graphic ID
P_TID              Text ID
P_TM               Text Module
P_TSP             Language
P_TXT             Text Name
RB_BW            Black & White Bitmap
RB_CL             Color Bitmap
RB_CONF        Smartforms not NACE Configured
RB_LOGO       Find Graphics/Logo in Form
RB_ST              SO10 Text
RB_TEXT         Find Text in Form
RB_TM             Text Module
RB_WULO       WHERE-USED for Graphic/Logo
RB_WUTX       WHERE-USED for SO10 Text
S_APL              Application Restrict
S_APPL           Application
S_FORM         Form Name
S_OUT            Output Type

 

Message Class - ZTEST_MSG

000 Please enter a Value in the Field
001 Do not enter Alphabets
002 Graphic &1 could not be found
003 Dynamic Texts cannot be displayed
004 Name is Dynamic hence cannot be displayed
005 Invalid Value. Please enter a valid value or use F4(if available)
006 No Data found for the entered Selection Criteria
007 Combination for SO10 Text Where-used doesn't exist. Please check
008 Invalid Text Module. Please enter a valid value
009 Combination for Graphics Where-used doesn't exist. Please check
010 Please enter atleast one field value out of Application, o/p type or Form
011 Text name and Text ID cannot be blank for SO10 Text Where-used
012 Please enter the Text Module name
013 Graphics/Logo name and Graphic ID cannot be blank for Graphics Where-used
014 Wild Card i.e. * not allowed. Please re-enter
015 No Smartform exists for the Selection Criteria
016 No Texts exist in Forms for the given criteria
017 No Logos exist in Forms for the given criteria
018 Blank line or Text not available in Selection screen or Logon Language


 

SCREEN: 

Create 2 Screens as Modal Dialog Box to Display Text details and Graphic preview

Screen 9000 – Modal Dialog Box

Layout

 

 

Screen 9001 – Modal Dialog Box

 

Layout


 

PF-STATUSES: 

PF Status PF_9000 for both screens


 

ZPFSTATUS_CONF

 

 

ZPFSTATUS_GRPH

 

 

ZPFSTATUS_STXT


 

SE24 Class:

Create a Class in SE24 ZCL_SF_TEXT_EDIT and declare Attributes as below: 

  data OBJ_TEXT_EDIT type ref to CL_GUI_TEXTEDIT .         

  data OBJ_CONTAINER type ref to CL_GUI_CUSTOM_CONTAINER .

 

Declare Methods of the class as below:

******************************
     CONSTRUCTOR 
******************************

ATTRIBUTES

Importing
PF_CONTAINER type C
PF_WRAP_40 type C default SPACE
PF_TEXT type C optional
PF_NO_TOOLBAR type C default SPACE
PF_NO_STATUSBAR type C default SPACE .

Method Code

* Custom Control Container
CREATE OBJECT obj_container
EXPORTING
container_name = pf_container
lifetime = cntl_lifetime_default.
DATA: lf_wordwrap_position TYPE i.
CASE pf_wrap_40.
WHEN '1'.
lf_wordwrap_position = 30.
WHEN '0'.
lf_wordwrap_position = 72.
WHEN 'L'.
lf_wordwrap_position = 132.
WHEN '4'.
lf_wordwrap_position = 40.
ENDCASE.
CREATE OBJECT obj_text_edit
EXPORTING
parent = obj_container
lifetime = cntl_lifetime_default
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = lf_wordwrap_position
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5.
* Text setzen
IF pf_text NE space.
CALL METHOD obj_text_edit->set_status_text
EXPORTING
status_text = pf_text
EXCEPTIONS
error_cntl_call_method = 1.
ENDIF.
* Toolbar
IF pf_no_toolbar NE space.
CALL METHOD obj_text_edit->set_toolbar_mode
EXPORTING
toolbar_mode = 0.
ELSE.
CALL METHOD obj_text_edit->set_toolbar_mode
EXPORTING
toolbar_mode = 1.
ENDIF.
* Statusbar
IF pf_no_statusbar NE space.
CALL METHOD obj_text_edit->set_statusbar_mode
EXPORTING
statusbar_mode = 0.
ELSE.
CALL METHOD obj_text_edit->set_statusbar_mode
EXPORTING
statusbar_mode = 1.
ENDIF.

 

******************************
         SET_TEXT 
******************************

ATTRIBUTES

Importing
PT_TEXT type TABLE
PF_TOP type C default 'X' .

Method Code
CALL METHOD obj_text_edit->set_text_as_r3table
EXPORTING
table = pt_text
EXCEPTIONS
error_dp = 1
error_dp_create = 2.
IF pf_top EQ abap_true.
CALL METHOD obj_text_edit->set_first_visible_line.
ENDIF.

 

 

******************************
         GET_TEXT 
******************************

ATTRIBUTES

Exporting
PT_TEXT type TABLE.


Method Code

    CLEAR pt_text.
    CALL METHOD obj_text_edit→get_text_as_r3table
     EXPORTING
       only_when_modified     = obj_text_edit→false
     IMPORTING
       table                  = pt_text
     EXCEPTIONS

        error_dp               = 1

        error_cntl_call_method = 2

        error_dp_create        = 3

        potential_data_loss    = 4.

 

******************************
    SET_READ_ONLY      
******************************

ATTRIBUTES
Importing
PF_FLAG type C .

 

Method Code

    DATA: lf_flag TYPE i.

    IF pf_flag EQ space.

      lf_flag = 0.

    ELSE.

      lf_flag = 1.

    ENDIF.

    CALL METHOD obj_text_edit->set_readonly_mode

      EXPORTING

 

        readonly_mode = lf_flag.

 

******************************
    DELETE_OBJ      
******************************

No ATTRIBUTES



Method Code

  IF NOT obj_text_edit IS INITIAL.

    CALL METHOD obj_text_edit->delete_text

                EXCEPTIONS

                error_cntl_call_method = 1.

    IF sy-subrc NE 0.

*

    ELSE.

*

    ENDIF.

    CALL METHOD obj_text_edit->free

        EXCEPTIONS cntl_error        = 1

                   cntl_system_error = 2.

    IF sy-subrc NE 0.

*

    ELSE.

*

    ENDIF.

  ENDIF.

  IF NOT obj_container IS INITIAL.

    CALL METHOD obj_container->free

            EXCEPTIONS cntl_error        = 1

                       cntl_system_error = 2.

 

    IF sy-subrc NE 0.

*

    ELSE.

*

    ENDIF.

  ENDIF.

  CALL METHOD cl_gui_cfw=>flush

             EXCEPTIONS cntl_system_error = 1

                        cntl_error = 2.

  CLEAR: obj_container, obj_text_edit.

  FREE: obj_container, obj_text_edit.

 

******************************
    SET_WORDWRAP     
******************************

ATTRIBUTES
importing
PF_WRAP_40 type C

exceptions
NO_INSTANCE .

 

Method Code

    DATA: lf_wordwrap_position TYPE i.

    IF NOT obj_text_edit IS INITIAL.

      CASE pf_wrap_40.

        WHEN '1'.

          lf_wordwrap_position = 30.

        WHEN '0'.

          lf_wordwrap_position = 72.

        WHEN 'L'.

          lf_wordwrap_position = 132.

        WHEN '4'.

          lf_wordwrap_position = 40.

        WHEN '6'.

          lf_wordwrap_position = 60.

      ENDCASE.

      CALL METHOD obj_text_edit->set_wordwrap_behavior

        EXPORTING

*         wordwrap_mode     = wordwrap_mode

          wordwrap_position = lf_wordwrap_position.

*      wordwrap_to_linebreak_mode = wordwrap_to_linebreak_mode.

    ELSE.

      RAISE no_instance.

 

    ENDIF.

 

******************************
       DELETE_TEXT     
******************************

NO ATTRIBUTES

 

 

Method Code

 

    CALL METHOD obj_text_edit->delete_text

      EXCEPTIONS

 

        error_cntl_call_method = 1.

 

 

 

ATTRIBUTES
ImportingPT_TEXT type TABLEPF_TOP type C default 'X' .
Method Code    CALL METHOD obj_text_edit->set_text_as_r3table      EXPORTING        table           = pt_text      EXCEPTIONS        error_dp        = 1        error_dp_create = 2.    IF pf_top EQ abap_true.      CALL METHOD obj_text_edit->set_first_visible_line.    ENDIF.

 

  • No labels