‎2006 Jan 03 4:43 AM
Hi ,
I want to upoload a text file in Application Server for a BDC program.
Please let me know , how i have to do it.
Is there any standard Transaction Code for that?
While going thru the transaction AL11 , i need to find my file in that.
Thanks and Regards,
Sowmmya B
‎2006 Jan 03 4:53 AM
Try to run the Transaction CG3Z.
to upload the file from local pc to application server.
thanks
vijay
‎2006 Jan 03 4:51 AM
Hi,
Try this sample code and kindly reward points by clicking the star on the left of reply,if it helps.
data : G_AFILE1(100) TYPE C,
G_DATA(1000) TYPE C,
G_DELIM TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
DATA: BEGIN OF T_INPUT OCCURS 0, " Flat file data
PERNR(9) TYPE C,
AMOUNT(15) TYPE C,
W_TYPE(5) TYPE C,
END OF T_INPUT.
OPEN DATASET G_AFILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
DO.
READ DATASET G_AFILE1 INTO G_DATA.
IF SY-SUBRC = 0.
SPLIT G_DATA AT G_DELIM INTO T_INPUT-PERNR T_INPUT-AMOUNT
T_INPUT-W_TYPE .
IF SY-SUBRC = 0.
APPEND T_INPUT.
CLEAR T_INPUT.
ELSE.
MESSAGE E001 WITH TEXT-012 G_AFILE1.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDDO.
ELSE.
MESSAGE E001 WITH TEXT-013 G_AFILE1.
ENDIF.
‎2006 Jan 03 4:53 AM
Try to run the Transaction CG3Z.
to upload the file from local pc to application server.
thanks
vijay
‎2006 Jan 03 5:21 AM
Hi Soumya,
If u want to place the file from local path to application server use Tcode CG3Z and download to logical path..
*then in the program to read that file
*also check Tcode FILE to know the path
PARAMETERS:
p_path TYPE rlgrap-filename OBLIGATORY,"physical path
p_file TYPE rlgrap-filename . "filename
DATA : lv_path(256) TYPE c,
lv_opfile(30) TYPE c,
lv_op(8) TYPE c VALUE 'OUTPUT_',
lv_str(30) TYPE c.
Getting the I/P and O/P Files Complete Paths
MOVE p_path TO lv_path.
MOVE p_file TO lv_path+128(128).
CONDENSE lv_path NO-GAPS.
v_inputfile = lv_path.
OPEN DATASET v_inputfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
do.
read dataset v_inputfile into wa.
if sy-subrc ne 0. exit. endif.
*append to itab
enddo.
then use the BDC technique as required..
Regards,
Sridhar
‎2006 Jan 03 4:59 AM
Dear Sowmmya,
There are many FM's to upload text file. Like GUI_UPLOAD etc.
As such you can get more details on BDC from
http://help.sap.com/saphelp_47x200/helpdata/en/fa/097119543b11d1898e0000e8322d00/frameset.htm
Transaction AL11 lists file in your SAP directories. Are you trying to use it to locate the file you uploaded??? I couldn't gather the last part.
Regards,
Deva.
‎2006 Jan 03 9:23 AM
SEE
OPEN DATASET, READ DATASET, TRANSFER, CLOSE DATASET
documentation