2008 Apr 22 7:41 PM
Hi Experts,
According to my rek, I need to find out is there any thing hardcoded in the system for the currency.
Is there any way to scan for this ....????
Thanks in Advance,
Praveen
2008 Apr 22 8:16 PM
Check this program and see if it helps you. Input for this program is hard code value and program name.
REPORT z_detect_hardcode NO STANDARD PAGE HEADING
LINE-SIZE 180
LINE-COUNT 45.
*---------------------------------------------------------------------*
* DATA DECLARATION *
*---------------------------------------------------------------------*
TYPES: BEGIN OF ty_ztab,
prog TYPE programm,
END OF ty_ztab.
TYPES: BEGIN OF ty_zprog,
line TYPE char72,
END OF ty_zprog.
TYPES: BEGIN OF ty_zprogdet,
prog TYPE programm,
linenr TYPE i,
line TYPE char72,
END OF ty_zprogdet.
DATA: i_prog TYPE STANDARD TABLE OF ty_ztab,
wa_prog TYPE ty_ztab.
DATA: i_zprog TYPE STANDARD TABLE OF ty_zprog,
wa_zprog TYPE ty_zprog.
DATA: i_zprogdet TYPE STANDARD TABLE OF ty_zprogdet,
wa_zprogdet TYPE ty_zprogdet.
PARAMETERS: p_hard TYPE char25 OBLIGATORY.
PARAMETERS: p_chk TYPE char25 OBLIGATORY DEFAULT 'Z*'.
PARAMETERS: p_full RADIOBUTTON GROUP g1,
p_nam RADIOBUTTON GROUP g1.
*---------------------------------------------------------------------*
* START OF SELECTION *
*---------------------------------------------------------------------*
START-OF-SELECTION.
*-- Replace * by %
REPLACE ALL OCCURRENCES OF '*' IN p_chk WITH '%'."--get the list of programs
SELECT prog FROM d010sinf
INTO TABLE i_prog
WHERE prog LIKE p_chk.
IF sy-subrc = 0.
LOOP AT i_prog INTO wa_prog.
try.
READ REPORT wa_prog-prog INTO i_zprog.
catch CX_SY_READ_SRC_LINE_TOO_LONG.
endtry.
IF sy-subrc = 0.
LOOP AT i_zprog INTO wa_zprog.
IF wa_zprog-line CS p_hard.
wa_zprogdet-prog = wa_prog-prog.
wa_zprogdet-line = wa_zprog-line.
wa_zprogdet-linenr = sy-tabix.
APPEND wa_zprogdet TO i_zprogdet.
CLEAR wa_zprogdet.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ELSE.
*-- Message - No entries found
ENDIF.
IF i_zprogdet IS INITIAL.
*-- Message - No entries found
ENDIF.
*---------------------------------------------------------------------*
* END OF SELECTION *
*---------------------------------------------------------------------*
END-OF-SELECTION.
*-- Display report
LOOP AT i_zprogdet INTO wa_zprogdet.
AT NEW prog.
IF p_full EQ 'X'.
SKIP.
WRITE: / wa_zprogdet-prog COLOR 4.
SKIP.
ELSE.
WRITE: / wa_zprogdet-prog COLOR 4.
ENDIF.
ENDAT.
IF p_full EQ 'X'.
WRITE: / wa_zprogdet-prog,
'LINE Nr:',
wa_zprogdet-linenr,
wa_zprogdet-line COLOR 2.
ENDIF.
ENDLOOP.
Thanks,
SKJ
Check this program and see if it helps you. Input for this program is hard code value and program name.
REPORT z_detect_hardcode NO STANDARD PAGE HEADING
LINE-SIZE 180
LINE-COUNT 45.
*---------------------------------------------------------------------*
* DATA DECLARATION *
*---------------------------------------------------------------------*
TYPES: BEGIN OF ty_ztab,
prog TYPE programm,
END OF ty_ztab.
TYPES: BEGIN OF ty_zprog,
line TYPE char72,
END OF ty_zprog.
TYPES: BEGIN OF ty_zprogdet,
prog TYPE programm,
linenr TYPE i,
line TYPE char72,
END OF ty_zprogdet.
DATA: i_prog TYPE STANDARD TABLE OF ty_ztab,
wa_prog TYPE ty_ztab.
DATA: i_zprog TYPE STANDARD TABLE OF ty_zprog,
wa_zprog TYPE ty_zprog.
DATA: i_zprogdet TYPE STANDARD TABLE OF ty_zprogdet,
wa_zprogdet TYPE ty_zprogdet.
PARAMETERS: p_hard TYPE char25 OBLIGATORY.
PARAMETERS: p_chk TYPE char25 OBLIGATORY DEFAULT 'Z*'.
PARAMETERS: p_full RADIOBUTTON GROUP g1,
p_nam RADIOBUTTON GROUP g1.
*---------------------------------------------------------------------*
* START OF SELECTION *
*---------------------------------------------------------------------*
START-OF-SELECTION.
*-- Replace * by %
REPLACE ALL OCCURRENCES OF '*' IN p_chk WITH '%'."--get the list of programs
SELECT prog FROM d010sinf
INTO TABLE i_prog
WHERE prog LIKE p_chk.
IF sy-subrc = 0.
LOOP AT i_prog INTO wa_prog.
try.
READ REPORT wa_prog-prog INTO i_zprog.
catch CX_SY_READ_SRC_LINE_TOO_LONG.
endtry.
IF sy-subrc = 0.
LOOP AT i_zprog INTO wa_zprog.
IF wa_zprog-line CS p_hard.
wa_zprogdet-prog = wa_prog-prog.
wa_zprogdet-line = wa_zprog-line.
wa_zprogdet-linenr = sy-tabix.
APPEND wa_zprogdet TO i_zprogdet.
CLEAR wa_zprogdet.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ELSE.
*-- Message - No entries found
ENDIF.
IF i_zprogdet IS INITIAL.
*-- Message - No entries found
ENDIF.
*---------------------------------------------------------------------*
* END OF SELECTION *
*---------------------------------------------------------------------*
END-OF-SELECTION.
*-- Display report
LOOP AT i_zprogdet INTO wa_zprogdet.
AT NEW prog.
IF p_full EQ 'X'.
SKIP.
WRITE: / wa_zprogdet-prog COLOR 4.
SKIP.
ELSE.
WRITE: / wa_zprogdet-prog COLOR 4.
ENDIF.
ENDAT.
IF p_full EQ 'X'.
WRITE: / wa_zprogdet-prog,
'LINE Nr:',
wa_zprogdet-linenr,
wa_zprogdet-line COLOR 2.
ENDIF.
ENDLOOP.
Thanks,
SKJ
2008 Apr 22 7:45 PM
Hardcode are nothing but manually entering the values in the code instead of fetching it from database table or from someother source. Just try to find out the places where the currency value is assigned manually instead of being refered to the source.
regards
Saravanan
2008 Apr 22 7:48 PM
Hi ,
Thanks for your quick reply.
In my case there are one thousand programs in the system, is there any quick tip to find out the hard coding.
Thanks in Advance,
Praveen
2008 Apr 22 7:47 PM
Hello,
Go to the ABAP Program Extended Syntax Check and mark the option Character Strings, then when you go to the SLIN Overview, double click the lines with warning or errors.
The hardcoded values will be showed.
Regards,
2008 Apr 22 8:16 PM
Check this program and see if it helps you. Input for this program is hard code value and program name.
REPORT z_detect_hardcode NO STANDARD PAGE HEADING
LINE-SIZE 180
LINE-COUNT 45.
*---------------------------------------------------------------------*
* DATA DECLARATION *
*---------------------------------------------------------------------*
TYPES: BEGIN OF ty_ztab,
prog TYPE programm,
END OF ty_ztab.
TYPES: BEGIN OF ty_zprog,
line TYPE char72,
END OF ty_zprog.
TYPES: BEGIN OF ty_zprogdet,
prog TYPE programm,
linenr TYPE i,
line TYPE char72,
END OF ty_zprogdet.
DATA: i_prog TYPE STANDARD TABLE OF ty_ztab,
wa_prog TYPE ty_ztab.
DATA: i_zprog TYPE STANDARD TABLE OF ty_zprog,
wa_zprog TYPE ty_zprog.
DATA: i_zprogdet TYPE STANDARD TABLE OF ty_zprogdet,
wa_zprogdet TYPE ty_zprogdet.
PARAMETERS: p_hard TYPE char25 OBLIGATORY.
PARAMETERS: p_chk TYPE char25 OBLIGATORY DEFAULT 'Z*'.
PARAMETERS: p_full RADIOBUTTON GROUP g1,
p_nam RADIOBUTTON GROUP g1.
*---------------------------------------------------------------------*
* START OF SELECTION *
*---------------------------------------------------------------------*
START-OF-SELECTION.
*-- Replace * by %
REPLACE ALL OCCURRENCES OF '*' IN p_chk WITH '%'."--get the list of programs
SELECT prog FROM d010sinf
INTO TABLE i_prog
WHERE prog LIKE p_chk.
IF sy-subrc = 0.
LOOP AT i_prog INTO wa_prog.
try.
READ REPORT wa_prog-prog INTO i_zprog.
catch CX_SY_READ_SRC_LINE_TOO_LONG.
endtry.
IF sy-subrc = 0.
LOOP AT i_zprog INTO wa_zprog.
IF wa_zprog-line CS p_hard.
wa_zprogdet-prog = wa_prog-prog.
wa_zprogdet-line = wa_zprog-line.
wa_zprogdet-linenr = sy-tabix.
APPEND wa_zprogdet TO i_zprogdet.
CLEAR wa_zprogdet.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ELSE.
*-- Message - No entries found
ENDIF.
IF i_zprogdet IS INITIAL.
*-- Message - No entries found
ENDIF.
*---------------------------------------------------------------------*
* END OF SELECTION *
*---------------------------------------------------------------------*
END-OF-SELECTION.
*-- Display report
LOOP AT i_zprogdet INTO wa_zprogdet.
AT NEW prog.
IF p_full EQ 'X'.
SKIP.
WRITE: / wa_zprogdet-prog COLOR 4.
SKIP.
ELSE.
WRITE: / wa_zprogdet-prog COLOR 4.
ENDIF.
ENDAT.
IF p_full EQ 'X'.
WRITE: / wa_zprogdet-prog,
'LINE Nr:',
wa_zprogdet-linenr,
wa_zprogdet-line COLOR 2.
ENDIF.
ENDLOOP.
Thanks,
SKJ
2008 Apr 23 2:05 AM
Thanks for your replies.
I dont have access to develop the program in the production system nor I can move from the dev system
Is there any standart program to scan for the hardcoded values.
Please suggest me.
Thanks,
Praveen
2008 Apr 23 2:16 AM
Hi
Do like below:
Run Program RPR_ABAP_SOURCE_SCAN
Give Z* against Program Names
Now TO GO Table TCURC, put all the WAERS values in one Notepad and import this file againt
FIND STRING on the selection screen
and execute, it will display the lines of Z* programs, where these waers are used as hardcode.
Hope it helps.
Thanks.
2008 Apr 23 2:52 AM
Thanks Praveen,
Definitely I will try this and will let you know.
and also I want to look for the BUKRS and WAERK fields , what are the tables to look for the values.
Thanks in Advance,
Praveen
2008 Apr 23 3:03 AM
Hi
Look for table T001 for Bukrs
For waerk is the same table TCURC
Hope this helps.
Thanks,Praveen
2008 Apr 23 3:08 AM
Hi Praveen,
Thanks for your reply.
How long does it take to run the program, hours to gether ????
Thanks in Advance,
Praveen
2008 Apr 23 3:14 AM
Hi
Anywhere bet 2-4 Hours.
Depends on string values , if more takes more time.
Praveen
2008 Apr 22 8:43 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |