‎2008 Mar 10 10:53 AM
Hi All,
Pls can you help me
i want to create multple materials using BDC program
if you have any sample code pls can you send me.
one more thing that BDC program i want to make it has BAPI
THANKS
MARS
‎2008 Mar 10 10:58 AM
hi,
See, as the no of views depends upon the material types and industry sector. It is very difficult and complex to use BDC for data uploading. To select view, you can use the FM 'MATERIAL_BTCI_SELECTION_NEW'. If you have very few material type then you can use different recording for each material type.
But i think the better way is to use the BAPI 'BAPI_MATERIAL_SAVEDATA' for your purpose. It will autometically take care of the views.
Ex:
codeREPORT z34332_bdc_create_material .
data: la_headdata type BAPIMATHEAD,
la_clientdata type BAPI_MARA,
la_CLIENTDATAX type BAPI_MARAX,
la_return type BAPIRET2.
data: i_materialdescription type table of BAPI_MAKT,
wa_materialdescription like line of i_materialdescription.
la_headdata-MATERIAL = '000000000000000004'.
la_headdata-IND_SECTOR = 'M'.
la_headdata-MATL_TYPE = 'FERT'.
la_clientdata-BASE_UOM = 'FT3'.
la_CLIENTDATAX-BASE_UOM = 'X'.
la_clientdata-MATL_GROUP = '01'.
la_CLIENTDATAX-MATL_GROUP = 'X'.
wa_materialdescription = 'TEST'.
append wa_materialdescription to i_materialdescription.
clear: wa_materialdescription.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = la_headdata
CLIENTDATA = la_clientdata
CLIENTDATAX = la_CLIENTDATAX
PLANTDATA =
PLANTDATAX =
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
VALUATIONDATA =
VALUATIONDATAX =
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA =
STORAGETYPEDATAX =
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
IMPORTING
RETURN = la_return
TABLES
MATERIALDESCRIPTION = i_materialdescription
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
.
write: la_return-TYPE, ',', la_return-MESSAGE.
clear: la_headdata, la_return, la[/code]
regards,
venkat.