Skip to Content
3
Dec 07, 2021 at 01:02 PM

incorrectly padded postdata with Java GUI

505 Views Last edit Dec 07, 2021 at 04:14 PM 3 rev

Followup to abapGit #4832 for Frank Krause (see comment)

Using abapGit most of the time with the Java GUI on Linux, I noticed that abapGit would occasionally abort commit depending on the length of the commit description. With the help of Marc Bernard and Sandra Rossi this was narrowed down to the GUI returning spurious data in the postdata value from a HTML control.

postdata.png

This does NOT happen with the Windows GUI and it seems to be version-dependent with the Java GUI version as well:

  • 7.50rev9.6 works
  • 7.50rev12 works
  • 7.70rev1 fails
  • 7.70rev4 fails

To reproduce outside of abapGit you may use the following code, courtesy of Sandra Rossi:

CLASS lcl_app DEFINITION.
  PUBLIC SECTION.
    METHODS at_selection_screen_output.
    METHODS at_selection_screen_exit.
    METHODS on_sapevent FOR EVENT sapevent OF cl_gui_html_viewer
          IMPORTING action frame getdata postdata query_table.
  PRIVATE SECTION.
    DATA o_html TYPE REF TO cl_gui_html_viewer.
ENDCLASS.

CLASS lcl_app IMPLEMENTATION.

  METHOD at_selection_screen_output.
    DATA: l_url  TYPE cndp_url,
          l_text TYPE string.

    IF o_html IS NOT BOUND.

      CONCATENATE '<html><head></head><body>'
      '<form id="form" method="POST" action="SAPEVENT:submit">'
      '<p>Text : <input name="text" type="text" length="50" value="'
      '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'
      '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'
      '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'
      '"></p>'
      '<p>Checkbox : <input name="checkbox" type="checkbox"></p><p><button type= "submit">ABAP call</button></p>'
      '</form>'
      '</body></html>'
      INTO l_text.

      o_html = new #( parent = cl_gui_container=>screen0 ).
      SET HANDLER on_sapevent FOR o_html.
      o_html->set_registered_events( events = value #( ( eventid = o_html->m_id_sapevent ) ) ).
      DATA(lt_text) = cl_bcs_convert=>string_to_soli( l_text ).
      o_html->load_data(
        EXPORTING type = 'text' subtype = 'html' size = strlen( l_text )
        IMPORTING assigned_url = l_url
        CHANGING  data_table = lt_text ).
      o_html->show_url( EXPORTING url = l_url ).
    ENDIF.
  ENDMETHOD.

  METHOD at_selection_screen_exit.
    IF o_html IS BOUND.
      o_html->free( ).
      FREE o_html.
    ENDIF.
  ENDMETHOD.

  METHOD on_sapevent.
    CONCATENATE LINES OF postdata INTO data(l_post_data) RESPECTING BLANKS.
    MESSAGE l_post_data TYPE 'I'.
  ENDMETHOD.

ENDCLASS.

PARAMETERS dummy.
DATA go_app TYPE REF TO lcl_app.

LOAD-OF-PROGRAM.
  CREATE OBJECT go_app.

AT SELECTION-SCREEN OUTPUT.
  go_app->at_selection_screen_output( ).

AT SELECTION-SCREEN ON EXIT-COMMAND.
  go_app->at_selection_screen_exit( ).

The issue depends on the length on the text: 2 lines show the spurious padding, while 3 are ok, for example.

So, question is: can anyone at SAP verify this? How do we get this fixed?

Attachments

postdata.png (36.0 kB)