Tuesday, June 7, 2016

Research on SAP.


  1. http://www.sapdatasheet.org/abap/func/bapi_procord_check_mat_avail.html

  Read Any Table From SAP Using This BAPI:
  2. http://www.sapdatasheet.org/abap/func/RFC_READ_TABLE.html
  3. https://www.youtube.com/watch?v=Wzrns86C0BE--to create a window wizards for installation.
  4. https://www.youtube.com/watch?v=VWuS0Czj1jY--to create a window wizards for installation.
  5. https://scn.sap.com/thread/921459---repository
  6. https://www.youtube.com/watch?v=GC344FZeWqc--wcf
  7. https://www.youtube.com/watch?v=Oma-RbEWAAA&list=PL6n9fhu94yhVxEyaRMaMN_-              qnDdNVGsL1&index=49                                                                                                                     8. https://help.sap.com/saphelp_srm40/helpdata/en/7f/c6dc66c54811d194af00a0c94260a5/
      content.htm
  9. http://www.sapdatasheet.org/abap/func/bapi_procord_check_mat_avail.html
10. http://www.sapdatasheet.org/abap/func//sapds/rfc_read_table.html
11. http://www.se80.co.uk/sapfms/b/bapi/bapi_procord_check_mat_avail.htm
12. http://scn.sap.com/community/erp/manufacturing-pp/blog?start=120
13. https://scn.sap.com/thread/3626629
14. https://scn.sap.com/thread/298356
15. http://help.sap.com/saphelp_erp60_sp/helpdata/en/b1/c04750439a11d189410000e829fbbd/
      content.htm
16. http://www.sapdatasheet.org/abap/dtel/av_clear.html
17. http://www.sapdatasheet.org/abap/doma/av_check_o.html----for atp value
18. http://www.sapdatasheet.org/abap/dtel/cowb_avail_check_mode.html
19. http://www.sapdatasheet.org/abap/doma/as4flag.html

Example:
RfcRepository repository = _rfcDestination.Repository;
                IRfcFunction rfcReadTableBapi = repository.CreateFunction("BAPI_PROCORD_CHECK_MAT_AVAIL");

                IRfcTable orderTable = rfcReadTableBapi.GetTable("ORDERS");
                RfcStructureMetadata orderKeyStructure = repository.GetStructureMetadata("BAPI_ORDER_KEY");
                IRfcStructure orderStructure = orderKeyStructure.CreateStructure();
                orderStructure.SetValue("ORDER_NUMBER", "001000649701");
                orderTable.Append(orderStructure);
                rfcReadTableBapi.SetValue("ORDERS", orderTable);

                rfcReadTableBapi.SetValue("SCOPE_AVAIL", "A");//----mandatory parameter
                rfcReadTableBapi.SetValue("FIX_PLANNED_ORDERS", " ");//--non mandatory field
                rfcReadTableBapi.SetValue("WORK_PROCESS_GROUP", "COWORK_BAPI");//--non mandatory field
                rfcReadTableBapi.SetValue("RESET_AVAIL_DATA", " ");//--non mandatory field
                rfcReadTableBapi.Invoke(_rfcDestination);//execute the function


                IRfcTable returnDetailTable = rfcReadTableBapi.GetTable("DETAIL_RETURN");
                DataTable detailTable = GetDataTableFromRFCTable(returnDetailTable, "DETAIL_RETURN");

                IRfcTable returnApplicationTable = rfcReadTableBapi.GetTable("APPLICATION_LOG");
                DataTable applicationTable = GetDataTableFromRFCTable(returnApplicationTable, "APPLICATION_LOG");

                string value = rfcReadTableBapi.GetValue("RETURN").ToString();
we can read this Return value through string as well as dataTable also. for that first we need to get structure from bapi function.
                return detailTable;

20. https://www.youtube.com/watch?v=OGGg273z888
21. http://erpbizz.com/mm/vendor_evaluation.htm
22. http://www.se80.co.uk/saptables/l/lagp/lagp.htm

23. Know T-codes
/NSE37====for executing written functions from SAP frontend.
/NCOR1===create a new Process Order.
/NCOR2===edit a existing Process Order.
/NME21N==create a new Purchase Order.
/NOX09===to see storage locations for my plant in SAP.
/NMMBE===Stock over view in SAP
/NMM03===Material master view in SAP
/NLS24
/NLS01
/NLT01
/NCOGI
/NMIGO-For FG Confirmation.

Note:
Here /N represents it will open in a new window if we want to open in same window then we dont need to write.

some t-code links
https://olivers14.wordpress.com/sap-transaction-codes-and-its-meaning/
http://www.easymarketplace.de/transactions-i-l.php
https://www.tutorialspoint.com/sap/sap_transaction_codes.htm
http://www.saphub.com/abap-general/useful-transaction-codes-for-sap-abap-developers/
http://www.consulting.mungapen.com/?p=143
https://archive.sap.com/discussions/thread/1009863
http://www.erpgreat.com/general/sap-r3-transaction-codes.htm
http://www.tcodesearch.com/sap-tcodes
http://www.tcodesearch.com/sap-tables/list?module=mm
http://www.tcodesearch.com/transaction-codes/search?module=mm


1. How to create Purchase Order:
Step:1
Collect Below Information while creating PO
1. Purchase Organization of that Site.
2. Purchasing Group for that material.
3. Plant Code.
4. Company Code.

Step:2
Use T-code /nme21n This is used for purchase order screen

After entering Purchase Org, Purchase Group and Company Code.
Now its time to select vendor for that material.
In This Vendor form we need to select vendor as per our Purchase Organization, Plant Code and Material.

Step:3
Now its time to fill the required materials grid for my all materials.
What are things to fill here:
1)Material Number.
2)PO Quantity.
3)OUn--Order Unit.
4)Plant.

Hit Enter.

Step:4
Now its time for entering vendor confirmations.
Click On Item Detail in Left Side at bottom.

Item Detail->Now go to Confirmations Tab->Conf. Control Select here Order Acknowledgement.

Step:5
Now its time to check availablity
Click on Check and if everything goes fine then at last you click on save it will create the purchase Order.

How while FG confirmation set Auto generate serial number as per the qty:
BAPI_GOODSMVT_CREATE->BAPI2017_GM_ITEM_CREATE->SERIALNO_AUTO_NUMBERASSIGNMENT set as "X".

How to POST DESTOCKING/STOCKING movement to SAP.
 public void ReduceORIncreaseStock(Object confirmInfo, ref string materialDocNumber, ref string materialDocYear, ref string errorMessage)
        {
            RfcRepository repository = _rfcDestination.Repository;
            IRfcFunction bapiRollback = repository.CreateFunction("BAPI_TRANSACTION_ROLLBACK");
            try
            {
                IRfcFunction goodsMovementBapi = repository.CreateFunction("BAPI_GOODSMVT_CREATE");
                IRfcFunction bapiCommit = repository.CreateFunction("BAPI_TRANSACTION_COMMIT");

                bapiCommit.SetValue("WAIT", "X");

                RfcStructureMetadata goodsMovementCodeStructureMeta = repository.GetStructureMetadata("BAPI2017_GM_CODE");
                IRfcStructure goodsMovementCodeStructure = goodsMovementCodeStructureMeta.CreateStructure();

                RfcStructureMetadata goodsMovementHeaderStructureMeta = repository.GetStructureMetadata("BAPI2017_GM_HEAD_01");
                IRfcStructure goodsMovementHeaderStructure = goodsMovementHeaderStructureMeta.CreateStructure();

                RfcStructureMetadata goodsMovementItemCreateStructureMeta = repository.GetStructureMetadata("BAPI2017_GM_ITEM_CREATE");
                IRfcTable goodsMovementItemTable = goodsMovementBapi.GetTable("GOODSMVT_ITEM");

                RfcStructureMetadata goodsMovementSerialNumberCreateStructureMeta = repository.GetStructureMetadata("BAPI2017_GM_SERIALNUMBER");
                IRfcTable goodsMovementSerialTable = goodsMovementBapi.GetTable("GOODSMVT_SERIALNUMBER");


                List<iPASRFSAP.GoodsMovementMaterialInfo> postingMaterialInfoList = confirmInfo.MaterialInfoList;

                foreach (iPASRFSAP.GoodsMovementMaterialInfo postingMaterialInfo in postingMaterialInfoList)
                {

                    if (postingMaterialInfo.MovementType == "101")
                    {
                        goodsMovementCodeStructure.SetValue("GM_CODE", "02");           //Goods Receipts for Prod Order
                    }
                    else if (postingMaterialInfo.MovementType == "102")
                    {
                        goodsMovementCodeStructure.SetValue("GM_CODE", "06");       //Reversal of goods movements
                    }
                    else if (postingMaterialInfo.MovementType == "261")
                    {
                        goodsMovementCodeStructure.SetValue("GM_CODE", "03");          //Goods Issue
                    }
                    else
                    {
                        goodsMovementCodeStructure.SetValue("GM_CODE", "06");
                    }

                    goodsMovementHeaderStructure.SetValue("PSTNG_DATE", confirmInfo.PostingDate.ToString());
                    goodsMovementHeaderStructure.SetValue("DOC_DATE", confirmInfo.PostingDate.ToString());
                    goodsMovementHeaderStructure.SetValue("HEADER_TXT", confirmInfo.UserName);

                    IRfcStructure goodsMovementItemCreateStructure = goodsMovementItemCreateStructureMeta.CreateStructure();
                    if (postingMaterialInfo.MovementType == "262")
                    {
                        goodsMovementItemCreateStructure.SetValue("MOVE_TYPE", "261");
                    }
                    else
                    {
                        goodsMovementItemCreateStructure.SetValue("MOVE_TYPE", postingMaterialInfo.MovementType.Trim());
                    }
                    goodsMovementItemCreateStructure.SetValue("MATERIAL", postingMaterialInfo.MaterialNum.Trim().PadLeft(18, '0'));
                    goodsMovementItemCreateStructure.SetValue("BATCH", postingMaterialInfo.BatchNumber.Trim().ToUpper());
                    goodsMovementItemCreateStructure.SetValue("PLANT", confirmInfo.PlantCode.Trim());
                    goodsMovementItemCreateStructure.SetValue("STGE_LOC", postingMaterialInfo.StorageLocation.Trim());
                    goodsMovementItemCreateStructure.SetValue("ENTRY_QNT", postingMaterialInfo.EntryQty);
                    goodsMovementItemCreateStructure.SetValue("ENTRY_UOM", postingMaterialInfo.UoM.Trim());
                    goodsMovementItemCreateStructure.SetValue("ORDERID", confirmInfo.ProcessOrder.PadLeft(12, '0'));

                    if (postingMaterialInfo.MovementType == "261" || postingMaterialInfo.MovementType == "262")
                    {
                        //goodsMovementItemCreateStructure.SetValue("STCK_TYPE", "F");
                        goodsMovementItemCreateStructure.SetValue("STGE_TYPE", postingMaterialInfo.StorageType);
                        goodsMovementItemCreateStructure.SetValue("STGE_BIN", postingMaterialInfo.StorageBin);

                        goodsMovementItemCreateStructure.SetValue("NO_TRANSFER_REQ", "X");
                        if (postingMaterialInfo.MovementType == "262")
                        {
                            goodsMovementItemCreateStructure.SetValue("XSTOB", "X");
                        }

                        if (postingMaterialInfo.ReservationNumber > 0)
                        {
                            goodsMovementItemCreateStructure.SetValue("RESERV_NO", postingMaterialInfo.ReservationNumber);
                            goodsMovementItemCreateStructure.SetValue("RES_ITEM", postingMaterialInfo.ReservationItemNumber);
                        }

                        //if (postingMaterialInfo.IsLastPosting)
                        //{
                        //    goodsMovementItemCreateStructure.SetValue("WITHDRAWN", "X");
                        //}
                    }
                    else
                    {
                        //goodsMovementItemCreateStructure.SetValue("ORDERID", confirmInfo.ProcessOrder.PadLeft(12, '0'));
                        goodsMovementItemCreateStructure.SetValue("PROD_DATE", postingMaterialInfo.ProductionDate.ToString());
                        goodsMovementItemCreateStructure.SetValue("MVT_IND", "F");

                        if (postingMaterialInfo.MovementType == "102")
                        {
                            goodsMovementItemCreateStructure.SetValue("XSTOB", "X");
                            goodsMovementItemCreateStructure.SetValue("MOVE_TYPE", 101);
                        }

                        //goodsMovementItemCreateStructure.SetValue("SERIALNO_AUTO_NUMBERASSIGNMENT", " ");
                        goodsMovementItemCreateStructure.SetValue("SERIALNO_AUTO_NUMBERASSIGNMENT", "X");

                        //IRfcStructure goodsMovementSerialNumberCreateStructure = goodsMovementSerialNumberCreateStructureMeta.CreateStructure();
                        //goodsMovementSerialNumberCreateStructure.SetValue("MATDOC_ITM", postingMaterialInfo.ReservationItemNumber);
                        ////goodsMovementSerialNumberCreateStructure.SetValue("SERIALNO", 000000000010000081);
                        //goodsMovementSerialTable.Append(goodsMovementSerialNumberCreateStructure);

                    }


                    goodsMovementItemTable.Append(goodsMovementItemCreateStructure);
                }

                // goodsMovementSerialNumberCreateStructure.SetValue("", "");

                goodsMovementBapi.SetValue("GOODSMVT_CODE", goodsMovementCodeStructure);
                goodsMovementBapi.SetValue("GOODSMVT_HEADER", goodsMovementHeaderStructure);
                goodsMovementBapi.SetValue("GOODSMVT_ITEM", goodsMovementItemTable);
                //goodsMovementBapi.SetValue("GOODSMVT_SERIALNUMBER", goodsMovementSerialTable);


                RfcSessionManager.BeginContext(_rfcDestination);
                goodsMovementBapi.Invoke(_rfcDestination);
                bapiCommit.Invoke(_rfcDestination);
                RfcSessionManager.EndContext(_rfcDestination);

                IRfcTable returnTable = goodsMovementBapi.GetTable("RETURN");

                DataTable bapiReturnTable = GetDataTableFromRFCTable(returnTable, "returnTable");

                if (bapiReturnTable.Rows.Count > 0)
                {
                    //Error while executing the bapi
                    errorMessage = bapiReturnTable.Rows[0]["Message"].ToString();
                    return;
                }

                materialDocNumber = goodsMovementBapi.GetValue("MATERIALDOCUMENT").ToString();
                materialDocYear = goodsMovementBapi.GetValue("MATDOCUMENTYEAR").ToString();

            }
            catch (Exception ex)
            {
                bapiRollback.Invoke(_rfcDestination);
                RfcSessionManager.EndContext(_rfcDestination);
                throw ex;
            }
        }

List Down all bapis:
http://codingthis.com/uncategorized/list-of-all-bapi-available/

How to read multiple columns through BAPI:
IRfcTable fieldsTable = rfcReadTableBapi.GetTable("FIELDS");
                RfcStructureMetadata fieldsStructureMeta = repository.GetStructureMetadata("RFC_DB_FLD");
                IRfcStructure fieldsStructure = fieldsStructureMeta.CreateStructure();
                fieldsStructure.SetValue("FIELDNAME", "SERNR");
                fieldsTable.Append(fieldsStructure);
                RfcStructureMetadata fieldsStructureMeta1 = repository.GetStructureMetadata("RFC_DB_FLD");
                IRfcStructure fieldsStructure1 = fieldsStructureMeta1.CreateStructure();
                fieldsStructure1.SetValue("FIELDNAME", "MATNR");
                fieldsTable.Append(fieldsStructure1);
                rfcReadTableBapi.SetValue("FIELDS", fieldsTable);
                rfcReadTableBapi.Invoke(_rfcDestination);


All Important T-codes:
ME21N - Create Purchase Order
ME23N - Display Purchase Order tcode Purchase order info / STO
ME22N - Change Purchase Order
VA01 –Create Sales order
VA02 –Change sales order
VL01N- Create Delivery order
VL03N - Display Outbound Delivery
VL32N - Change Inbound Delivery tcode
VL33N -Display Inbound Delivery
VL22N - Display Delivery Change Documents
QA32 - QC test UD / Inspation slot
QA33 - Display data for inspection lot
QA03 - Display inspection lot
LS24 - Display Quants for Material
MM03 - Display Material
MM04 - Display Material Change Documents
MSC2N - change batch
MSC3N - display change batch & check Production date
LS25 - Display Quants per Storage Bin
SE16 - View SAP tables
CORT - Display Process Order Confirmation.
COGI - Postprocess Faulty Goods Movements
COR1 - Create Process Orde
COR2 - Change Process Order
COR3 - Display Process order
C203- Display Recipe Details
SE37 - Babi funtion
mb51 - movement check
LT01 - Bin 2 Bin movement, movement type(999).
MB23 - Display Reservation
SE38 - Execute Program
MMBE - Stock details
LT21 – Display transfer order
LT22 – Display Transfer order for Storage Type
LT24 – Display Transfer Order For Material (B2B trancation),
LB11 – Display Transfer Requirement for Material
LB13 - Display Transfer Requirement
MB52  -  with section params - mark  K -Consignment stock or (MB54 )
C261  -  changes done in master recipe & resources (C260 or C261 and QP60,)
MB1C- To book stock with movement type - 501, enter material details and save it. TO created and go lt01 and do putway.
LT22 - Track SAP error logs
LS01N – Create Bin SAP
LS41 – Consuming Bulk indicator material configure in SAP.
LS03 – Storage Capacity
LX03 – Bin status
SM12 – Lock entry list
SM21 – System Logs
SM20 –Analysis of Security Audit Log
SM58 – TRANSACTIONAL rfc

Confirmation unit of Measure for Yield during FG Confirmation:
https://archive.sap.com/discussions/thread/1916758
CONF_QUAN_UNIT


No comments:

Post a Comment

Things to carry while travelling

 Kapda 1)3 jeans. 2)5 chaddi. 3)4 short pant. 4)1 taulia. 5)1 Topi. 6)1 paijama. 7)3 T-shirt. 8)3 Shirt. 9)Ganji 5. 10)1 inner ware mota. Fr...