Uday's website
Published on Uday's website (https://uday.net)

Home > SAP Technical > How-To

How-To

This section will give tips and tricks for technical stuff.

  • Log in [1] to post comments

Delete data from a table

You can use T-code = SE14 to empty the entire table.

Be careful and do NOT delete the actual table, just the data.

  • Log in [2] to post comments

Replace HTML tags in a string

Suppose you want to change "<HTML><B>Sample Text</B></HTML>" to "Sample Text".

Use following function modules.

SOTR_TAGS_REMOVE_FROM_STRING

HRDSYS_CONVERT_FROM_HTML

SWA_STRING_REMOVE_SUBSTRING

 

Other option is to use Regular Expressions.

DATA: message TYPE string.
message = '<p style="something">Hello <strong>World</strong>!</p>'.
REPLACE ALL OCCURRENCES OF REGEX '<[a-zA-Z\/][^>]*>' IN message with space.
WRITE:/ message.

 

 

 

  • Log in [3] to post comments

Replace special characters in a string

Use function module =  SCP_REPLACE_STRANGE_CHARS

Test to replace: Ö Ä Ü SÓNIA GONÇALVES

  • Log in [4] to post comments

Search the source code of ABAP programs?

1) You can use report RPR_ABAP_SOURCE_SCAN.

Search ABAP code

2) Old method is to use report RSRSCAN1. Use with the Z* in the program parameter to search in custom programs only.
   Otherwise, it will take a long time to search. Enter the string to-be-searched in "Find string parameter".

3) Try transaction EWK1.

 
  
If you already know program name:

Then use the function "Find in source code" in the ABAP Editor instead.
(Transaction SE38, Menu "Utilities" -> Find in Source Code) or Use program SAPLS_SEARCH

 

  • Log in [5] to post comments

Validate ABAP code

You can do "Program>Check>Extended Program Check". Check all the boxes and execute. It will tell you all those literals which are hard-coded like this with a warning saying that they may not be translated.
Alternately, you can also use transaction SLIN

The results are shown as following. You can double click on errors etc. for more details.

  • Log in [6] to post comments

Write variant-specific code

We can write ABAP code that will be executed for a particular variant only.

For this, we use ABAP system fields from SYST structure.

Sample code is as follows:

      IF sy-slset = 'XI_SHARP_RESET'.
        gs_output-removal_flag = 'Y'.
      ELSE.
        gs_output-removal_flag = 'N'.
      ENDIF.

In the above code, removal flag is set to 'Y' only if program is run using variant name = 'XI_SHARP_RESET'.

For any other variant, it is set to 'N'.

  • Log in [7] to post comments

 Valid XHTML 1.0 StrictCreative Commons LicenseVerbatim copying and redistribution of this entire page are permitted provided this notice is preserved. All content on this website including archives (including text, photographs, audio files and any other original work), unless otherwise noted, is licensed under a Creative Commons License or later.


Source URL:https://uday.net/SAP-technical-how-to

Links
[1] https://uday.net/user/login?destination=node/526%23comment-form [2] https://uday.net/user/login?destination=node/534%23comment-form [3] https://uday.net/user/login?destination=node/536%23comment-form [4] https://uday.net/user/login?destination=node/535%23comment-form [5] https://uday.net/user/login?destination=node/532%23comment-form [6] https://uday.net/user/login?destination=node/533%23comment-form [7] https://uday.net/user/login?destination=node/527%23comment-form