‎2007 Sep 05 8:48 AM
Hi,
i have one requirement, in extended program check for checking the text elements,(chracter -strings).
There is a sap standard programavailabel. ( Code slin,function pool sapslin) , if i am checking EPC for my z program ,the sapling is not comparing the text elements and text literals character by character,It is checking whether the text element is created or not.(for example if i created a text literal as "cat" and for that if i created text element as "ca". ) then also the EPC (sapslin) is not identifying that error.
please guide me with the proper code.
‎2007 Sep 05 9:34 AM
SAP checks Spelling mistakes only for STANDARD SAP COMMANDS.
For texts, that needs to be validated manually. Hence every company has a review process in place. Code should be reviewed so that such errors are not moved to Quality/Production.
‎2007 Sep 20 11:26 AM
REPORT ZTEXT_ELEMENTS_CHECK .
include <icon>.
PARAMETERS : P_TEXT(40) TYPE C.
TYPES : BEGIN OF TY_RESULT,
id type c,
key(3) type c,
ENTRY TYPE STRING,
STATUS TYPE C,
END OF TY_RESULT.
DATA : LEN TYPE I,
POS TYPE I,
ACTLEN TYPE I,
COMPLEN TYPE I,
count type i,
STR TYPE STRING.
DATA : BEGIN OF TY_PROG.
INCLUDE STRUCTURE ABAPTEXT.
DATA : END OF TY_PROG.
data : i_data type table of abaptext with header line.
DATA : I_PROGRAM TYPE TABLE OF ABAPTEXT WITH HEADER LINE.
DATA : I_TEXTELEMENT TYPE TABLE OF TEXTPOOL WITH HEADER LINE.
DATA : I_RESULT TYPE TABLE OF TY_RESULT WITH HEADER LINE.
READ REPORT P_TEXT INTO I_data.
READ TEXTPOOL P_TEXT INTO I_TEXTELEMENT LANGUAGE SY-LANGU.
break-point.
loop at i_data.
if I_data-LINE cp '00'.
i_program-line = i_data-line.
append i_program.
endif.
endloop.
LOOP AT I_TEXTELEMENT.
LOOP AT I_PROGRAM.
SEARCH I_PROGRAM-LINE FOR I_TEXTELEMENT-ENTRY.
IF SY-SUBRC EQ 0.
LEN = STRLEN( I_TEXTELEMENT-ENTRY ) + 1.
POS = SY-FDPOS.
STR = I_PROGRAM+POS(LEN).
SHIFT STR RIGHT DELETING TRAILING ''''.
CONDENSE STR NO-GAPS.
ACTLEN = STRLEN( I_TEXTELEMENT-ENTRY ).
COMPLEN = STRLEN( STR ).
IF ACTLEN = COMPLEN.
I_RESULT-ENTRY = I_TEXTELEMENT-ENTRY.
I_RESULT-STATUS = 'T'.
APPEND I_RESULT.
ENDIF.
ENDIF.
ENDLOOP.
ENDLOOP.
loop at i_result.
loop at i_textelement where entry = i_result-entry or id = ''.
i_result-id = i_textelement-id.
i_result-key = i_textelement-key.
modify i_result from i_result.
endloop.
endloop.
loop at i_textelement where id = 'I'.
clear count.
loop at i_result where key = i_textelement-key.
count = 1.
endloop.
if count = 0.
i_result-id = i_textelement-id.
i_result-key = i_textelement-key.
i_result-entry = i_textelement-entry.
i_result-status = 'F'.
append i_result.
endif.
endloop.
LOOP AT I_RESULT.
if i_result-status = 'F'.
WRITE : /3 I_RESULT-id, 15 I_RESULT-key,
30 I_RESULT-ENTRY, 40 I_RESULT-STATUS,ICON_INCOMPLETE AS ICON
.
endif.
ENDLOOP.
Hope it is useful.
Please reward.
‎2007 Sep 20 12:39 PM