Table associated for Batch and PO line item
Hi All,
I am looking for a table,where I can see the batches associated with the Purchase Orders.
Thanks,
Seshadri
Hi
If you are referring to the Batch field in PO line item then you will get the details in tale EKET.
Regards
Prasad
Similar Messages
-
How to read Images associate with Purchase Requisitions and its Line Items
Hello,
My scenario: i need to read the Images associated with PR and its line items and pass them as Idoc FM.
Any idea where are these images stored in the SAP table or they just available till runtime
Regards,
AbhishekYou can have a look at the link here [GOS Contents|http://help-abap.zevolving.com/2009/02/generic-object-services-gos-toolbar-part-5-get-note-attachment-contents/]
Please note that in your case if its attachments only then pass la_relat-low = 'ATTA*'. if there is no filtering then pass 'NOTE', 'URL', 'ATTA' as required.
For the business object of PR pass BUS2105 and instance id pass the PR no.
The tables related to this are srrelroles,srgbinrel,sood etc. -
Profit centre needs to be updated in Vendor and Customer line item reports
We are using ECC 6.
Profit centre is updating for vendor and customer line items in document level. But the same is to be reflected/updated in profit centre field in FBL1N and Reports.hi
Use this T codes you will get Profit center wise S_AC0_52000888 Paybles (vendor balances )
Tcode for Profit center wise receviables S_AC0_52000887 (customer balances )
Regards
Babu.k -
BAPI FOR Deleting a Schedule Line Item from EKES and EKET tables
Dear All,
I would like to for deleting one of the line item from EKES (Po Confirmation ) and the respective line item from the EKET(PO Schedule Line Item Table).
Assume that am allowing the user to select the lineitem from zprogram screen and collecting the PO and Its LIne Item details in an internal table.
Can i Use
<b>BAPI_PO_Change</b> , if so , can anybody tell me the steps to follow to use this bapi for deleting the PO lineItems, since i m going to try BAPI for First time.
pls help me out
Message was edited by: Raja K.PHi raja ,
loop at iekko1.
w_index = sy-tabix.
item-po_item = itemx-po_item = iekko1-ebelp.
item-quantity = iekko1-mng01.
itemx-quantity = iekko1-mng01.
if iekko1-wamng = iekko1-wemng.
itemx-no_more_gr = item-no_more_gr = 'X'.
else.
itemx-no_more_gr = item-no_more_gr = ''.
endif.
append item.
append itemx.
clear return[].
call function 'BAPI_PO_CHANGE'
exporting
purchaseorder = iekko1-ebeln
tables
return = return
poitem = item
poitemx = itemx.
if return[] is initial.
commit work and wait.
call function 'DEQUEUE_ALL'.
search for deletion fields which u have to mark 'X'.
before calling this BAPi u have to lock the PO by using ENQUEUE.
<b>
FU BAPI_PO_CHANGE
Text
Change purchase order
Functionality
Function module BAPI_PO_CHANGE enables you to change purchase orders. The Change method uses the technology behind the online transaction ME22N.
Alternatively, the IDoc type PORDCH1 is available. The data from this IDoc populates the interface parameters of the function module BAPI_PO_CHANGE.
Functionality in Detail
Authorization
When you create (activity 02) an Enjoy purchase order, the following authorization objects are checked:
M_BEST_BSA (document type in PO)
M_BEST_EKG (purchasing group in PO)
M_BEST_EKO (purchasing organization in PO)
M_BEST_WRK (plant in PO)
Controlling adoption of field values via X bar
For most tables, you can use your own parameters in the associated X bar (e.g. PoItemX) to determine whether fields are to be set initial, values inserted via the interface, or default values adopted from Customizing or master records, etc. (for example, it is not mandatory to adopt the material group from an underlying requisition - you can change it with the BAPI).
Transfer
Purchase order number
The PurchaseOrder field uniquely identifies a purchase order. This field must be populated in order to carry out the Change method.
Header data
The header data of the Enjoy purchase order is transferred in table PoHeader.
Item data
The item data of the Enjoy purchase order is stored in the tables PoItem (general item data). Changes regarding quantity and delivery date are to be made in the table PoSchedule.
Use the table PoAccount to change the account assignment information.
Services and limits
Changes to existing items cannot be carried out with the Change method. It is only possible to create new items.
Conditions
Conditions are transferred in the table PoCond; header conditions in the table PoCondHeader. A new price determination process can be initiated via the parameter CALCTYPE in the table PoItem.
Vendor and delivery address
The vendor address in the table PoAddrVendor and the delivery address in the table PoAddrDelivery can only be replaced by another address number that already exists in the system (table ADRC). Changes to address details can only be made using the method BAPI_ADDRESSORG_CHANGE.
Partner roles
You can change all partners except the partner role "vendor" via the table PoPartner.
Export/import data
Export/import data can be specified per item in the table PoExpImpItem. Foreign trade data can only be transferred as default data for new items. Changes to the export/import data of existing items are not possible.
Texts
Header and item texts can be transferred in the tables PoTextHeader and PoTextItem. Texts for services are imported in the table PoServicesText. Texts can only be replaced completely.
Version Management
You can make use of the Version Management facility via the table AllVersions.
Return
If the PO was changed successfully, the header and item tables are populated with the information from the PO.
Return messages
Messages are returned in the parameter Return. This also contains information as to whether interface data has been wrongly or probably wrongly (heuristical interface check) populated. If a PO has been successfully created, the PO number is also placed in the return table with the appropriate message.
Restrictions
With this function module, it is not possible to:
Create subcontracting components (you can only use existing ones)
Create configurations (you can only use existing ones)
Change message records (table NAST) and additional message data (this data can only be determined via the message determination facility (Customizing))
Attach documents to the purchase order
Change foreign trade data
Change service data
Change or reexplode BOMs
A firewall prevents the manipulation of data that is not changeable in Purchasing according to the business logic of the purchase order (e.g. PO number, vendor, etc.).
PO items with an invoicing plan cannot be created or changed using the BAPIs
In this connection, please refer to current information in Note 197958.
To change addresses with numbers from Business Address Services (cantral address management), please use the function module BAPI_ADDRESSORG_CHANGE.
To change variant configurations, please use the function module BAPI_UI_CHANGE. More information is available in the BAPI Explorer under the Logistics General node.
In the case of changes that are to be made via the BAPI_PO_CHANGE, a firewall first checks whether the relevant fields are changeable. This approach follows that of the online transaction. Here it is not possible to change the vendor or the document type, for example.
Example
Example of changes made to a purchase order with:
1. Change in header data
2. Change in item
3. Change in delivery schedule
4. Change in account assignment
5. Change in conditions
6. Change in partners
Parameter: PURCHASEORDER 4500049596
Parameter: POHEADER
PMNTTRMS = 0002
PUR_GROUP = 002
Parameter: POHEADERX
PMNTTRMS = X
PUR_GROUP = X
Parameter: POITEM
PO_ITEM = 00001
CONF_CTRL = 0001
Parameter: POITEMX
PO_ITEM = 00001
PO_ITEMX = X
CONF_CTRL = X
Parameter: POSCHEDULE
PO_ITEM = 00001
SCHED_LINE = 0001
QUANTITY = 10.000
PO_ITEM = 00001
SCHED_LINE = 0003
DELETE_IND = X
Parameter: POSCHEDULEX
PO_ITEM = 00001
SCHED_LINE = 0001
PO_ITEMX = X
SCHED_LINEX = X
QUANTITY = X
PO_ITEM = 00001
SCHED_LINE = 0003
PO_ITEMX = X
SCHED_LINEX = X
DELETE_IND = X
Parameter: POACCOUNT
PO_ITEM = 00001
SERIAL_NO = 01
GL_ACCOUNT = 0000400020
Parameter: POACCOUNTX
PO_ITEM = 00001
SERIAL_NO = 01
PO_ITEMX = X
SERIAL_NOX = X
GL_ACCOUNT = X
Parameter: POCOND
ITM_NUMBER = 000001
COND_TYPE = RA02
COND_VALUE = 2.110000000
CURRENCY = %
CHANGE_ID = U
Parameter: POCONDX
ITM_NUMBER = 000001
COND_ST_NO = 001
ITM_NUMBERX = X
COND_ST_NOX = X
COND_TYPE = X
COND_VALUE = X
CURRENCY = X
CHANGE_ID = X
Parameter: POPARTNER
PARTNERDESC = GS
LANGU = EN
BUSPARTNO = 0000001000
Help in the Case of Problems
1. Note 197958 lists answers to frequently asked questions (FAQs). (Note 499626 contains answers to FAQs relating to External Services Management.)
2. If you have detected an error in the function of a BAPI, kindly create a reproducible example in the test data directory in the Function Builder (transaction code SE37). Note 375886 tells you how to do this.
3. If the problem persists, please create a Customer Problem Message for the componente MM-PUR-PO-BAPI, and document the reproducible example where necessary.
Customer Enhancements
The following user exits (function modules) are available for the BAPI BAPI_PO_CREATE1:
EXIT_SAPL2012_001 (at start of BAPI)
EXIT_SAPL2012_003 (at end of BAPI)
The following user exits (function modules) are available for the BAPI BAPI BAPI_PO_CHANGE:
EXIT_SAPL2012_002 (at start of BAPI)
EXIT_SAPL2012_004 (at end of BAPI)
These exits belong to the enhancement SAPL2012 (see also transaction codes SMOD and CMOD).
There is also the option of populating customer-specific fields for header, item, or account assignment data via the parameter EXTENSIONIN.
Further Information
1. Note 197958 contains up-to-date information on the purchase order BAPIs.
2. If you test the BAPIs BAPI_PO_CREATE1 or BAPI_PO_CHANGE in the Function Builder (transaction code SE37), no database updates will be carried out. If you need this function, please take a look at Note 420646.
3. The BAPI BAPI_PO_GETDETAIL serves to read the details of a purchase order. The BAPI cannot read all details (e.g. conditions). However, you can use the BAPI BAPI_PO_CHANGE for this purpose if only the document number is populated and the initiator has change authorizations for purchase orders.
4. Frequently used BAPIs for purchase orders are BAPI_PO_CREATE, BAPI_PO_CREATE1, BAPI_PO_CHANGE, BAPI_PO_GETDETAIL, BAPI_PO_GETITEMS, BAPI_PO_GETITEMSREL, and BAPI_PO_GETRELINFO.
5. For more information on purchase orders, refer to the SAP library (under MM Purchasing -> Purchase Orders) or the Help for the Enjoy Purchase Order, or choose the path Tools -> ABAP Workbench -> Overview -> BAPI Explorer from the SAP menu.
Parameters
PURCHASEORDER
POHEADER
POHEADERX
POADDRVENDOR
TESTRUN
MEMORY_UNCOMPLETE
MEMORY_COMPLETE
POEXPIMPHEADER
POEXPIMPHEADERX
VERSIONS
NO_MESSAGING
NO_MESSAGE_REQ
NO_AUTHORITY
NO_PRICE_FROM_PO
EXPHEADER
EXPPOEXPIMPHEADER
RETURN
POITEM
POITEMX
POADDRDELIVERY
POSCHEDULE
POSCHEDULEX
POACCOUNT
POACCOUNTPROFITSEGMENT
POACCOUNTX
POCONDHEADER
POCONDHEADERX
POCOND
POCONDX
POLIMITS
POCONTRACTLIMITS
POSERVICES
POSRVACCESSVALUES
POSERVICESTEXT
EXTENSIONIN
EXTENSIONOUT
POEXPIMPITEM
POEXPIMPITEMX
POTEXTHEADER
POTEXTITEM
ALLVERSIONS
POPARTNER
Exceptions
Function Group
2012
</b>
regards
prabhu
Message was edited by: Prabhu Peram -
Select aentries from table Z-Table for all sales order line items
Hi friends,
can anyone please explain me about the "Select entries from table Z-Table for all sales order line items".
Thanks.Moderator message - Welcome to SCN.
But
Moderator message - Please search before asking. Press F1 on SELECT and look at the FOR ALL ENTRIES addition. - post locked
Rob -
T.code required for Vendor line item display and Customer line item display
Hi Gurus,
Pl provide me transaction code for "Vendor line item display and " Customer line item display apart from FBL1n for vendor and FBL5n for customers.
Kindly advise.
Regards,
SamarHi,
You could use these, for example:
S_ALR_87012103 - List of Vendor Line Items
S_ALR_87012197 - List of Customer Line Items
Just curious: what's wrong with FBL1(5)N?
Regards,
Eli -
Profit Center population in the Vendor and Customer Line items
hello
our client is asking for getting profit center in the vendor and customer line items where in the view FBL5n and fbl1n we are not getting the profit center populated - in the new gl i understand that there is a standard report based on the gl account.
but our business is not satisfied with the report and expecting report at profit center level.
Can any one suggest any way of doing this.
regards,
VijayDear Vijay,
Let me provide you my view of solutioning for this. This is an enahcement that needs to be done
1. You can get the profit center from the given vendor and customer line item at the time of posting, using an enahcement you will be able to capture it.
2. Existing the profit center field is not populated in the BSIK,BSAK,BSID and BSAD tables
3. Hence, in the same enhancement once you capture the profit center , you can write the code that profit center is updated in these tables also.
4. This will help you to do the vendor line item wise selection in the FBL1N, FBL5N profit center wise.
Constraints of this solution:
The only constraint remains where in the for a given document if there are multiple profit center, then the system will do the splitting profit center wise for a vendor line item, which will not populate the profit center in those tables as there is only one field available in the bsid etc.. tables.
This basically would be the one the soltuion where in as seeen from the end user ther eis no change in the front end interface , the way they are doing always they can do.
You need to also take care the % of document splitting means cross profit center postings /cross document splitting charactericstics postings and the volume involved in this. so that you can suggest this to your client.
Regards,
Bharathi. -
Table to see the link between line items on bank statement to customer invo
table to see the link between line items on bank statement to customer invoices
Hi,
There is no link from VBRP to BSEG directly.
This is because the data in BSEG is posted to various accounts and the VBRP is usually for a Sales Order or Delivery.
However there is a link from BKPF to VBRK and VBRK is linked to VBRP.
BKPF-AWKEY has the the Invoice number VBRK-VBELN
Hope this helps.
regards,
Advait -
How to Find Out The Production Order Number For The Sales Order Line Items
Hi All,
I want to know the number of production orders for each sales order line item. I know the sales order number .Can anyone tell me how the tables can be linked to get all the production order numbers for each sales order line item.I think it depends on your configuration. But check fields KDAUF and KDPOS in table AUFK. or in table AFPO.
Regards,
Rich HEilman -
Use FM SD_SALESDOCUMENT_CREATE for creating free goods line items
Dear Experts,
I have created a program for uploading Sales Order details using FM "SD_SALESDOCUMENT_CREATE".
The program successfully creates Sales Orders.
Now the problem is with the materials which is a free goods item.
i.e. if I enter a material say 'XYZ' which has a 20% free goods then if I enter quantity as 10 then it has to create 2 line items where in 1st line item will have 8 as qty. with value and 2nd line item will have 2 as qty with no value.
It successfully happens when I create Sales Order using tcode VA01.
*& Form CREATE_SALES_ORDER
FORM create_sales_order.
head_flg = 'T'.
LOOP AT t_socreate02 INTO w_socreate02.
CLEAR : vbeln, spart, bstnk, bstdk,
w_itemin, w_iteminx, w_partnr.
MOVE : w_socreate02-vbeln TO vbeln,
w_socreate02-spart TO spart,
w_socreate02-bstnk TO bstnk,
w_socreate02-bstdk TO bstdk.
AT NEW vbeln.
CLEAR : w_sdhead, w_sdheadx.
**Transferring Header Details
MOVE : 'ZODF' TO w_sdhead-doc_type, "Default
'L001' TO w_sdhead-sales_org, "Default
'01' TO w_sdhead-distr_chan, "Default
spart TO w_sdhead-division,
bstdk TO w_sdhead-purch_date,
sy-datum TO w_sdhead-req_date_h,
bstnk TO w_sdhead-purch_no_c.
MOVE : 'I' TO w_sdheadx-updateflag,
'X' TO w_sdheadx-doc_type,
'X' TO w_sdheadx-sales_org,
'X' TO w_sdheadx-distr_chan,
'X' TO w_sdheadx-division,
'X' TO w_sdheadx-purch_date,
'X' TO w_sdheadx-req_date_h,
'X' TO w_sdheadx-purch_no_c.
ENDAT.
**Transferring Item Details
MOVE : w_socreate02-posnr TO w_itemin-itm_number,
w_socreate02-matnr TO w_itemin-material,
w_socreate02-zmeng TO w_itemin-target_qty.
APPEND w_itemin TO t_itemin.
MOVE : w_socreate02-posnr TO w_iteminx-itm_number,
'I' TO w_iteminx-updateflag,
'X' TO w_iteminx-material,
'X' TO w_iteminx-target_qty.
APPEND w_iteminx TO t_iteminx.
**Transferring Partner Function Details
CLEAR : w_partnr.
MOVE : 'AG' TO w_partnr-partn_role, "Sold-to-Party
w_socreate02-sold_party TO w_partnr-partn_numb.
APPEND w_partnr TO t_partnr.
CLEAR : w_partnr.
MOVE : 'WE' TO w_partnr-partn_role, "Ship-to-Party
w_socreate02-ship_party TO w_partnr-partn_numb.
APPEND w_partnr TO t_partnr.
**Transferring Schedule Line Details
*Schedule Line 1
CLEAR : w_schedulesin, w_schedulesinx.
MOVE : w_socreate02-posnr TO w_schedulesin-itm_number,
'0001' TO w_schedulesin-sched_line,
w_socreate02-edatu01 TO w_schedulesin-req_date,
w_socreate02-edatu01 TO w_schedulesin-dlv_date,
w_socreate02-wmeng01 TO w_schedulesin-req_qty.
APPEND w_schedulesin TO t_schedulesin.
MOVE : w_socreate02-posnr TO w_schedulesinx-itm_number,
'0001' TO w_schedulesinx-sched_line,
'I' TO w_schedulesinx-updateflag,
'X' TO w_schedulesinx-req_date,
'X' TO w_schedulesinx-dlv_date,
'X' TO w_schedulesinx-req_qty.
APPEND w_schedulesinx TO t_schedulesinx.
*Schedule Line 2
IF NOT w_socreate02-wmeng02 IS INITIAL.
CLEAR : w_schedulesin, w_schedulesinx.
MOVE : w_socreate02-posnr TO w_schedulesin-itm_number,
'0002' TO w_schedulesin-sched_line,
w_socreate02-edatu02 TO w_schedulesin-req_date,
w_socreate02-edatu02 TO w_schedulesin-dlv_date,
w_socreate02-wmeng02 TO w_schedulesin-req_qty.
APPEND w_schedulesin TO t_schedulesin.
MOVE : w_socreate02-posnr TO w_schedulesinx-itm_number,
'0002' TO w_schedulesinx-sched_line,
'I' TO w_schedulesinx-updateflag,
'X' TO w_schedulesinx-req_date,
'X' TO w_schedulesinx-dlv_date,
'X' TO w_schedulesinx-req_qty.
APPEND w_schedulesinx TO t_schedulesinx.
ENDIF.
*Schedule Line 3
IF NOT w_socreate02-wmeng03 IS INITIAL.
CLEAR : w_schedulesin, w_schedulesinx.
MOVE : w_socreate02-posnr TO w_schedulesin-itm_number,
'0003' TO w_schedulesin-sched_line,
w_socreate02-edatu03 TO w_schedulesin-req_date,
w_socreate02-edatu03 TO w_schedulesin-dlv_date,
w_socreate02-wmeng03 TO w_schedulesin-req_qty.
APPEND w_schedulesin TO t_schedulesin.
MOVE : w_socreate02-posnr TO w_schedulesinx-itm_number,
'0003' TO w_schedulesinx-sched_line,
'I' TO w_schedulesinx-updateflag,
'X' TO w_schedulesinx-req_date,
'X' TO w_schedulesinx-dlv_date,
'X' TO w_schedulesinx-req_qty.
APPEND w_schedulesinx TO t_schedulesinx.
ENDIF.
*Schedule Line 4
IF NOT w_socreate02-wmeng04 IS INITIAL.
CLEAR : w_schedulesin, w_schedulesinx.
MOVE : w_socreate02-posnr TO w_schedulesin-itm_number,
'0004' TO w_schedulesin-sched_line,
w_socreate02-edatu04 TO w_schedulesin-req_date,
w_socreate02-edatu04 TO w_schedulesin-dlv_date,
w_socreate02-wmeng04 TO w_schedulesin-req_qty.
APPEND w_schedulesin TO t_schedulesin.
MOVE : w_socreate02-posnr TO w_schedulesinx-itm_number,
'0004' TO w_schedulesinx-sched_line,
'I' TO w_schedulesinx-updateflag,
'X' TO w_schedulesinx-req_date,
'X' TO w_schedulesinx-dlv_date,
'X' TO w_schedulesinx-req_qty.
APPEND w_schedulesinx TO t_schedulesinx.
ENDIF.
*Schedule Line 5
IF NOT w_socreate02-wmeng05 IS INITIAL.
CLEAR : w_schedulesin, w_schedulesinx.
MOVE : w_socreate02-posnr TO w_schedulesin-itm_number,
'0005' TO w_schedulesin-sched_line,
w_socreate02-edatu05 TO w_schedulesin-req_date,
w_socreate02-edatu05 TO w_schedulesin-dlv_date,
w_socreate02-wmeng05 TO w_schedulesin-req_qty.
APPEND w_schedulesin TO t_schedulesin.
MOVE : w_socreate02-posnr TO w_schedulesinx-itm_number,
'0005' TO w_schedulesinx-sched_line,
'I' TO w_schedulesinx-updateflag,
'X' TO w_schedulesinx-req_date,
'X' TO w_schedulesinx-dlv_date,
'X' TO w_schedulesinx-req_qty.
APPEND w_schedulesinx TO t_schedulesinx.
ENDIF.
AT END OF vbeln.
PERFORM bapi_salesorder.
CLEAR : t_itemin[], t_iteminx[], t_partnr[],
t_schedulesin[], t_schedulesinx[],
sdno, head_flg.
ENDAT.
ENDLOOP.
ENDFORM. " CREATE_SALES_ORDER
*& Form BAPI_SALESORDER
FORM bapi_salesorder.
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
sales_header_in = w_sdhead
sales_header_inx = w_sdheadx
testrun = p_test
status_buffer_refresh = 'X'
IMPORTING
salesdocument_ex = sdno
TABLES
return = t_return
sales_items_in = t_itemin
sales_items_inx = t_iteminx
sales_partners = t_partnr
sales_schedules_in = t_schedulesin
sales_schedules_inx = t_schedulesinx.
IF p_test <> 'X'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
IF head_flg = 'T' AND p_test = 'X'.
WRITE :/40 '** E X E C U T E D - I N - T E S T - M O D E **' COLOR 2.
ELSEIF head_flg = 'T' AND p_test = ' '.
WRITE :/40 '** E X E C U T E D - I N - U P D A T E - M O D E **' COLOR 2.
ENDIF.
IF head_flg = 'T'.
SKIP 1.
ULINE /2(139).
WRITE :/2 sy-vline,
3 'Dummy SalesOrder No.' COLOR 1,
23 sy-vline,
24 'Generated SalesOrder No.' COLOR 1,
48 sy-vline,
49 'Return Message' COLOR 1,
140 sy-vline.
ULINE /2(139).
ENDIF.
IF sdno IS INITIAL.
DELETE t_return WHERE type <> 'E'.
IF NOT t_return[] IS INITIAL.
LOOP AT t_return INTO w_return WHERE type = 'E'.
WRITE :/2 sy-vline,
5 w_socreate02-vbeln,
23 sy-vline,
28 sdno,
48 sy-vline,
49 w_return-message COLOR 6 INVERSE,
140 sy-vline.
ENDLOOP.
ELSE.
WRITE :/2 sy-vline,
5 w_socreate02-vbeln,
23 sy-vline,
28 sdno,
48 sy-vline,
49 'Sales Order can be processed SUCCESSFULLY' COLOR 7 INVERSE,
140 sy-vline.
ENDIF.
ELSE.
WRITE :/2 sy-vline,
5 w_socreate02-vbeln,
23 sy-vline,
28 sdno,
48 sy-vline,
49 'Sales Order created SUCCESSFULLY !!' COLOR 5 INVERSE,
140 sy-vline.
ENDIF.
ULINE /2(139).
ENDFORM. " BAPI_SALESORDERNo reply so closed the thread.
-
Adding a batch to a line item in an Order with B1WS
Hi,
I am trying to create code which can update a batch in a line item in an order. The updating works great, if the batch is already attached to the line item. However, I am unable to add a batch if one doesn't already exist.
Can you please have a look at this code and let me know what is wrong?
I've tried various things, though am still unable to get it to work.
Thank you very much!
Mike
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using orderWebRef;
using System.Text;
public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
// B1BATCH performs batch operations on SAP via DISERVER and B1WS
// The inputs are:
// o = Order Number (this is the DocEntry value, NOT the DocNum value)
// b = Batch Number
// q = Quantity
// i = Item Code
// p = Project
// debug = 1 or true if you want to see output messages
// For some security, we will encode some values at the client,
// and verify them here for consistency.
// The "Secret Formula" is these variables, which will be passed to the URL
// 1 = Order Number * 2 (encoded at the client)
// 2 = Batch Number * 2 (encoded at the client)
// To decode, we do this:
// Correct decoding if ((1 = (o/2)) AND (2 = (b/2))
string o = "";
string b = "";
string q = "";
string i = "";
string p = "";
string v1 = "";
string v2 = "";
int orderNumber = 0; // This is the DocEntry value, NOT the DocNum value
int batchNumber = 0;
int quantity = 0;
int v1int = 0;
int v2int = 0;
bool debugMode = false;
bool allVarsPresent = true;
bool allVarsValid = true;
try
o = Request.QueryString["o"].ToString();
catch
allVarsPresent = false;
try
b = Request.QueryString["b"].ToString();
catch
allVarsPresent = false;
try
q = Request.QueryString["q"].ToString();
catch
allVarsPresent = false;
try
i = Request.QueryString["i"].ToString().ToUpper();
catch
allVarsPresent = false;
try
p = Request.QueryString["p"].ToString().ToUpper();
catch
allVarsPresent = false;
try
v1 = Request.QueryString["1"].ToString();
catch
allVarsPresent = false;
try
v2 = Request.QueryString["2"].ToString();
catch
allVarsPresent = false;
try
string debug = Request.QueryString["debug"].ToString();
if ((debug == "1") || (debug.ToLower() == "true"))
debugMode = true;
catch
debugMode = false;
if (!allVarsPresent)
WriteDebugMessage(debugMode, "All required variables are not in the request.");
return;
else
// All variables are present, now check that they are valid.
// First, check the v1 and v2 variables are correct
// Then check that the order exists
// Then check that the batch exists and has the appropraite quantity available
try
orderNumber = Convert.ToInt32(o);
batchNumber = Convert.ToInt32(b);
quantity = Convert.ToInt32(q);
v1int = Convert.ToInt32(v1);
v2int = Convert.ToInt32(v2);
if ((v1int / 2) != orderNumber)
allVarsValid = false;
if ((v2int / 2) != batchNumber)
allVarsValid = false;
catch
WriteDebugMessage(debugMode, "Error in processing variables.");
return;
if (!allVarsValid)
WriteDebugMessage(debugMode, "Error in validating checksum.");
return;
// All variables are present and valid!
WriteDebugMessage(debugMode, "All variables are present and valid.");
try
loginWebRef.LoginService ls = new loginWebRef.LoginService();
string sessionID = ls.Login("DBSERVER", "DBNAME", loginWebRef.LoginDatabaseType.dst_MSSQL2005, true, "sa", "PASSWORD", "manager", "managerPass", loginWebRef.LoginLanguage.ln_English, true, "LICENSE:30000");
WriteDebugMessage(debugMode, "<BR><BR>SessionId: " + sessionID + "<BR><BR>");
orderWebRef.MsgHeader msgHeader = new orderWebRef.MsgHeader();
msgHeader.SessionID = sessionID;
msgHeader.ServiceName = MsgHeaderServiceName.OrdersService;
msgHeader.ServiceNameSpecified = true;
orderWebRef.OrdersService order = new OrdersService();
order.MsgHeaderValue = msgHeader;
DocumentParams param = new DocumentParams();
param.DocEntry = orderNumber;
param.DocEntrySpecified = true;
orderWebRef.Document document = new orderWebRef.Document();
document = order.GetByParams(param);
StringBuilder orderSb = new StringBuilder();
orderSb.Append("Order " + document.DocNum.ToString() + "<BR><BR>");
foreach (DocumentDocumentLine docLine in document.DocumentLines)
if ((docLine.ProjectCode == p) && (docLine.ItemCode == i))
orderSb.Append("Line Num: " + docLine.LineNum + "<BR>");
orderSb.Append("Item Code: " + docLine.ItemCode + "<BR>");
orderSb.Append("Project Code: " + docLine.ProjectCode + "<BR>");
orderSb.Append("Description: " + docLine.ItemDescription + "<BR>");
// Find the batch if it exists and update the quantity
// Add the batch if it doesn't exist
bool batchExistsInLineItem = false;
int batchCount = 0;
foreach (DocumentDocumentLineBatchNumber batch in docLine.BatchNumbers)
batchCount++;
if (batch.BatchNumber == b)
batchExistsInLineItem = true;
orderSb.Append("<BR>");
orderSb.Append("+++++ Batch exists in line item. Updating.<BR><BR>");
orderSb.Append("+++++ Batch Line: " + batchCount.ToString() + "<BR>");
orderSb.Append("+++++ Batch Num: " + batchNumber + "<BR>");
orderSb.Append("+++++ Quantity: " + quantity + "<BR>");
batch.Quantity = quantity;
if (!batchExistsInLineItem)
docLine.BatchNumbers = new DocumentDocumentLineBatchNumber[1];
DocumentDocumentLineBatchNumber batch = new DocumentDocumentLineBatchNumber();
batch.BatchNumber = b;
batch.Quantity = quantity;
docLine.BatchNumbers[0] = batch;
orderSb.Append("<BR>");
orderSb.Append("+++++ Batch does not exist in line item. Adding.<BR><BR>");
orderSb.Append("+++++ Batch Line: " + batchCount.ToString() + "<BR>");
orderSb.Append("+++++ Batch Num: " + batchNumber + "<BR>");
orderSb.Append("+++++ Quantity: " + quantity + "<BR>");
try
order.Update(document);
catch (Exception ex)
WriteDebugMessage(debugMode, "SAP Exception: " + ex.Message.ToString());
return;
WriteDebugMessage(debugMode, orderSb.ToString());
catch (Exception ex)
WriteDebugMessage(debugMode, "Error in processing the request. Exception:<BR><BR>" + ex.Message);
return;
private void WriteDebugMessage(bool debugMode, string exitMessage)
if (debugMode)
Response.Write(exitMessage);Hi Everyone,
I found the answer, you can find the code here: [B1WS Batch Manipulations with Orders|http://paste-it.net/public/dbbcea0/]
Cheers,
Mike -
Offsetting account in Vendor, Customer and GL line item report
Hi All,
There is one requirement from our client. They want offsetting account in Vendor, Customer and GL line item report.(FBL1n, FBL3n and FBL5n).
As this field is there in selection screen in lay out setting but field coming as blank no off setting account is coming. It was coming in old SAP 4.7 system but same is not coming in ECC6.0.
Kindly let me know if any development is requirement, if yes than which tables we have refer for the same.
Thanks and Regards,
Abhinav SharmaHi Abhinav,
There is a SAP not and you can refer to that - SAP OSS note 112312
T.Code: FIBF
After entering in above T.code
Follow Path
Settings Products of a customer
Product : XXXX
Text : XXXX
Active : Tick it
Click on Back i.e. F3
Follow Path
Settings >P/S Function Modules > of a customer
Event: 00001650
Product: XXXX
Function Module: LINE_ITEMS_GET_GKONT
Now Go to FBL3N display of any account
After opening the account display click on Change Layout i.e. CTRL+ F8
And Select
Offsetting A/C Type & Offsetting A/C no.
Regards,
SAPFICO
Edited by: SAPFICO on Dec 1, 2010 8:26 AM -
Fbl1n and fbl5n line item wise display the cutomer and vendor name
Hi,
My user is asking report for fbl5n and fbl1n line itemwise dispaly vendor and customer.See the report for one time vendor and customer name displaythe line item wise display in FBL!N/FBL5N. but not the display the regular vendors/customer.So one time table name BSEC
Please advise
Regards.
Edited by: yps y on Nov 13, 2008 1:26 PMHi,
line item reports FBL1N/FBL5N are reading the line items (wow, what a big surpise ) and displaying information on line item level.
As the vendor/customer name is NOT stored in the line items, you cannot display this in the lines (along with other item level information., like amount, posting key, doc.type, etc.). You may find a field called "Name 1) in the field catalog when configuring the ALV layout but this is empty for normal customers/vendors. It is only filled in for one time (Cpd) customers - the reason is as explained above: for these special accounts, the name IS stored on line item level (it varies from item to item),, that's why it can be read and displayed in the items.
Now how about normal customers/vendors?
You have to activate Business Transaction Event 1650 and implement a simple code so that depending on the account type (D = customer, K = vendor), you get the business partners name from table KNA1 / LFA1 and put it into field Name1.
Hope that helps, points welcome
Csaba -
GR Doc# and GR Line Item Number
Hi All,
We have custom defined infocube actually WM-stocks.Now our requirement is to add GR Number and GR line Item Number. can be these be added to Infocube or should we go for ODS? any help from experts?
Data has been loaded from generic datasource which is based on LQUA table.
regardsHi,
We implemented just the opposite:
A cube for line items, an ODS for header data which didn't went to the cube (I mean those data that cannot be calculated by summing up item data).
If we need summary data from ODS, we use RRI.
Everything depends on a level of details you need. In our case we needed analysis on item data.
Best regards,
Eugene
Message was edited by: Eugene Khusainov -
Derivation of Profit Centers in case of bank and Cash line items
We are in the process of configuring the Profit Center Accounting functionality. We are in ECC 6.0 but have not migrated to New G/L.
We understand that Profit center needs to be derived for each of the items for which it does not flow online in realtime. As regards Bank and Cash Line Items, we are not able to understand how Profit Center Derivation will happen.
We have posted an FI payment document using Tcode F110 and further to which we executed F.5D and 1KEK. Further to this, we have checked the Profit Center Total records report (2KEE). It updates the vendor line items. But it does not reflect the Bank line item. Unless this happens, we understand that our Profit Center wise Trial Balance will not tally.
Kindly let us know how bank and Cash line items will update in PCA. In our view, it should derive the Profit center from the offsetting entry in the vendor invoice. Pl. correct me if I am wrong.
Pl. help.
Venkat IyerHi Venkat,
You may define a derivation rule in 3KEH
Regarda
Sachin
Maybe you are looking for
-
Universal Spell Checker doesn't work.
For some reason my universal spell checker wont work. I am using TextEdit, where it worked fine until recently. Is anyone else having this problem? And yes, I checked ON the appropriate function in the menu. I am on a MacBook Pro with the latest OS (
-
How to find data dictionary and oracle schema tables for UTF8 char conversi
I am doing UTF8 char conversition, i got lot of convertable objects,as per document we don't need to worry about data dictionary objects and how to find data dictionary and oracle schema objects for UTF8 char conversition. USER.TABLE Convertible Trun
-
Interrupted update; how do I restore corrupted library?
My iPhoto update (to 9.6.1, I think) was interrupted due to a power surge. This seems to have left my iPhoto library (all 200+Gb of it) nonfunctional. I tried rebuilding my backup copy with iPhoto Library Manager but it says the album data file canno
-
Hi all, I am using Adobe Photoshop Album Starter Edition 3.2 and can seem to find a way to correct red eye on photos. Any ideas? Thanks much!! Regine Goerke
-
Standby database creation notes by metalink
Can any body send me good Standby database creation notes by metalink.