Application Development 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: 

Problem in Creating a new Folder.

Former Member
0 Kudos

Hi,

      How to create a New Folder , while Working in RFC . For example ,  i need a path like this  'D:\sy-datum\Programname.txt' . 

  If my drive doesn't contains a Folder name( Sy-datum ) , then my RFC is Stops working , Please Guys help me on this.

Thanks and Regards ,

Ramkumar R.

7 REPLIES 7

Former Member
0 Kudos

data: dat like RLGRAP-FILENAME .

concatenate 'D:\ ' sy-datum  into dat .

CALL FUNCTION 'TMP_GUI_CREATE_DIRECTORY'

   EXPORTING

     DIRNAME  = dat   

     NO_FLUSH = ' '

   EXCEPTIONS

     FAILED   = 1

     OTHERS   = 2.

IF SY-SUBRC <> 0.

   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regard's

Smruti

0 Kudos

Hi Ranjan,

            I need to Implement this in Background Job .

0 Kudos

Yes Ramkumar it is working in Background Mode . Please test .

1 : Create a Z program and call Ur RFC where u used this "TMP_GUI_CREATE_DIRECTORY"

      and pass your Import Parameter's , then check ur Respective Drive.

SE38 Test Code

data: dat like RLGRAP-FILENAME .

concatenate 'G:\ ' sy-datum  into dat .

CALL FUNCTION 'ZTEST1'

  EXPORTING

    DAT1          = dat

           .

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*************************************************************************************************

SE37  RFC Code

****************************************************************

FUNCTION ZTEST1.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     VALUE(DAT1) LIKE  RLGRAP-FILENAME DEFAULT 121

*"----------------------------------------------------------------------

*break-point.

CALL FUNCTION 'TMP_GUI_CREATE_DIRECTORY'

   EXPORTING

     DIRNAME  = dat1

     NO_FLUSH = ' '

   EXCEPTIONS

     FAILED   = 1

     OTHERS   = 2.

IF SY-SUBRC <> 0.

   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFUNCTION.

Regard's

Smruti

0 Kudos

HI Ranjan ,

           i Checked ur code, its working fine in Foreground , but it is failing in RFC while Executing this in Background .

0 Kudos

is ur RFC Linked with third party application ?  (Yes/No)

how you test ur RFC in Background mode  plz give the steps , let me check .

check ur authorization is properly given by that user ID where u test ur RFC in Background Mode .

Regard's

Smruti

0 Kudos

Dear Ranjan ,

       Actually my Requirement is to download a file in Background job , and this file to be downloaded in a folder for the present date , I used the RFC to download the file( I execute the RFC as Shown in the below Screen), its working fine , but i need to download a file in a Folder and that folder should be created automatically for the  present date. this Background job should work daily , so that each and every day , new folder should be created as per the present date.

Former Member
0 Kudos

Got the Solution , I created a Batch File , and i execute it through RFC_REMOTE_EXEC , so that the new folder is created .

Thanks and Regards,

Ramkumar R.