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

Uplaoding data to Pplication Server

Former Member
0 Likes
864

Hi friends,

need to uplaod a text file from Presentation Server to Application Server. Could any one tell me the procedure.thnaks in advance,

sant.

9 REPLIES 9
Read only

Former Member
0 Likes
821

Use transaction CG3Z

Read only

Former Member
0 Likes
821

Hi write a report program.

In that first upload the presentation server file into an internal table using GUI_UPLOAD function module. after that use OPEN DATASET .. transfer and CLOSE DATASET logic to transfer the file to application server.

Read only

Former Member
0 Likes
821

Hi,

try this sample code.

data : begin of itab occurs 0,
       field1 type p,
       field2 type p,
       field3 type P,
       field4 type p,
       desc   type char10,
       end   of itab.

data: filepath_g(100),
      filepath        type string.

CALL FUNCTION 'AL_POPUP_FOR_LOCAL_PATH'
  EXPORTING
    DOC_TYPE         = 'txt'
  IMPORTING
    FILERETURN       = filepath_g
          .

filepath = filepath_g.

CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename                      = filepath
    FILETYPE                      = 'ASC'
    HAS_FIELD_SEPARATOR           = 'X'
  tables
    data_tab                      = itab
 EXCEPTIONS
   FILE_OPEN_ERROR               = 1
   FILE_READ_ERROR               = 2
   NO_BATCH                      = 3
   GUI_REFUSE_FILETRANSFER       = 4
   INVALID_TYPE                  = 5
   NO_AUTHORITY                  = 6
   UNKNOWN_ERROR                 = 7
   BAD_DATA_FORMAT               = 8
   HEADER_NOT_ALLOWED            = 9
   SEPARATOR_NOT_ALLOWED         = 10
   HEADER_TOO_LONG               = 11
   UNKNOWN_DP_ERROR              = 12
   ACCESS_DENIED                 = 13
   DP_OUT_OF_MEMORY              = 14
   DISK_FULL                     = 15
   DP_TIMEOUT                    = 16
   OTHERS                        = 17
          .
IF sy-subrc <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

loop at itab.
write : / itab-field1,itab-field2,itab-field3,itab-field4,itab-desc.
endloop.

Cheers,

jose

Read only

Former Member
0 Likes
821

Hi

Use FM GUI_UPLOAD to get the file from Presentation Server into an internal table.

Then use FM GUI_DOWNLOAD using same internal table to download the file to Application server.

Regards,

Guarav.

Read only

Former Member
0 Likes
821

Hi,

Use GUI_UPLOAD to get the data of file from presentation server to your internal table in program. (Got for where-used list of teh FM, you will get to see the usage).

then use OPEN DATASET and dump the data from the internal table to the application server.

regards,

theja.

Read only

Former Member
0 Likes
821

Use CG3Z transaction .

andIn the source , with out deleting the path that is already there in the pop-up ,select F4 option and select the path . Then give the target file name in the apploicatipon serevr.

If you want to do it programitically.

then use Open data set operation as given by other pals.

Reward points if useful.

Regards,

Nageswar

Read only

Former Member
0 Likes
821

first fetch the text fiel data from presentation server to ur internal table using GUI_UPLOAD function module.

after fetching the data from preasentation sever using data sets we can upload data to application server.

  • Open data set for write mode

OPEN DATASET <Appserver file>

FOR OUTPUT IN TEXT MODE MESSAGE l_msg.

if sy-subrc eq 0.

LOOP AT <itab>

CONCATENATE <itab>-field

INTO <string> SEPARATED BY <separator>.

TRANSFER l_str TO <Appserver file>.

CLEAR: l_str.

ENDLOOP. " LOOP AT REPORT_tab

CLOSE DATASET <Appserver file>.

endif.

Read only

Former Member
0 Likes
821

we can also use CG3Z transaction to upload the file from presentation server

Read only

Former Member
0 Likes
821

the approach depends upon your requirement. If you want to load few files lets say for ur testing program ten you can use TCODE: cg3Z this will Upload the file from users machine to the appln Server ( Tcode cg3y will download Files from appln to users machine).

If you want to write a program then use FM: GUI_UPLOAd to upload the file from the Presentation Server and use Open DATASET ..to write the file on the Application Server.

approach depends on ur requirement.