‎2007 Feb 20 10:29 AM
Hi,
I need to upload a file to SAP using BDC.
The BDC session should be created for transaction FB01.
The file should be picked up from the unix server, validated and then uploaded via BDC .This BDC should have the capability of the end user manually invoking BDC sessions in SAP.
Any pointers on the same. Thanks in advance.
‎2007 Feb 20 10:33 AM
To upload file from unix
You have to write Open data set....close data sets to upload file.
Checkn in sdn,you get so many about open sets.
Use SHDB tcode to upload this and before starting find out what are the mandatory fields for tcode FB01.
select call transaction method and you have to select mode A while uploading for user interaction.
This is just overview and hope u get some idea.
Thanks
‎2007 Feb 20 10:38 AM
Hi SV,
For uploading file from Unix Server..get the file path using the FM
FILE_GET_NAME_USING_PATH.
Use Open data set to get read the file, eg
OPEN DATASET P_FILE FOR INPUT IN TEXT MODE.
read data into inter nal table
READ DATASET P_FILE INTO ITAB.
separate the data the separator using SPLIT . Collect garbage values at the end to variable which is not needed.
SPLIT ITAB
AT SEPERATOR INTO
ITAB-MATNR
ITAB-LIFNR....
GARBAGE.
Now you can use this for your BDC.
Regards,
George
Reqard points if you find this hint useful
‎2007 Feb 20 10:39 AM
Thanks, some pointers on the basics on how to build a BDC would be helpful
‎2007 Feb 20 10:39 AM
report ZAMOL_BDC_1
no standard page heading line-size 255.
TYPES : BEGIN OF S1,
BLDAT TYPE BKPF-BLDAT,
BLART TYPE BKPF-BLART,
BUKRS TYPE BKPF-BUKRS,
BUDAT TYPE BKPF-BUDAT,
MONAT TYPE BKPF-MONAT,
WAERS TYPE BKPF-WAERS,
END OF S1.
DATA : WA TYPE S1,
ITAB TYPE TABLE OF S1.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = PHYSICAL FILE PATH
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
IMPORTING
FILELENGTH =
HEADER =
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.
include bdcrecx1.
start-of-selection.
perform open_group.
LOOP AT ITAB INTO WA.
perform bdc_dynpro using 'SAPMF05A' '0100'.
perform bdc_field using 'BDC_CURSOR'
'BKPF-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'PI'.
perform bdc_field using 'BKPF-BLDAT'
WA-BLDAT. "'01.12.2005'.
perform bdc_field using 'BKPF-BLART'
WA-BLART. " 'CI'.
perform bdc_field using 'BKPF-BUKRS'
WA-BUKRS. " '1020'.
perform bdc_field using 'BKPF-BUDAT'
WA-BUDAT. " '01.03.2006'.
perform bdc_field using 'BKPF-MONAT'
WA-MONAT. "''.
perform bdc_field using 'BKPF-WAERS'
WA-WAERS. "'INR'.
perform bdc_field using 'FS006-DOCID'
'*'.
perform bdc_transaction using 'FB01'.
ENDLOOP.
perform close_group.
Regards,
Amol C.
*- Don't forget to reward points
‎2007 Feb 20 10:43 AM
Hi,
When you do the recording, you will get the Screen Number, Program name and Ok codes, and also from the initial screen of SHDB you can generate a program from the recording, so do that and create a program, so you will come to know about the code for BDC.
and also, we have a standard program to upload the Documents, the Program name is RSBIBL00, so read the documentaion of this project..
Regards
Sudheer
‎2007 Feb 20 2:20 PM
This sounds like a situation made fro RFBIBL00. Check it's documentation.
Rob