MM01 with inspection setup using bapi
I need create material with some views including the Quality management view. the Bapi i am using is BAPI_MATERIAL_SAVEDATA. this contains only some fields for that QM view. Bu hw do i check the Inspection setup check box.
There is another BAPI BAPI_MATINSPCTRL_SAVEREPLICA
this includes inspection type details.the problem is i run the first mentioned BAPI and create the material with QM view and then later use the second mentioned BAPI to load inspection details. but it states that no inspection setup is maintaind for that material, even though a QM view exists. How to resolve?
Thanks.
Hi,
you can check the BAPI_INSPECTIONPLAN_CREATE for the named purpose, the values you named are in the structure BAPI1191_CHA_C please read the BAPI documentation:
Functionality
You can use this function module to create inspection plans and all its subordinate objects.
You can create a key date view and the complete history of an inspection plan. It is useful to have a history when transferring data from external systems.
Example
You want to create an inspection plan with operations and inspection characteristics for key date 01.01.2000. Make an entry in the following tables for each object:
TASK
OPERATION
INSPCHARACTERISTIC
If you want to assign test equipment to the inspection characteristic in field ITEM_NO_OF_PRODUCTION_RESOURCE, you must have assigned this test equipment in PARAMETER PRODUCTIONRESOURCE.
Notes
If no error occurs during the transfer of data, the export parameters GROUP and GROUPCOUNTER contain the key for the task list created. A COMMIT WORK must be executed for writing data to the database.
All errors that have occured are logged in the export parameter RETURN. If there are inconsistencies, the inspection plan to be created is rejected
<b>Reward points</b>
Regards
Similar Messages
-
Creating a material with its classification using BAPI's
Hi there,
I am creating a function module to create a material master using BAPI's. I am using the BAPI 'BAPI_MATERIAL_SAVEDATA'. However I did not find a way to pass the classification details to this BAPI. As I need to create a classification data along with material basic data, can you please tell me how I can do it. Are there any BAPI's which I can use to create classification data?
Please help, I have stuck here from a longer time.
Thanks,
Ganesh.hi
good
Use FM 'BAPI_OBJCL_GETDETAIL' to retrieve the classification data.
Import params:
1. Object key : give the material number
2. Object table : give material master table i.e. MARA
3. Class Num: Give the class name from which u have to fetch the characteristic data
4. Class type: give '001' for material
You will get the classification data in the following tables:
ALLOCVALUESNUM
ALLOCVALUESCHAR
ALLOCVALUESCURR
This should be helpful, do get back in case of any queries.
thanks
mrutyun^ -
LSMW help with DIRs by using BAPi method
Hi experts,
I am learning LSMW and I have been given exercise which I have to finish. The question is:
Create a LSMW object for creation of DIRs by using BAPI method (UPLOAD_DOCUMENT)???
Can anyone tell me how should I go forward and what DIRs stands for... ??
I really appreciate your help..
Regards,
-Ashok HansrajHello Ashok,
If you need a step - by - step approach for loading data using LSMW with various import techniques (like batch input, BAPI, IDOCS etc) you have to go thru this LSMW manual.
And the files with DIR information, you should receive those fields from your business. Because you should know the structure of the data in those files in order to maintain source and target structures.
Ask your business people over the format of the file you will be provided. In mean you can go thru this manual on this link.
http://www.sapgenie.com/saptech/lsmw.htm
Thanks,
Naren -
Creating Inspection plan using BAPI
HI all,
I am using the FM 'BAPI_INSPECTIONPLAN_CREATE'. I am unable to update the Inspection characteristics as multiple entries. Its getting updated only the last item.
Expecting answer from the experts.
Ravi.Hi,
you can check the BAPI_INSPECTIONPLAN_CREATE for the named purpose, the values you named are in the structure BAPI1191_CHA_C please read the BAPI documentation:
Functionality
You can use this function module to create inspection plans and all its subordinate objects.
You can create a key date view and the complete history of an inspection plan. It is useful to have a history when transferring data from external systems.
Example
You want to create an inspection plan with operations and inspection characteristics for key date 01.01.2000. Make an entry in the following tables for each object:
TASK
OPERATION
INSPCHARACTERISTIC
If you want to assign test equipment to the inspection characteristic in field ITEM_NO_OF_PRODUCTION_RESOURCE, you must have assigned this test equipment in PARAMETER PRODUCTIONRESOURCE.
Notes
If no error occurs during the transfer of data, the export parameters GROUP and GROUPCOUNTER contain the key for the task list created. A COMMIT WORK must be executed for writing data to the database.
All errors that have occured are logged in the export parameter RETURN. If there are inconsistencies, the inspection plan to be created is rejected
<b>Reward points</b>
Regards -
How to create a Sales order with ref. with serial number using BAPI
Hi Gurus...
I have a requirement where, i need to create an order with reference to serial number using a BAPI.
The inputs will be the Order type..Sales area..Sales office..Sales group..Sold-To-party..Material number...Serial number...
When i create the order using VA01 the configuration data will be automatically copied from the BUMP order which will have all the required information.
But to create using a BAPI, i am struck ed..Please help
Thanks in advance..
SrinuYou can use this BAPI.
You can pass ITM_NUMBER to the ORDER_ITEMS_IN parameter. I think this will act as serial number.
Regards,
Murali -
How to create a Sales Order with external number using BAPI
Hi People,
I am wonderning how to create Sales order using external number range by BAPI (SALESORDER_CREATEFROMDAT202).
I tried search but could not succeed in finding the solution.
Please share if anyone has some info.
Thanks in advance.
Regards,
PraveenAs per my understanding, the BAPI
SALESORDER_CREATEFROMDAT202
mentioned by you, is not BAPI. In fact, that is basic IDoc Type. For processing an Inbound IDoc, we use FM IDOC_INPUT_ORDERS.
If you want to create sales order other than IDoc, refer FM BAPI_SALESORDER_CREATEFROMDAT2. There you can provide external sales order no in SALESDOCUMENTIN. In addition to that check whether your sales doc type is relevant for external number range or not. If yes. then make sure you are providing external number according to the number range maintained.
If you still have any concerns, please revert back.
Thanks, JP -
Problems with variant configuration using BAPI on Business connector
Hi every body I need help.
Steps.
1.- I created an RFC with BAPI_SALESORDER_CREATEFROMDAT2 and then a commit function,
I call this RFC via SAp business connector
Im triying to create a Configure order(With characteristics) I fill all configuration structures exactly like note 567348.
I created a sales order but when i checked ti in VA01 transaction the order quantys are diferents at configuration tables, if the function is executed on directly on SAP this work fine the error is only in a SAP Business Connector
Is necesary to send another parameter when i Execute Bapis on SAPBC?
\[removed by moderator\]
Edited by: Jan Stallkamp on Jun 27, 2008 4:21 PMHi,
Just debug your SAP BC service in which you are calling the RFC and check if proper values are getting mappend to your input variables of RFC.
If that is correct than there wont be much chances of problem in BC.
\[removed by moderator\]
Regards,
Siddhesh S.Tawate
Edited by: Jan Stallkamp on Jul 1, 2008 4:32 PM -
Creating credit memo with two positions using Bapi
Hi all, i are creating a credit memo using BAPI_BILLINGDOC_CREATEMULTIPLE with manual price condition for each position and have a problem.
All the positions use the last condition value of the CONDITIONDATAIN table.
Thes is an example code used.
t_billing-salesorg = 'SI01'.
t_billing-DISTR_CHAN = '05'.
t_billing-DIVISION = '01'.
t_billing-DOC_TYPE = p_dtype. " ZC07 o TA
t_billing-ORDBILLTYP = 'ZC06'. " ZC06 o FX
t_billing-SOLD_TO = p_clie. "'0000200002'.
t_billing-ITEM_CATEG = 'ZG2N'. " ZG2N o TAN
t_billing-PLANT = '1100'.
t_billing-BILL_TO = p_clie. "'0000200002'.
t_billing-PAYER = p_clie. "'0000200002'.
t_billing-SHIP_TO = p_clie. "'0000200002'.
t_billing-MATERIAL = '0000000000300003'.
t_billing-REQ_QTY = p_cant. "'1.000'.
t_billing-item = '1'.
APPEND t_billing.
t_conditions-DATA_INDEX = '1'.
t_conditions-COND_TYPE = 'ZCON'.
t_conditions-COND_VALUE = '12.0000'.
append t_conditions.
t_billing-salesorg = 'SI01'.
t_billing-DISTR_CHAN = '05'.
t_billing-DIVISION = '01'.
t_billing-DOC_TYPE = p_dtype. " ZC07 o TA
t_billing-ORDBILLTYP = 'ZC06'. " ZC06 o FX
t_billing-SOLD_TO = p_clie. "'0000200002'.
t_billing-ITEM_CATEG = 'ZG2N'. " ZG2N o TAN
t_billing-PLANT = '1100'.
t_billing-BILL_TO = p_clie. "'0000200002'.
t_billing-PAYER = p_clie. "'0000200002'.
t_billing-SHIP_TO = p_clie. "'0000200002'.
t_billing-MATERIAL = '0000000000300004'.
t_billing-REQ_QTY = p_cant. "'1.000'.
t_billing-item = '2'.
APPEND t_billing.
t_conditions-DATA_INDEX = '2'.
t_conditions-COND_TYPE = 'ZCON'.
t_conditions-COND_VALUE = '24.0000'.
append t_conditions.
CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
EXPORTING
CREATORDATAIN = t_creator
TABLES
billingdatain = t_billing
CONDITIONDATAIN = t_conditions
return = t_return
success = t_success.
In these example, the first position have a value of 12 and the seccond a value of 24.
The generated document have a value of 24 for the two positions.
Do you helpme??
Regards
Adrián Callejón
Message was edited by:
Adrian CallejonThank you Jack. That's exactly what I needed to know.
Now it works. As an example I attach some code that also uses the credit card functionality
pos-salesorg = 'EESP'.
pos-distr_chan = 'ES'.
pos-division = 'TI'.
pos-ref_doc = '1'.
pos-material = mat10.
pos-req_qty = 1.
pos-itm_number = 1.
pos-ref_item = 1.
APPEND pos TO billdata.
pos-material = mat11.
pos-req_qty = 1.
pos-itm_number = 2.
pos-ref_item = 2.
APPEND pos TO billdata.
lincond-data_index = '1'.
lincond-cond_type = 'PR01'.
lincond-cond_value = '1.85'.
lincond-cond_curr = 'EUR'.
APPEND lincond TO conddata.
lincond-data_index = '2'.
lincond-cond_type = 'PR01'.
lincond-cond_value = '1.70'.
lincond-cond_curr = 'EUR'.
APPEND lincond TO conddata.
lincard-cc_type = 'VISA'.
lincard-cc_number = '4560000000000038'.
lincard-cc_valid_t = sy-datum + 90.
lincard-cc_name = 'Pedro Pérez'.
lincard-authamount = '1.85'.
lincard-currency = 'EUR'.
lincard-auth_flag = 'X'.
lincard-auth_date = sy-datum.
lincard-cc_auth_no = 'autno10'.
lincard-bill_value = '1.85'.
APPEND lincard TO carddata.
CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
* EXPORTING
* CREATORDATAIN =
* TESTRUN =
* POSTING =
TABLES
BILLINGDATAIN = billdata
CONDITIONDATAIN = conddata
CCARDDATAIN = carddata
* TEXTDATAIN =
ERRORS = t_errores
RETURN = t_bapiret
SUCCESS = t_success. -
How to configure and deploy OAM 11g with DB setup using silent mode
Hello all,
I am trying to create automation process to install and configure OAM 11g on WLS. This task involves three stages
1. Install WLS
2. Install OAM 11g
3. Create DB schema using RCU
4. Configure and deploy OAM 11g
I have done first 3 stages in silent mode using scripts and response files. I am stuck at 4th stage. I know how to configure and deploy OAM 11g using config.sh via GUI installer as well as console mode. But I would like to run config.sh in silent mode something like
./config.sh -mode=silent -silent_script=<script_location>
I have searched a lot, but could not find any resource on how to do it? I tried passing the parameters via a text file. But that has not worked. I have also explored WLST, but it also does not work. Given that first 3 things are relatively very simple, the 4th step is becoming complex. I would be very thankful if someone can please point me in the right direction.
Thanks!Have a look at your software directory : <sofware directory>/Disk1/stage/Response
Here you will find 2 rsp files which you can use to install and then configure it all.
Good luck.
Filip -
How create a purchase order without imputation using bapi: BAPI_PO_CREATE1
Hello Forum
I have an request for purchase order with imputation K (cost center, EBAN-KNTTP). During the liberation of the request for purchase order, and using the Bapi: BAPI_PO_CREATE1, I want to create a Purchase Order without imputation (imputation empty or charge empty).
The system displays the following error: The request for purchase order, item (position) 10, is attributed to another order...
I imagine that is because the request for purchase order has imputation (charged) K and the purchase order will have no type of imputation (imputation empty).
However, manually, Yes, I can create the purchase order. That is, I first release, the request for purchase order. Then I create the order of purchase using ME21 and with reference to request for purchase order, and when SAP returns the items of the request for purchase order, I manually remove the imputation K, and these items to become the purchase order.
Please support me want to know how to resolve this case, why can not I create a purchase order without imputation to from the request for purchase order with imputation K, using Bapi
Thank you.
Greetings,Hi,
In the item overview of the purchase order creation screen (ME21N), you have a column Purchasing Doc and next it item no. You can give the existing purchase order number here with item no which will create a purchase order, and changes can be made wherever you require.
Hope this helps.
Thanks
Krishna. -
How to upload material master using BAPI
I have a flat file with 3 fields MATNR,MAKTX,MEINS and I want to create material master with 2 views basic data1 & basic data2 with three fields using BAPI
Can anyone tell me how to do this only using three fields and 2 views
and also i want to know what is the exact difference between session call transaction BAPI and LSWM methods.
Thank you,
Pradeep Reddy M.Hi Pradeep Reddy Miriyala,
This a example you can use, the views are related with each table only have to adapt to your case.
Best regards
Jaime Cordeiro
*& Report ZMM01_BAPI_01 *
REPORT ZMM01_BAPI_01 .
STRUCTURE DECLARATIONS *
TABLES: BAPIMATHEAD, "Headerdata
BAPI_MARA, "Clientdata
BAPI_MARAX, "Clientdatax
BAPI_MVKE, "SalesData
BAPI_MVKEX, "SalesDatax
BAPI_MARC, "Plantdata
BAPI_MARCX, "Plantdatax
BAPI_MBEW, "ValuationData
BAPI_MBEWX, "ValuationData
BAPI_MLGN, "Storage
BAPI_MLGNX, "StorageX
BAPI_MAKT, "Material description
BAPI_MARM,
BAPI_MARMX,
bapi_mean,
BAPI_MLAN,
BAPIRET2. "Return messages
DATA: BEGIN OF LSMW_MATERIAL_MASTER,
> Initial Data
matnr(18),
mtart(4),
WERKS(4),
VKORG(4),
VTWEG(2),
LGNUM(3),"retirar
> Basic Data 1
MAKTX(40),
MEINS(3),
MATKL(9),
BISMT(18),
SPART(2),
PRDHA(18),
BRGEW(17),
NTGEW(17),
GEWEI(3),
VOLUM(13),
VOLEH(3),
EAN11(18),
NUMTP(2),
> Sales 1
DWERK(4),
TAXKM(1),
> Sales 2
KTGRM(2),
PRODH(18),
MTPOS(4),
> Sales: General/Plant
MTVFP(2),
TRAGR(4),
LADGR(4),
PRCTR(10),
> Purchasing
Novas entradas
EKGRP(3),
KAUTB(1),
XCHPF1(1),
EKWSL(4),
WEBAZ(3),
INSMK1(1),
KORDB(1),
> Foreign Trade
STAWN(17),
MTVER(4),
HERKL(3),
HERKR(3),
> Purchase Order Text View
Identificar Campos
TextoEN(100),
TextoPT(100),
TextoPL(100),
TextoES(100),
> MRP1
DISGR(4),
DISMM(2),
DISPO(3),
DISLS(2),
BSTMI(18),
BSTRF(13),
> MRP2
BESKZ(1),
RGEKZ(1),
LGPRO(4),
LGFSB(4),
EPRIO(4),
WEBAZ1(3),
PLIFZ(3),
FHORI(3),
> MRP3
PERKZ(1),
STRGR(2),
VRMOD(1),
VINT1(3),
VINT2(3),
> MRP4
ALTSL(1),
FEVOR(3),
> Work Sch
INSMK(1),
XCHPF(1),
UEETO(3),
> Plant Storage 1
MHDRZ(4),
MHDHB(4),
> Plant Storage 2
PRCTR1(10),
EPRIO1(4),
> WM 1 S01 comum a todos
LTKZA_S01(3),
LTKZE_S01(3),
LGBKZ_S01(3),
> WM 1 SHV
LTKZA_SHV(3),
LTKZE_SHV(3),
LGBKZ_SHV(3),
> WM 1 SQW
LTKZA_SQW(3),
LTKZE_SQW(3),
LGBKZ_SQW(3),
> WM 2
LHMG1(13),
LHME1(3),
LETY1(3),
LHMG2(13),
LHME2(3),
LETY2(3),
LHMG3(13),
LHME3(3),
LETY3(3),
> Accounting 1
BKLAS(4),
VPRSV(1),
VERPR(23),
PEINH(5),
END OF LSMW_MATERIAL_MASTER.
DATA:V_FILE TYPE STRING.
DATA:VolumUnitConv(3).
DATA:UnitConv(3).
INTERNAL TABLE DECLARATIONS *
*to store the input data
DATA:
BEGIN OF it_matmaster OCCURS 0.
INCLUDE STRUCTURE LSMW_MATERIAL_MASTER.
DATA:
END OF it_matmaster.
*for material description
DATA:BEGIN OF IT_MATERIALDESC OCCURS 0.
INCLUDE STRUCTURE BAPI_MAKT .
DATA:END OF IT_MATERIALDESC.
*FOR gross wt
data: begin of it_uom occurs 0.
include structure BAPI_MARM.
data:end of it_uom.
DATA: BEGIN OF IT_UOMX OCCURS 0.
INCLUDE STRUCTURE BAPI_MARMX.
DATA:END OF IT_UOMX.
data:begin of it_mean occurs 0.
include structure bapi_mean.
data:end of it_mean.
DATA: BEGIN OF it_MLAN OCCURS 0.
include STRUCTURE BAPI_MLAN.
DATA: END OF it_MLAN.
DATA:BEGIN OF IT_MLTX OCCURS 0.
INCLUDE STRUCTURE BAPI_MLTX.
DATA:END OF IT_MLTX.
*to return messages
DATA:BEGIN OF IT_RETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA:END OF IT_RETURN.
DATA : imat TYPE TABLE OF bapimatinr WITH HEADER LINE.
DATA: text LIKE bapi_mltx OCCURS 0 WITH HEADER LINE.
DATA: matnrAct(18),oldMart(4).
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.
PARAMETERS:P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1 .
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = P_FILE.
TO UPLOAD THE DATA *
START-OF-SELECTION.
V_FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = V_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = IT_MATMASTER
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.
check sy-subrc eq 0.
DATA POPULATIONS *
LOOP AT IT_MATMASTER.
IF IT_MATMASTER-MATNR EQ '' .
oldMart = IT_MATMASTER-Mtart.
CALL FUNCTION 'MATERIAL_NUMBER_GET_NEXT'
EXPORTING
MATERIALART = IT_MATMASTER-Mtart
IMPORTING
MATERIALNR = matnrAct
RETURNCODE =
EXCEPTIONS
NO_INTERNAL_INTERVAL = 1
TYPE_NOT_FOUND = 2
OTHERS = 3
if sy-subrc = 0.
BAPIMATHEAD-MATERIAL = matnrAct.
endif.
ELSE.
BAPIMATHEAD-MATERIAL = it_matmaster-matnr.
ENDIF.
Preenchimento dos dados do ecrã inicial
BAPIMATHEAD-MATERIAL = IT_MATMASTER-MATNR.
BAPIMATHEAD-IND_SECTOR = 'M'.
BAPIMATHEAD-MATL_TYPE = IT_MATMASTER-Mtart.
"declaration of views
BAPIMATHEAD-BASIC_VIEW = 'X'.
BAPIMATHEAD-MRP_VIEW = 'X'.
BAPIMATHEAD-STORAGE_VIEW = 'X'.
BAPIMATHEAD-WAREHOUSE_VIEW = 'X'.
BAPIMATHEAD-ACCOUNT_VIEW = 'X'.
If IT_MATMASTER-Mtart EQ '31'.
BAPIMATHEAD-SALES_VIEW = 'X'.
BAPIMATHEAD-WORK_SCHED_VIEW = 'X'.
ENDIF.
If IT_MATMASTER-Mtart EQ '51'.
BAPIMATHEAD-SALES_VIEW = 'X'.
BAPIMATHEAD-WORK_SCHED_VIEW = 'X'.
ENDIF.
If IT_MATMASTER-Mtart EQ '65'.
BAPIMATHEAD-PURCHASE_VIEW = 'X'.
ENDIF.
Preenchimento de dados relativos a MARA
BAPI_MARA-BASE_UOM = IT_MATMASTER-MEINS.
BAPI_MARA-MATL_GROUP = IT_MATMASTER-MATKL.
BAPI_MARA-OLD_MAT_NO = IT_MATMASTER-BISMT.
BAPI_MARA-DIVISION = IT_MATMASTER-SPART.
BAPI_MARA-PROD_HIER = IT_MATMASTER-PRDHA.
BAPI_MARA-NET_WEIGHT = IT_MATMASTER-ntgew.
BAPI_MARA-UNIT_OF_WT = IT_MATMASTER-GEWEI.
BAPI_MARA-TRANS_GRP = IT_MATMASTER-tragr.
> Novas Entradas
IF IT_MATMASTER-Mtart EQ '65'.
BAPI_MARA-BATCH_MGMT = IT_MATMASTER-XCHPF1.
BAPI_MARA-PUR_VALKEY = IT_MATMASTER-EKWSL.
BAPI_MARAX-PUR_VALKEY = 'X'.
ELSE.
BAPI_MARA-BATCH_MGMT = IT_MATMASTER-XCHPF.
ENDIF.
> Novas Entradas
BAPI_MARA-MINREMLIFE = IT_MATMASTER-MHDRZ.
BAPI_MARA-SHELF_LIFE = IT_MATMASTER-MHDHB.
BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-OLD_MAT_NO = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-DIVISION = 'X'.
BAPI_MARAX-PROD_HIER = 'X'.
BAPI_MARAX-NET_WEIGHT = 'X'.
BAPI_MARAX-UNIT_OF_WT = 'X'.
BAPI_MARAX-TRANS_GRP = 'X'.
BAPI_MARAX-BATCH_MGMT = 'X'.
BAPI_MARAX-MINREMLIFE = 'X'.
BAPI_MARAX-SHELF_LIFE = 'X'.
Preencimento de dados Relativos a MKVE
BAPI_MVKE-DELYG_PLNT = IT_MATMASTER-DWERK.
BAPI_MVKE-SALES_ORG = IT_MATMASTER-VKORG.
BAPI_MVKE-DISTR_CHAN = IT_MATMASTER-VTWEG.
BAPI_MVKE-PROD_HIER = IT_MATMASTER-PRODH.
BAPI_MVKE-ITEM_CAT = IT_MATMASTER-MTPOS.
BAPI_MVKE-ACCT_ASSGT = IT_MATMASTER-KTGRM.
BAPI_MVKEX-SALES_ORG = IT_MATMASTER-VKORG.
BAPI_MVKEX-DISTR_CHAN = IT_MATMASTER-VTWEG.
BAPI_MVKEX-PROD_HIER = 'X'.
BAPI_MVKEX-ITEM_CAT = 'X'.
BAPI_MVKEX-DELYG_PLNT = 'X'.
BAPI_MVKEX-ACCT_ASSGT = 'X'.
Preencimento de dados Relativos a MARC
BAPI_MARC-PLANT = IT_MATMASTER-WERKS.
BAPI_MARC-AVAILCHECK = IT_MATMASTER-MTVFP.
BAPI_MARC-LOADINGGRP = IT_MATMASTER-LADGR.
BAPI_MARC-PROFIT_CTR = IT_MATMASTER-PRCTR.
IF NOT IT_MATMASTER-Mtart EQ '51'.
BAPI_MARC-COMM_CODE = IT_MATMASTER-STAWN.
BAPI_MARC-COUNTRYORI = IT_MATMASTER-HERKL.
BAPI_MARC-REGIONORIG = IT_MATMASTER-HERKR.
BAPI_MARCX-COMM_CODE = 'X'.
BAPI_MARCX-COUNTRYORI = 'X'.
BAPI_MARCX-REGIONORIG = 'X'.
ENDIF.
BAPI_MARC-MRP_GROUP = IT_MATMASTER-DISGR.
BAPI_MARC-MRP_TYPE = IT_MATMASTER-DISMM.
BAPI_MARC-MRP_CTRLER = IT_MATMASTER-DISPO.
BAPI_MARC-LOTSIZEKEY = IT_MATMASTER-DISLS.
BAPI_MARC-MINLOTSIZE = IT_MATMASTER-BSTMI.
BAPI_MARC-ROUND_VAL = IT_MATMASTER-BSTRF.
BAPI_MARC-PROC_TYPE = IT_MATMASTER-BESKZ.
BAPI_MARC-BACKFLUSH = IT_MATMASTER-RGEKZ .
BAPI_MARC-ISS_ST_LOC = IT_MATMASTER-LGPRO.
BAPI_MARC-DETERM_GRP = IT_MATMASTER-EPRIO.
BAPI_MARC-SM_KEY = IT_MATMASTER-FHORI.
BAPI_MARC-PERIOD_IND = IT_MATMASTER-PERKZ.
BAPI_MARC-PLAN_STRGP = IT_MATMASTER-STRGR.
BAPI_MARC-CONSUMMODE = IT_MATMASTER-VRMOD.
BAPI_MARC-BWD_CONS = IT_MATMASTER-VINT1.
BAPI_MARC-FWD_CONS = IT_MATMASTER-VINT2.
BAPI_MARC-ALT_BOM_ID = IT_MATMASTER-ALTSL.
BAPI_MARC-PRODUCTION_SCHEDULER = IT_MATMASTER-FEVOR.
IF NOT IT_MATMASTER-Mtart EQ '65'.
BAPI_MARC-IND_POST_TO_INSP_STOCK = IT_MATMASTER-INSMK.
BAPI_MARC-OVER_TOL = IT_MATMASTER-UEETO.
BAPI_MARCX-IND_POST_TO_INSP_STOCK = 'X'.
BAPI_MARCX-OVER_TOL = 'X'.
ENDIF.
> Novas Entradas
IF IT_MATMASTER-Mtart EQ '65'.
BAPI_MARC-PUR_GROUP = IT_MATMASTER-EKGRP .
BAPI_MARC-AUTO_P_ORD = IT_MATMASTER-KAUTB .
BAPI_MARC-GR_PR_TIME = IT_MATMASTER-WEBAZ .
BAPI_MARC-IND_POST_TO_INSP_STOCK = IT_MATMASTER-INSMK1 .
BAPI_MARC-SOURCELIST = IT_MATMASTER-KORDB .
BAPI_MARC-EXPIMPGRP = IT_MATMASTER-MTVER .
BAPI_MARCX-PUR_GROUP = 'X'.
BAPI_MARCX-AUTO_P_ORD = 'X'.
BAPI_MARCX-GR_PR_TIME = 'X'.
BAPI_MARCX-IND_POST_TO_INSP_STOCK = 'X'.
BAPI_MARCX-SOURCELIST = 'X'.
BAPI_MARCX-EXPIMPGRP = 'X'.
ENDIF.
> Novas Entradas
BAPI_MARCX-PLANT = IT_MATMASTER-WERKS.
BAPI_MARCX-AVAILCHECK = 'X'.
BAPI_MARCX-LOADINGGRP = 'X'.
BAPI_MARCX-PROFIT_CTR = 'X'.
BAPI_MARCX-MRP_GROUP = 'X'.
BAPI_MARCX-MRP_TYPE = 'X'.
BAPI_MARCX-MRP_CTRLER = 'X'.
BAPI_MARCX-LOTSIZEKEY = 'X'.
BAPI_MARCX-MINLOTSIZE = 'X'.
BAPI_MARCX-ROUND_VAL = 'X'.
BAPI_MARCX-PROC_TYPE = 'X'.
BAPI_MARCX-BACKFLUSH = 'X'.
BAPI_MARCX-ISS_ST_LOC = 'X'.
BAPI_MARCX-DETERM_GRP = 'X'.
BAPI_MARCX-SM_KEY = 'X'.
BAPI_MARCX-PERIOD_IND = 'X'.
BAPI_MARCX-PLAN_STRGP = 'X'.
BAPI_MARCX-CONSUMMODE = 'X'.
BAPI_MARCX-BWD_CONS = 'X'.
BAPI_MARCX-FWD_CONS = 'X'.
BAPI_MARCX-ALT_BOM_ID = 'X'.
BAPI_MARCX-PRODUCTION_SCHEDULER = 'X'.
Preencimento de dados Relativos a MLGN
BAPI_MLGN-WHSE_NO = 'S01'.
BAPI_MLGN-WITHDRAWAL = IT_MATMASTER-LTKZA_S01.
BAPI_MLGN-PLACEMENT = IT_MATMASTER-LTKZE_S01.
BAPI_MLGN-STGESECTOR = IT_MATMASTER-LGBKZ_S01.
BAPI_MLGN-L_EQUIP_1 = IT_MATMASTER-LHMG1.
BAPI_MLGN-L_EQUIP_2 = IT_MATMASTER-LHMG2.
BAPI_MLGN-L_EQUIP_3 = IT_MATMASTER-LHMG3.
BAPI_MLGN-LEQ_UNIT_1 = IT_MATMASTER-LHME1.
BAPI_MLGN-LEQ_UNIT_2 = IT_MATMASTER-LHME2.
BAPI_MLGN-LEQ_UNIT_3 = IT_MATMASTER-LHME3.
BAPI_MLGN-UNITTYPE_1 = IT_MATMASTER-LETY1.
BAPI_MLGN-UNITTYPE_2 = IT_MATMASTER-LETY2.
BAPI_MLGN-UNITTYPE_3 = IT_MATMASTER-LETY3.
BAPI_MLGNX-WHSE_NO = 'S01'.
BAPI_MLGNX-WITHDRAWAL = 'X'.
BAPI_MLGNX-PLACEMENT = 'X'.
BAPI_MLGNX-STGESECTOR = 'X'.
BAPI_MLGNX-L_EQUIP_1 = 'X'.
BAPI_MLGNX-L_EQUIP_2 = 'X'.
BAPI_MLGNX-L_EQUIP_3 = 'X'.
BAPI_MLGNX-LEQ_UNIT_1 = 'X'.
BAPI_MLGNX-LEQ_UNIT_2 = 'X'.
BAPI_MLGNX-LEQ_UNIT_3 = 'X'.
BAPI_MLGNX-UNITTYPE_1 = 'X'.
BAPI_MLGNX-UNITTYPE_2 = 'X'.
BAPI_MLGNX-UNITTYPE_3 = 'X'.
Preencimento de dados Relativos a MBEW
BAPI_MBEW,
BAPI_MBEWX,
BAPI_MBEW-VAL_CLASS = IT_MATMASTER-BKLAS.
BAPI_MBEW-PRICE_CTRL = IT_MATMASTER-VPRSV.
BAPI_MBEW-STD_PRICE = IT_MATMASTER-VERPR.
BAPI_MBEW-PRICE_UNIT = IT_MATMASTER-PEINH.
BAPI_MBEW-VAL_AREA = 'CLPS'."IT_MATMASTER-BWKEY.
BAPI_MBEWX-VAL_AREA = 'CLPS'."IT_MATMASTER-BWKEY.
BAPI_MBEWX-VAL_CLASS = 'X'.
BAPI_MBEWX-PRICE_CTRL = 'X'.
BAPI_MBEWX-STD_PRICE = 'X'.
BAPI_MBEWX-PRICE_UNIT = 'X'.
---------------------------------------------------> Material Descrition
IT_MATERIALDESC-LANGU = sy-langu. "'EN'.
IT_MATERIALDESC-MATL_DESC = IT_MATMASTER-MAKTX.
APPEND IT_materialdesc.
Gross Weight, Volume and EAN
*Volume é preciso uma rotina de conversão
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
EXPORTING
INPUT = IT_MATMASTER-VOLEH
LANGUAGE = SY-LANGU
IMPORTING
OUTPUT = VolumUnitConv
EXCEPTIONS
UNIT_NOT_FOUND = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
EXPORTING
INPUT = IT_MATMASTER-MEINS
LANGUAGE = SY-LANGU
IMPORTING
OUTPUT = UnitConv
EXCEPTIONS
UNIT_NOT_FOUND = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IT_UOM-GROSS_WT = IT_MATMASTER-BRGEW.
IT_UOM-ALT_UNIT = UnitConv.
IT_UOM-ALT_UNIT_ISO = IT_MATMASTER-GEWEI.
IT_UOM-UNIT_OF_WT = IT_MATMASTER-GEWEI.
IT_UOM-EAN_UPC = IT_MATMASTER-EAN11.
IT_UOM-EAN_CAT = IT_MATMASTER-NUMTP.
IT_UOM-VOLUME = IT_MATMASTER-VOLUM.
IT_UOM-VOLUMEUNIT = VolumUnitConv.
IT_UOM-VOLUMEUNIT_ISO = IT_MATMASTER-VOLEH.
APPEND IT_UOM.
IT_UOMX-ALT_UNIT = IT_MATMASTER-MEINS.
IT_UOMX-ALT_UNIT_ISO = IT_MATMASTER-GEWEI.
IT_UOMX-GROSS_WT = 'X'.
IT_UOMX-UNIT_OF_WT = 'X'.
IT_UOMX-EAN_UPC = 'X'.
IT_UOMX-EAN_CAT = 'X'.
*Volume
IT_UOMX-VOLUME = 'X'.
IT_UOMX-VOLUMEUNIT = 'X'.
IT_UOMX-VOLUMEUNIT_ISO = 'X'.
APPEND IT_UOMX.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = BAPIMATHEAD
CLIENTDATA = BAPI_MARA
CLIENTDATAX = BAPI_MARAx
PLANTDATA = BAPI_MARc
PLANTDATAX = BAPI_MARcx
VALUATIONDATA = BAPI_MBEW
VALUATIONDATAX = BAPI_MBEWX
WAREHOUSENUMBERDATA = BAPI_MLGN
WAREHOUSENUMBERDATAX = BAPI_MLGNX
SALESDATA = BAPI_MVKE
SALESDATAX = BAPI_MVKEX
IMPORTING
RETURN = IT_RETURN
TABLES
MATERIALDESCRIPTION = IT_MATERIALDESC
UNITSOFMEASURE = IT_UOM
UNITSOFMEASUREX = IT_UOMX
MATERIALLONGTEXT = text
TAXCLASSIFICATIONS = it_MLAN.
if it_return-type eq 'S'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
endif.
WAIT UP TO 10 SECONDS.
WRITE : / IT_RETURN-MESSAGE.
CLEAR: IT_MATERIALDESC[],
IT_UOM[],
IT_UOMX[],
it_MLAN[],
IT_RETURN,
text,
BAPIMATHEAD,
BAPI_MARA,
BAPI_MARAx,
BAPI_MARc,
BAPI_MARcx,
BAPI_MBEW,
BAPI_MBEWX,
BAPI_MLGN,
BAPI_MLGNX,
BAPI_MVKE,
BAPI_MVKEX
ENDLOOP. -
I want complete code of mm01 using bapi's
hi experts!
my requirements is upload material master data using bapi....
i want complete code of mm01 ......i have no idea of bapi
pls help me anybody...............................Dear Shilpa,
Please go through the following link:
https://www.sdn.sap.com/irj/sdn/wiki
Tutorial, MM01 Upload using BAPI
Author: Karthik Potharaju
Submitted: 28.09.07
*& Report ZKAR_MATMAS_BAPI
*& This program demonstrates how easy it is to create Material master
*& data using BAPI_MATERIAL_SAVEDATA
*& The program also generates a report post-execution displaying errors
*& as well as successful uploads
*& Written by: Karthik Potharaju
*& URL: http://allaboutsap.blogspot.com
REPORT ZKAR_MATMAS_BAPI.
TABLES
FLAGS *
DATA: F_STOP. " Flag used to stop processing
DATA DECLARATIONS *
DATA : V_EMPTY TYPE I, " No. of empty records
V_TOTAL TYPE I. " Total no. of records.
STRUCTURES & INTERNAL TABLES
*--- BAPI structures
DATA: BAPI_HEAD LIKE BAPIMATHEAD, " Header Segment with Control Information
BAPI_MAKT LIKE BAPI_MAKT, " Material Description
BAPI_MARA1 LIKE BAPI_MARA, " Client Data
BAPI_MARAX LIKE BAPI_MARAX, " Checkbox Structure for BAPI_MARA
BAPI_MARC1 LIKE BAPI_MARC, " Plant View
BAPI_MARCX LIKE BAPI_MARCX, " Checkbox Structure for BAPI_MARC
BAPI_MBEW1 LIKE BAPI_MBEW, " Accounting View
BAPI_MBEWX LIKE BAPI_MBEWX, " Checkbox Structure for BAPI_MBEW
BAPI_RETURN LIKE BAPIRET2. " Return Parameter
*--- Internal table to hold excel file data
DATA: IT_INTERN TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
*--- Internal table to hold Matetrial descriptions
DATA: BEGIN OF IT_MAKT OCCURS 100.
INCLUDE STRUCTURE BAPI_MAKT.
DATA: END OF IT_MAKT.
*--- Internal to hold the records in the text file
DATA : BEGIN OF IT_DATA OCCURS 100,
WERKS(4), " Plant
MTART(4), " Material type
MATNR(18), " Material number
MATKL(9) , " Material group
MBRSH(1), " Industry sector
MEINS(3), " Base unit of measure
GEWEI(3), " Weight Unit
SPART(2), " Division
EKGRP(3), " Purchasing group
VPRSV(1), " Price control indicator
STPRS(12), " Standard price
PEINH(3), " Price unit
SPRAS(2), " Language key
MAKTX(40), " Material description
END OF IT_DATA.
SELECTION SCREEN. *
SELECTION-SCREEN BEGIN OF BLOCK SCR1 WITH FRAME TITLE TEXT-111.
PARAMETER : P_FILE TYPE RLGRAP-FILENAME OBLIGATORY DEFAULT " Input File
'C:Material_master.XLS'.
PARAMETER : P_MAX(4) OBLIGATORY DEFAULT '100'. " no.of recs in a session
PARAMETERS: P_HEADER TYPE I DEFAULT 0. " Header Lines
PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,
P_BEGROW TYPE I DEFAULT 1 NO-DISPLAY,
P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,
P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK SCR1.
AT SELECTION-SCREEN *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
*--- Validating file
PERFORM VALIDATE_FILE USING P_FILE.
START-OF-SELECTION
START-OF-SELECTION.
*--- Perform to convert the Excel data into an internal table
PERFORM CONVERT_XLS_ITAB.
IF NOT IT_DATA[] IS INITIAL.
*--- Perform to delete Header lines
PERFORM DELETE_HEADER_EMPTY_RECS.
ENDIF.
END OF SELECTION. *
END-OF-SELECTION.
*--- Perform to upload Material Master data
PERFORM UPLOAD_MATMAS.
Form : validate_input_file
Description : To provide F4 help for file if read from PC
FORM VALIDATE_FILE USING F_FILE TYPE RLGRAP-FILENAME.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
FILE_NAME = F_FILE
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE S010(ZLKPL_MSGCLASS). " 'Error in getting filename'.
ENDIF.
ENDFORM. " validate_input_file
*& Form CONVER_XLS_ITAB
text
FORM CONVERT_XLS_ITAB.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = P_BEGCOL
I_BEGIN_ROW = P_BEGROW
I_END_COL = P_ENDCOL
I_END_ROW = P_ENDROW
TABLES
INTERN = IT_INTERN.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*--- Perform to move the data into an internal data
PERFORM MOVE_DATA.
ENDFORM. " CONVERT_XLS_ITAB
*& Form MOVE_DATA
text
FORM MOVE_DATA.
DATA : LV_INDEX TYPE I.
FIELD-SYMBOLS <FS>.
*--- Sorting the internal table
SORT IT_INTERN BY ROW COL.
CLEAR IT_INTERN.
LOOP AT IT_INTERN.
MOVE IT_INTERN-COL TO LV_INDEX.
*--- Assigning the each record to an internal table row
ASSIGN COMPONENT LV_INDEX OF STRUCTURE IT_DATA TO <FS>.
*--- Asigning the field value to a field symbol
MOVE IT_INTERN-VALUE TO <FS>.
AT END OF ROW.
APPEND IT_DATA.
CLEAR IT_DATA.
ENDAT.
ENDLOOP.
ENDFORM. " MOVE_DATA
*& Form DELETE_HEADER_EMPTY_RECS
To delete the Header and empty records
FORM DELETE_HEADER_EMPTY_RECS.
DATA: LV_TABIX LIKE SY-TABIX.
IF NOT P_HEADER IS INITIAL.
LOOP AT IT_DATA.
IF P_HEADER > 0 AND NOT IT_DATA IS INITIAL.
DELETE IT_DATA FROM 1 TO P_HEADER.
P_HEADER = 0.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
CLEAR IT_DATA.
*--- To delete the empty lines from internal table
LOOP AT IT_DATA.
LV_TABIX = SY-TABIX.
IF IT_DATA IS INITIAL.
V_EMPTY = V_EMPTY + 1.
DELETE IT_DATA INDEX LV_TABIX..
ENDIF.
ENDLOOP.
CLEAR IT_DATA.
*--- Total no of recs in file
DESCRIBE TABLE IT_DATA LINES V_TOTAL.
IF V_TOTAL = 0.
MESSAGE I013(ZLKPL_MSGCLASS). " No records in the file
F_STOP = 'X'.
STOP.
ENDIF.
ENDFORM. " DELETE_HEADER_EMPTY_RECS
*& Form UPLOAD_MATMAS
to upload Material Master data
FORM UPLOAD_MATMAS .
LOOP AT IT_DATA.
Header
BAPI_HEAD-MATERIAL = IT_DATA-MATNR.
BAPI_HEAD-IND_SECTOR = IT_DATA-MBRSH.
BAPI_HEAD-MATL_TYPE = IT_DATA-MTART.
BAPI_HEAD-BASIC_VIEW = 'X'.
BAPI_HEAD-PURCHASE_VIEW = 'X'.
BAPI_HEAD-ACCOUNT_VIEW = 'X'.
Material Description
REFRESH IT_MAKT.
IT_MAKT-LANGU = IT_DATA-SPRAS.
IT_MAKT-MATL_DESC = IT_DATA-MAKTX.
APPEND IT_MAKT.
Client Data - Basic
BAPI_MARA1-MATL_GROUP = IT_DATA-MATKL.
BAPI_MARA1-BASE_UOM = IT_DATA-MEINS.
BAPI_MARA1-UNIT_OF_WT = IT_DATA-GEWEI.
BAPI_MARA1-DIVISION = IT_DATA-SPART.
BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-UNIT_OF_WT = 'X'.
BAPI_MARAX-DIVISION = 'X'.
Plant - Purchasing
BAPI_MARC1-PLANT = IT_DATA-WERKS.
BAPI_MARC1-PUR_GROUP = IT_DATA-EKGRP.
BAPI_MARCX-PLANT = IT_DATA-WERKS.
BAPI_MARCX-PUR_GROUP = 'X'.
Accounting
BAPI_MBEW1-VAL_AREA = IT_DATA-WERKS.
BAPI_MBEW1-PRICE_CTRL = IT_DATA-VPRSV.
BAPI_MBEW1-STD_PRICE = IT_DATA-STPRS.
BAPI_MBEW1-PRICE_UNIT = IT_DATA-PEINH.
BAPI_MBEWX-VAL_AREA = IT_DATA-WERKS.
BAPI_MBEWX-PRICE_CTRL = 'X'.
BAPI_MBEWX-STD_PRICE = 'X'.
BAPI_MBEWX-PRICE_UNIT = 'X'.
*--- BAPI to create material
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
HEADDATA = BAPI_HEAD
CLIENTDATA = BAPI_MARA1
CLIENTDATAX = BAPI_MARAX
PLANTDATA = BAPI_MARC1
PLANTDATAX = BAPI_MARCX
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
VALUATIONDATA = BAPI_MBEW1
VALUATIONDATAX = BAPI_MBEWX
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA = BAPI_MVKE1
SALESDATAX = BAPI_MVKEX
STORAGETYPEDATA =
STORAGETYPEDATAX =
IMPORTING
RETURN = BAPI_RETURN
TABLES
MATERIALDESCRIPTION = IT_MAKT
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
IF BAPI_RETURN-TYPE = 'E'.
WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,it_data-matnr.
ELSEIF BAPI_RETURN-TYPE = 'S'.
WRITE: 'Successfully created material' ,it_data-matnr.
ENDIF.
ENDLOOP.
ENDFORM. " UPLOAD_MATMAS
Regards,
Abir
Don't forget to Reward Points * -
hello everybody!!
i want executable code on mm01 with using bapi................
my requirement is upload mm01 data ( no validations)
i want complete code from strach..........
pls help anybody .......Here's the complete code for T-code MM01.
Just a make a text file with relevant data in the program.
REPORT zrs NO STANDARD PAGE HEADING.
*-- Variable declaratins
DATA: fname LIKE rlgrap-filename.
DATA: wa_string(255) TYPE c.
*CONSTANTS: con_tab(2) TYPE c VALUE '09'.
constants: con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
TYPES:BEGIN OF t_mat,
matnr(10),
desc(10),
uom(5),
END OF t_mat.
*-- Work area declaration.
DATA : i_mat TYPE TABLE OF t_mat.
DATA: i_mat_temp TYPE TABLE OF t_mat.
DATA : wa_mat TYPE t_mat.
DATA : wa_matstr TYPE t_mat.
INCLUDE bdcrecxx.
START-OF-SELECTION.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = ' '
filetype = 'DAT'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
data_tab = i_mat
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.
IF sy-subrc <> 0.
WRITE:/ 'Internal Table not populated.'.
ENDIF.
**--- Name of file inapplication server
fname = 'bdcdata.txt'.
OPEN DATASET fname FOR OUTPUT IN TEXT MODE encoding default. " encoding default not in 4.0b
IF sy-subrc <> 0.
WRITE: / 'Error opening file'.
ENDIF.
**---Transfering data from internal table to dataset
LOOP AT i_mat INTO wa_mat.
TRANSFER wa_mat TO fname.
ENDLOOP.
CLOSE DATASET fname.
CLEAR i_mat.
CLEAR wa_mat.
PERFORM open_group.
**-----Opening dataset for reading
OPEN DATASET fname FOR INPUT IN TEXT MODE encoding default.
Reading the file from application server
DO.
READ DATASET fname INTO wa_string.
IF sy-subrc <> 0.
EXIT.
ENDIF.
SPLIT wa_string AT con_tab INTO TABLE i_mat_temp.
SPLIT wa_string AT con_tab into table i_mat_temp.
LOOP AT i_mat_temp INTO wa_mat.
APPEND wa_mat TO i_mat.
ENDLOOP.
ENDDO.
CLOSE DATASET fname.
LOOP AT i_mat INTO wa_mat.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-MTART'.
PERFORM bdc_field USING 'RMMG1-MATNR'
wa_mat-matnr.
PERFORM bdc_field USING 'RMMG1-MBRSH'
'W'.
PERFORM bdc_field USING 'RMMG1-MTART'
'FERT'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MSICHTAUSW-KZSEL(01)'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'
'X'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_SUBSCR'
'SAPLMGMM'
& ' 2000TABFRA1'.
PERFORM bdc_field USING 'BDC_SUBSCR'
'SAPLMGD1'
& ' 1002SUB1'.
PERFORM bdc_field USING 'MAKT-MAKTX'
wa_mat-desc.
PERFORM bdc_field USING 'BDC_SUBSCR'
'SAPLMGD1'
& ' 2001SUB2'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARA-MEINS'.
PERFORM bdc_field USING 'MARA-MEINS'
wa_mat-uom.
PERFORM bdc_field USING 'BDC_SUBSCR'
'SAPLMGD1'
& ' 2561SUB3'.
PERFORM bdc_field USING 'BDC_SUBSCR'
'SAPLMGD1'
& ' 2007SUB4'.
PERFORM bdc_field USING 'BDC_SUBSCR'
'SAPLMGD1'
& ' 2005SUB5'.
PERFORM bdc_field USING 'BDC_SUBSCR'
'SAPLMGD1'
& ' 2011SUB6'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
PERFORM bdc_transaction USING 'MM01'.
REFRESH bdcdata.
ENDLOOP.
PERFORM close_group.
<b>Hope this is helpful, Do reward</b> -
Need screen-shot for create mm01 using BAPI(Through lsmw or ecording)
hi,
could u give screen-shot of the lsmw using bapi.for material master data create using t.code (mm01')
i will be waiting for eply.
regards
eswar.Check this link dude.....
http://www.****************/Tutorials/LSMW/LSMWMainPage.htm
It has all different types of LSMW with the screen shots.... keep doin
Regards,
Pavan -
Service order creation using bapi with repair order number
Hi experts,
Pls suggest me a BAPI to create a service order for those repair orders where a PGR has been done(for return delivery type : LR).
The plant should be 0260 with storage location wh01 and item category ZRRE
Creation of a service order with repair order type SM03 is not allowed in iw31.
thanks and regards,
Vijayb.Hi prakash,
Thank u for the BAPI
But an error is being displayed saying that the REFURBISHMENT ORDERS CANNOT BE PROCESSED USING BAPI.
ERROR DURING PROCESSING OF BAPI METHODS.
This is while u pass the order type as either ZM03 or SM01or SM02 or SM03.
pls help me on that.
thanks and regards,
Vijayb.
Maybe you are looking for
-
I have scoured the web for days and have not been able to quite come up with exactly what I need for this. I have created an Outlook signature deployment using VBScript which sets information in an already formatted Word doc using placeholders. (Ex.
-
Final Cut Pro X CRASHES every time I try to add a transition
G'day - just wondering if anyone with this issue has found a solution ? Have seen some scatterings regarding this issue - but no real solutions. It's doing my head in - just trying to add a simple cross disolve will crash it everytime. Any help would
-
Connecting a video??
Hi Does anyone know if you can connect a video player to the powerbook and digitize a video from it??? Do you connect the s-video cable to it both ways or something else??? can anyone help. Cheers Mark
-
Hi Experts, Can you give an example program on mailing ALV report output to any ID. Thanks in advance. Regards, Ram
-
Hi Just wondering if anybody knows if PPRO CS3 can create flash based clip notes and not just QT or WMV. Cheers ANgus