Skip to Content
avatar image
Former Member

Case issue in Database table

Hi All,

We have an issue of lowercase in database table and we want to convert that lowercase data to upper case. The code for doing this operation is as follows:

"

SELECT * FROM zehs_volumes INTO TABLE i_volumes_temp.

LOOP AT i_volumes_temp.

DELETE zehs_volumes FROM i_volumes_temp.

IF sy-subrc is INITIAL.

COMMIT WORK.

ELSE.

ROLLBACK WORK.

ENDIF.

TRANSLATE i_volumes_temp-zehs_business TO UPPER CASE.

MODIFY i_volumes_temp.

CLEAR i_volumes_temp.

ENDLOOP.

SORT i_volumes_temp BY SUBID ZEHS_BUSINESS ZEHS_SITE ZEHS_ROLE

ZST_DATE ZED_DATE.

DELETE ADJACENT DUPLICATES

FROM i_volumes_temp COMPARING SUBID ZEHS_BUSINESS ZEHS_SITE

ZEHS_ROLE ZST_DATE ZED_DATE.

MODIFY zehs_volumes FROM TABLE i_volumes_temp.

IF sy-subrc is INITIAL.

COMMIT WORK.

ELSE.

ROLLBACK WORK.

ENDIF.

"

The problem wid the above code is that it first clears the entire database table and then fills it with the modified data from the internal table. But we do not want to take risk of emptying the database table. Is there any way out to perform the above operation?

Thanks in advance

Regards,

Yogesh Sharma

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Sep 01, 2008 at 02:34 PM

    I dont know why you made a complicate code .

    This should help

    SELECT * FROM zehs_volumes INTO TABLE i_volumes_temp.

    LOOP AT i_volumes_temp.

    TRANSLATE i_volumes_temp-zehs_business TO UPPER CASE.

    MODIFY i_volumes_temp.

    endloop.

    MODIFY zehs_volumes FROM TABLE i_volumes_temp.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Karthik,

      Thanks for replying.

      In our case the scenario is we need to delete wrong entires in the database table based on the primary input fields. There is already a utility to do so. But in the table some of the entries are present in the lower case.

      For eg. Suppose we need to delete entry with field zehs_business = "Pioneer". When we input this SAP interpret it as PIONEER and we get an error message "No data exist".

      So the code should we in such a way that all the value in field zehs_business should be translated to upper case otherwise SAP will give an error message of non-existence of data.

      The code which you gave adds one more entry in database table with zehs_business = "PIONEER". Now the database table have two records one with "Pioneer" and other with "PIONEER". After the execution of DELETE statement only the record with zehs_business = PIONEER gets deleted....and the other record still exist.

      Is there any way to avoid above situation....