Friday, November 23, 2007

Delimiter for sap BDC Program

I use (tab and ,) delimeter for bdc but I could not upload data from note pad to sap.

As you mentioned that you have used ( tab & , ) this is wrong you have to use TAB OR , (comma) .
Use , (comma). While executing bdc you have to mention delimiter factor at bdc screen.

Nitin

Can anybody tell me, if we are using excel sheet as a data provider for BDC Program, then how to define a delimiter so that my BDC programe should automatically split the field.

You either save the excel sheet as Tab delimited file or .csv file. and declare your internal table to get the corresponding the contents from the file. Then when its tab delimited or .csv, SPLIT the contents into respective fields.

Here is a sample for CSV file :

*declaration of internal tables.
DATA : BEGIN OF IT_DUMMY OCCURS 0,
TEXT(500),
END OF IT_DUMMY.

DATA : BEGIN OF IT_MAIN OCCURS 0,
MATNR LIKE RMMG1-MATNR, "material selection to change
DISLS LIKE MARC-DISLS, "lot size key
END OF IT_MAIN.

*uploading the input file***********************************************
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = INPUT
TABLES
DATA_TAB = IT_DUMMY
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
OTHERS = 6.

*appending it_main by splitting the uploaded file
LOOP AT IT_DUMMY.
SPLIT IT_DUMMY AT ',' INTO IT_MAIN-MATNR IT_MAIN-DISLS.
APPEND IT_MAIN.
ENDLOOP.

No comments:

Blog Archive