ABAP convert Database char to lowercase

60 views Asked by At

I have the following problem:

I have the URL to a picture 'HTTP://WWW.ROLANDSCHWAIGER.AT/DURCHBLICK.JPG' saved in my database. I think you see the problem here: The URL is in uppercase. Now I want to display the picture in the SAP GUI, but for that, I have to convert it to lowercase.

I have the following code from a tutorial, but without the conversion:

*&---------------------------------------------------------------------*
*& Report ZDURCHBLICK_24035
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zdurchblick_24035.

TABLES: zproject_24035.

PARAMETERS pa_proj TYPE zproject_24035-projekt OBLIGATORY.

DATA gs_project TYPE zproject_24035.

*Controls
DATA: go_container TYPE REF TO cl_gui_custom_container.

DATA: go_picture TYPE REF TO cl_gui_picture.

START-OF-SELECTION.

WRITE: / 'Durchblick 3.0'.

SELECT SINGLE * FROM zproject_24035 INTO @gs_project WHERE projekt = 
@pa_proj.

WRITE gs_project.
IF sy-subrc = 0.
 WRITE 'Wert im System gefunden'.
ELSE.
 WRITE 'Kein Wert gefunden'.
ENDIF.

WRITE : /'Es wurden', sy-dbcnt, 'Werte gefunden'.

AT LINE-SELECTION.
  zproject_24035 = gs_project.
  CALL SCREEN 9100.
*&---------------------------------------------------------------------*
*& Module CREATE_CONROLS OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE create_conrols OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.

  IF go_container IS NOT BOUND.
    CREATE OBJECT go_container
      EXPORTING
        container_name = 'BILD'.

    CREATE OBJECT go_picture
      EXPORTING
        parent = go_container.

    CALL METHOD go_picture->load_picture_from_url
      EXPORTING
        url = gs_project-bild.
  ENDIF.

ENDMODULE.
2

There are 2 answers

0
Schesam On

1.Way: Integrated Functions to convert it after Executing the Report

2.Way: Use the Keyword LOWER CASE on your Parameter. This way your input will be transported like its entered instead of translated to upper case. Only works if you get it from the Parameters. If its from your SELECT, use Way 1.

Btw: Try not to use TABLES. In 95 % of the Cases its obsolete and not recommended to use. Use DATA instead. For the few cases where its needed, look up the F1 Help in ABAP :) There is also a very good documented german Version of it, judging from your Code which hints you're from Austria.

0
Xavier Salomone On

Check the data element of field BILD in table ZPROJECT_24035. Case handling is done through the domain of the data element in SE11->Domain->TEXT10->Definition Tab->output properties->Lowercase checkbox. for example:

  • Domain CHAR10: lowercase checkbox unchecked. Any value in this field is always converted to uppercase.
  • Domain TEXT10: lowercase checkbox checked. This field allows uppercase and/or lowercase characters.

There is no lowercase-only domain, if that is the case, before writing to the database it must be converted to lowercase, by code or through a conversion exit routine function (standard or z).