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

create file on application server

Former Member
0 Likes
6,514

hi all,

how to create a file on application server and use it in a bdc.

Thanks In Advance

Assad

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,241

hi u can create a file on app server using tcode CG3Z...

U CAN use that file in BDC by reading the file(read dataset.....) and uploading the data into an internal table.

Message was edited by:

Premalatha G

5 REPLIES 5
Read only

Former Member
0 Likes
2,242

hi u can create a file on app server using tcode CG3Z...

U CAN use that file in BDC by reading the file(read dataset.....) and uploading the data into an internal table.

Message was edited by:

Premalatha G

Read only

vikram_maduri2
Explorer
0 Likes
2,241

U can create a File in Application Server by using a program with

OPEN DATA SET INPUT Statement &

OPEN DATA SET OUTPUT statement in the BDC program for retrivng the data ino Internal table in the BDC program

Vikram.M

Read only

Former Member
0 Likes
2,241

Hi,

You can copy a local file from presentation server to the application server using transaction USS_FAS.

<b>ABAP code to create and write to a file:</b>

  • Check whether file already exists

OPEN DATASET g_out_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc IS INITIAL.

  • File g_out_file already exists. Do not write to an existing file

  • Error message

STOP.

ENDIF.

  • open outbound file for writing

OPEN DATASET g_out_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

  • write detail record to outbound file

LOOP AT t_iout INTO g_out.

TRANSFER g_out TO g_out_file.

ENDLOOP.

CLOSE DATASET g_out_file.

IF sy-subrc IS INITIAL.

  • Success message

ENDIF.

CATCH cx_root INTO l_oref.

l_text = l_oref->get_text( ).

  • log free text message if exception is catched

  • Error message

STOP.

ENDTRY.

Read only

Former Member
0 Likes
2,241

hi assad,

You can directly upload the data in the Applocation layer with the help of transaction...

<b>CG3Z is the transaction to upload data from Presentation server to Application server.

CG3Y is the transaction to upload data from Application server toPresentation server.</b>

You can see whether the data has been uploaded or not thr Al11 transaction... an going on to that particular dierctly...

for uploading the same data inthe internal table, yo have to use ..opendata set and close dataset...

Regards,

Jayant.

Read only

Former Member
0 Likes
2,241
  • APPLICATION FILE CREATION.

  • Check whether file already exists vkont

OPEN DATASET c_filepath_fpb3 "/tmp/file_FI009_01_fpb3.txt

FOR INPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc EQ 0.

  • File c_filepath_fpb3 already exists then delete that file

DELETE DATASET c_filepath_fpb3. "/tmp/file_FI009_01_fpb3.txt

ENDIF.

  • Open the filepath / dataset on the application server for writing

OPEN DATASET c_filepath_fpb3 "/tmp/file_FI009_01_fpb3.txt

FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

  • Check if the OPEN has been successful

IF sy-subrc EQ 0.

  • Transfer file header data

TRANSFER wa_bfkkzgr00 TO c_filepath_fpb3.

"/tmp/file_FI009_01_fpb3.txt

CLEAR: wa_bfkkzgr00.

  • Transfer paymentlot header data

TRANSFER wa_bfkkzk TO c_filepath_fpb3.

"/tmp/file_FI009_01_fpb3.txt

CLEAR: wa_bfkkzk.

LOOP AT it_bfkkzp INTO wa_bfkkzp.

TRANSFER wa_bfkkzp TO c_filepath_fpb3.

"/tmp/file_FI009_01_fpb3.txt

CLEAR: wa_bfkkzp.

ENDLOOP.

  • Close the dataset / filepath

CLOSE DATASET c_filepath_fpb3.

"/tmp/file_FI009_01_fpb3.txt

ENDIF.

  • Call the report for creating the payment lots(Transaction FPB3)

  • Submit the data to park the document

SUBMIT rfkkze00 WITH as_fname = c_filepath_fpb3

"/tmp/file_FI009_01_fpb3.txt

AND RETURN.

ENDIF.