public async Task <MaterialSaveDataBapiOutputParameter> CreateMaterialAsync()
        {
            var inputParameter = new MaterialSaveDataBapiInputParameter
            {
                HeadData = new HeadData {
                    MaterialCode = "HSN000000000000030", MaterialType = "7100", Sector = 'B', IsBasicView = 'X'
                },
                MaterialDescription = new MaterialDescription {
                    Name = "Plastik Palet 100 'Lük", LanguageCode = "TR"
                },
                ClientData = new ClientData
                {
                    MaterialGroup          = "71000010",
                    BaseMeasurementUnit    = "ST",
                    BaseMeasurementUnitIso = "ST",
                    Divison             = "15",
                    ProductionHierarchy = "ZZZ",
                    StorageCondition    = "I3"
                }
            };


            using IRfcClient client = _serviceProvider.GetRequiredService <IRfcClient>();

            using IRfcTransaction transaction  = client.CreateTransaction();
            using IRfcTransactionFunction func = transaction.CreateFunction("BAPI_MATERIAL_SAVEDATA");
            await func.InvokeAsync(inputParameter);

            transaction.SubmitTransaction();
            transaction.ConfirmTransaction();
            MaterialSaveDataBapiOutputParameter result = func.ReadSubmitResult <MaterialSaveDataBapiOutputParameter>();

            return(result);
        }
Exemplo n.º 2
0
        public async Task <GoodsMovementBapiOutputParameter> MaterialTransferAsync()
        {
            var inputParameter = new GoodsMovementBapiInputParameter
            {
                Header = new Header {
                    DocumentDate = DateTime.Now, PostingDate = DateTime.Now
                },
                MovementType = new MovementType {
                    MovementTypeCode = "04"
                },
                Items = new MovementItem[]
                {
                    new MovementItem
                    {
                        MaterialCode  = "",
                        PlantCode     = "",
                        WarehouseCode = "",
                        MoveType      = "413",
                        ValueType     = "",
                        Quantity      = 1,
                        QuantityMeasurementUnitType = "ST",
                        MovementMaterialCode        = "",
                        SpecialStockIndicator       = 'E',
                        SalesOrderNumberOld         = "",
                        SalesItemNumberOld          = "",
                        OrderNumber           = "",
                        OrderItemNumber       = "",
                        MovementPlantCode     = "",
                        MovementValueType     = "",
                        MovementWarehouseCode = ""
                    }
                },
                SerialNumbers = new MovementSerialNumber[] { }
            };


            using IRfcClient client            = _serviceProvider.GetRequiredService <IRfcClient>();
            using IRfcTransaction transaction  = client.CreateTransaction();
            using IRfcTransactionFunction func = transaction.CreateFunction("BAPI_GOODSMVT_CREATE");
            await func.InvokeAsync(inputParameter);

            transaction.SubmitTransaction();
            transaction.ConfirmTransaction();
            GoodsMovementBapiOutputParameter result = func.ReadSubmitResult <GoodsMovementBapiOutputParameter>();

            return(result);
        }