Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Regarding Function Module Execution

sreeramkumar_madisetty
Active Contributor
0 Likes
1,688

Hi Friends

I am using the FM: ARCHIVFILE_SERVER_TO_CLIEN.

With the parameters:

Path = /tmp/TEST EMP COMP COE ECM_MB_07.txt

And target Path = c:\Bonusbudget\TEST EMP COMP COE ECM_MB_07.txt

While executing this FM , if I checked the uppercase/lower case checkbox, I am getting the proper results otherwise I am getting the error that:

Error in opening file /TMP/TEST EMP COMP COE ECM_MB_07.TXT for reading (No such file or directory).

As I am calling this in my program and getting the above error.

Can anyone please suggest me the solution for this.

Points are assured for useful answers.

Regards,

Sreeram

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,287

Hi,

You are presumably running SAP on unix, and as unix files are case sensitive it considers /TMP/TEST EMP COMP COE ECM_MB_07.TXT and /tmp/TEST EMP COMP COE ECM_MB_07.txt to be different.

As far as unix is concerned /tmp is different from /TMP

Regards,

Nick

8 REPLIES 8
Read only

Former Member
0 Likes
1,288

Hi,

You are presumably running SAP on unix, and as unix files are case sensitive it considers /TMP/TEST EMP COMP COE ECM_MB_07.TXT and /tmp/TEST EMP COMP COE ECM_MB_07.txt to be different.

As far as unix is concerned /tmp is different from /TMP

Regards,

Nick

Read only

0 Likes
1,287

Hi Nick

Thanks for the Response.

By seeing the error description I have understand the problem.

To resolve this can you/anyone please suggest me the solution.

Regards,

Sree

Read only

0 Likes
1,287

Hi,

You don't mention where the file name is coming from in your program, if it is a selection screen parameter you will need to add the option LOWER CASE. Otherwise you need to receive and process the file name without changing the case, and not knowing your program I can't be more specific.

Regards,

Nick

Read only

0 Likes
1,287

Hi Nick

Thanks.

See my code to correct:

      • VARIABLE DECLARATION

DATA: lv_single_line TYPE string, "To split the file contents

lv_objid TYPE hrobjid, "Holds the Org Unit ID

p_file TYPE rlgrap-filename,"File from Application Server

lv_file_budget TYPE string. "Source File Name

DATA: it_orgunit TYPE hap_t_hrsobid , " Id of Org. unit

it_suborgunits TYPE hap_t_hrsobid , " Ids of Sub Org Units

wa_orgunit TYPE LINE OF hap_t_hrsobid ," Work Area of orgunit

lv_sobid TYPE hrp1001-sobid , " Org. Unit

lv_stext TYPE stext, "Org.Unit Description

lv_user TYPE sy-uname , "User

lv_afile TYPE epsf-epsfilnam, "Application Server file name

lv_objid1 TYPE hrobjid, "Holds the Org Unit ID

lv_uzeit TYPE syuzeit, "Application Server's time

lv_tpath TYPE sapb-sappfad, "Target Path on the Desktop

lv_spath type SAPB-SAPPFAD. "Source File

          • CONSTANTS DECLARATION

CONSTANTS: c_split(5) TYPE c VALUE ' ', " File spliting indicator

c_rsign TYPE rsign VALUE 'A', "Relationship Indicator

c_relat TYPE relat VALUE '300',"Relation ship

  • c_file(255) TYPE c VALUE '/tmp/Bonusfile3.txt',

c_file(255) TYPE c VALUE '/tmp/Sample Budget Upload File.txt',

c_currency(5) TYPE c VALUE 'USD'.

CONSTANTS: c_plvar(4) TYPE c VALUE '01', "Plan Version

c_o(3) TYPE c VALUE 'O', "Object

c_otype(4) TYPE c VALUE 'BU', "Object type

c_rsign1 TYPE rsign VALUE 'B'."Relationship

CONSTANTS : c_x(3) TYPE c VALUE 'X',

c_0(3) TYPE c VALUE '0',

c_usd(5) TYPE c VALUE 'USD'.

CONSTANTS: c_otype1 TYPE otype VALUE 'US', "Object Type for User

c_otype2 TYPE otype VALUE 'O', "Org.Unit

c_evalpath TYPE gdstr-wegid VALUE 'SAP_MANG', "Evaluation path

c_depth TYPE hrrhas-tdepth VALUE '0',"Depth

c_underscore TYPE c VALUE '_', "Underscore

c_mb(4) TYPE c VALUE 'MB', "Merit Bonus

c_pb(4) TYPE c VALUE 'PB', "Performance Bonus

c_spot(6) TYPE c VALUE 'SPOT', "Spot Bonus

c_star TYPE c VALUE '*', "To fecth all files

c_dirname TYPE epsf-epsdirnam VALUE '/tmp', "Directory name

c_tpath TYPE sapb-sappfad VALUE 'c:\Bonusbudget\'. "Target Path on the Desktop

        • INTERNAL TABLE DECLARATION.

TYPES: BEGIN OF ty_budget,

orgunit TYPE orgeh, "Org.Unit

kcurr TYPE cmp_bu_kcurr, "Monetery Falg

butyp TYPE ecm_butyp, "Budget Type

budgetperiod TYPE cmp_bu_finyr, "Budget Period

oldam(20) TYPE c, "Amount

oldcu TYPE waers, "Currency

END OF ty_budget.

DATA: it_budget TYPE STANDARD TABLE OF ty_budget,

wa_budget TYPE ty_budget.

*INTERNAL TABLE & WORK AREA HOLDS THE MANAGER ORG.UNIT

DATA: it_obj_tab_tmp TYPE STANDARD TABLE OF hrrootob.

DATA: wa_obj_tab_tmp TYPE hrrootob.

DATA: it_dir_list TYPE STANDARD TABLE OF epsfili,

wa_dir_list TYPE epsfili.

lv_user = sy-uname.

lv_uzeit = sy-uzeit.

lv_user = 'DALKW1'.

p_file = c_file.

lv_file_budget = p_file.

CALL FUNCTION 'RH_STRUC_GET' "#EC *

EXPORTING

act_otype = c_otype1

act_objid = lv_user

act_wegid = c_evalpath

act_begda = sy-datum

act_endda = sy-datum

act_tdepth = c_depth

TABLES

result_tab = it_obj_tab_tmp

EXCEPTIONS

no_plvar_found = 1

no_entry_found = 2

OTHERS = 3.

LOOP AT it_obj_tab_tmp INTO wa_obj_tab_tmp.

lv_objid1 = wa_obj_tab_tmp-objid.

ENDLOOP.

SELECT SINGLE stext

FROM hrp1000

INTO lv_stext

WHERE otype = c_otype2

AND objid = lv_objid1.

IF sy-subrc EQ 0.

CONCATENATE lv_stext+0(18) c_star INTO lv_afile.

ENDIF.

  • GET THE FILE NAMES BY PASSING THE DIRECTORY NAME AND FILE NAME.

CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'

EXPORTING

dir_name = c_dirname

file_mask = lv_afile

TABLES

dir_list = it_dir_list

EXCEPTIONS

invalid_eps_subdir = 1

sapgparam_failed = 2

build_directory_failed = 3

no_authorization = 4

read_directory_failed = 5

too_many_read_errors = 6

empty_directory_list = 7

OTHERS = 8.

IF sy-subrc EQ 0.

LOOP AT it_dir_list INTO wa_dir_list.

CONCATENATE c_tpath wa_dir_list-name INTO lv_tpath.

lv_spath = wa_dir_list-name.

concatenate c_dirname '/' lv_spath into lv_spath.

  • DOWNLOAD THE FILE TO THE PRESENATATION SERVER PATH.

CALL FUNCTION 'ARCHIVFILE_SERVER_TO_CLIENT'

EXPORTING

path = lv_spath

targetpath = lv_tpath

EXCEPTIONS

error_file = 1

OTHERS = 2.

IF sy-subrc EQ 0.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = lv_tpath

filetype = 'ASC'

TABLES

data_tab = it_budget.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

CLEAR lv_tpath.

ENDLOOP.

ENDIF.

Regards,

Sree

Read only

0 Likes
1,287

Hi,

You need to debug the code and find the point that the directory is converted to upper case. Your constant c_dirname is of the correct type, but presumably when it is concatenated with lv_spath this is converted to upper case.

Only debugging this program will show you where the change is happening.

Regards,

Nick

Read only

Former Member
0 Likes
1,287

Pass a variable which refers to SAPB-SAPPFAD to the

FM ARCHIVFILE_SERVER_TO_CLIENT

data : p_path1 like SAPB-SAPPFAD,

p_path2 like SAPB-SAPPFAD.

CALL FUNCTION 'ARCHIVFILE_SERVER_TO_CLIENT'

EXPORTING

path = p_path1

TARGETPATH = p_path2

  • EXCEPTIONS

  • ERROR_FILE = 1

  • OTHERS = 2

.

Read only

Former Member
0 Likes
1,287

Hi Sree Ram,

May be problem in your file path you are providing.I tested this function module with my file.Every thing is working fine...

Check your file name

Thanks,

Ravee...

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
1,287

Closed.