‎2007 Oct 02 11:42 AM
Hi Abapers,
When i execute one report, its going to dump and thereby giving runtime error "UC_OBJECTS_NOT_CHARLIKE". I checked attributes of this report, unicode check box is enabled.
Im getting this error at 'strlen' function:
DATA: CTEMP(80) TYPE C, ILEN TYPE I.
CTEMP = P_IN.
ILEN = STRLEN( CTEMP ).
REPLACE '"' WITH '' INTO CTEMP LENGTH ILEN.
REPLACE '"' WITH '' INTO CTEMP LENGTH ILEN.
CONDENSE CTEMP.
P_OUT = CTEMP.
Error analysis says that only character-type data objects are supported at the argument position "obj" for the statement:
STRLEN( obj )
The operand "obj" has the non-character type "ty_descr". but as the program is unicode flag enabled, in unicode context type X fields are seen as non-character type as the structures that contain non-character type components.
kindly suggest me how to overcome from this runtime error.
Points are sure for all helpfull answers.
Thanks & Regards,
Radhika.
Message was edited by:
Premraj Cheguri
‎2007 Oct 02 11:54 AM
Hi
See this for Unicdoe
The Link will be helpful to you.
Very good document:
http://www.doag.org/pub/docs/sig/sap/2004-03/Buhlinger_Maxi_Version.pdf
You need to use the transaction UCCHECK.
The report documentation is here
ABAP Unicode Scan Tool UCCHECK
You can use transaction UCCHECK to examine a Unicode program set for syntax errors without having to set the program attribute "Unicode checks active" for every individual program. From the list of Unicode syntax errors, you can go directly to the affected programs and remove the errors. It is also possible to automatically create transport requests and set the Unicode program attribute for a program set.
Some application-specific checks, which draw your attention to program points that are not Unicode-compatible, are also integrated.
Selection of Objects:
The program objects can be selected according to object name, object type, author (TADIR), package, and original system. For the Unicode syntax check, only object types for which an independent syntax check can be carried out are appropriate. The following object types are possibilities:
PROG Report
CLAS Class
FUGR Function groups
FUGX Function group (with customer include, customer area)
FUGS Function group (with customer include, SAP area)
LDBA Logical Database
CNTX Context
TYPE Type pool
INTF Interface
Only Examine Programs with Non-Activated Unicode Flag
By default, the system only displays program objects that have not yet set the Unicode attribute. If you want to use UCCHECK to process program objects that have already set the attribute, you can deactivate this option.
Only Objects with TADIR Entry
By default, the system only displays program objects with a TADIR entry. If you want to examine programs that don't have a TADIR entry, for example locally generated programs without a package, you can deactivate this option.
Exclude Packages $*
By default, the system does not display program objects that are in a local, non-transportable package. If you want to examine programs that are in such a package, you can deactivate this option.
Display Modified SAP Programs Also
By default, SAP programs are not checked in customer systems. If you also want to check SAP programs that were modified in a customer system (see transaction SE95), you can activate this option.
Maximum Number of Programs:
To avoid timeouts or unexpectedly long waiting times, the maximum number of program objects is preset to 50. If you want to examine more objects, you must increase the maximum number or run a SAMT scan (general program set processing). The latter also has the advantage that the data is stored persistently. Proceed as follows:
- Call transaction SAMT
- Create task with program RSUNISCAN_FINAL, subroutine SAMT_SEARCH
For further information refer to documentation for transaction SAMT.
Displaying Points that Cannot Be Analyzed Statically
If you choose this option, you get an overview of the program points, where a static check for Unicode syntax errors is not possible. This can be the case if, for example, parameters or field symbols are not typed or you are accessing a field or structure with variable length/offset. At these points the system only tests at runtime whether the code is sufficient for the stricter Unicode tests. If possible, you should assign types to the variables used, otherwise you must check runtime behavior after the Unicode attribute has been set.
To be able to differentiate between your own and foreign code (for example when using standard includes or generated includes), there is a selection option for the includes to be displayed. By default, the system excludes the standard includes of the view maintenance LSVIM* from the display, because they cause a large number of messages that are not relevant for the Unicode conversion. It is recommended that you also exclude the generated function group-specific includes of the view maintenance (usually L<function group name>F00 and L<function group name>I00) from the display.
Similarly to the process in the extended syntax check, you can hide the warning using the pseudo comment ("#EC *).
Application-Specific Checks
These checks indicate program points that represent a public interface but are not Unicode-compatible. Under Unicode, the corresponding interfaces change according to the referenced documentation and must be adapted appropriately.
View Maintenance
Parts of the view maintenance generated in older releases are not Unicode-compatible. The relevant parts can be regenerated with a service report.
UPLOAD/DOWNLOAD
The function modules UPLOAD, DOWNLOAD or WS_UPLOAD and WS_DOWNLOAD are obsolete and cannot run under Unicode. Refer to the documentation for these modules to find out which routines serve as replacements.
Regards
Anji
‎2007 Oct 02 11:54 AM
Hi
See this for Unicdoe
The Link will be helpful to you.
Very good document:
http://www.doag.org/pub/docs/sig/sap/2004-03/Buhlinger_Maxi_Version.pdf
You need to use the transaction UCCHECK.
The report documentation is here
ABAP Unicode Scan Tool UCCHECK
You can use transaction UCCHECK to examine a Unicode program set for syntax errors without having to set the program attribute "Unicode checks active" for every individual program. From the list of Unicode syntax errors, you can go directly to the affected programs and remove the errors. It is also possible to automatically create transport requests and set the Unicode program attribute for a program set.
Some application-specific checks, which draw your attention to program points that are not Unicode-compatible, are also integrated.
Selection of Objects:
The program objects can be selected according to object name, object type, author (TADIR), package, and original system. For the Unicode syntax check, only object types for which an independent syntax check can be carried out are appropriate. The following object types are possibilities:
PROG Report
CLAS Class
FUGR Function groups
FUGX Function group (with customer include, customer area)
FUGS Function group (with customer include, SAP area)
LDBA Logical Database
CNTX Context
TYPE Type pool
INTF Interface
Only Examine Programs with Non-Activated Unicode Flag
By default, the system only displays program objects that have not yet set the Unicode attribute. If you want to use UCCHECK to process program objects that have already set the attribute, you can deactivate this option.
Only Objects with TADIR Entry
By default, the system only displays program objects with a TADIR entry. If you want to examine programs that don't have a TADIR entry, for example locally generated programs without a package, you can deactivate this option.
Exclude Packages $*
By default, the system does not display program objects that are in a local, non-transportable package. If you want to examine programs that are in such a package, you can deactivate this option.
Display Modified SAP Programs Also
By default, SAP programs are not checked in customer systems. If you also want to check SAP programs that were modified in a customer system (see transaction SE95), you can activate this option.
Maximum Number of Programs:
To avoid timeouts or unexpectedly long waiting times, the maximum number of program objects is preset to 50. If you want to examine more objects, you must increase the maximum number or run a SAMT scan (general program set processing). The latter also has the advantage that the data is stored persistently. Proceed as follows:
- Call transaction SAMT
- Create task with program RSUNISCAN_FINAL, subroutine SAMT_SEARCH
For further information refer to documentation for transaction SAMT.
Displaying Points that Cannot Be Analyzed Statically
If you choose this option, you get an overview of the program points, where a static check for Unicode syntax errors is not possible. This can be the case if, for example, parameters or field symbols are not typed or you are accessing a field or structure with variable length/offset. At these points the system only tests at runtime whether the code is sufficient for the stricter Unicode tests. If possible, you should assign types to the variables used, otherwise you must check runtime behavior after the Unicode attribute has been set.
To be able to differentiate between your own and foreign code (for example when using standard includes or generated includes), there is a selection option for the includes to be displayed. By default, the system excludes the standard includes of the view maintenance LSVIM* from the display, because they cause a large number of messages that are not relevant for the Unicode conversion. It is recommended that you also exclude the generated function group-specific includes of the view maintenance (usually L<function group name>F00 and L<function group name>I00) from the display.
Similarly to the process in the extended syntax check, you can hide the warning using the pseudo comment ("#EC *).
Application-Specific Checks
These checks indicate program points that represent a public interface but are not Unicode-compatible. Under Unicode, the corresponding interfaces change according to the referenced documentation and must be adapted appropriately.
View Maintenance
Parts of the view maintenance generated in older releases are not Unicode-compatible. The relevant parts can be regenerated with a service report.
UPLOAD/DOWNLOAD
The function modules UPLOAD, DOWNLOAD or WS_UPLOAD and WS_DOWNLOAD are obsolete and cannot run under Unicode. Refer to the documentation for these modules to find out which routines serve as replacements.
Regards
Anji
‎2007 Oct 02 12:09 PM
Can some one please help me on this. its very urgent...
Please give me the solution.
error is coming at 'strlen(obj)'
data: obj(70) type c.
unicode check box is enabled.
‎2007 Oct 02 12:52 PM
Hi,
Can you entire code, so that we try to suggest you some solution.
Thanks,
Sriram Ponna.
‎2007 Oct 02 1:09 PM
Hi Sriram,
kindly look into below code and suggest some solution.
REPORT ZDR_EDCOR
MESSAGE-ID 00.
SAP CONVERSION/COMBINATION OF PEOPLESOFT PGMS KPE272.SQR & KPE234.SQR
TABLES: pernr,
T522T,
T529U.
INFOTYPES: 0000, "Actions
0001, "Org Assignments
0002, "Personal Data
0006, "Addresses
0008, "Basic Pay
0033, "Statistics Exceptions
0041, "Date Specifications
0077, "Additional Personal Data
0105, "Communication
1000, "Objects
1001, "Hierarchy
9101, "Job Function
9047, "Internationa Assignment Data
9070. "US Position Attributes
Structure for Hold File
TYPES: BEGIN OF ty_hold,
hold_code(10) TYPE c,
hold_desc(40) TYPE c,
hold_date TYPE dats,
END OF ty_hold.
Structure for EdCor File
TYPES: BEGIN OF ty_edcor,
emplid(9) TYPE c,
tab01 TYPE x,
payroll_id(9) TYPE c,
tab02 TYPE x,
posn_nbr(8) TYPE c,
tab03 TYPE x,
name_prefix(8) TYPE c,
tab04 TYPE x,
first_name(25) TYPE c,
tab05 TYPE x,
initial(8) TYPE c,
tab06 TYPE x,
last_name(25) TYPE c,
tab07 TYPE x,
suffix TYPE c,
tab08 TYPE x,
birthdate(8) TYPE c,
tab09 TYPE x,
addr1(35) TYPE c,
tab10 TYPE x,
addr2(35) TYPE c,
tab11 TYPE x,
addr3(35) TYPE c,
tab12 TYPE x,
city(30) TYPE c,
tab13 TYPE x,
state(2) TYPE c,
tab14 TYPE x,
zip(10) TYPE c,
tab15 TYPE x,
country(2) TYPE c,
tab16 TYPE x,
home_ph TYPE c,
tab17 TYPE x,
email_addr(30) TYPE c,
tab18 TYPE x,
wk_addr1(35) TYPE c,
tab19 TYPE x,
wk_addr2(35) TYPE c,
tab20 TYPE x,
wk_addr3(35) TYPE c,
tab21 TYPE x,
wk_city(30) TYPE c,
tab22 TYPE x,
wk_state(2) TYPE c,
tab23 TYPE x,
wk_zip(10) TYPE c,
tab24 TYPE x,
wk_cntry(2) TYPE c,
tab25 TYPE x,
wk_ph(15) TYPE c,
tab26 TYPE x,
wk_ext TYPE c,
tab27 TYPE x,
wk_fax TYPE c,
tab28 TYPE x,
mail_stop(30) TYPE c,
tab29 TYPE x,
svc_id(9) TYPE c,
tab30 TYPE x,
svc_global_id(9) TYPE c,
tab31 TYPE x,
hire_dt(8) TYPE c,
tab32 TYPE x,
service_dt(8) TYPE c,
tab33 TYPE x,
empl_status TYPE c,
tab34 TYPE x,
sex TYPE c,
tab35 TYPE x,
empl_class(3) TYPE c,
tab36 TYPE x,
empl_status_dt(8) TYPE c,
tab37 TYPE x,
empl_type(2) TYPE c,
tab38 TYPE x,
jobcode(8) TYPE c,
tab39 TYPE x,
jobtitle(25) TYPE c,
tab40 TYPE x,
level_2(10) TYPE c,
tab41 TYPE x,
level_3(10) TYPE c,
tab42 TYPE x,
level_4(10) TYPE c,
tab43 TYPE x,
level_5(10) TYPE c,
tab44 TYPE x,
level_6(10) TYPE c,
tab45 TYPE x,
level_7(10) TYPE c,
tab46 TYPE x,
level_8(10) TYPE c,
tab47 TYPE x,
level_9(10) TYPE c,
tab48 TYPE x,
org_unit(10) TYPE c,
tab49 TYPE x,
deptid(10) TYPE c,
tab50 TYPE x,
grade(8) TYPE c,
tab51 TYPE x,
ethnic_grp(10) TYPE c,
tab52 TYPE x,
func_cd_ko(2) TYPE c,
tab53 TYPE x,
fmly_cd_ko(2) TYPE c,
tab54 TYPE x,
role_ko(2) TYPE c,
tab55 TYPE x,
lvl_ko TYPE c,
tab56 TYPE x,
acctg_code_05 TYPE c,
tab57 TYPE x,
e_flag1 TYPE c,
tab58 TYPE x,
e_flag2 TYPE c,
tab59 TYPE x,
e_flag3 TYPE c,
tab60 TYPE x,
e_flag4 TYPE c,
tab61 TYPE x,
e_flag5 TYPE c,
tab62 TYPE x,
created_by TYPE c,
tab63 TYPE x,
created_dt(8) TYPE c,
tab64 TYPE x,
updated_by TYPE c,
tab65 TYPE x,
updated_dt TYPE c ,
END OF ty_edcor.
Structure for Data File
TYPES: BEGIN OF ty_descr,
rec_type(3) TYPE c,
tab01 TYPE x,
rec_code(10) TYPE c,
tab02 TYPE x,
rec_desc(40) TYPE c,
END OF ty_descr.
Header Structure
TYPES: BEGIN OF hdr_struc,
line_type,
version_number(10),
acct_date LIKE SY-DATUM,
acct_number(10),
company_number(10),
cc_company(2),
acct_currency(3),
decimal_places TYPE N,
vat_input_rate(5),
test_parameter,
END OF hdr_struc.
Tables
DATA: tb_descr TYPE STANDARD TABLE OF ty_descr WITH HEADER LINE,
tb_hold TYPE STANDARD TABLE OF ty_hold WITH HEADER LINE,
tb_edcor TYPE STANDARD TABLE OF ty_edcor WITH HEADER LINE,
header TYPE STANDARD TABLE OF hdr_struc WITH HEADER LINE,
tb0000 TYPE STANDARD TABLE OF P0000 WITH HEADER LINE,
tb0033 TYPE STANDARD TABLE OF P0033 WITH HEADER LINE,
tb1001 TYPE STANDARD TABLE OF hrp1001 WITH HEADER LINE,
tb9070 TYPE STANDARD TABLE OF P9070 WITH HEADER LINE,
tb9101 TYPE STANDARD TABLE OF P9101 WITH HEADER LINE,
objects TYPE STANDARD TABLE OF hrobject WITH HEADER LINE,
relate1 LIKE p1001 OCCURS 0 WITH HEADER LINE,
relate2 LIKE p1001 OCCURS 0 WITH HEADER LINE,
l_p0001 LIKE p0001 OCCURS 0 WITH HEADER LINE.
Miscellaneous Data
DATA: nameofformofaddress(15),
empstat(3) TYPE c,
svcid(3) TYPE c,
code(10) TYPE c,
code2(10) TYPE c,
desc(40) TYPE c,
desc1 TYPE c,
desc2(40) TYPE c,
conv_begda LIKE sy-datum,
chkdate TYPE dats,
new_end_dt TYPE dats,
begda_0000 TYPE dats,
endda_0000 TYPE dats,
cont_prcs TYPE c,
empl_status_chg(1) TYPE c,
persgsk(20) TYPE c,
pgpktxt(25) TYPE c,
char25(25) TYPE c,
tot_org_lvls TYPE i,
lvl_cnt TYPE i,
i_descr TYPE i,
i_edcor TYPE i,
dar LIKE P0041-dar01,
dat LIKE P0041-dat01,
formofaddress LIKE P0002-anred,
h_index LIKE SY-TABIX,
org_unit LIKE HRP1000-objid,
company LIKE HRP1000-objid,
l_pernr LIKE pernr-pernr,
svc_pernr LIKE pernr-pernr,
u_filename1(9) TYPE c value 'descr.dat',
u_filename2(9) TYPE c value 'edcor.dat'.
DATA: BEGIN OF tb_org_levels OCCURS 50.
INCLUDE STRUCTURE ZHRORGLVLS.
DATA: END OF tb_org_levels.
DATA: mask(50),
filename LIKE rlgrap-filename VALUE '*.DAT',
filepath(40) VALUE 'C:\',
rela_show TYPE i,
object_show TYPE i,
subrc LIKE sy-subrc.
FIELD-SYMBOLS: <tb>.
DATA: w_fldname(15) TYPE c,
w_cnt TYPE i.
CONTEXTS: y_hr_get_parent_orgs.
DATA: ctx_orgs TYPE context_y_hr_get_parent_orgs.
SELECTION-SCREEN: BEGIN OF BLOCK bk1 WITH FRAME TITLE TEXT-005.
SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS: s_ex3 RADIOBUTTON GROUP RAD3.
SELECTION-SCREEN COMMENT 5(17) TEXT-EX3.
PARAMETERS: s_ex4 RADIOBUTTON GROUP RAD3.
SELECTION-SCREEN COMMENT 25(18) TEXT-EX4.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: END OF BLOCK bk1.
SELECTION-SCREEN: BEGIN OF BLOCK bk2 WITH FRAME TITLE TEXT-004.
SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS: s_ex1 RADIOBUTTON GROUP RAD1.
SELECTION-SCREEN COMMENT 5(17) TEXT-EX1.
PARAMETERS: s_ex2 RADIOBUTTON GROUP RAD1.
SELECTION-SCREEN COMMENT 25(18) TEXT-EX2.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: END OF BLOCK bk2.
FIELD-SYMBOLS: <titlename> TYPE ANY.
FIELD-SYMBOLS: <tablename> TYPE standard table.
SELECTION-SCREEN: BEGIN OF BLOCK bk3 WITH FRAME TITLE text-001.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(21) text-002.
PARAMETERS: fname1 LIKE rlgrap-filename default 'c:\descr.dat'.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(21) text-003.
PARAMETERS: fname2 LIKE rlgrap-filename default 'c:\edcor.dat'.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: END OF BLOCK bk3.
ASSIGN_FLD is used to assign fieldnames to the field-symbol.
This is used for the ASCII tab fields in the output table.
DEFINE assign_fld.
write &1 to w_fldname.
condense w_fldname no-gaps.
if &1 > 9.
concatenate &2 w_fldname into w_fldname.
else.
concatenate &2 '0' w_fldname into w_fldname.
endif.
assign (w_fldname) to &3.
END-OF-DEFINITION.
TOP-OF-PAGE.
FORMAT COLOR 1 INTENSIFIED.
WRITE: / header-acct_date DD/MM/YYYY,
SY-TITLE(65) CENTERED NO-GAP.
FORMAT COLOR 5 INTENSIFIED OFF.
NEW-LINE NO-SCROLLING.
AT SELECTION-SCREEN.
IF fname1 is initial.
message E398(00) with 'You Must Enter a Filename for '
'the Edcor Descriptor File'.
ENDIF.
IF fname2 is initial.
message E398(00) with 'You Must Enter a Filename for '
'the Edcor Data File'.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR fname1.
PERFORM get_filename USING 'D' fname1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR fname2.
PERFORM get_filename USING 'E' fname2.
START-OF-SELECTION.
SET PF-STATUS 'LIST'.
header-acct_date = sy-datum.
conv_begda = '20021115'.
WRITE: / 'dates', conv_begda, pn-endda.
PERFORM Load_Descriptor_File.
GET pernr.
CLEAR tb_edcor.
Initialize tb_edcor with tab characters.
w_cnt = 1.
WHILE w_cnt LE 67.
assign_fld w_cnt 'TB_EDCOR-TAB' <tb>.
<tb> = '09'.
w_cnt = w_cnt + 1.
ENDWHILE.
cont_prcs = 'Y'.
Establish created_dt from sy-datum.
PERFORM CHANGE_DATE_FORMAT USING sy-datum
CHANGING tb_edcor-created_dt.
Get Employee Status Date and Payroll Id
rp-provide-from-last P0000 space conv_begda pn-endda.
IF pnp-sw-found eq '1'.
IF P0000-begda >= conv_begda
AND P0000-stat2 in pnpstat2.
CASE P0000-stat2.
WHEN '3'.
tb_edcor-empl_status = 'A'.
WHEN '2'.
tb_edcor-empl_status = 'R'.
WHEN '1'.
tb_edcor-empl_status = 'I'.
WHEN OTHERS.
tb_edcor-empl_status = 'W'.
ENDCASE.
tb_edcor-payroll_id = P0000-pernr.
begda_0000 = P0000-begda.
endda_0000 = P0000-endda.
PERFORM CHANGE_DATE_FORMAT USING P0000-begda
CHANGING tb_edcor-empl_status_dt.
ELSE.
cont_prcs = 'N'.
ENDIF.
ENDIF.
WRITE: / 'tb_edcor-payroll_id ', tb_edcor-payroll_id,
/ 'tb_edcor-empl_status ', tb_edcor-empl_status,
/ 'tb_edcor-empl_status_dt ', tb_edcor-empl_status_dt.
IF cont_prcs = 'Y'.
PERFORM Continue_Process.
ENDIF.
END-OF-SELECTION.
LOOP AT tb_edcor.
IF tb_edcor-emplid IS INITIAL.
WRITE: /'SSN BLANK', tb_edcor-payroll_id,
tb_edcor-last_name,
tb_edcor-first_name,
tb_edcor-empl_status,
begda_0000,
conv_begda,
endda_0000,
pn-endda.
DELETE tb_edcor.
ELSE.
PERFORM NOQUOTES:
USING tb_edcor-name_prefix CHANGING tb_edcor-name_prefix,
USING tb_edcor-first_name CHANGING tb_edcor-first_name,
USING tb_edcor-initial CHANGING tb_edcor-initial,
USING tb_edcor-last_name CHANGING tb_edcor-last_name,
USING tb_edcor-addr1 CHANGING tb_edcor-addr1,
USING tb_edcor-addr2 CHANGING tb_edcor-addr2,
USING tb_edcor-addr3 CHANGING tb_edcor-addr3,
USING tb_edcor-email_addr CHANGING tb_edcor-email_addr,
USING tb_edcor-mail_stop CHANGING tb_edcor-mail_stop,
USING tb_edcor-wk_addr1 CHANGING tb_edcor-wk_addr1,
USING tb_edcor-wk_addr2 CHANGING tb_edcor-wk_addr2,
USING tb_edcor-wk_addr3 CHANGING tb_edcor-wk_addr3,
USING tb_edcor-jobtitle CHANGING tb_edcor-jobtitle.
MODIFY tb_edcor.
ENDIF.
CLEAR tb_edcor.
ENDLOOP.
DESCRIBE TABLE tb_descr LINES i_descr.
DESCRIBE TABLE tb_edcor LINES i_edcor.
Initialize tb_edcor with tab characters.
w_cnt = 1.
WHILE w_cnt LE 67.
assign_fld w_cnt 'TB_EDCOR-TAB' <tb>.
<tb> = '09'.
w_cnt = w_cnt + 1.
ENDWHILE.
i_edcor = i_edcor + 1.
tb_edcor-emplid = 'Trailer'.
tb_edcor-payroll_id = i_edcor.
APPEND tb_edcor.
CLEAR tb_edcor.
WRITE: SY-ULINE.
WRITE: / 'Number of Records in Edcor Desc File: ', i_descr.
SKIP.
WRITE: / 'Number of Records in Edcor Data File: ', i_edcor.
PERFORM DOWNLOADDATA TABLES tb_descr USING fname1.
PERFORM DOWNLOADDATA TABLES tb_edcor USING fname2.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'DESCRFILE'.
SET PF-STATUS 'LIST' EXCLUDING 'DESCRFILE'.
SY-LSIND = 1.
LOOP AT tb_descr.
EXIT.
ENDLOOP.
IF SY-SUBRC EQ 0.
WRITE: / 'EDCOR DESCRITPION FILE'.
WRITE: / SY-ULINE(53).
WRITE: / TEXT-H01, "Type
TEXT-H02, "Code
TEXT-H03. "Description
WRITE: / SY-ULINE(53).
LOOP AT tb_descr.
WRITE: / tb_descr-rec_type UNDER TEXT-H01,
tb_descr-rec_code UNDER TEXT-H02,
tb_descr-rec_desc UNDER TEXT-H03.
ENDLOOP.
ELSE.
CLEAR SY-UCOMM.
SKIP.
ENDIF.
WHEN 'EDCORFILE'.
SET PF-STATUS 'LIST' EXCLUDING 'EDCORFILE'.
SY-LSIND = 1.
LOOP AT tb_edcor.
EXIT.
ENDLOOP.
IF SY-SUBRC EQ 0.
NEW-PAGE LINE-SIZE 1023.
WRITE: / 'EDCOR DATA FILE'.
WRITE: /(1023) SY-ULINE.
WRITE: / TEXT-H10, "SSN
TEXT-H11, "Empl Id
TEXT-H12, "Position-No
TEXT-H13, "Prefix
TEXT-H14, "First-Name
TEXT-H74, "Initial
TEXT-H15, "Last-Name
TEXT-H16, "Suffix
TEXT-H17, "BirthDt
TEXT-H18, "Address-1
TEXT-H19, "Address-2
TEXT-H20, "Address-3
TEXT-H21, "City
TEXT-H22, "State
TEXT-H23, "Zip
TEXT-H24, "Country
TEXT-H25, "HomePh
TEXT-H26, "E-mail
TEXT-H27, "Wk-Address-1
TEXT-H28, "Wk-Address-2
TEXT-H29, "Wk-Address-3
TEXT-H30, "Wk-City
TEXT-H31, "Wk-State
TEXT-H32, "Wk-Zip
TEXT-H33, "Wk-Country
TEXT-H34, "Wk-Phone
TEXT-H35, "Wk-Ext
TEXT-H36, "Wk-Fax
TEXT-H37, "Mail-Stop
TEXT-H38, "Svc-SSN
TEXT-H39, "Svc-Id
TEXT-H40, "Hire-Dt
TEXT-H41, "Serv-Dt
TEXT-H42, "Empl-Stat
TEXT-H43, "Sex
TEXT-H44, "Empl-Class
TEXT-H45, "EmSt-Dt
TEXT-H46, "Empl-Type
TEXT-H47, "Job-Cd
TEXT-H48, "Job-Title
TEXT-H49, "Lvl-2
TEXT-H50, "Lvl-3
TEXT-H51, "Lvl-4
TEXT-H52, "Lvl-5
TEXT-H53, "Lvl-6
TEXT-H75, "Lvl-7
TEXT-H54, "Lvl-8
TEXT-H55, "Lvl-9
TEXT-H56, "Org
TEXT-H57, "Dept-Id
TEXT-H58, "Grade
TEXT-H59, "Ethnic-Cd
TEXT-H60, "Func-Cd
TEXT-H61, "Fam-Cd
TEXT-H62, "Role-Cd
TEXT-H63, "Lvl-Cd
TEXT-H64, "Acct-Cd
TEXT-H71. "Crtd-Dt
WRITE: /(1023) SY-ULINE.
LOOP AT tb_edcor.
WRITE: / tb_edcor-emplid UNDER TEXT-H10,
tb_edcor-payroll_id UNDER TEXT-H11,
tb_edcor-posn_nbr UNDER TEXT-H12,
tb_edcor-name_prefix UNDER TEXT-H13,
tb_edcor-first_name UNDER TEXT-H14,
tb_edcor-initial UNDER TEXT-H74,
tb_edcor-last_name UNDER TEXT-H15,
tb_edcor-suffix UNDER TEXT-H16,
tb_edcor-birthdate UNDER TEXT-H17,
tb_edcor-addr1 UNDER TEXT-H18,
tb_edcor-addr2 UNDER TEXT-H19,
tb_edcor-addr3 UNDER TEXT-H20,
tb_edcor-city UNDER TEXT-H21,
tb_edcor-state UNDER TEXT-H22,
tb_edcor-zip UNDER TEXT-H23,
tb_edcor-country UNDER TEXT-H24,
tb_edcor-home_ph UNDER TEXT-H25,
tb_edcor-email_addr UNDER TEXT-H26,
tb_edcor-wk_addr1 UNDER TEXT-H27,
tb_edcor-wk_addr2 UNDER TEXT-H28,
tb_edcor-wk_addr3 UNDER TEXT-H29,
tb_edcor-wk_city UNDER TEXT-H30,
tb_edcor-wk_state UNDER TEXT-H31,
tb_edcor-wk_zip UNDER TEXT-H32,
tb_edcor-wk_cntry UNDER TEXT-H33,
tb_edcor-wk_ph UNDER TEXT-H34,
tb_edcor-wk_ext UNDER TEXT-H35,
tb_edcor-wk_fax UNDER TEXT-H36,
tb_edcor-mail_stop UNDER TEXT-H37,
tb_edcor-svc_id UNDER TEXT-H38,
tb_edcor-svc_global_id UNDER TEXT-H39,
tb_edcor-hire_dt UNDER TEXT-H40,
tb_edcor-service_dt UNDER TEXT-H41,
tb_edcor-empl_status UNDER TEXT-H42,
tb_edcor-sex UNDER TEXT-H43,
tb_edcor-empl_class UNDER TEXT-H44,
tb_edcor-empl_status_dt UNDER TEXT-H45,
tb_edcor-empl_type UNDER TEXT-H46,
tb_edcor-jobcode UNDER TEXT-H47,
tb_edcor-jobtitle UNDER TEXT-H48,
tb_edcor-level_2 UNDER TEXT-H49,
tb_edcor-level_3 UNDER TEXT-H50,
tb_edcor-level_4 UNDER TEXT-H51,
tb_edcor-level_5 UNDER TEXT-H52,
tb_edcor-level_6 UNDER TEXT-H53,
tb_edcor-level_7 UNDER TEXT-H75,
tb_edcor-level_8 UNDER TEXT-H54,
tb_edcor-level_9 UNDER TEXT-H55,
tb_edcor-org_unit UNDER TEXT-H56,
tb_edcor-deptid UNDER TEXT-H57,
tb_edcor-grade UNDER TEXT-H58,
tb_edcor-ethnic_grp UNDER TEXT-H59,
tb_edcor-func_cd_ko UNDER TEXT-H60,
tb_edcor-fmly_cd_ko UNDER TEXT-H61,
tb_edcor-role_ko UNDER TEXT-H62,
tb_edcor-lvl_ko UNDER TEXT-H63,
tb_edcor-acctg_code_05 UNDER TEXT-H64,
tb_edcor-created_dt UNDER TEXT-H71.
ENDLOOP.
ELSE.
CLEAR SY-UCOMM.
SKIP.
ENDIF.
WHEN 'LEGEND'.
SY-LSIND = 2.
SET PF-STATUS 'WINDOW'.
NEW-PAGE LINE-SIZE 30.
WINDOW STARTING AT 20 1 ENDING AT 55 13.
SKIP.
WRITE:/ 'Descriptor Legend:'.
SKIP.
WRITE:/ 'A1 - Function Code. '
COLOR 2 INTENSIFIED ON INVERSE OFF.
WRITE:/ 'A2 - Family Code. '
COLOR 1 INTENSIFIED ON INVERSE OFF.
WRITE:/ 'A3 - Role Code. '
COLOR 2 INTENSIFIED ON INVERSE OFF.
WRITE:/ 'CO - Country Code. '
COLOR 1 INTENSIFIED ON INVERSE OFF.
WRITE:/ 'EC - Sex Code. '
COLOR 2 INTENSIFIED ON INVERSE OFF.
WRITE:/ 'EMC - Employee Class Code. '
COLOR 1 INTENSIFIED ON INVERSE OFF.
WRITE:/ 'ES - Employee Status Code.'
COLOR 2 INTENSIFIED ON INVERSE OFF.
WRITE:/ 'ET - Employee Type Code. '
COLOR 1 INTENSIFIED ON INVERSE OFF.
WRITE:/ 'JC - Job Code. '
COLOR 2 INTENSIFIED ON INVERSE OFF.
WRITE:/ 'L9 - Org Code. '
COLOR 1 INTENSIFIED ON INVERSE OFF.
WRITE:/ 'L10 - Deptartment Code. '
COLOR 2 INTENSIFIED ON INVERSE OFF.
WRITE:/ 'L12 - Ethnic Code. '
COLOR 1 INTENSIFIED ON INVERSE OFF.
WRITE:/ 'PC - Position Code. '
COLOR 2 INTENSIFIED ON INVERSE OFF.
WRITE:/ 'ST - State Abbreviation. '
COLOR 1 INTENSIFIED ON INVERSE OFF.
WHEN 'CANC'.
SY-LSIND = SY-LSIND - 2.
ENDCASE.
----
FORM Continue_Process *
----
FORM Continue_Process.
*Get Employee Status and Date Status last Changed
empl_status_chg = 'N'.
WHILE empl_status_chg = 'N'.
new_end_dt = P0000-begda - 1.
rp-provide-from-last p0000 space '01/01/1900' new_end_dt.
IF pnp-sw-found = 1.
IF P0000-stat2 <> tb_edcor-empl_status.
empl_status_chg = 'Y'.
endif.
CASE P0000-stat2.
WHEN '3'.
tb_edcor-empl_status = 'A'.
WHEN '2'.
tb_edcor-empl_status = 'R'.
WHEN '1'.
tb_edcor-empl_status = 'I'.
WHEN OTHERS.
tb_edcor-empl_status = 'W'.
ENDCASE.
PERFORM CHANGE_DATE_FORMAT USING P0000-begda
CHANGING tb_edcor-empl_status_dt.
ELSE.
empl_status_chg = 'Y'.
ENDIF.
ENDWHILE.
WRITE: / 'empl_status_chg ', empl_status_chg,
/ 'tb_edcor-empl_status ', tb_edcor-empl_status,
/ 'tb_edcor-empl_status_dt ', tb_edcor-empl_status_dt.
Get Position, Employee Type, Job, and Org Unit
rp-provide-from-last P0001 space conv_begda pn-endda.
IF pnp-sw-found eq '1'.
tb_edcor-posn_nbr = P0001-plans.
tb_edcor-empl_type = P0001-persk.
tb_edcor-jobcode = P0001-stell.
tb_edcor-org_unit = P0001-orgeh.
org_unit = P0001-orgeh.
CONCATENATE p0001-persg P0001-persk INTO tb_edcor-empl_class.
PERFORM get_object_text(Y20530RXLAT)
USING 'C' P0001-stell sy-datum
CHANGING tb_edcor-jobtitle.
ENDIF.
WRITE: / 'tb_edcor-posn_nbr ', tb_edcor-posn_nbr,
/ 'tb-edcor-empl_type ', tb_edcor-empl_type,
/ 'tb_edcor-jobcode ', tb_edcor-jobcode,
/ 'tb_edcor-org_unit ', tb_edcor-orgunit,
/ 'tb_edcor-jobtitle ', tb_edcor-jobtitle,
Get Employee Name, Address, and Gender
rp-provide-from-last p0002 space conv_begda pn-endda.
IF pnp-sw-found eq '1'.
char25 = P0002-vorna.
tb_edcor-first_name = char25.
char25 = P0002-midnm.
tb_edcor-initial = char25.
char25 = P0002-nachn.
tb_edcor-last_name = char25.
tb_edcor-sex = P0002-gesch.
PERFORM CHANGE_DATE_FORMAT USING P0002-gbdat
CHANGING tb_edcor-birthdate.
IF p0002-titl2 is INITIAL.
formofaddress = P0002-anred.
PERFORM re522t USING formofaddress
CHANGING nameofformofaddress.
tb_edcor-name_prefix = nameofformofaddress.
ELSE.
tb_edcor-name_prefix = P0002-titl2.
ENDIF.
ENDIF.
WRITE: / 'tb_edcor-first_name ', tb_edcor-first_name,
/ 'tb_edcor-initial ', tb_edcor-initial,
/ 'tb_edcor-last_name ', tb_edcor-last_name,
/ 'tb_edcor-sex ', tb_edcor-sex,
/ 'tb_edcor-name_prefix ', tb_edcor-name_prefix.
PERFORM Get-Address.
Get Employee Grade
rp-provide-from-last P0008 space conv_begda pn-endda.
IF pnp-sw-found eq '1'.
tb_edcor-grade = P0008-trfgr.
ENDIF.
WRITE: / 'tb_edcor-grade ', tb_edcor-grade.
Get Employee SSN
rp-provide-from-last P0033 'ZVEN' conv_begda pn-endda.
IF pnp-sw-found eq '1'.
tb_edcor-emplid = P0033-zzven.
ENDIF.
WRITE: / 'tb_edcor-emplid ', tb_edcor-emplid.
Get Employee Hire Date and Service Date
rp-provide-from-last P0041 space conv_begda pn-endda.
IF pnp-sw-found eq '1'.
DO 12 times VARYING dar FROM P0041-dar01 NEXT P0041-dar02
VARYING dat FROM P0041-dat01 NEXT P0041-dat02.
IF dar is initial.
exit.
ELSE.
CASE dar.
WHEN '01'.
PERFORM CHANGE_DATE_FORMAT USING dat
CHANGING tb_edcor-hire_dt.
WHEN '02'.
PERFORM CHANGE_DATE_FORMAT USING dat
CHANGING tb_edcor-service_dt.
ENDCASE.
ENDIF.
ENDDO.
ENDIF.
WRITE: / 'tb_edcor-hire_dt ', tb_edcor-hire_dt,
/ 'tb_edcor-service_dt ', tb_edcor-service_dt.
Get Employee Ethnic Group
rp-provide-from-last P0077 space conv_begda pn-endda.
IF pnp-sw-found = '1'.
tb_edcor-ethnic_grp = P0077-racky.
ENDIF.
WRITE: /'E-Mail Pernr', tb_edcor-payroll_id.
rp-provide-from-last P0105 '9009' conv_begda pn-endda.
IF pnp-sw-found = '1'.
***Start Of Change By A21669 --- V# 207511/CR 39976 - 11/24/2003
IF P0105-usrid_long IS INITIAL.
rp-provide-from-last P0105 '0010' conv_begda pn-endda.
IF pnp-sw-found = '1'.
WRITE: /'E-Mail 0010 ', tb_edcor-payroll_id,
pnp-sw-found,
P0105-usrid_long.
tb_edcor-email_addr = P0105-usrid_long.
ENDIF.
ELSE.
***End Of Change By A21669 --- V# 207511/CR 39976 - 11/24/2003
tb_edcor-email_addr = P0105-usrid_long.
WRITE: /'E-Mail 9009 ', tb_edcor-payroll_id,
pnp-sw-found,
P0105-usrid_long.
***Start Of Change By A20881 --- V# 207511/CR 39976 - 11/24/2003
ENDIF.
ELSE.
rp-provide-from-last P0105 '0010' conv_begda pn-endda.
IF pnp-sw-found = '1'.
WRITE: /'E-Mail 0010 ', tb_edcor-payroll_id,
pnp-sw-found,
P0105-usrid_long.
tb_edcor-email_addr = P0105-usrid_long.
ENDIF.
***End Of Change By A20881 --- V# 207511/CR 39976 - 11/24/2003
ENDIF.
WRITE: / 'tb_edcor-ethnic_grp ', tb_edcor-ethnic_grp,
/ 'tb_edcor-email_addr ', tb_edcor-email_addr.
PERFORM Get-Supervisor-Info.
PERFORM Get-FFRL.
PERFORM Get-Cost-Center.
Get Employee's Organization Structure
IF s_ex1 = 'X'.
PERFORM Get_Org_Levels.
ELSEIF s_ex2 = 'X'.
PERFORM Get_Grp_Div_Org.
ENDIF.
ENDFORM.
----
FORM Load_Descriptor_File *
----
FORM Load_Descriptor_File.
Initialize tb_descr with tab characters.
w_cnt = 1.
WHILE w_cnt LE 2.
assign_fld w_cnt 'TB_DESCR-TAB' <tb>.
<tb> = '09'.
w_cnt = w_cnt + 1.
ENDWHILE.
Load Country Codes ('CO') Into Descr Table
SELECT land1 landx
INTO (code, desc)
FROM T005T
WHERE spras = sy-langu.
tb_descr-rec_type = 'CO'.
tb_descr-rec_code = code.
tb_descr-rec_desc = desc.
APPEND tb_descr.
ENDSELECT.
Load State Codes ('ST') Into Descr Table
SELECT bland bezei
INTO (code, desc)
FROM T005U
WHERE spras = sy-langu.
tb_descr-rec_type = 'ST'.
tb_descr-rec_code = code.
tb_descr-rec_desc = desc.
APPEND tb_descr.
ENDSELECT.
Load Func Codes ('A1') Into Descr Table
SELECT zzfun zzfuntxt
INTO (code, desc)
FROM YHRFFRLFUN
WHERE sprsl = sy-langu.
tb_descr-rec_type = 'A1'.
tb_descr-rec_code = code.
tb_descr-rec_desc = desc.
APPEND tb_descr.
ENDSELECT.
Load Fmly Codes ('A2') Into Descr Table
SELECT zzfam zzfamtxt
INTO (code, desc)
FROM YHRFFRLFAM
WHERE sprsl = sy-langu.
tb_descr-rec_type = 'A2'.
tb_descr-rec_code = code.
tb_descr-rec_desc = desc.
APPEND tb_descr.
ENDSELECT.
Load Role Codes ('A3') Into Descr Table
SELECT zzrol zzroltxt
INTO (code, desc)
FROM YHRFFRLROL
WHERE sprsl = sy-langu.
tb_descr-rec_type = 'A3'.
tb_descr-rec_code = code.
tb_descr-rec_desc = desc.
APPEND tb_descr.
ENDSELECT.
Load Empl Status Codes ('ES') Into Descr Table
SELECT statv text1
INTO (code, desc)
FROM T529U
WHERE sprsl = sy-langu
AND statn = 2.
tb_descr-rec_type = 'ES'.
desc1 = desc.
tb_descr-rec_code = desc1.
tb_descr-rec_desc = desc.
APPEND tb_descr.
ENDSELECT.
Load Sex Codes ('EC') Into Descr Table
tb_descr-rec_type = 'EC'.
tb_descr-rec_code = ' '.
tb_descr-rec_desc = 'UNKNOWN'.
APPEND tb_descr.
tb_descr-rec_type = 'EC'.
tb_descr-rec_code = '2'.
tb_descr-rec_desc = 'FEMALE'.
APPEND tb_descr.
tb_descr-rec_type = 'EC'.
tb_descr-rec_code = '1'.
tb_descr-rec_desc = 'MALE'.
APPEND tb_descr.
Load Empl Class Codes ('EMC') Into Descr Table
SELECT T503Zpersg T503Zpersk T501Tptext T503Tptext
INTO (code, code2, desc, desc2)
FROM ( T503Z INNER JOIN T501T ON T503Zpersg = T501Tpersg
INNER JOIN T503T ON T503Zpersk = T503Tpersk )
WHERE T503Z~molga = '10'
AND T501T~sprsl = 'EN'
AND T503T~sprsl = 'EN'.
CONCATENATE code code2 INTO persgsk.
CONCATENATE desc desc2 INTO pgpktxt.
tb_descr-rec_type = 'EMC'.
tb_descr-rec_code = persgsk.
tb_descr-rec_desc = pgpktxt.
APPEND tb_descr.
ENDSELECT.
Load Empl Type Codes ('ET') Into Descr Table
SELECT T503Kpersk T503Tptext
INTO (code, desc)
FROM ( T503K INNER JOIN T503T ON T503Kpersk = T503Tpersk )
WHERE T503T~sprsl = 'EN'.
tb_descr-rec_type = 'ET'.
tb_descr-rec_code = code.
tb_descr-rec_desc = desc.
APPEND tb_descr.
ENDSELECT.
Load Org Codes ('L9') Into Descr Table
SELECT objid stext
INTO (code, desc)
FROM HRP1000
WHERE plvar = '01'
AND otype = 'O'
AND istat = '1'
AND langu = sy-langu
AND infty = '1000'
AND begda <= sy-datum
AND endda > sy-datum
ORDER BY objid ASCENDING.
tb_descr-rec_type = 'L09'.
tb_descr-rec_code = code.
tb_descr-rec_desc = desc.
APPEND tb_descr.
ENDSELECT.
Load Dept Codes ('L10') Into Descr Table
SELECT kostl ktext datbi
FROM CSKT
INTO (code, desc, chkdate)
WHERE spras = sy-langu
AND datbi <= sy-datum
ORDER BY kostl ASCENDING datbi DESCENDING.
tb_hold-hold_code = code.
tb_hold-hold_desc = desc.
tb_hold-hold_date = chkdate.
APPEND tb_hold.
ENDSELECT.
CLEAR h_index.
WHILE sy-subrc = 0.
h_index = h_index + 1.
READ TABLE tb_hold INDEX h_index.
IF h_index = 1.
code = tb_hold-hold_code.
desc = tb_hold-hold_desc.
chkdate = tb_hold-hold_date.
tb_descr-rec_type = 'L10'.
tb_descr-rec_code = tb_hold-hold_code.
tb_descr-rec_desc = tb_hold-hold_desc.
APPEND tb_descr.
ELSEIF tb_hold-hold_code <> code.
code = tb_hold-hold_code.
desc = tb_hold-hold_desc.
chkdate = tb_hold-hold_date.
tb_descr-rec_type = 'L10'.
tb_descr-rec_code = tb_hold-hold_code.
tb_descr-rec_desc = tb_hold-hold_desc.
APPEND tb_descr.
ENDIF.
ENDWHILE.
Load Ethnic Codes ('L12') Into Descr Table
SELECT racky ltext
INTO (code, desc)
FROM T505S
WHERE sprsl = sy-langu
AND molga = 10.
tb_descr-rec_type = 'L12'.
tb_descr-rec_code = code.
tb_descr-rec_desc = desc.
APPEND tb_descr.
ENDSELECT.
Load Position Codes ('PC') Into Descr Table
SELECT objid stext
INTO (code, desc)
FROM HRP1000
WHERE plvar = '01'
AND otype = 'S'
AND istat = '1'
AND langu = 'EN'
AND begda <= sy-datum
AND endda > sy-datum
ORDER BY objid ASCENDING.
tb_descr-rec_type = 'PC'.
tb_descr-rec_code = code.
tb_descr-rec_desc = desc.
APPEND tb_descr.
ENDSELECT.
Load Job Codes ('JC') Into Descr Table
SELECT objid stext
INTO (code, desc)
FROM HRP1000
WHERE plvar = '01'
AND otype = 'C'
AND istat = '1'
AND langu = 'EN'
AND begda <= sy-datum
AND endda > sy-datum
ORDER BY objid ASCENDING.
tb_descr-rec_type = 'JC'.
tb_descr-rec_code = code.
tb_descr-rec_desc = desc.
APPEND tb_descr.
ENDSELECT.
Did Descr Table Load Correctly?
LOOP AT tb_descr.
WRITE: / 'tb_descr: ', tb_descr-rec_type, tb_descr-rec_code,
tb_descr-rec_desc.
ENDLOOP.
*Sort Desc File
SORT tb_descr ASCENDING BY rec_type rec_code.
COLLECT tb_descr.
ENDFORM.
----
FORM Get-Address *
----
FORM Get-Address.
CALL FUNCTION 'Y_HR_DECODE_ADDRESS'
TABLES
i0006 = P0006
EXCEPTIONS
invalid_91_yybuild = 1
OTHERS = 2.
LOOP AT P0006.
IF P0006-subty = '1 '.
tb_edcor-addr1 = P0006-stras.
tb_edcor-addr2 = P0006-locat.
tb_edcor-city = P0006-ort01.
tb_edcor-state = P0006-state.
tb_edcor-zip = P0006-pstlz.
tb_edcor-country = P0006-land1.
ELSEIF P0006-subty = '91 '.
tb_edcor-wk_addr1 = P0006-stras.
tb_edcor-wk_addr2 = P0006-locat.
tb_edcor-wk_city = P0006-ort01.
tb_edcor-wk_state = P0006-state.
tb_edcor-wk_zip = P0006-pstlz.
tb_edcor-wk_cntry = P0006-land1.
tb_edcor-wk_ph = P0006-yyoffph.
tb_edcor-mail_stop = P0006-yymailc.
ENDIF.
ENDLOOP.
WRITE: / 'tb_edcor-addr1 ', tb_edcor-addr1,
/ 'tb_edcor-addr2 ', tb_edcor-addr2,
/ 'tb_edcor-city ', tb_edcor-city,
/ 'tb_edcor-state ', tb_edcor-state,
/ 'tb_edcor-zip ', tb_edcor-zip ,
/ 'tb_edcor-country ', tb_edcor-country,
/ 'tb_edcor-wk_addr1 ', tb_edcor-wk_addr1,
/ 'tb_edcor-wk_addr2 ', tb_edcor-wk_addr2,
/ 'tb_edcor-wk_city ', tb_edcor-wk_city,
/ 'tb_edcor-wk_state ', tb_edcor-wk_state,
/ 'tb_edcor-wk_zip ', tb_edcor-wk_zip ,
/ 'tb_edcor-wk_cntry ', tb_edcor-wk_cntry,
/ 'tb_edcor-wk_ph ', tb_edcor-wk_ph,
/ 'tb_edcor-mail_stop ', tb_edcor-mail_stop.
ENDFORM.
----
FORM Get-Supervisor-Info *
----
FORM Get-Supervisor-Info.
Get Employee's Supervisor Personnel Id
CLEAR objects.
REFRESH objects.
CLEAR relate1.
REFRESH relate1.
tb_edcor-svc_global_id = ' '.
svc_pernr = 0.
IF P0001-plans IS INITIAL.
ELSE.
objects-plvar = '01'.
objects-otype = 'S'.
objects-objid = P0001-plans.
APPEND objects.
CALL FUNCTION 'RH_READ_INFTY_1001'
EXPORTING
istat = '1'
subty = 'A002'
begda = pn-begda
endda = pn-endda
TABLES
i1001 = relate1
objects = objects
EXCEPTIONS
nothing_found = 1
wrong_condition = 2
OTHERS = 3.
IF sy-subrc = 0.
READ TABLE relate1 INDEX 1.
IF sy-subrc = 0.
CLEAR objects.
REFRESH objects.
CLEAR relate2.
REFRESH relate2.
objects-plvar = '01'.
objects-otype = 'S'.
objects-objid = relate1-sobid.
APPEND objects.
CALL FUNCTION 'RH_READ_INFTY_1001'
EXPORTING
istat = '1'
subty = 'A008'
begda = pn-begda
endda = pn-endda
TABLES
i1001 = relate2
objects = objects
EXCEPTIONS
nothing_found = 1
wrong_condition = 2
OTHERS = 3.
IF sy-subrc = 0.
READ TABLE relate2 INDEX 1.
IF sy-subrc = 0.
tb_edcor-svc_global_id = relate2-sobid.
svc_pernr = relate2-sobid.
condense svc_pernr.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
WRITE: / 'emp first_name ', tb_edcor-first_name,
/ 'emp last_name ', tb_edcor-last_name,
/ 'svc pernr-text ', tb_edcor-svc_global_id,
/ 'svc_pernr-num ', svc_pernr.
Get Supervisor Logon Id IF Supervisor Id was found.
IF svc_pernr = 0.
ELSE.
CLEAR tb0033.
REFRESH tb0033.
tb_edcor-svc_id = ' '.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
PERNR = svc_pernr
INFTY = '0033'
BEGDA = pn-begda
ENDDA = pn-endda
TABLES
INFTY_TAB = tb0033
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2.
READ TABLE tb0033 WITH KEY subty = 'ZVEN'.
IF sy-subrc = 0.
tb_edcor-svc_id = tb0033-zzven.
ENDIF.
ENDIF.
WRITE: / 'tb_edcor-emplid ', tb_edcor-emplid,
/ 'tb_edcor-payroll_id ', tb_edcor-payroll_id,
/ 'P0001-plans ', P0001-plans,
/ 'relate1-sobid ', relate1-sobid,
/ 'relate2-sobid ', relate2-sobid,
/ 'svc_pernr ', svc_pernr,
/ 'tb_edcor-svc_id ', tb_edcor-svc_id.
ENDFORM.
----
FORM Get-FFRL *
----
FORM Get-FFRL.
Get Employee' Job Function, Family, Role, Level
CLEAR objects.
REFRESH objects.
CLEAR tb9101.
REFRESH tb9101.
IF P0001-stell IS INITIAL.
ELSE.
objects-plvar = '01'.
objects-otype = 'C'.
objects-objid = P0001-stell.
APPEND objects.
CALL FUNCTION 'RH_READ_INFTY_NNNN'
EXPORTING
infty = '9101'
TABLES
innnn = tb9101
objects = objects
EXCEPTIONS
nothing_found = 1
wrong_condition = 2
infotyp_not_supported = 3
OTHERS = 4.
IF sy-subrc = 0.
LOOP AT tb9101 WHERE begda <= sy-datum AND endda >= sy-datum.
IF sy-subrc = 0.
tb_edcor-func_cd_ko = tb9101-zzfun.
tb_edcor-fmly_cd_ko = tb9101-zzfam.
tb_edcor-role_ko = tb9101-zzrol.
tb_edcor-lvl_ko = tb9101-zzlvl.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
WRITE: /'tb_edcor-func,fam,role,lvl: ', P0002-pernr, ' ',
tb_edcor-func_cd_ko, ' ',
tb_edcor-fmly_cd_ko, ' ',
tb_edcor-role_ko, ' ',
tb_edcor-lvl_ko.
ENDFORM.
----
FORM Get-Cost-Center *
----
FORM Get-Cost-Center.
Get Employee's Cost Center (or Department for FTN or MMC)
IF P0001-kostl IS INITIAL.
objects-plvar = '01'.
objects-otype = 'S'.
objects-objid = P0001-plans.
APPEND objects.
CALL FUNCTION 'RH_READ_INFTY_NNNN'
EXPORTING
infty = '9070'
TABLES
innnn = tb9070
objects = objects
EXCEPTIONS
nothing_found = 1
wrong_condition = 2
infotyp_not_supported = 3
OTHERS = 4.
IF sy-subrc = 0.
LOOP AT tb9070 WHERE begda <= sy-datum AND endda >= sy-datum.
IF sy-subrc = 0.
tb_edcor-deptid = P9070-zdeptidccf.
ELSE.
PERFORM Get_9047_Location.
ENDIF.
ENDLOOP.
ENDIF.
ELSE.
tb_edcor-deptid = P0001-kostl.
ENDIF.
WRITE: /'tb_edcor-deptid: ',
P0002-pernr, ' ',
P0001-plans, ' ',
tb_edcor-deptid.
ENDFORM.
----
FORM Get_9047_Location
----
FORM Get_9047_Location.
rp-provide-from-last P9047 space conv_begda pn-endda.
IF pnp-sw-found = '1'.
tb_edcor-deptid = P9047-bukr2.
ENDIF.
ENDFORM.
----
FORM UPLOADDATA *
----
--> tb_inssn *
--> pfile *
----
FORM UPLOADDATA TABLES tb_inssn
USING pfile TYPE c.
DATA: cfiletype(3) TYPE c.
DATA: tempd(10) TYPE c.
cfiletype = 'ASC'.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = pfile
filetype = cfiletype
TABLES
data_tab = tb_inssn
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM.
----
FORM DOWNLOADDATA
*
----
--> tb_table *
--> pfile *
----
FORM DOWNLOADDATA TABLES tb_table
USING pfile TYPE c.
DATA: cfiletype(3) TYPE c.
cfiletype = 'ASC'.
IF s_ex3 = 'X'.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = pfile
filetype = cfiletype
TABLES
data_tab = tb_table
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
Start of changes by os0784 for CR 61127 on 17.08.07
OPEN DATASET PFILE FOR OUTPUT IN TEXT MODE.
OPEN DATASET PFILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
End of changes by os0784 for CR 61127 on 17.08.2007
LOOP AT tb_table.
TRANSFER tb_table to pfile.
ENDLOOP.
IF sy-subrc = 0.
message s398 WITH pfile(25) 'created on Unix server'.
ELSE.
message s398 WITH pfile(25) 'cannot be created'.
ENDIF.
CLOSE DATASET pfile.
ENDIF.
ENDFORM.
----
FORM RE522T *
----
--> P_ANRED *
--> P_NAMEOFFORMOFADDRESS
----
FORM re522t USING p_anred
CHANGING p_nameofformofaddress.
IF p_anred NE t522t-anred.
SELECT single *
FROM t522t
WHERE sprsl = sy-langu
AND anred = p_anred .
IF sy-subrc ne 0.
CLEAR t522t.
ENDIF.
ENDIF.
p_nameofformofaddress = t522t-anrlt.
ENDFORM.
----
FORM get_obj_text *
----
Passed an object ID (assumed to be an ORG UNIT), this returns the *
name of the org unit from HRP1000. *
----
--> pobjid - Org Unit Id *
--> ppstat - ISTAT value *
<-- ptext - Org Unit Name *
----
FORM get_obj_text USING pobjid TYPE hrobjid
ppstat LIKE hrp1001-istat
CHANGING ptext.
DATA: lotext LIKE p1000-stext.
CLEAR lotext.
IF NOT pobjid IS INITIAL.
CALL FUNCTION 'HR_READ_FOREIGN_OBJECT_TEXT'
EXPORTING
otype = 'O'
objid = pobjid
status = ppstat
reference_date = sy-datum
IMPORTING
object_text = lotext
EXCEPTIONS
nothing_found = 1
wrong_objecttype = 2
missing_costcenter_data = 3
missing_object_id = 4
OTHERS = 5.
IF sy-subrc <> 0.
CLEAR lotext.
ENDIF.
ENDIF.
ptext = lotext.
ENDFORM.
&----
*& Form CHANGE_DATE_FORMAT
&----
text
----
-->DATE text
<--RDATE text
----
FORM CHANGE_DATE_FORMAT USING value(DATE)
CHANGING value(RDATE).
IF NOT date is initial.
CONCATENATE DATE4(2) '/' DATE6(2) '/' DATE+2(2)
INTO RDATE.
ELSE.
CLEAR RDATE.
ENDIF.
ENDFORM.
----
FORM GET_FILENAME *
----
........ *
----
--> OTYPE *
--> fname *
----
FORM get_filename USING otype fname.
filename = ' '.
CASE otype.
WHEN 'D'.
ASSIGN 'Edcor Desc File '(009) TO <titlename>.
CONCATENATE ',' 'Edcor Desc File'(008) '(.DAT),.DAT.' INTO mask.
WHEN 'E'.
ASSIGN 'Edcor Data File '(010) TO <titlename>.
CONCATENATE ',' 'Edcor Data File'(008) '(.DAT),.DAT.' INTO mask.
ENDCASE.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = filename
def_path = filepath
mask = mask
mode = 'O'
title = <titlename>
IMPORTING
filename = filename
EXCEPTIONS
inv_winsys = 01
no_batch = 02
selection_cancel = 03
selection_error = 04.
IF sy-subrc NE 0.
CASE sy-subrc.
WHEN 1.
CALL FUNCTION 'WS_MSG' "inv_winsys
EXPORTING
msg_type = 'A'
text = text-e01
titl = text-t01.
WHEN 2. "no-batch
CALL FUNCTION 'WS_MSG'
EXPORTING
msg_type = 'E'
text = text-e02
titl = text-t01.
WHEN 3. "selection cancel
CALL FUNCTION 'WS_MSG'
EXPORTING
msg_type = 'I'
text = text-e03
titl = text-t01.
WHEN 4. "selection error
CALL FUNCTION 'WS_MSG'
EXPORTING
msg_type = 'A'
text = text-e04
titl = text-t01.
ENDCASE.
ELSE.
fname = filename.
ENDIF.
ENDFORM. " GET_FILENAME
----
FORM GET_ORG_LEVELS *
----
........ *
----
--> OTYPE *
--> fname *
----
FORM Get_Org_Levels.
REFRESH tb_org_levels.
CALL FUNCTION 'Y_HR_GET_N_LEVELS'
EXPORTING
ORG_UNIT = org_unit
IMPORTING
TOT_ORG_LVLS = tot_org_lvls
TABLES
TB_ORG_LEVELS = tb_org_levels
EXCEPTIONS
too_many_iterations = 1
OTHERS = 2.
IF sy-subrc > 1.
WRITE: 'BAD RETURN FROM GETTING ORG LEVELS TABLE'.
ENDIF.
WRITE: /'TB_EDCOR-EMPLID ', tb_edcor-emplid.
LOOP AT tb_org_levels.
WRITE: /'returned_org_levels: ', tb_org_levels-zzlevel,
tb_org_levels-objid,
tb_org_levels-stext.
ENDLOOP.
lvl_cnt = 0.
company = ' '.
LOOP AT tb_org_levels.
lvl_cnt = lvl_cnt + 1.
CASE lvl_cnt.
WHEN 1.
tb_edcor-level_2 = TB_ORG_LEVELS-OBJID.
WHEN 2.
IF TB_ORG_LEVELS-OBJID is INITIAL.
tb_edcor-level_3 = tb_edcor-level_2.
ELSE .
tb_edcor-level_3 = TB_ORG_LEVELS-OBJID.
ENDIF.
WHEN 3.
IF TB_ORG_LEVELS-OBJID is INITIAL.
tb_edcor-level_4 = tb_edcor-level_3.
ELSE .
tb_edcor-level_4 = TB_ORG_LEVELS-OBJID.
ENDIF.
WHEN 4.
IF TB_ORG_LEVELS-OBJID is INITIAL.
tb_edcor-level_5 = tb_edcor-level_4.
ELSE .
tb_edcor-level_5 = TB_ORG_LEVELS-OBJID.
ENDIF.
WHEN 5.
IF TB_ORG_LEVELS-OBJID is INITIAL.
tb_edcor-level_6 = tb_edcor-level_5.
ELSE .
tb_edcor-level_6 = TB_ORG_LEVELS-OBJID.
ENDIF.
WHEN 6.
IF TB_ORG_LEVELS-OBJID is INITIAL.
tb_edcor-level_7 = tb_edcor-level_6.
ELSE .
tb_edcor-level_7 = TB_ORG_LEVELS-OBJID.
ENDIF.
WHEN 7.
IF TB_ORG_LEVELS-OBJID is INITIAL.
tb_edcor-level_8 = tb_edcor-level_7.
ELSE .
tb_edcor-level_8 = TB_ORG_LEVELS-OBJID.
ENDIF.
WHEN 8.
IF TB_ORG_LEVELS-OBJID is INITIAL.
tb_edcor-level_9 = tb_edcor-level_8.
ELSE .
tb_edcor-level_9 = TB_ORG_LEVELS-OBJID.
ENDIF.
ENDCASE.
ENDLOOP.
IF tb_edcor-level_2 =''.
tb_edcor-level_2 = company.
ENDIF.
IF tb_edcor-level_3 = ''.
tb_edcor-level_3 = tb_edcor-level_2.
ENDIF.
IF tb_edcor-level_4 = ''.
tb_edcor-level_4 = tb_edcor-level_3.
ENDIF.
IF tb_edcor-level_5 = ''.
tb_edcor-level_5 = tb_edcor-level_4.
ENDIF.
IF tb_edcor-level_6 = ''.
tb_edcor-level_6 = tb_edcor-level_5.
ENDIF.
IF tb_edcor-level_7 = ''.
tb_edcor-level_7 = tb_edcor-level_6.
ENDIF.
IF tb_edcor-level_8 = ''.
tb_edcor-level_8 = tb_edcor-level_7.
ENDIF.
IF tb_edcor-level_9 = ''.
tb_edcor-level_9 = tb_edcor-level_8.
ENDIF.
WRITE: /'FORM Get_Org_Levels ', tb_edcor-payroll_id, tb_edcor-emplid,
/ 'tb_edcor-level_2 ', tb_edcor-level_2,
/ 'tb_edcor-level_3 ', tb_edcor-level_3,
/ 'tb_edcor-level_4 ', tb_edcor-level_4,
/ 'tb_edcor-level_5 ', tb_edcor-level_5,
/ 'tb_edcor-level_6 ', tb_edcor-level_6,
/ 'tb_edcor-level_7 ', tb_edcor-level_7,
/ 'tb_edcor-level_8 ', tb_edcor-level_8,
/ 'tb_edcor-level_9 ', tb_edcor-level_9.
APPEND tb_edcor.
CLEAR tb_edcor.
ENDFORM.
----
FORM GET_GRP_DIV_ORG
*
----
FORM Get_Grp_Div_Org.
Get parent orgs (group, division, sub) using context.
SUPPLY
orgid = p0001-orgeh
begda = pn-begda
TO CONTEXT ctx_orgs.
DEMAND
group = tb_edcor-level_2
division = tb_edcor-level_3
child1 = tb_edcor-level_4
child2 = tb_edcor-level_5
child3 = tb_edcor-level_6
child3 = tb_edcor-level_7
child3 = tb_edcor-level_8
child3 = tb_edcor-level_9
FROM CONTEXT ctx_orgs.
WRITE: /'FORM Get_Grp_Div_Org ',tb_edcor-payroll_id, tb_edcor-emplid,
/ 'tb_edcor-level_2 ', tb_edcor-level_2,
/ 'tb_edcor-level_3 ', tb_edcor-level_3,
/ 'tb_edcor-level_4 ', tb_edcor-level_4,
/ 'tb_edcor-level_5 ', tb_edcor-level_5,
/ 'tb_edcor-level_6 ', tb_edcor-level_6,
/ 'tb_edcor-level_7 ', tb_edcor-level_7,
/ 'tb_edcor-level_8 ', tb_edcor-level_8,
/ 'tb_edcor-level_9 ', tb_edcor-level_9.
APPEND tb_edcor.
CLEAR tb_edcor.
ENDFORM.
&----
*& Form NOQUOTES
&----
text
this routine removes quotes(") in the input field and returns it.
----
-->P_IN text
----
FORM NOQUOTES
USING P_IN
CHANGING P_OUT.
Removes begin and end quotes from string.
DATA: CTEMP(80) TYPE C, ILEN TYPE I.
CTEMP = P_IN.
ILEN = STRLEN( CTEMP ).
REPLACE '"' WITH '' INTO CTEMP LENGTH ILEN.
REPLACE '"' WITH '' INTO CTEMP LENGTH ILEN.
CONDENSE CTEMP.
P_OUT = CTEMP.
ENDFORM.
Regards,
Radhika
‎2007 Oct 02 1:03 PM
hi
good
if you want to make the STRLEN unicode compatrible than i would suggest you to go for service.sap.com and try to find out the alternative of that particular statement.
thanks
mrutyun^