Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

How to get input values ?

$
0
0

hi,

 

     how to Get My Input Values (in this First name and Last name)

 

 

REPORT  ZKKK_DISABLE_COPY_PASTE.

   DATA : gr_html TYPE REF TO cl_gui_html_viewer,

          gr_cont TYPE REF TO cl_gui_custom_container.

DATA: lv_url TYPE char255.

DATA: html TYPE ZCHAR6000_T.

DATA: LV_HTML TYPE string.

 

DATA: lf_html TYPE string.

PARAMETERS : p_text TYPE string.

 

 

DATA: html_control TYPE REF TO cl_gui_html_viewer,

       my_container TYPE REF TO cl_gui_custom_container,

       prog_repid LIKE sy-repid,                             "#EC NEEDED

       edurl(2048),

       edframe(255),

       edaction(256),

       edgetdata(2048),

       edpostdataline(1024),

       ok_code LIKE sy-ucomm,

       myevent_tab TYPE cntl_simple_events,

       myevent TYPE cntl_simple_event,

       postdata_tab TYPE cnht_post_data_tab,

       edquery_table TYPE cnht_query_table.                  "#EC NEEDED

 

 

*DATA: evt_receiver TYPE REF TO cl_myevent_handler.

    CALL SCREEN 0100.

 

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

*& Module STATUS_0100 OUTPUT

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

* text

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

MODULE status_0100 OUTPUT.

   PERFORM HTML.

SET PF-STATUS 'HTML'.

SET TITLEBAR 'HTML_TITLE'." WITH gv_title.

 

 

CREATE OBJECT GR_CONT

   EXPORTING

*    PARENT                      = PARENT

     CONTAINER_NAME              = 'HTML_CONT'

*    STYLE                       = STYLE

*    LIFETIME                    = LIFETIME_DEFAULT

     REPID                       = SY-REPID

     DYNNR                       = SY-DYNNR

*    NO_AUTODEF_PROGID_DYNNR     = NO_AUTODEF_PROGID_DYNNR

   EXCEPTIONS

     CNTL_ERROR                  = 1

     CNTL_SYSTEM_ERROR           = 2

     CREATE_ERROR                = 3

     LIFETIME_ERROR              = 4

     LIFETIME_DYNPRO_DYNPRO_LINK = 5

     OTHERS                      = 6

     .

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

 

CREATE OBJECT gr_html

   EXPORTING

*    shellstyle         = shellstyle

     PARENT             = GR_CONT

*    lifetime           = '1'

*    saphtmlp           = 'X'

*    uiflag             = '6'

*    name               = name

*    saphttp            = saphttp

*    query_table_disabled = 'X'

   EXCEPTIONS

     cntl_error         = 1

     cntl_install_error = 2

     dp_install_error   = 3

     dp_error           = 4

     others             = 5

     .

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

 

* register event

     myevent-eventid = gr_html->m_id_sapevent.

     myevent-appl_event = 'x'.

     APPEND myevent TO myevent_tab.

     CALL METHOD gr_html->set_registered_events

         EXPORTING

            events = myevent_tab.

 

CALL METHOD gr_html->load_data(

*  EXPORTING

*    url                  = LV_URL

*    type                 = 'HTML'

*    subtype              = 'HTML'

*    size                 = 100

*    encoding             = encoding

*    charset              = charset

*    language             = 'E'

   IMPORTING

     ASSIGNED_URL         = LV_URL

   CHANGING

     DATA_TABLE           = HTML

   EXCEPTIONS

     dp_invalid_parameter = 1

     dp_error_general     = 2

     cntl_error           = 3

        ).

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

 

 

GR_HTML->SHOW_URL(

   EXPORTING

     URL                    = LV_URL

*    FRAME                  = FRAME

*    IN_PLACE               = ' X'

   EXCEPTIONS

     cntl_error             = 1

     cnht_error_not_allowed = 2

     cnht_error_parameter   = 3

     dp_error_general       = 4

        ).

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

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

*& Module USER_COMMAND_0100 INPUT

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

* text

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

MODULE user_command_0100 INPUT.

CASE sy-ucomm.

WHEN 'EXIT' OR 'CANCEL' or 'BACK'.

LEAVE TO SCREEN 0.

WHEN 'PRINT'.

  call method GR_HTML->execwb(

   EXPORTING

     cmd_id     = GR_HTML->WB_CMDID_PRINT

*    cmd_opt    = '2'

*    result     = result

   EXCEPTIONS

     cntl_error = 1

        ).

IF sy-subrc <> 0.

*      message e003(cnht) raising html_print_error.

ENDIF.

 

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

form HTML .

CONCATENATE

'<html>'

'<head>'

*'<style type="text/css">'

*'h1 {'

*'color:#EFAB00;'

*'font-family:tahoma,helvetica,sans-serif;'

*'font-size:160%;'

*'font-weight:bold;'

*'margin-bottom:0px;'

*'margin-top:0px;'

*'text-decoration:none;'

*'text-transform:uppercase;'

*'}'

*'h2 {'

*'color:#666666;'

*'font-family:tahoma,helvetica,sans-serif;'

*'font-size:140%;'

*'font-weight:normal;'

*'margin-bottom:15px;'

*'margin-top:10px;'

*'text-decoration:none;'

*'text-transform:uppercase;'

*'}'

*'h3, h4, h5, h6 {'

*'color:#44697D;'

*'font-family:verdana,helvetica,sans-serif;'

*'font-size:110%;'

*'font-weight:bold;'

*'margin-bottom:3px;'

*'text-decoration:none;'

*'}'

*'p {'

*'color:#333333;'

*'font-family:tahoma,helvetica,sans-serif;'

*'font-size:100%;'

*'margin-bottom:60px;'

*'margin-top:1px;'

*'}'

*'strong, b {'

*'font-family:tahoma,helvetica,sans-serif;'

*'font-weight:bold;'

*'}'

*'</style>'

'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />'

'<title>Disabling cut, copy, paste, right click and context menu using Javascript </title>'

'<script type="text/javascript"> '

'document.oncontextmenu=new Function("return false");'

'document.onselectstart=new Function ("return false"); '

'if (window.sidebar){'

'document.onmousedown=new Function("return false"); '

'document.onclick=new Function("return true") ; '

'document.oncut=new Function("return false"); '

'document.oncopy=new Function("return false"); '

'document.onpaste=new Function("return false"); }'

'</script>'

'</head>'

'<body bgcolor="#CBDCE9">'" style="font-family:arial;font-size:90%;overflow:hidden">'

'<p align="Center">' P_TEXT '</p>'

'<form>'

'First name: <input type="text" name="firstname"><br>'

'Last name: <input type="text" name="lastname">'

'</form>'

'</body>'

'</html>'

INTO lf_html SEPARATED BY space.

DATA subrc TYPE c VALUE 'X'.

DATA len TYPE i.

 

DATA line TYPE ZCHAR6000.

WHILE subrc = 'X'.

len = strlen( lf_html ).

IF len > 29900.

line = lf_html+0(29900).

APPEND line TO html.

SHIFT lf_html BY 29900 PLACES.

ELSE.

line = lf_html.

APPEND line TO html.

CLEAR subrc.

ENDIF.

CLEAR line.

ENDWHILE.

endform.                    " HTML

 

sample.JPG


Viewing all articles
Browse latest Browse all 8332

Trending Articles