Skip to Content

Display information in HTML ALV view.

Input: –

Output: –

Based on the given table in input screen, The output will get displayed in the HTML format as shown in the above diagram.

On selection of a particular column, it will get highlighted and one can sort the data either in ascending order or descending order from the available tool button from the toolbar.

Based on the data provided, on selection of a particular cell it will display a pop-up message containing the details of the selected cell.

Code: –

Program Name: – ZPRV_HTML_ALV

REPORT  ZPRV_HTML_ALV.
TABLES: DD02L, ABAP.
**********GET THE COLOR CODE FROM THE “http://html-color-codes.info/” WEBSITE

TYPESC_HTML(150)   TYPE C,
         BEGIN OF      S_HEAD,
           HEAD        TYPE CHAR50,
           WIDTH       TYPE I,
           EVEN        TYPE C,
           COLR        TYPE STRING,
           TECL        TYPE FIELDNAME,
         END OF        S_HEAD,
         TYP_HEAD      TYPE STANDARD TABLE OF S_HEAD,

         BEGIN OF      S_DD02L,
           TABNAME     TYPE TABNAME,
           DDTEXT      TYPE AS4TEXT,
         END OF        S_DD02L,
         TYP_TAB       TYPE STANDARD TABLE OF S_DD02L,

         TYP_DFIES     TYPE STANDARD TABLE OF DFIES.

DATA:   GIT_HTML      TYPE STANDARD TABLE OF C_HTML,
         GIT_INFO      TYPE STANDARD TABLE OF C_HTML,
         GFL_HTML      LIKE LINE OF GIT_HTML,

         GIT_HEAD      TYPE STANDARD TABLE OF S_HEAD,
         GFL_HEAD      TYPE S_HEAD,

         GIT_EVENT     TYPE CNTL_SIMPLE_EVENTS,
         GFL_EVENT     TYPE CNTL_SIMPLE_EVENT,

         GFL_DD02L     TYPE S_DD02L,

         G_RECS        TYPE I,
         G_HTML        TYPE C_HTML,
         G_URL(255)    TYPE C,

         G_UCOMM       TYPE SYUCOMM,
         G_SELCOL      TYPE STRING,

         G_FLD         TYPE FIELDNAME,
         G_WIDTH       TYPE I,

         GIT_FLD       TYPE ABAP_COMPDESCR_TAB,
         GIT_FLD1      TYPE STANDARD TABLE OF DFIES,
         GFL_FLD1      TYPE DFIES.

TYPESTYP_HTML      TYPE STANDARD TABLE OF C_HTML.
DATA:   CL_HVIEW      TYPE REF TO CL_GUI_HTML_VIEWER.

FIELD-SYMBOLS: <GIT>  TYPE STANDARD TABLE,
                <GFL>  TYPE ANY,
                <VAL>  TYPE ANY.

INCLUDE ZPRV_HTML_CLASS.
DATA:   CL_HTML       TYPE REF TO CL_HTML.

RANGES: R_TABCL       FOR DD02LTABCLASS.

DATA:   G_TAB         TYPE TABNAME,
         D_TAB         TYPE REF TO DATA.

INITIALIZATION.
   REFRESH: R_TABCL.
   R_TABCLLOW = ‘TRANSP’. R_TABCLSIGN = ‘I’.R_TABCLOPTION = ‘EQ’.APPEND R_TABCL.
   R_TABCLLOW = ‘POOL’.   R_TABCLSIGN = ‘I’.R_TABCLOPTION = ‘EQ’.APPEND R_TABCL.
   R_TABCLLOW = ‘CLUSTER’.R_TABCLSIGN = ‘I’.R_TABCLOPTION = ‘EQ’.APPEND R_TABCL.

SELECTION-SCREEN:   BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT001.

   PARAMETER:        P_TAB   TYPE TABNAME16 OBLIGATORY,
                     P_REC   TYPE I OBLIGATORY.

SELECTION-SCREEN:   END OF BLOCK B1.

START-OF-SELECTION.
SELECT SINGLE T~TABNAME X~DDTEXT  FROM DD02L AS T
                                   INNER JOIN DD02T AS X ON T~TABNAME EQ X~TABNAME
                                   INTO GFL_DD02L WHERE T~TABNAME EQ P_TAB
                                   AND T~TABCLASS IN R_TABCL
                                   AND X~DDLANGUAGE EQ SYLANGU.
IF SYSUBRC NE 0.
   MESSAGE ‘Not a valid Table’ TYPE ‘I’.
   EXIT.
ENDIF.
IF D_TAB IS NOT INITIAL.
   FREE D_TAB.
ENDIF.
IF <GIT> IS ASSIGNED.
   UNASSIGN <GIT>.
ENDIF.

CREATE DATA D_TAB TYPE STANDARD TABLE OF (P_TAB).
ASSIGN D_TAB->* TO <GIT>.
CREATE DATA D_TAB LIKE LINE OF <GIT>.
ASSIGN D_TAB->* TO <GFL>.
IF CL_HTML IS INITIAL.
   CREATE OBJECT CL_HTML.
ENDIF.

CALL METHOD CL_HTML->M_GET_TAB_FLDS1 EXPORTING C_TAB     = P_TAB
                                      IMPORTING CIT_FLD   = GIT_FLD1.

G_HTML = .
CALL METHOD CL_HTML->M_HTML_HEAD      EXPORTING C_HEAD      = G_HTML
                                       CHANGING  CIT_HTML    = GIT_HTML.

REFRESH: GIT_INFO.
GFL_HTML = GFL_DD02LDDTEXT.
APPEND GFL_HTML TO GIT_INFO.
CALL METHOD CL_HTML->M_GET_WIDTH      EXPORTING CIT_FLD     = GIT_FLD1
                                       IMPORTING C_WIDTH     = G_WIDTH.

CALL METHOD CL_HTML->M_HEADING_BOX    EXPORTING CIT_INFO    = GIT_INFO
                                                 C_HEIGHT    = 50
                                                 C_WIDTH     = G_WIDTH
                                                 C_BORDER    = 2
                                                 C_COLOR     = ‘#67F152’
                                       CHANGING  CIT_HTML    = GIT_HTML.

SELECT * FROM (P_TAB) INTO TABLE <GIT> UP TO P_REC ROWS.
DESCRIBE TABLE <GIT> LINES G_RECS.
IF G_RECS EQ 0.
   EXIT.
ENDIF.
CALL METHOD CL_HTML->M_CREATE_HEADING EXPORTING CIT_FLD     = GIT_FLD1.
CALL METHOD CL_HTML->M_CREATE_HEADS   EXPORTING CIT_FLD     = GIT_HEAD
                                                 C_COLOR     = ‘#F8E0F7’
                                       CHANGING  CIT_HTML    = GIT_HTML.

CALL METHOD CL_HTML->M_UPLOAD_INFO    EXPORTING CIT_TAB     = <GIT>
                                                 C_SELCOL    = G_SELCOL
                                                 CIT_FLD     = GIT_FLD1
                                       CHANGING  CIT_HTML    = GIT_HTML.

CALL SCREEN 9000.
*&———————————————————————*
*&      Module  STATUS_9000  OUTPUT
*&———————————————————————*
*       text
*———————————————————————-*
module STATUS_9000 output.
   SET PF-STATUS ‘HTML9000’.
   SET TITLEBAR ‘HTML9000’.

   IF CL_HVIEW IS INITIAL.
     CREATE OBJECT CL_HVIEW EXPORTING PARENT = CL_GUI_CONTAINER=>DEFAULT_SCREEN.
   ENDIF.

   DESCRIBE TABLE GIT_EVENT LINES G_RECS.
   IF G_RECS EQ 0.
     CLEAR: GFL_EVENT.
     GFL_EVENTEVENTID     = CL_HVIEW->M_ID_SAPEVENT.
     GFL_EVENTAPPL_EVENT  = ‘X’.
     APPEND GFL_EVENT TO GIT_EVENT.
   ENDIF.

   CALL METHOD CL_HVIEW->SET_REGISTERED_EVENTS EXPORTING EVENTS  = GIT_EVENT.
   SET HANDLER CL_HTML->M_SAPEVENT FOR CL_HVIEW.

   CALL METHOD CL_HVIEW->LOAD_DATA
        EXPORTING  TYPE            = ‘TEXT’
                   SUBTYPE         = ‘HTML’
                   LANGUAGE        = SYLANGU
        IMPORTING  ASSIGNED_URL    = G_URL
        CHANGING   DATA_TABLE      = GIT_HTML.

   CALL METHOD CL_HVIEW->SHOW_DATA EXPORTING URL  = G_URL.
endmodule.                 ” STATUS_9000  OUTPUT
*&———————————————————————*
*&      Module  USER_COMMAND_9000  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
module USER_COMMAND_9000 input.

   CASE G_UCOMM.
     WHEN ‘BACK’.
       LEAVE TO SCREEN 0.
     WHEN ‘EXIT’.
       LEAVE PROGRAM.
     WHEN ‘DOWN’.
     WHEN ‘ASEC’.
       IF G_SELCOL EQ SPACE.
         MESSAGE ‘Select a Column for Acsending’ TYPE ‘I’.
         EXIT.
       ENDIF.
       G_FLD = G_SELCOL.
       SORT <GIT> BY (G_FLD) ASCENDING.
       CALL METHOD CL_HTML->M_RELOAD_WITH_CLR EXPORTING C_SELCOL = SPACE
                                                        C_COLOR  = SPACE.
       CLEAR: G_SELCOL.
     WHEN ‘DESC’.
       IF G_SELCOL EQ SPACE.
         MESSAGE ‘Select a Column for Decsending’ TYPE ‘I’.
         EXIT.
       ENDIF.
       G_FLD = G_SELCOL.
       SORT <GIT> BY (G_FLD) DESCENDING.
       CALL METHOD CL_HTML->M_RELOAD_WITH_CLR EXPORTING C_SELCOL = SPACE
                                                        C_COLOR  = SPACE.
       CLEAR: G_SELCOL.
   ENDCASE.

endmodule.                 ” USER_COMMAND_9000  INPUT

——————————————-

Include Name: –  ZPRV_HTML_CLASS

*&———————————————————————*
*&  Include           ZPRV_HTML_CLASS
*&———————————————————————*

CLASS CL_HTML DEFINITION.

   PUBLIC SECTION.

   METHODS:    M_HTML_HEAD         IMPORTING   C_HEAD    TYPE C_HTML
                                   CHANGING    CIT_HTML  TYPE TYP_HTML.

   DATA:       P_HEIGHT            TYPE STRING,
               P_WIDTH             TYPE STRING,
               C_WIDTH             TYPE I,
               P_BORDER            TYPE STRING,
               P_COLOR             TYPE STRING,
               P_VALUE             TYPE STRING,
               P_FRAME             TYPE STRING,
               P_FRM               TYPE CNHT_URL_PREFIX,
               P_MATNR             TYPE MATNR,
               CFL_DD              TYPE DD04V,
               C_STR               TYPE CHAR2,
               C_SELCOL            TYPE STRING,
               C_SELCLR            TYPE STRING VALUE ‘#F4FA58’,
               P_DOMAIN            TYPE DDOBJNAME,
               P_LEN               TYPE I,
               P_FLDS              TYPE STRING.

   METHODS:    M_HEADING_BOX       IMPORTING   CIT_INFO  TYPE TYP_HTML
                                               C_HEIGHT  TYPE I
                                               C_WIDTH   TYPE I
                                               C_BORDER  TYPE I
                                               C_COLOR   TYPE STRING
                                   CHANGING    CIT_HTML  TYPE TYP_HTML.

   METHODS:    M_UPLOAD_FLD        IMPORTING   VALUE     TYPE STRING
                                               C_WIDTH   TYPE I
                                               C_EVEN    TYPE C
                                               C_COLOR   TYPE STRING
                                               C_TECL    TYPE FIELDNAME
                                               C_FLDS    TYPE STRING
                                   CHANGING    CIT_FLD   TYPE TYP_HEAD.

   METHODS:    M_CREATE_HEADING    IMPORTING   CIT_FLD   TYPE TYP_DFIES.

   METHODS:    M_UPLOAD_INFO       IMPORTING   CIT_TAB   TYPE STANDARD TABLE
                                               C_SELCOL  TYPE STRING
                                               CIT_FLD   TYPE TYP_DFIES
                                   CHANGING    CIT_HTML  TYPE TYP_HTML.

   METHODS:    M_CREATE_TABLE      IMPORTING   CIT_FLD   TYPE TYP_HEAD
                                               C_COLOR   TYPE STRING
                                               C_BORDER  TYPE I
                                               C_FRAME   TYPE STRING
                                               C_EVEN    TYPE C
                                               C_ATAB    TYPE C
                                   CHANGING    CIT_HTML  TYPE TYP_HTML.

   DATA:       C_RECS              TYPE I,
               C_REM               TYPE I.
   METHODS:    M_CREATE_HEADS      IMPORTING   CIT_FLD   TYPE TYP_HEAD
                                               C_COLOR   TYPE STRING
                                   CHANGING    CIT_HTML  TYPE TYP_HTML.

   METHODS:    M_TABLE_CELL        IMPORTING   C_VALUE   TYPE STRING
                                               C_COLOR   TYPE STRING
                                               C_WIDTH   TYPE I
                                               C_EVEN    TYPE C
                                               C_ATAB    TYPE C
                                   CHANGING    CIT_HTML  TYPE TYP_HTML.

   METHODS:   M_CLOSE_HTML         CHANGING    CIT_HTML  TYPE TYP_HTML.

   METHODS:   M_SAPEVENT           FOR EVENT   SAPEVENT OF CL_GUI_HTML_VIEWER
                                   IMPORTING   ACTION FRAME GETDATA POSTDATA QUERY_TABLE.

   METHODS:   M_RELOAD_WITH_CLR    IMPORTING   C_COLOR   TYPE STRING
                                               C_SELCOL  TYPE STRING.

   DATA:      CL_FLD               TYPE REF TO CL_ABAP_STRUCTDESCR.
   METHODS:   M_GET_TAB_FLDS       IMPORTING   C_TAB     TYPE TABNAME16
                                   EXPORTING   CIT_FLD   TYPE ABAP_COMPDESCR_TAB.

   METHODS:    M_GET_TAB_FLDS1     IMPORTING   C_TAB     TYPE TABNAME16
                                   EXPORTING   CIT_FLD   TYPE TYP_DFIES.

   METHODS:    M_GET_WIDTH         IMPORTING   CIT_FLD   TYPE TYP_DFIES
                                   EXPORTING   C_WIDTH   TYPE I.

   PROTECTED SECTION.

   PRIVATE SECTION.

ENDCLASS.

CLASS CL_HTML IMPLEMENTATION.

   METHOD:     M_HTML_HEAD.
     APPEND C_HEAD TO CIT_HTML.
     CLEAR: GFL_HTML.
     GFL_HTML = ‘<HTML>’.
     APPEND GFL_HTML TO CIT_HTML.
     CLEAR: GFL_HTML.
     GFL_HTML = ‘<BODY>’.
     APPEND GFL_HTML TO CIT_HTML.
   ENDMETHOD.

   METHOD:   M_HEADING_BOX.
     P_HEIGHT  = C_HEIGHT.
     P_BORDER  = C_BORDER.
     P_WIDTH   = C_WIDTH.
     P_COLOR   = C_COLOR.
     CONDENSE: P_HEIGHT NOGAPS, P_BORDER NOGAPS, P_WIDTH NOGAPS.
     CLEAR: GFL_HTML.
     CONCATENATE ‘<div style=”height:’ P_HEIGHT  ‘px;width:’ P_WIDTH ‘px;border:’ P_BORDER
     ‘px solid #ccc;font:26px/26px Georgia, Garamond, Serif;overflow:auto;background-color:’ P_COLOR ‘;”>’ INTO GFL_HTML.
     APPEND GFL_HTML TO CIT_HTML.

     LOOP AT CIT_INFO INTO GFL_HTML.
       APPEND GFL_HTML TO CIT_HTML.
     ENDLOOP.

     GFL_HTML = ‘</DIV>’.
     APPEND GFL_HTML TO CIT_HTML.

   ENDMETHOD.

   METHOD:   M_UPLOAD_FLD.
     P_LEN           = STRLEN( C_FLDS ).
     IF P_LEN EQ 5.
       P_LEN = P_LEN + 3.
     ENDIF.
     IF P_LEN GT C_WIDTH.
       GFL_HEADWIDTH  = P_LEN * 10.
     ELSE.
       GFL_HEADWIDTH  = C_WIDTH * 10.
     ENDIF.
     GFL_HEADEVEN   = C_EVEN.
     GFL_HEADHEAD   = VALUE.
     GFL_HEADCOLR   = C_COLOR.
     GFL_HEADTECL   = C_TECL.
     APPEND GFL_HEAD  TO CIT_FLD.

   ENDMETHOD.

   METHOD:   M_CREATE_HEADING.
     REFRESH: GIT_HEAD.
     DESCRIBE TABLE CIT_FLD LINES C_RECS.
     IF C_RECS EQ 0.
       EXIT.
     ENDIF.
     LOOP AT CIT_FLD INTO GFL_FLD1 WHERE FIELDNAME NE ‘MANDT’.
       P_VALUE     = GFL_FLD1SCRTEXT_L.
       P_DOMAIN    = GFL_FLD1DOMNAME.
       C_WIDTH     = GFL_FLD1HEADLEN.
       IF C_WIDTH EQ 2.
         C_WIDTH = 5.
       ENDIF.
       P_FLDS = GFL_FLD1SCRTEXT_L.
       CALL METHOD M_UPLOAD_FLD  EXPORTING VALUE     = P_VALUE
                                           C_WIDTH   = C_WIDTH
                                           C_EVEN    = SPACE
                                           C_COLOR   = SPACE
                                           C_TECL    = GFL_FLD1FIELDNAME
                                           C_FLDS    = P_FLDS
                                 CHANGING  CIT_FLD   = GIT_HEAD.
     ENDLOOP.
   ENDMETHOD.

   METHOD:   M_UPLOAD_INFO.
     DESCRIBE TABLE CIT_TAB LINES G_RECS.
     IF G_RECS EQ 0.
       EXIT.
     ENDIF.
     LOOP AT CIT_TAB ASSIGNING <GFL>.
       REFRESH: GIT_HEAD.
       LOOP AT CIT_FLD INTO GFL_FLD1 WHERE FIELDNAME NE ‘MANDT’.
         ASSIGN COMPONENT GFL_FLD1FIELDNAME OF STRUCTURE <GFL> TO <VAL>.
         P_VALUE = <VAL>.
         P_FRAME = P_VALUE.
         IF C_SELCOL EQ GFL_FLD1FIELDNAME.
           P_COLOR = C_SELCLR.
         ELSE.
           P_COLOR = ‘#F8E0F7’.
         ENDIF.
         C_WIDTH = GFL_FLD1HEADLEN.
         IF C_WIDTH EQ 2.
           C_WIDTH = 5.
         ENDIF.
         P_FLDS = GFL_FLD1SCRTEXT_L.
         CALL METHOD M_UPLOAD_FLD      EXPORTING VALUE     = P_VALUE
                                                 C_WIDTH   = C_WIDTH
                                                 C_EVEN    = ‘X’
                                                 C_COLOR   = P_COLOR
                                                 C_TECL    = GFL_FLD1FIELDNAME
                                                 C_FLDS    = P_FLDS
                                       CHANGING  CIT_FLD   = GIT_HEAD.
       ENDLOOP.
       CALL METHOD M_CREATE_TABLE    EXPORTING CIT_FLD   = GIT_HEAD
                                               C_COLOR   = ‘#F6E3CE’
                                               C_BORDER  = 2
                                               C_FRAME   = P_FRAME
                                               C_EVEN    = ‘X’
                                               C_ATAB    = SPACE
                                     CHANGING  CIT_HTML  = GIT_HTML.
     ENDLOOP.

   ENDMETHOD.

   METHOD:   M_CREATE_TABLE.
     DESCRIBE TABLE CIT_FLD LINES G_RECS.
     IF G_RECS EQ 0.
       EXIT.
     ENDIF.
     CLEAR: GFL_HTML.
     P_BORDER  = C_BORDER.
     P_FRAME   = C_FRAME.
     P_COLOR   = C_COLOR.
     CONDENSE: P_BORDER NOGAPS, P_FRAME NOGAPS, P_COLOR NOGAPS.
     CONCATENATE ‘<TABLE BORDER =”‘ P_BORDER ‘” FRAME=”‘ P_FRAME ‘”>’ INTO GFL_HTML.
     APPEND GFL_HTML TO CIT_HTML.
     READ TABLE CIT_FLD INTO GFL_HEAD INDEX 1.
     IF SYSUBRC EQ 0.
       IF GFL_HEADEVEN = ‘X’.
         CONCATENATE ‘<FORM method=post action=SAPEVENT:PRESS_ME?’ GFL_HEADHEAD ‘>’ INTO GFL_HTML.
         APPEND GFL_HTML TO CIT_HTML.
       ENDIF.
     ENDIF.
     GFL_HTML = ‘<TR>’.
     APPEND GFL_HTML TO CIT_HTML.

     LOOP AT CIT_FLD INTO GFL_HEAD.
       P_VALUE = GFL_HEADHEAD.
       G_RECS  = GFL_HEADWIDTH.
       IF P_VALUE EQ SPACE.
         P_VALUE = ‘.’.
       ENDIF.
       CALL METHOD M_TABLE_CELL EXPORTING  C_VALUE   = P_VALUE
                                           C_COLOR   = C_COLOR
                                           C_WIDTH   = G_RECS
                                           C_EVEN    = GFL_HEADEVEN
                                           C_ATAB    = C_ATAB
                                CHANGING   CIT_HTML  = CIT_HTML.
     ENDLOOP.

     GFL_HTML = ‘</TR>’.
     APPEND GFL_HTML TO CIT_HTML.
     READ TABLE CIT_FLD INTO GFL_HEAD INDEX 1.
     IF SYSUBRC EQ 0.
       IF GFL_HEADEVEN = ‘X’.
         GFL_HTML = ‘</FORM>’.
         APPEND GFL_HTML TO CIT_HTML.
       ENDIF.
     ENDIF.
     GFL_HTML = ‘</TABLE>’.
     APPEND GFL_HTML TO CIT_HTML.

   ENDMETHOD.

   METHOD:   M_TABLE_CELL.
         CLEAR: GFL_HTML.
         P_COLOR   = C_COLOR.
         IF GFL_HEADCOLR NE SPACE.
           P_COLOR = GFL_HEADCOLR.
         ENDIF.
         P_WIDTH   = C_WIDTH.
         CONDENSE P_COLOR NOGAPS.
         IF C_EVEN EQ ‘X’.
*          CONCATENATE ‘<TD STYLE=”width:’ P_WIDTH ‘px;”><FORM METHOD=GET ACTION=”SAPEVENT:CLICK_ON_ME?’ C_VALUE ‘”><INPUT TYPE=SUBMIT VALUE=”‘  “SUBMIT_FORM_AS_GET_METHOD
*          C_VALUE ‘”></TD>’ INTO GFL_HTML.
           CONCATENATE ‘<TD STYLE=”background-color:’ P_COLOR ‘;width:’ P_WIDTH ‘px;”><A HREF=SAPEVENT:CLICK_ON_ME?’ C_VALUE ‘>’ C_VALUE ‘</A></TD>’ INTO GFL_HTML.
         ELSE.
           CONCATENATE ‘<TD STYLE=”background-color:’ P_COLOR ‘;width:’ P_WIDTH ‘px;”>’ C_VALUE ‘</TD>’ INTO GFL_HTML.
         ENDIF.
         APPEND GFL_HTML TO CIT_HTML.
   ENDMETHOD.

   METHOD:   M_CLOSE_HTML.
     CLEAR: GFL_HTML.
     GFL_HTML = ‘</BODY>’.
     APPEND GFL_HTML TO CIT_HTML.
     CLEAR: GFL_HTML.
     GFL_HTML = ‘</HTML>’.
     APPEND GFL_HTML TO CIT_HTML.
   ENDMETHOD.

   METHOD:   M_SAPEVENT.
     C_STR GETDATA.
     IF C_STR EQ ‘H_’.
       C_RECS = STRLEN( GETDATA ).
       C_RECS = C_RECS 2.
       C_SELCOL = GETDATA+2(C_RECS).
       G_SELCOL = C_SELCOL.
       TRANSLATE C_SELCOL TO  UPPER CASE.
       CALL METHOD M_RELOAD_WITH_CLR EXPORTING C_SELCOL = C_SELCOL
                                               C_COLOR  = C_SELCLR.
     ELSE.
       CLEAR: GFL_HTML.
       CONCATENATE ‘Selected Value is: ‘ GETDATA INTO GFL_HTML SEPARATED BY SPACE.
       MESSAGE GFL_HTML TYPE ‘I’.
     ENDIF.
   ENDMETHOD.

   METHOD:   M_CREATE_HEADS.

     DESCRIBE TABLE CIT_FLD LINES G_RECS.
     IF G_RECS EQ 0.
       EXIT.
     ENDIF.
     CLEAR: C_RECS.
     LOOP AT CIT_FLD INTO GFL_HEAD.
       C_RECS = C_RECS + GFL_HEADWIDTH.
     ENDLOOP.
     P_WIDTH = C_RECS.
     P_COLOR = C_COLOR.
     CONDENSE: P_WIDTH NOGAPS, P_COLOR NOGAPS.
     CONCATENATE ‘<TABLE BORDER=”1″ WIDTH=”‘ P_WIDTH ‘”>’ INTO GFL_HTML.
     APPEND GFL_HTML TO CIT_HTML.
     GFL_HTML = ‘<TR>’.
     APPEND GFL_HTML TO CIT_HTML.

     LOOP AT CIT_FLD INTO GFL_HEAD.
       P_WIDTH = GFL_HEADWIDTH.
       CONDENSE P_WIDTH NOGAPS.
       CONCATENATE ‘<TD STYLE=”background-color:’ P_COLOR ‘”WIDTH=’ P_WIDTH ‘>’ INTO GFL_HTML.
       APPEND GFL_HTML TO CIT_HTML.
       CONCATENATE ‘<TABLE BORDER=”0″ WIDTH=”‘ P_WIDTH ‘”>’ INTO GFL_HTML.
       APPEND GFL_HTML TO CIT_HTML.
       CONCATENATE ‘<FORM method=post action=SAPEVENT:PRESS_ME?H_’ GFL_HEADTECL ‘>’ INTO GFL_HTML.
       APPEND GFL_HTML TO CIT_HTML.
       GFL_HTML = ‘<TR>’.
       APPEND GFL_HTML TO CIT_HTML.
       CONCATENATE ‘<TD><INPUT TYPE=SUBMIT ALIGN = “CENTER” VALUE=”‘ GFL_HEADHEAD ‘”STYLE=”BACKGROUND-COLOR:’ P_COLOR ‘; COLOR:’ P_COLOR ‘,”WIDTH = “‘ P_WIDTH ‘”>’ INTO GFL_HTML.
       APPEND GFL_HTML TO CIT_HTML.
       GFL_HTML = ‘</TD>’.
       APPEND GFL_HTML TO CIT_HTML.
       GFL_HTML = ‘</TR>’.
       APPEND GFL_HTML TO CIT_HTML.
       GFL_HTML = ‘</FORM>’.
       APPEND GFL_HTML TO CIT_HTML.
       GFL_HTML = ‘</TABLE>’.
       APPEND GFL_HTML TO CIT_HTML.
       GFL_HTML = ‘</TD>’.
       APPEND GFL_HTML TO CIT_HTML.
     ENDLOOP.

     GFL_HTML = ‘</TR>’.
     APPEND GFL_HTML TO CIT_HTML.
     GFL_HTML = ‘</TABLE>’.
     APPEND GFL_HTML TO CIT_HTML.
   ENDMETHOD.

   METHOD:   M_RELOAD_WITH_CLR.
     REFRESH: GIT_HTML.
     G_HTML = .
     CALL METHOD M_HTML_HEAD      EXPORTING C_HEAD      = G_HTML
                                  CHANGING  CIT_HTML    = GIT_HTML.

     REFRESH: GIT_INFO.
     GFL_HTML = ‘Material Desciption information’.
     APPEND GFL_HTML TO GIT_INFO.

     CALL METHOD M_HEADING_BOX    EXPORTING CIT_INFO    = GIT_INFO
                                            C_HEIGHT    = 50
                                            C_WIDTH     = 1300
                                            C_BORDER    = 2
                                            C_COLOR     = ‘#67F152’
                                  CHANGING  CIT_HTML    = GIT_HTML.
     CALL METHOD M_CREATE_HEADING EXPORTING CIT_FLD     GIT_FLD1.
     CALL METHOD M_CREATE_HEADS   EXPORTING CIT_FLD     = GIT_HEAD
                                            C_COLOR     = ‘#F8E0F7’
                                  CHANGING  CIT_HTML    = GIT_HTML.

     CALL METHOD M_UPLOAD_INFO    EXPORTING CIT_TAB     = <GIT>
                                            C_SELCOL    = C_SELCOL
                                            CIT_FLD     = GIT_FLD1
                                  CHANGING  CIT_HTML    = GIT_HTML.
   ENDMETHOD.

   METHOD:   M_GET_TAB_FLDS.
     CL_FLD ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( C_TAB ).
     CIT_FLD = CL_FLD->COMPONENTS[].
   ENDMETHOD.

   METHOD:   M_GET_TAB_FLDS1.
     DATA: TABNAME TYPE DDOBJNAME.
     TABNAME = C_TAB.
     CALL FUNCTION ‘DDIF_FIELDINFO_GET’
       EXPORTING
         tabname              = TABNAME
         LANGU                = SYLANGU
      TABLES
        DFIES_TAB            = CIT_FLD
      EXCEPTIONS
        NOT_FOUND            = 1
        INTERNAL_ERROR       = 2
        OTHERS               = 3.
     IF sysubrc <> 0.

     ENDIF.

   ENDMETHOD.

   METHOD:   M_GET_WIDTH.
     LOOP AT CIT_FLD INTO GFL_FLD1.
       C_WIDTH = C_WIDTH + ( GFL_FLD1OUTPUTLEN * 10 ).
     ENDLOOP.

   ENDMETHOD.

ENDCLASS.

Screen Logic:  – 9000.

Thanks & Regards.

Praveer Kumar Sen.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply