Assign different ship to party for each material in a sales order in CRM?
Hi all,
I need to create a sales order in CRM, such that the sales order contains more than 100 materials at item level and each material should be shipped to a different ship to party.
That is for 100 materials in sales order I need to ship to 100 different customers.
The 100 ship to partyu2019s are maintained for the business partner in relation ships tab in /nBP.
The CRM configuration is done in such a way that when we enter a material while creating a sales order in CRM,u2026u2026.a window pops up asking us to select the ship to party for that material.
No I need to replicate this programmatically. I generated a sales order in CRM programmatically using BAPI_SLSTRANSACT_CREATEMULTI. u2026 Now I need to make changes such that I have a provision to assign ship to party for each materialu2026
How can I do this? Can any one tell me if there is a BAPI or Function Module available so that I can assign a different ship to party for each material in sales order?
Regards,
Jessica Sam
Here is sample code. In that highlighted portion is different. check this out
DATA: ls_partner TYPE crmt_partner_com,
ls_input_fields TYPE crmt_input_field,
lt_fieldname TYPE crmt_input_field_names_tab,
ls_fieldname LIKE LINE OF lt_fieldname.
ls_partner-ref_handle = p_iv_handle.
ls_partner-ref_partner_handle = 1.
ls_partner-ref_kind = 'A'.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-kind_of_entry = 'C'.
licensee
ls_partner-partner_fct = '00000069'.
ls_partner-partner_no = w_but000-partner.
INSERT ls_partner INTO TABLE gt_partner.
Bill to party
IF NOT w_con_header-billtoparty IS INITIAL.
ls_partner-partner_fct = '00000003'.
ls_partner-partner_no = w_but001-partner.
INSERT ls_partner INTO TABLE gt_partner.
ENDIF.
IF w_con_header-billtoparty IS INITIAL.
ls_partner-partner_fct = '00000003'.
ls_partner-partner_no = w_but000-partner.
INSERT ls_partner INTO TABLE gt_partner.
ENDIF.
Employee
ls_partner-partner_fct = '00000014'.
ls_partner-partner_no = w_con_header-empresp.
INSERT ls_partner INTO TABLE gt_partner.
+*lsinput_fields-ref_handle = p_iv_handle.*+_
+*lsinput_fields-ref_kind = 'A'.*+_
ls_input_fields-logical_key = ls_partner-ref_partner_handle.
ls_input_fields-objectname = 'PARTNER'.
ls_fieldname-fieldname = 'DISPLAY_TYPE'.
INSERT ls_fieldname INTO TABLE lt_fieldname.
CLEAR ls_fieldname.
ls_fieldname-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_fieldname INTO TABLE lt_fieldname.
CLEAR ls_fieldname.
ls_fieldname-fieldname = 'NO_TYPE'.
INSERT ls_fieldname INTO TABLE lt_fieldname.
CLEAR ls_fieldname.
ls_fieldname-fieldname = 'PARTNER_FCT'.
INSERT ls_fieldname INTO TABLE lt_fieldname.
CLEAR ls_fieldname.
ls_fieldname-fieldname = 'PARTNER_NO'.
INSERT ls_fieldname INTO TABLE lt_fieldname.
CLEAR ls_fieldname.
ls_input_fields-field_names = lt_fieldname.
INSERT ls_input_fields INTO TABLE gt_input_fields.
Similar Messages
-
Ship to party for each material using BAPI_SLSTRANSACT_CREATEMULTI
i am able to generate sales order for in CRM. I am inputting the sold to party, ship to party, bill to party and payer at the header level...
CRM is currently configured in such a way that , there is a provision to assign ship to party at item level for each material.
How can i programatically replicate this? I need to assign a diiferent ship to party for each material in the sales order.*
how can i programatically replicate this?...
this is my code for cresating a sales order in CRM with sold to party, ship to party, bill to party and payer at the header level...
*************include constants
include crm_direct.
************// GUIDs
data: lv_guid_h type GUID_32, "HEADER GUIDE
lv_guid_i type GUID_32, "ITEM GUIDE
lv_guid_sl type GUID_32, "SCHEDULE LINE GUIDE
lv_guid_p type GUID_32. "PARTNER GUIDE
***********// Handles
data: lv_current_handle type crmt_handle, "CURRENT HANDLE
lv_handle_h type crmt_handle, "HEADER HANDLE
lv_handle_i type crmt_handle, "ITEM HANDLE
lv_handle_sl type crmt_handle, "SCHEDULE LINE HANDLE
lv_handle_p type crmt_handle. "PARTNER HANDLE
***********// Administration header + item + etc
data: lt_salesorder_header type table of bapibus20001_header_ins, "LT_SALESORDER_HEADER
ls_salesorder_header type bapibus20001_header_ins, "LS_SALESORDER_HEADER
lt_salesorder_item type table of bapibus20001_item, "LT_SALESORDER_ITEM
ls_salesorder_item type bapibus20001_item, "LS_SALESORDER_ITEM
lt_scheduleline type table of BAPIBUS20001_SCHEDLIN, "LT_SCHEDULELINE
ls_scheduleline type BAPIBUS20001_SCHEDLIN, "LS_SCHEDULELINE
lt_partner type table of BAPIBUS20001_PARTNER_INS, "LT_PARTNER
ls_partner type BAPIBUS20001_PARTNER_INS, "LS_PARTNER
ls_logical_key TYPE crmt_partner_logic_partner_key, "LS_LOGICAL_KEY
lt_organisation type table of BAPIBUS20001_ORGMAN_INS, "LT_ORGANISATION
ls_organisation type BAPIBUS20001_ORGMAN_INS. "LS_ORGANISATION
*********// Saved sales orders
data: lt_saved_process type table of bapibus20001_object_id, "LT_SAVED_PROCESS
data:
ls_saved_process type bapibus20001_object_id, "LS_SAVED_PROCESS
ls_salesorder type CRMT_RETURN_OBJECTS_STRUC. "LS_SALESORDER
data: lt_input_fields type table of bapibus20001_input_fields, "LT_INPUT_FIELDS
ls_input_fields type bapibus20001_input_fields, "LS_INPUT_FIELDS
ls_return type bapiret2. "LS_RETURN
data: lt_return type table of bapiret2. "LT_RETURN
***********// Macro definition to populate structure and input field This, called as
*_set_field ls_salesorder_header GUID lv_guid_h
*is exploded as
ls_salesorder_header-GUID = lv_guid_h.
ls_input_fields-fieldname = 'GUID'.
append ls_input_fields to lt_input_fields.
*Note 1: &2 (field name) MUST be uppercase
*Note 2: for the salesorder header, Macro has not been used to show how the code should look like.
*except for that the macro has been used everywhere else.
define setfield.
&1-&2 = &3.
ls_input_fields-fieldname = '&2'.
append ls_input_fields to lt_input_fields.
end-of-definition.
*****// end of macro definition
******// fill order administration header
perform get_guid changing lv_guid_h.
add 1 to lv_handle_h.
ls_salesorder_header-guid = lv_guid_h.
ls_salesorder_header-handle = lv_handle_h.
ls_salesorder_header-process_type = 'ZWEB'.
clear ls_input_fields.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_guid = lv_guid_h.
*ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-orderadm_h.
ls_input_fields-fieldname = 'GUID'.
append ls_input_fields to lt_input_fields.
ls_input_fields-fieldname = 'HANDLE'.
append ls_input_fields to lt_input_fields.
ls_input_fields-fieldname = 'PROCESS_TYPE'.
append ls_input_fields to lt_input_fields.
append ls_salesorder_header to lt_salesorder_header.
**********// fill organisation data (Interface needs this, some times may rely on sales org determination instead...
clear ls_input_fields.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_guid = lv_guid_h.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-orgman.
setfield ls_organisation REF_GUID lv_guid_h.
setfield ls_organisation REF_HANDLE lv_handle_h.
setfield ls_organisation REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_organisation SALES_ORG_RESP SO_RESP . "(input).
setfield ls_organisation SALES_ORG SALES_ORG. "(input).
setfield ls_organisation DIS_CHANNEL DIS_CHNL. "(input).
setfield ls_organisation DIVISION DIVISION. "(input).
append ls_organisation to lt_organisation.
**********// fill order administration item
perform get_guid changing lv_guid_i.
lv_handle_i = lv_handle_h.
add 1 to lv_handle_i.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_i.
ls_input_fields-ref_handle = lv_handle_i.
*ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_i.
ls_input_fields-objectname = gc_object_name-orderadm_i.
setfield ls_salesorder_item GUID lv_guid_i.
setfield ls_salesorder_item HEADER lv_guid_h.
setfield ls_salesorder_item HANDLE lv_handle_i.
setfield ls_salesorder_item HEADER_HANDLE lv_handle_h.
setfield ls_salesorder_item ORDERED_PROD PRODUCT . "(input).
setfield ls_salesorder_item ITM_TYPE 'ZTAN'.
setfield ls_salesorder_item MODE 'A'.
*adjustment taken from standard include LCMS_MAPPERF04
*(see where-used-list for BAPI_SLSTRANSACT_CREATEMULTI, program LCMS_MAPPERU11)
delete lt_input_fields where fieldname = 'HANDLE'
OR
fieldname = 'HEADER_HANDLE'.
append ls_salesorder_item to lt_salesorder_item.
********// fill schedule line for item
perform get_guid changing lv_guid_sl.
add 1 to lv_handle_sl.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_i.
ls_input_fields-ref_handle = lv_handle_i.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_i.
ls_input_fields-objectname = gc_object_name-schedlin.
setfield ls_scheduleline ITEM_GUID lv_guid_i.
setfield ls_scheduleline GUID lv_guid_sl.
setfield ls_scheduleline HANDLE lv_handle_sl.
setfield ls_scheduleline ITEM_HANDLE lv_handle_i.
setfield ls_scheduleline QUANTITY quantity. "(input).
append ls_scheduleline to lt_scheduleline.
********// fill partner line
*perform get_guid changing lv_guid_p.
*the partner use the logical key as well
ls_logical_key-ref_partner_handle = '0001'.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_h.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-partner.
ls_input_fields-logical_key = ls_logical_key.
setfield ls_partner REF_GUID lv_guid_h.
setfield ls_partner REF_HANDLE lv_handle_h.
setfield ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_partner REF_PARTNER_HANDLE '0001'.
setfield ls_partner KIND_OF_ENTRY 'C'.
setfield ls_partner PARTNER_FCT '00000001'.
setfield ls_partner PARTNER_NO SOLD_TO. "(input).
setfield ls_partner NO_TYPE 'BP'.
setfield ls_partner DISPLAY_TYPE 'BP'.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
ls_logical_key-ref_partner_handle = '0002'.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_h.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-partner.
ls_input_fields-logical_key = ls_logical_key.
setfield ls_partner REF_GUID lv_guid_h.
setfield ls_partner REF_HANDLE lv_handle_h.
setfield ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_partner REF_PARTNER_HANDLE '0002'.
setfield ls_partner KIND_OF_ENTRY 'C'.
setfield ls_partner PARTNER_FCT '00000002'.
setfield ls_partner PARTNER_NO SHIP_TO . "(input).
setfield ls_partner NO_TYPE 'BP'.
setfield ls_partner DISPLAY_TYPE 'BP'.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
ls_logical_key-ref_partner_handle = '0003'.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_h.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-partner.
ls_input_fields-logical_key = ls_logical_key.
setfield ls_partner REF_GUID lv_guid_h.
setfield ls_partner REF_HANDLE lv_handle_h.
setfield ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_partner REF_PARTNER_HANDLE '0003'.
setfield ls_partner KIND_OF_ENTRY 'C'.
setfield ls_partner PARTNER_FCT '00000003'.
setfield ls_partner PARTNER_NO BILL_TO ."(input).
setfield ls_partner NO_TYPE 'BP'.
setfield ls_partner DISPLAY_TYPE 'BP'.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
ls_logical_key-ref_partner_handle = '0004'.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_h.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-partner.
ls_input_fields-logical_key = ls_logical_key.
setfield ls_partner REF_GUID lv_guid_h.
setfield ls_partner REF_HANDLE lv_handle_h.
setfield ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_partner REF_PARTNER_HANDLE '0004'.
setfield ls_partner KIND_OF_ENTRY 'C'.
setfield ls_partner PARTNER_FCT '00000004'.
setfield ls_partner PARTNER_NO PAYER ."(input).
setfield ls_partner NO_TYPE 'BP'.
setfield ls_partner DISPLAY_TYPE 'BP'.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
*******// example of a second partner function (custom) with data override
*ls_logical_key-ref_partner_handle = '0002'.
*clear ls_input_fields.
*ls_input_fields-ref_guid = lv_guid_h.
*ls_input_fields-ref_handle = lv_handle_h.
*ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
*ls_input_fields-objectname = gc_object_name-partner.
*ls_input_fields-logical_key = ls_logical_key.
*_set_field ls_partner REF_GUID lv_guid_h.
*_set_field ls_partner REF_HANDLE lv_handle_h.
*_set_field ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
*_set_field ls_partner REF_PARTNER_HANDLE '0002'.
*_set_field ls_partner KIND_OF_ENTRY 'B'. "manual entry...
*_set_field ls_partner PARTNER_FCT customFct(input).
*_set_field ls_partner PARTNER_NO bpNumber(input).
*_set_field ls_partner NO_TYPE 'BP'.
*_set_field ls_partner DISPLAY_TYPE 'BP'.
*_set_field ls_partner TITLE 'Mr.'.
*_set_field ls_partner FIRSTNAME 'John'.
*_set_field ls_partner LASTNAME 'Smith'.
*_set_field ls_partner STR_SUPPL1 'John Smith and Co'.
*_set_field ls_partner STREET 'Street1'.
*_set_field ls_partner STR_SUPPL3 'Street4'.
*_set_field ls_partner HOUSE_NO '42'.
*_set_field ls_partner CITY 'Townville'.
*_set_field ls_partner DISTRICT 'Districtshire'.
*_set_field ls_partner POSTL_COD1 'AA1 2BB'.
*note now ...
*adjustment taken from standard include LCMS_MAPPERF04
*(see where-used-list for BAPI_SLSTRANSACT_CREATEMULTI, program LCMS_MAPPERU11)
*I don't use macro because name of the field in input_table is different
*_set_field ls_partner COUNTRYISO 'GB'.
*instead
ls_partner-COUNTRYISO = 'GB'.
ls_input_fields-fieldname = 'COUNTRY'.
append ls_input_fields to lt_input_fields.
*_set_field ls_partner LANGU_ISO 'EN'.
ls_partner-LANGU_ISO = 'EN'.
ls_input_fields-fieldname = 'LANGU'.
append ls_input_fields to lt_input_fields.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
*Create sales orders *
call function 'BAPI_SLSTRANSACT_CREATEMULTI'
EXPORTING
testrun = false
TABLES
header = lt_salesorder_header[]
item = lt_salesorder_item[]
partner = lt_partner[]
organisation = lt_organisation[]
input_fields = lt_input_fields[]
scheduleline = lt_scheduleline[]
saved_process = lt_saved_process[]
return = lt_return[].
*************// get the GUID of the created object
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = lt_return1.
INCLUDE ZZGVBAPISALESORDER_GET_GUIDF01.
Edited by: jessica sam on Dec 22, 2008 4:25 PM
Edited by: jessica sam on Dec 22, 2008 4:27 PM
Edited by: jessica sam on Dec 22, 2008 7:05 PM
Edited by: jessica sam on Dec 23, 2008 5:18 AMI know how to trace the Ship to party at line item. When i create an order manually on CRM then the table CRMD_PARTNER has the required entries and the Ship to party at line item is getting populated correctly. Also if i open the order in CRMD_ORDER the ship pto party are being populated correctly at line item..
But if i am trying to replicate this programatcally using the BAPI, i see that the ship to at header is being copied to each line item and this is not what is expected.
If i go and check in the CRMD_PARTNER the data is not filled
correctly as I dont have any ship to party at line item
So finally I even tried to insert the data manually in the CRMD_PARTNER table using an
INSERT statement and even that doesnt work...
https://www.sdn.sap.com/irj/scn/forums
So i am unable to ficgure out what is going wrong
Any body if they have any idea on poulating ship to party programatically in
sales order for each line item please help
I am unable to figure out how to fill PArtner table of this BAPI to populate ship to at line item level
Kindly Help..
Regards,
Jessica Sam -
BAPI for Assigning multiple ship to party for customer
Hi experts,
I need a bapi to assign different ship to party for a customer.
I have tried SD_CUSTOMER_MAINTAIN_ALL but not working properly.
Kindly suggest the solution.
Regards,
Nitin.Hi,
For the maintenance of customers, there is NO BAPI and NO direct function module.
There are some functions modules like the one above where the name is looking nice. But these should not be used.
Below ECC 2005 (6.00), the only solution was batch input and DEBMAS idocs. See [note 384462|https://service.sap.com/sap/support/notes/384462]
Starting with ECC 2005 (6.00) and above: a synchronisation tool has been introduce. See class CMD_EI_API and VMD_EI_API
Hope this helps
BR
Alain -
Different ship to party for one of two line items from sales order
Hi Experts,
1. The Sales Order No.19701 is an Export Order, received from M/s. Industries & Construction, Indonesia. We have to supply all the materials on FOB Indian seaport basis.
2. However, we have to dispatch against Line Item No. 280 & 290 to one of our subvendors, M/s.Industries, sec,rabad to complete some Control Assly. as per agreed Inspection terms.
3. After completion of Control Assembly & Client's Inspection materials will be finally dispatched to nearest Seaport for seafreight.
So here i can i map this scenario from sales order to billing, ship to party for those 2 items must be sub vendor.
Thanx in advance
MadhuHi madhusudan
You can map different ship to party . First you need to configure customer master for the same.
Add the alternate ship to parties to customer master of sold to party, your export customer.
While creating master data for sub vendors as ship to party ,you need to maintian proper customer pricing pricing procedure and tax classification as you mentioned customer is export customer ,but ship to party seems to be domestic ,so carefully check the same. also check the shipping condition if it is separate for exports.
Then in Sales order transaction on line item data ,change your ship to party for the line item as per the the requirement.
for further processing of this scenario ,like excise invoice and ARE1 u might have lsome issues if ship to party is liable for duties and taxes and Sold to is exempt and you are drawing only one invoice for these 2 separate deliveries. pl check on the same.
I hope this helps
Revert for any queries
Regards
Mandar
Edited by: Mandar Deshpande on Apr 13, 2010 11:04 PM -
Ship to party is not comming same in Sales order from Quotation?
Dear all,
Here I have a scenario,
(1) I created 1111 sold to party and extended fot SH,BP,PY and
(2) I created 2222 ship to pary is only a SH not others.
Now when i enter 1111 for sold to party and 2222 as a ship to party in Quotation and when i am going to create a order with reference to that Quoatation the system pick up 1111 as a sold to party and also ship to party same in order.
Why?
Can anybody guide me
Thanks
JayeshHi Jayesh,
If I understand you correctly, you want that when creating SO from Quoatation
the Ship to Party also follow/copy Ship to Party from Quotation, right?
Just to confirm with you, when you creating SO reference from Quotation, you
use copy/follow-up function, am I right?
You can do this by setting in configuration of Copy Control (like mentioned by Hui).
Step as follow :
1. Go to IMG->CRM->Transactions->Basic Settings->Copying Control for
Business Transactions
2. Create your BAdi (Business Add-In for Copying Control), such as get Ship to
Party value from source document and use it in current document
3. Use this Rule you have created in BAdi (no. 2), in copy control transaction type
IMG->CRM->Transactions->Basic Settings->Copying Control for
Business Transactions-> Define Copying Control for Transaction Types
4. Here you set Copying Routine for your transaction types (put name of your Badi
created in step no. 2)
Or alternatively, you can set it on access sequence in Partner Function
Ship to Party in configuration. You can define access sequence the Ship
to Party is taken from Preceeding Document -> Ship To Party
1. Go to Partner Function access sequence :
IMG->CRM->Basic Functions->Partner Processing->Define Access Sequence
2. Create new access sequence with following entry :
- Source COM_PARTNER_A (PrecedingPartner)
- Check Mapping for Partner Being search
- Partner Function in Source = Ship To Party
3. Assign this Access Sequence in you Partner Function used in Sales Order Transaction
Type.
Tell me if this is what you looking for
Gun. -
Ship to party not assigned to sold to party still can i create a sale order
Hi ,
For example i have a ship to Party B who is not assigned to Sold to Party A . System is allowing me to create a sale order for the above mentioned "Sold to" and "ship to" combination. What is the logic behind this ? is it a provided functionality or a bug?hi,
for example if you are using account group 0001, when you create a customer it has the ability of picking up a SH, BP and PY along with SP. this is the underlying config at account group. Now for SP 100 the ship party can 100 or 200 ... or you can modify at the order level. Its not necessary that 200 has been identified at the customer master creation level itself. But partner function SH shoudl be availble in the account group with which the customer is created.
regards
sadhu kishore -
Production Order and Internal Order for each item of the sales order
Hi
I am developing Make To Order Report where I have to display the MTO Line Items and non MTO Line Items. For non MTO Line Items I have to display Internal order with Planned and Actual Costs and also Production Order with Planned and Actual Costs. Could anybody tell how to get the Internal order no and production order with Planned and Actual costs for each line item for a sales order.
Thanks
NagaHi,
You can get the Production orders, Planned orders, Internal orders generated for Sales order item from AFPO table (use fields KDAUF-Sales order number & KDPOS-Sales order item). Then to identify the order type use order category (AUTYP) from table AUFK.
Once you have the Production/internal order, you can ge the cost from COSS and COSP table. Use the object number from AUFK to get the cost entries from COSS & COSP.
You can use the following sample code as reference.
Hope this is helps.. (Don't forget to mark it... )
Form GET_COSTS *
Get the material cost, labour hours and the labour cost for the *
sales order material. *
There are no interface parameters to be passed to this subroutine. *
FORM GET_COSTS.
DATA V_OBJNR LIKE AUFK-OBJNR.
DATA v_menge LIKE vbap-kwmeng.
SELECT SINGLE OBJNR
INTO V_OBJNR
FROM AUFK
WHERE AUFNR EQ AFPO-AUFNR.
SELECT * FROM COSS
WHERE OBJNR EQ V_OBJNR
AND WRTTP IN ('01', '04'). " p_wrttp. "Labour Cost ( Plan, Actual)
PERFORM GET_VALUES_FROM_COSS.
ENDSELECT.
SELECT * FROM COSP
WHERE OBJNR EQ V_OBJNR
AND WRTTP IN ('01', '04') " p_wrttp
AND KSTAR NE '0000510033'. " EQ p_kstar2. "Material Cost
PERFORM GET_VALUE_FROM_COSP.
ENDSELECT.
Get the unit cost of the production order by dividing the production
cost by the order quantity. The result will be multiplied by the
GL posting qunatity (Delivery quantity) to get the production cost
for the quantity being deluivered.
IF NOT AFPO-PSMNG IS INITIAL.
OUT_REC-LABOUR_HOURS_ACT = OUT_REC-LABOUR_HOURS_ACT / AFPO-PSMNG.
OUT_REC-ADDNL_LABOUR_HOURS_ACT =
OUT_REC-ADDNL_LABOUR_HOURS_ACT / AFPO-PSMNG.
OUT_REC-LABOUR_HOURS_PLN = OUT_REC-LABOUR_HOURS_PLN / AFPO-PSMNG.
OUT_REC-ADDNL_LABOUR_HOURS_PLN =
OUT_REC-ADDNL_LABOUR_HOURS_PLN / AFPO-PSMNG.
OUT_REC-LABOUR_COST_ACT = OUT_REC-LABOUR_COST_ACT / AFPO-PSMNG.
OUT_REC-ADDNL_LABOUR_COST_ACT =
OUT_REC-ADDNL_LABOUR_COST_ACT / AFPO-PSMNG.
OUT_REC-LABOUR_COST_PLN = OUT_REC-LABOUR_COST_PLN / AFPO-PSMNG.
OUT_REC-ADDNL_LABOUR_COST_PLN =
OUT_REC-ADDNL_LABOUR_COST_PLN / AFPO-PSMNG.
OUT_REC-MATERIAL_COST_ACT = OUT_REC-MATERIAL_COST_ACT / AFPO-PSMNG.
OUT_REC-ADDNL_MATERIAL_COST_ACT =
OUT_REC-ADDNL_MATERIAL_COST_ACT / AFPO-PSMNG.
OUT_REC-MATERIAL_COST_PLN = OUT_REC-MATERIAL_COST_PLN / AFPO-PSMNG.
OUT_REC-ADDNL_MATERIAL_COST_PLN =
OUT_REC-ADDNL_MATERIAL_COST_PLN / AFPO-PSMNG.
ENDIF.
Multiply the calculated Unit Production costs with the GL quantity to
get the actual production cost of the quantity delivered.
Calculation for Labour Hours
OUT_REC-LABOUR_HOURS_ACT = OUT_REC-LABOUR_HOURS_ACT *
OUT_REC-QUANTITY.
OUT_REC-ADDNL_LABOUR_HOURS_ACT = OUT_REC-ADDNL_LABOUR_HOURS_ACT *
OUT_REC-QUANTITY.
OUT_REC-LABOUR_HOURS_PLN = OUT_REC-LABOUR_HOURS_PLN *
OUT_REC-QUANTITY.
OUT_REC-ADDNL_LABOUR_HOURS_PLN = OUT_REC-ADDNL_LABOUR_HOURS_PLN *
OUT_REC-QUANTITY.
Calculation for Material Cost
OUT_REC-MATERIAL_COST_ACT = OUT_REC-MATERIAL_COST_ACT *
OUT_REC-QUANTITY.
OUT_REC-ADDNL_MATERIAL_COST_ACT =
OUT_REC-ADDNL_MATERIAL_COST_ACT * OUT_REC-QUANTITY.
OUT_REC-MATERIAL_COST_PLN = OUT_REC-MATERIAL_COST_PLN *
OUT_REC-QUANTITY.
OUT_REC-ADDNL_MATERIAL_COST_PLN =
OUT_REC-ADDNL_MATERIAL_COST_PLN * OUT_REC-QUANTITY.
Calculation for Labour cost
OUT_REC-LABOUR_COST_ACT = OUT_REC-LABOUR_COST_ACT *
OUT_REC-QUANTITY.
OUT_REC-ADDNL_LABOUR_COST_ACT = OUT_REC-ADDNL_LABOUR_COST_ACT *
OUT_REC-QUANTITY.
OUT_REC-LABOUR_COST_PLN = OUT_REC-LABOUR_COST_PLN *
OUT_REC-QUANTITY.
OUT_REC-ADDNL_LABOUR_COST_PLN = OUT_REC-ADDNL_LABOUR_COST_PLN *
OUT_REC-QUANTITY.
Get the planned material cost from the total of the planned cost of
the component materials in the production order confirmations.
SELECT BWART MENGE MATNR SHKZG FROM AUFM
INTO (AUFM-BWART, AUFM-MENGE, AUFM-MATNR, AUFM-SHKZG)
WHERE AUFNR EQ AFPO-AUFNR.
CHECK AUFM-BWART NE '101'.
READ TABLE I_MBEW WITH KEY MATNR = AUFM-MATNR
BWKEY = AFPO-DWERK.
IF SY-SUBRC NE 0.
SELECT MATNR BWKEY ZPLPR LPLPR PEINH
FROM MBEW
INTO I_MBEW
WHERE MATNR EQ AUFM-MATNR
AND BWKEY EQ AFPO-DWERK.
APPEND I_MBEW.
ENDSELECT.
ENDIF.
IF SY-SUBRC EQ 0.
IF I_MBEW-ZPLPR NE 0.
IF AUFM-SHKZG EQ 'H'.
OUT_REC-PLANNED_MATERIAL_COST =
OUT_REC-PLANNED_MATERIAL_COST +
( I_MBEW-ZPLPR * AUFM-MENGE / I_MBEW-PEINH ).
ELSE.
OUT_REC-PLANNED_MATERIAL_COST =
OUT_REC-PLANNED_MATERIAL_COST -
( I_MBEW-ZPLPR * AUFM-MENGE / I_MBEW-PEINH ).
ENDIF.
ELSEIF I_MBEW-LPLPR NE 0.
IF AUFM-SHKZG EQ 'H'.
OUT_REC-CURRENT_MATERIAL_COST =
OUT_REC-CURRENT_MATERIAL_COST +
( I_MBEW-LPLPR * AUFM-MENGE / I_MBEW-PEINH ).
ELSE.
OUT_REC-CURRENT_MATERIAL_COST =
OUT_REC-CURRENT_MATERIAL_COST -
( I_MBEW-LPLPR * AUFM-MENGE / I_MBEW-PEINH ).
ENDIF.
ENDIF.
ENDIF.
ENDSELECT.
Get the Future material cost per Unit by deviding the calculated
Future material cost above with the goods reciept quantity to, then
multiply the unit cost with the GL quantity to get the Future material
Cost for the Quantity delivered. (Quantity in the entery from GLPCA
Table).
IF NOT AFPO-WEMNG IS INITIAL.
OUT_REC-PLANNED_MATERIAL_COST =
OUT_REC-PLANNED_MATERIAL_COST / AFPO-WEMNG * OUT_REC-QUANTITY.
OUT_REC-CURRENT_MATERIAL_COST =
OUT_REC-CURRENT_MATERIAL_COST / AFPO-WEMNG * OUT_REC-QUANTITY.
ENDIF.
ENDFORM. " GET_COSTS
Form GET_VALUE_FROM_COSP *
Get the Material cost from COSP table. *
There are no interface parameters to be passed to this subroutine. *
FORM GET_VALUE_FROM_COSP.
FIELD-SYMBOLS: <FS> TYPE ANY.
DATA: V_COMPONENT TYPE I.
Cummulate the posting values of all the 16 period buckets as to get
total production order cost. This is to handle the aprtial posting of
prodction order values in diffrent periods.
V_COMPONENT = 15.
DO 16 TIMES.
ADD 1 TO V_COMPONENT.
ASSIGN COMPONENT V_COMPONENT OF STRUCTURE COSP TO <FS>.
IF COSP-WRTTP EQ '04' AND COSP-KSTAR EQ P_KSTAR2.
ADD <FS> TO OUT_REC-MATERIAL_COST_ACT.
ELSEIF COSP-WRTTP EQ '04'.
ADD <FS> TO OUT_REC-ADDNL_MATERIAL_COST_ACT.
ELSEIF COSP-WRTTP EQ '01' AND COSP-KSTAR EQ P_KSTAR2.
ADD <FS> TO OUT_REC-MATERIAL_COST_PLN.
ELSEIF COSP-WRTTP EQ '01'.
ADD <FS> TO OUT_REC-ADDNL_MATERIAL_COST_PLN.
ENDIF.
ENDDO.
ENDFORM. " GET_VALUE_FROM_COSP
Form GET_VALUES_FROM_COSS *
Get the Labour cost and Labour hours from the COSS table. *
There are no interface parameters to be passed to this subroutine. *
FORM GET_VALUES_FROM_COSS.
FIELD-SYMBOLS: <FS1> TYPE ANY,
<FS2> TYPE ANY.
DATA: V_COMPONENT1 TYPE I,
V_COMPONENT2 TYPE I.
Cummulate the posting values of all the 16 period buckets as to get
total production order cost. This is to handle the aprtial posting of
prodction order values in diffrent periods.
V_COMPONENT1 = 15.
V_COMPONENT2 = 111.
DO 16 TIMES.
ADD 1 TO: V_COMPONENT1, V_COMPONENT2.
ASSIGN COMPONENT V_COMPONENT1 OF STRUCTURE COSS TO <FS1>.
ASSIGN COMPONENT V_COMPONENT2 OF STRUCTURE COSS TO <FS2>.
IF COSS-WRTTP EQ '04' AND COSS-KSTAR EQ P_KSTAR1.
ADD <FS1> TO OUT_REC-LABOUR_COST_ACT.
ADD <FS2> TO OUT_REC-LABOUR_HOURS_ACT.
ELSEIF COSS-WRTTP EQ '04'.
ADD <FS1> TO OUT_REC-ADDNL_LABOUR_COST_ACT.
ADD <FS2> TO OUT_REC-ADDNL_LABOUR_HOURS_ACT.
ELSEIF COSS-WRTTP EQ '01' AND COSS-KSTAR EQ P_KSTAR1.
ADD <FS1> TO OUT_REC-LABOUR_COST_PLN.
ADD <FS2> TO OUT_REC-LABOUR_HOURS_PLN.
ELSEIF COSS-WRTTP EQ '01'.
ADD <FS1> TO OUT_REC-ADDNL_LABOUR_COST_PLN.
ADD <FS2> TO OUT_REC-ADDNL_LABOUR_HOURS_PLN.
ENDIF.
ENDDO.
ENDFORM. " GET_VALUES_FROM_COSS -
Multiple ship to party address default setting in the " sales order creat
we use the SAP ECC 6.0,
I've a problem about the "ship to party" in the sales order creation,
the customer have 3 ship to party,
the pop up "Partner selection", default show is: "Title" , "Name1"....
But I want to default to show the "Street"
I check the sap notes: 302835, and add the "SD_VARIANT_MAINTAIN" = A in my user profile.
But seems can't working,
when click the right mouse button. A menu can't displayed.
Does anyone have the experience, Thanks.It seems so strange ...
First of all you need to set the ALV administrator parameter among the parameters of your user-id
System-> User Profile> Own Data> Parameters
add the parameter "SD_VARIANT_MAINTAIN" = A in your user profile and SAVE
After that, execute VA01 again; when the ship to party selection pop-up appears, place your cursor at a point on the screen and just the hotspot appears , click with the right mouse button in order to open the context menu.
The "Administration" function would serve only to set the default display variant; the functions "Current Layout", "Save Layout" allow you to create the variant with the needed fields (the popup is an ALV .... )
Try to execute the described steps and give us asap a feedback...
Regards,
Andrea -
Use only sales unit for a material in a sales order
Hi experts,
Sorry in advance if my question has already been asked before. I looked for an answer in forums but I can't find it.
One of my colleague told me about a customizing point which I can't find.
When creating a sales order, for some materials we have defined a sales unit. Conversion units have been maintained in Additional data.
The problem is that it is still possible to order material using base unit.
I want to know if it possible to fill an item with base unit and to have an automatic conversion into sales unit and how.
Thanks in advance for your replies.
S.HI,
Please check the following link
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/504bcd76-51da-2b10-43ae-fc460c7cf95b&overridelayout=true
Regards
senya -
Grouping of ship to party for price deterination
Dear Guru's
Scenario: Each Sold to party has different ship to partys. the price is based on ship to party.
Ex : SP X SH Y SH Z
SP 1 SH 2 SH 3
now SH y& 3 are of one group and have same price and similarly for 2&Z
ie a group of ship to partys have similar price.
question:Can these ship to partys grouped and can price be maintained for these groups.
Please note that
1) Scenario is such that it will be huge price master maintenace if my pricing is based on ship to party alone and not by grouping and then maintaining the price.
2) Customer group , price group, price list flow only from sold to party and not from ship to party
Waiting for your valuable inputs
vasistaDearNitin
Thanks for your reply.
if what you are saying is to activate customer group in Ship to party and maintain customer groups for ship to party and during Sales order the customer group from ship to party is going to flow in Sales Order. then that doest work as i have already written Customer groups flow only from Sold to party
if you meant something else request you to detail
regards
vasista -
How Assign a Buyer for Each Material
Dear experts ,
How Assign a Buyer for Each Material , for example,This person is going to buy this material in purchase dept. is there any possiblities
regards,
Rajahello,
u can achieve same results by following simple way
create purchase document types for example for raw material purchase,consumable purchase etc
then assign buyer from personal setting from each buyers computer.
regards
kedar -
SALES ORDER WITH DIFFERENT SHIP TO PARTY
DEAR FRIENDS
WHEN CUSTOMER SAY 1000 PLACE FOR ORDER MATERIAL ONLY "P-101" WITH 30 PCS. OUT OF 30 10PCS TO TO HIMSELF(1000), 10 PCS TO SHIP TO PARTIES 1010, REMAINING 10 PCS TO 1020.
IN THIS CASE HOW I WILL ASSIGN THE SHIP TO PARTY ALONG WITH QUANTITY. USING ONE LINE ITEM ONLY.
REGARDS
ARUNHi
This is a standard scenario of cross docking and supply chain distribution for retail companies. In this you define partner determination for different ship to parties at item level. Generally we have the main cross docking SH in header. There will be one more partner at item level which will be ship to party if other than header. These are generally the retail stores.
Now when the order is created each line item will have different SH. We cant consolidate demand in one line item for all SH. Once the delivery is created the stock all 1000 is sent to cross docking station which is warehouse at main SH. From here bulk breaking happens and pallets without breaking as sent to the SH at the item level.
This is the way it is working in my client place. This is very common used with retailers like WALMART, KMART, TARGET etc.
Reward if helpful. U can shoot more queries if u have
Kind Regards
Sandeep -
Material Description in Sales Order based on Ship to Party Language
As we know that Material Description coming in Sales Order is based on the Language setup in Sold to Party. Is there any way I can get the Material description based on the Language setup in Ship to Party?
If not in Sales Order then anyway I can get the Material description based on the Language setup in Ship to Party in "Delivery" or do I have to use the user exit to do so?Hey,
Why u r bother about translation of language description in sales order from ship to party n all.
c u can even take language description from sold to party, as u wanted from Ship to party. for this u just have to maintain language in alternate data tab in CMR.
Thanks
Mk -
How to capture the different sold-to party for a single WBS Element
Hello,
The client wants to automatically populate the Partner field in the WBSE. The Sold-to party that is indicated in the Sales Order will be the same with the Partner Field in the WBSE. I would like to ask regarding on how can we capture the different sold-to party for a single wbs element, since in our project there is a system constraint where it is not possible to have multiple u2018sold tou2019 rows assigned to partner field in the WBSE.
Hoping for your suggestions and comments. Thanks in advance.
- Irica
Edited by: Irica Vaile Dalisay on May 25, 2011 3:45 PMTry using the Customer Enhancement
-
Ship to party can not be found in freight order for cost calculation
Dear All,
Cost charge can not be calculated because of missing ship to part. Please help me about this problem
In my rate table, there are 3 combinations which are Product + Carier + Ship to party.and cost will be calculated according to weight. Also resolution base is selected product in calculation sheet.
When I press "calculate charges" button in fregiht order and have a look at charge anylysis log, product ID and Carier are found successfully, ship to part not. Erro message is "Calculation base SHIP_To_PARTY has [ ] on resoltion base product"
Also how can I add new scale base , is there any user exit or any documentation?
Regards,
AliHi Jayesh,
If I understand you correctly, you want that when creating SO from Quoatation
the Ship to Party also follow/copy Ship to Party from Quotation, right?
Just to confirm with you, when you creating SO reference from Quotation, you
use copy/follow-up function, am I right?
You can do this by setting in configuration of Copy Control (like mentioned by Hui).
Step as follow :
1. Go to IMG->CRM->Transactions->Basic Settings->Copying Control for
Business Transactions
2. Create your BAdi (Business Add-In for Copying Control), such as get Ship to
Party value from source document and use it in current document
3. Use this Rule you have created in BAdi (no. 2), in copy control transaction type
IMG->CRM->Transactions->Basic Settings->Copying Control for
Business Transactions-> Define Copying Control for Transaction Types
4. Here you set Copying Routine for your transaction types (put name of your Badi
created in step no. 2)
Or alternatively, you can set it on access sequence in Partner Function
Ship to Party in configuration. You can define access sequence the Ship
to Party is taken from Preceeding Document -> Ship To Party
1. Go to Partner Function access sequence :
IMG->CRM->Basic Functions->Partner Processing->Define Access Sequence
2. Create new access sequence with following entry :
- Source COM_PARTNER_A (PrecedingPartner)
- Check Mapping for Partner Being search
- Partner Function in Source = Ship To Party
3. Assign this Access Sequence in you Partner Function used in Sales Order Transaction
Type.
Tell me if this is what you looking for
Gun.
Maybe you are looking for
-
I have had a laptop for years. I backed up the entire hard drive using Time Machine onto an external hard drive. We now have a new iMac and I am trying to put everything from my old lap top onto our new computer. I know it's probably simple but I'
-
I just got the iPhone 5S. I am able to RECEIVE air drops from people, but I can't send anything via Air Drop. I doesn't seem to be communicating with others. I have Air Drop to communicate with my contacts, but it isn't working. Help!
-
Ok so, bear with me! I don't plan on making any major credit decisions any time soon until I get my balances down and let some accounts age. But I've been eyeing this card and would like some advice. 1) What are the qualifications? I know Chase is st
-
Problem with load balancing on CSS
Hi, we have a pair of servers that are load balanced for port 80 traffic to 198.x.x.21 using the h_www_tcp:80 content rule . I recently got a request that port 80 traffic directed to 198.x.x.21/apps/auction be directed only to one of the load balance
-
How to refresh error message log when displaying an order in WebUI?
Hi, When I create and save an order in WebUI, it shows error messages: Details Business partner XXXXXXX has status "Not Released" Details Business partner XXXXXXX has status "Locked" Key User XXXXXXX may not be used. Then I goto "BP" and correct cor