Sales Org Creation.
Hi Gurus,
What is the Major changes that will happen when we create More ( more than one ). sales Organisations. Any extra assignments will come or any FI enties will happen?
Give me the detail view. Wt are the advantages and disadvatages when we created more sales organisaions.
rgards,
jyothi.
Hi,
If you r creating a new sales org (more than one)
following activities has to be done:
in IMG
*create sales org -
assign sales org to comp code
assign dist channel to sales org
*assign div to sales org
*set up sales area
*assign sales office to sales org ( if u maintain any sales office )
*assign plant to sales org-dist channel.
*Business area-BA assignment has to be done( if BA derivation rule is based on sales aera)
*Pricing procedure determination has to re-check
*Account determination has to check -VKOA(if any table based on sales org )
Master Data
*Customer Masters has to extend to new sales area
*Sales Material tabs has to maintain for the materials
*price condition records has to generate which is based on Sales org specific.
*hope it helps
Similar Messages
-
Sales Org Creation with incorrect Statistics Currency
We created a new sales org with the incorrect statistics currency. When realized this BEFORE we created any documents in that sales org. We changed the statistics currency in config and now we get an error when entering a sales order on that Sales Org. The error is Error while determ. loc. crcy: exchange rate type XXX date 07/31/2014 from TWD to CNY.
We do not want to maintain a currency exchange rate in OB08 for this combination as it is not relevant for our business.
Is there any way we can get past this error without maintaining that currency exchange rate?Issue has been resolved.
Configuration was pulling in the incorrect credit control area from the copy. -
Creation of Sales org and company code
Hello Folks,
Am i right to say that sales org is assigned to company code but the creation of sales org is not dependent on the existence of the company code is will be assigned to?
regards
RaviHi Ravi,
You are right. You can create either company code first or sales organisation first. You can first create everything you need (sales organisation, plant, d.channel, division, company code, credit control area....anything) in any order, the order really doesnt matter here.
Once you start assigning,, the assignment elements shoudl be there. Thats all. If the assignment elements are there, you can assign them, as long as they are there in the system. -
Creation of Sales org views for customers related to vendor
Hello All,
Can any body tell me is there any functional module which can be used to created the sales org views for customers related to vendors.
Regards
SrinivasHi Ravi,
the number of sales area possible would be 6 sales area,
yes you can of course use the common master data functionality
After creating the organizational structure and relevant master records you want to use as the masters, that is, in the distribution channels and divisions you are going to use as a reference, you can group distribution channels and divisions separately for master data (which combines customer master and material master records), group condition records, or both master data and condition records.
Letu2019s say you have a product range that is not different for the four different distribution channels you have (the channels could be telesales, retail, industry, and wholesale.) Neither is there a difference in the customersu2019 details when they purchase through one or the other. Thus, you will not want to create a multiple of four views of customer master and material master records. Merely create the customer master records and material master records in one of the distribution channels, such as retail. Then assign the other distribution channels you created in the organizational structure setup to this one.
Donu2019t forget this means you can only create or change master data in the distribution channel that is being referenced. In the scenario above, this means you can only change data for the retail distribution channel. Even if you should access a customer or material master in change mode, press F4 (possible entries), and select telesales, industry, or wholesale, you will receive a message u201CSales area is not defined . . . u201D
The same is true for the sharing of conditions. If conditions are shared, you need only create a condition in the distribution channel or division you are using as the reference. Obviously, this only pertains to conditions that have the distribution channel and/or division in their key, such as a price based on sales area
Revert if helpful
Mohit Singh -
Material master creation problem in sales org views
Hi
I have faced problem while creating material master
In mm01 >then select the org views basic data1&2 , sales org data1&2, purchaing, accounting and costing views >thanclick org levels> here enter the plant , stor loc, sales org & dist.chanel >then enter fill the all fields and save this is original procedure
but problem occured at ... in org levels without dist.chan ( only enter plant ,sales org stor loc ) also system goes to sales org data-2
in our development system .. in select sales org 1& 2 ... system should ask sales ogr &dist,chanel at org ..level scren ..if we does't ente dist.ch .. system does't allow the material master...actually like this in production system also worked earler....but now our production system not worked like this procedure ...
pls ..guide me to solve this issue any one
regards
sesidharhi
we have 1 sales org ,4 dist.chanel and 1 plant
4 distbution channels are also assigned to sales org and plant
but problem is ..when create material amster ...if select the select views sales orgdata 1,2 and sales gnerael plant data
than press enter ... here system ask the palnt (mandatory), sales org(mandatory) and dist channel9optional).in production sysstem....
plant 1000
sale org zosd
DC .........(BLANK)
IF press enter system allow to ... sales org data 2
if DC ....(BLANK) System does 't allow to next screen sales org data 2
how can i change this optional to mandatory in DC -
BAPI - Problem in Sales order creation
Hi Friends,
I have problem in Sales order creation using BAPI ,I am getting a messsage - Error in creating document ,I have sent the code along with this mail ,can you help it out.
Code:
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text FOR FIELD p_auart.
PARAMETERS: p_auart TYPE auart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Sales organization
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text1 FOR FIELD p_vkorg.
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Distribution channel
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text2 FOR FIELD p_vtweg.
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Division.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text3 FOR FIELD p_spart.
PARAMETERS: p_spart TYPE spart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SKIP 1.
Sold-to
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text4 FOR FIELD p_sold.
PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Ship-to
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text5 FOR FIELD p_ship.
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SKIP 1.
Material
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text6 FOR FIELD p_matnr.
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Quantity.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text7 FOR FIELD p_menge.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Plant
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text9 FOR FIELD p_plant.
PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Data declarations.
DATA: v_vbeln LIKE vbak-vbeln.
DATA: header LIKE bapisdhead1.
DATA: headerx LIKE bapisdhead1x.
DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
Initialization.
INITIALIZATION.
v_text = 'Order type'.
v_text1 = 'Sales Org'.
v_text2 = 'Distribution channel'.
v_text3 = 'Division'.
v_text4 = 'Sold-to'.
v_text5 = 'Ship-to'.
v_text6 = 'Material'.
v_text7 = 'Quantity'.
v_text9 = 'Plant'.
Start-of-selection.
START-OF-SELECTION.
Header data
Sales document type
header-doc_type = p_auart.
headerx-doc_type = 'X'.
Sales organization
header-sales_org = p_vkorg.
headerx-sales_org = 'X'.
Distribution channel
header-distr_chan = p_vtweg.
headerx-distr_chan = 'X'.
Division
header-division = p_spart.
headerx-division = 'X'.
headerx-updateflag = 'I'.
Partner data
Sold to
partner-partn_role = 'AG'.
partner-partn_numb = p_sold.
APPEND partner.
Ship to
partner-partn_role = 'WE'.
partner-partn_numb = p_ship.
APPEND partner.
ITEM DATA
itemx-updateflag = 'I'.
Line item number.
item-itm_number = '000010'.
itemx-itm_number = 'X'.
Material
item-material = p_matnr.
itemx-material = 'X'.
Plant
item-plant = p_plant.
itemx-plant = 'X'.
Quantity
item-target_qty = p_menge.
itemx-target_qty = 'X'.
APPEND item.
APPEND itemx.
Fill schedule lines
lt_schedules_in-itm_number = '000010'.
lt_schedules_in-sched_line = '0001'.
lt_schedules_in-req_qty = p_menge.
APPEND lt_schedules_in.
Fill schedule line flags
lt_schedules_inx-itm_number = '000010'.
lt_schedules_inx-sched_line = '0001'.
lt_schedules_inx-updateflag = 'X'.
lt_schedules_inx-req_qty = 'X'.
APPEND lt_schedules_inx.
Call the BAPI to create the sales order.
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
Check the return table.
LOOP AT return WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'Error in creating document'.
ELSE.
Commit the work.
COMMIT WORK AND WAIT.
WRITE: / 'Document ', v_vbeln, ' created'.
ENDIF.
Regards,
Dineshwhat messages u are gettting in RETURN ? Please check the RETURN tables data.
[code]CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
Regards
Prabhu -
Sales Order creation with Ship to not assigned to Sold to
Hi There,
I have an issue that I am able to create an order with a Ship to which is not assigned to Sold to. i.e, The sold to accepts any ship to and not giving any error. I am giving both Sold to and Ship to together while order creation. Is it because of this? Should I enter sold to and then press enter for the list of Ship to's assigned to that? I dont find any issues in the Partner determination.
Can you help?
Thanks in advance,
RenjithHi Renjith,
I agree with you that SAP allows you to enter any ship to(belonging to sales org of sold-to party) for a given sold to party.
To meet your requirement, You may like to use the Userexit MV45AFZZ (Form USEREXIT_SAVE_DOCUMENT_PREPARE) to check the Ship-to while saving. Thus a comparison could be made with assigned Ship-Tos for the given Sold-to party. In case there is a mismatch throw a error message before allowing committing of save.
Your developer would be able to help you to achieve this
Please let me know if this helps
Warm regards
Harpreet -
BAPI for Sales Order Creation.
Hello gurus,
I want to create a sales order using BAPI.
I have tried some BAPI's like BAPI_SALESORDER_CREATEFROMDAT1, BAPI_SALESORDER_CREATEFROMDAT2, BAPI_SALESORDER_CREATEFROMDATA, BAPI_SALESDOCU_CREATEWITHDIA.
But I am not able to update the Miscellaneous Information like Mode of transport(VBAP-OIC_MOT), Forwarding Agent(VBAP-OIC_LIFNR), Base Location(VBAP-OIA_BASELO), Truck Number(VBAP-OIC_TRUCKN), Pipeline trip No.(VBAP-OIC_PTRIP), Pipeline operator´s external batch number(VBAP-OIC_PBATCH).
Is there any other BAPI thru which i can update these fields while creation of Sales Order.
The Fields which I can provide to BAPI as import parameter is:
Order Type(VBAK-AUART),
Contract(VBAK_VGBEL),
SALES Org (VBAK-VGORT),
Dist Channel(VBAK-VTWEG),
Division (VBAK-SPART),
Open Quantity (VBAK-KWMENG)
Plant(VBAP-WERKS)
Storage Location (VBAP-LGORT)
Mode of transport(VBAP-OIC_MOT), Forwarding Agent(VBAP-OIC_LIFNR), Base Location(VBAP-OIA_BASELO), Truck Number(VBAP-OIC_TRUCKN), Pipeline trip No.(VBAP-OIC_PTRIP), Pipeline operator´s external batch number(VBAP-OIC_PBATCH).
Thanks In Advance,
Points will be rewarded for Best Solution......
Yogesh Sharmahi,
I can give u a suggestion .. try it ..
its a quite a long process....
in BAPI_SALESORDER_CREATEFROMDAT2
there is a table EXTENSIONIN...
here u can add append structure and carry on ur sales order creation
Follow the process
Customer Enhancement for VBAK, VBAP, VBEP
Description
You can use this parameter to transfer user-specific enhancments to a BAPI. The customer has to complete the EXTENSION structure and the system automatically continues processing it. If you have not defined any user-specific fields, then you can transfer a blank EXTENSIONIN structure.
Technical information about Customer Enhancements
The following description uses an example to explain how to proceed with customer enhancements to the SD tables VBAK, VBKD, VBAP and VBEP.
The customer has added their own fields to table VBAP using the INCLUDE structure CUTEST. This structure contains 2 fields:
CFIELD1, CHAR 10
CFIELD2, CHAR 3.
The customer also requires that these two fields can be maintained with the BAPI.
1. Maintain structure CUTEST in table VBAP
2. Because the BAPIs work with checkboxes, you must also define a CUTESTX checkbox for the customer structure. It should be structured like this:
Field name Data element
CFIELD1 CHAR1
CFIELD2 CHAR1
3. Define these customer structures in the structures VBAPKOZ und VBAPKOZX using INCLUDE or APPEND.
4. Add the customer structures to the BAPE_VBAP and BAPE_VBAPX BAPI structures using the APPEND technique.
5. Adjust the following structures for customer enhancements to table VBAK:
a) VBAKKOZ
b) VBAKKOZX
c) BAPE_VBAK
d) BAPE_VBAKX
6. Adjust the following structures for customer enhancements to table VBEK:
a) VBEPKOZ
b) VBEPKOZX
c) BAPE_VBEP
d) BAPE_VBEPX
7. Generally, the data should be added to the BAPI interface in the internal communication structures (VBAKKOM, and so on). There, you can process the data in the SD tables (VBAK, and so on).
8. If the EXTENSIONIN parameter contains customer data, you must complete at least the key fields in the relevant standard parameters.
For example:
You want to change customer field VBAP-CFIELD2 for item 20 to "XYZ" in order 4711.
The following entries are expected:
Import: BAPIVBELN-VBELN = '0000004711' Document number
BAPISDHD1X-UPDATEFLAG = 'U' UPDKZ for doc header
Tables: BAPISDITM-ITM_NUMBER = '000020' Item number
BAPISDITMX-ITM_NUMBER = '000020' Item number
+ BAPISDITMX-UPDATEFLAG = 'U' UPDKZ for item
You must complete the EXTENSION table as follows:
STRUCTURE VALUEPART1 1234561234567890123
BAPE_VBAP 0000004711000020 XYZ
BAPE_VBAPX 0000004711000020 X
Further Information
You can find more information in the BAPI programming guide in the chapter for enhancements to BAPIs.
Notes
You must complete the STRUCTURE field with the name of the relevant enhancement structure (BAPE_VBAK, BAPE_VBAP, BAPE_VBEP). You can complete the remaining fields with the append structures from the enhancement structures.
At the moment, you can use the BAPI to store enhancements in the following structures:
VBAK : An enhancement to header data requires an append structure to BAPE_VBAK and an enhancement to structure VBAKKOZ.
VBAP : An enhancement to item data requires an append structure to BAPE_VBAP and an enhancment to structure VBAPKOZ.
VBEP : An enhancement to schedule line data requires an append structure to BAPE_VBEP and an enhancement to structure VBEPKOZ.
VBKD : If you are using an enhancement for header data, you must add an append structure to BAPE_VBAK. You also need to enhance structure VBAKKOZ. If it is for item data, you need to add an append structure to BAPE_VBAP. You must also enhance structure VBAPKOZ.
If you also want to work with checkboxes, each X-structure must also contain an append structure.
For example:
A customer has created an order and wants to include the material long text (50 digits long).
The EXTENSIONIN structure must be completed with BAPE_VBAP. Two fields have fixed definitions in this structure. These are in the VBAP host key (VBELN, POSNR). The customer sets up an append structure that contains field ZMAT50.
Because the VBELN is normally blank when you create an order, the data can look like this:
STRUCTURE |BAPE_VBAP
VALUEPART1 | 000010Customermateriallongtext50
VBELN POSNR ZMAT50 -
Sales Org. structure reallignment
First thanks for taking the time to read this post. I would like to have your expert suggestions for the below scenario.
In our client organization, a country is mapped as sales org in SAP, different product lines are captured in the sales division level, the country is divided into mutiple sales districts and it is captured as sales office in SAP, district is further sub-divided into mutiple territories and it is captured as sales group in the system. Customers will be created at the bottom of the sales structure.
The business is highly dynamic and they would do geographical reallignment every year. For eg, To start with, we may have created 8 different sales offices in the system. But it could be reduced (for eg. 6) or increasted (for eg. 10) in the next year depending on the market situation. The same could happen with the sales group also. So the underlying customers need to updated with new sales office and sales group. How can we do it easily considering the master record volume (approx. 200,000). How will it impact other areas like demand planning, allocation, pricing, commission and etc. Is there any alternate approach to handle it differently?Hi,
Sales pricing, commission will be effected in case you sales office and sales group will be part of it, you need to input the condition record for the same to caluculate the pricing and commission.
Since this is your business requirements, you have to go with it, and later you need to maintained the condition record as required.
For demand planning is based upon creation of sales order, i don't it will impact mutch in it.
regards
Vivek. -
hi,
in our implementation we plan to use ERP sales org for all sales documents in CRM hence we plan to map org structures between CRM and ERP.
we also have a need to leverage Employee maintenance done in HR. hence we plan to download employees from HR into CRM.
can you please help guide on how we can achieve both the above scenarios?..can we maintain HR org and ERP org in CRM?
thanks
RHHi,
What I undestand is u want to map the ERP sales area i.e. the Logistic Org Structure into CRM as well as u want the HR Integration with employees coming from HR.
a. ERP Sales Area or Logistic Org structure
This implies mapping of the Sales Organization with CRM.
This can be downloaded using the transaction CRMC_R3_ORG_GENERATE. This will result in creation of organization unit in CRM represting the ECC sales area.
b. HR employees
This will requre HR integration to be activated, here the employees will flow from HR to CRM via ALE and will be maintained as business partners with the role Employees.
WIsh this helps.
Regards,
Shalini Chauhan -
Sales Office values linked to Sales Org
Hi,
How can I connect sales org to sales office and sales group in IT900? for example. If user selects Sales Org 001 then a list of Sales offices that are under that Sales org will only show. And then if the user selects a Sales Office 001 then a specific list will onlybe available for selection for the sales group.
Thanks in AdvanceHi,
In OVXM we assign sales office to sales area.
OVXJ we assign sales group to sales office.
E.g In sales order creation VA01 enter sales area, when press F4 in Sales office, system search for possible sales offices from OVXM.
Regards,
Chandra -
Sold to party field should be editable and non-Editable for diff sales org
Hi,
in creation of SO,i want SP field should be editable for Domestic sales org and Non Editable for Export sales org.
please help on this.Dear Mohanty,
In sales order, for domestic sles SP is editable - It is Normal process.
Non Editable for Export sales org.
In this how user will enter the sold to party while creating sales order.
And did you create export customer classification in Sales org rather Distribution channel.
Regards,
Mani -
How to make a payment term as Default in Credit note in certain Sales Orgs.
Hello experts,
Kindly provide your valuable inputs as How can i make the payment terms( say AU00 =Due Immediately) default for a few sales organizations.
As checked, Depending on the type of Credit notes( i.e. WITH OR WITHOUT reference to an invoice), payment terms are used in credit notes processing. Also putting V in invoice reference field will make the payment terms calculation as similar to invoice.
But I need, that everytime a credit note( any type with /without Ref.) is raised in a given sales org., IT HAS TO BE DUE IMMEDIATELY i.e. payment terms must be AU00( Pay immediately).
Kindly suggest accordingly.
Many thanks in advance.Hi Ram,
Thanks for the reply.
I hope you have seen the scenario- My requirement is to MAKE THE PAYMENT TERM AU00( DUE IMMEDIATELY) SPECIFICALLY FOR CREDIT MEMOS WHICH ARE RAISED UNDER SPECIFIC SALES ORG.
i.e. If Sales org X,raised a Credit memo( with or without reference to an invoice), THE CREDIT NOTE MUST BECOME DUE IMMEDIATELY.
I would be greatful, if you can suugest the path/procedure to achieve that. I have received valable inputs about the variant but I am seeking some hint in a CUSTOM Z TABLE creation with any User exit,that can Default this payment terms to CREDIT NOTE.
Many thanks in advance. -
Factory Calendar Maintained in Sales Org
Hi
I need one Information
I have a sales org which is assigned to 10 plants. out of 10 plants some are assigned to different factory calendar.
Now the requirement is to assign one of the calendar to the sales org. so my question is what will be the impact of assigning calendar to the sales org.
Regards
NaveenHi Naveen,
The sales org. calendar, defined in sales organization address data, is the calendar in which the sales organization people work. It is really useful to... I don't know. I guess not that much since deliveries and production do not depend on it. There is also no "planning" of sales orders creation, to my knowledge, nor anything logistics related that makes sense to use it but information wise.
I guess it can be use by HR, maybe, to determine working days of sales organization staff.
Technically I can only find it in function VELO14_GET_VKORG_CALENDAR, that is really innocuous.
regards,
Edgar -
Reg: Sales document creation
Hi Abapers,
As i am new to SD Module, would like to get some ideas from your end. My requirement is to create a sales order using Programming. After creation of sales order it should post to finance. Could anyone help me how this can be done.REPORT ZSALESORDER.
* Parameters
* Sales document type
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text FOR FIELD p_auart.
PARAMETERS: p_auart TYPE auart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
* Sales organization
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text1 FOR FIELD p_vkorg.
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
SELECTION-SCREEN END OF LINE.
* Distribution channel
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text2 FOR FIELD p_vtweg.
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
SELECTION-SCREEN END OF LINE.
* Division.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text3 FOR FIELD p_spart.
PARAMETERS: p_spart TYPE spart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SKIP 1.
* Sold-to
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text4 FOR FIELD p_sold.
PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
* Ship-to
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text5 FOR FIELD p_ship.
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SKIP 1.
* Material
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text6 FOR FIELD p_matnr.
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
* Quantity.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text7 FOR FIELD p_menge.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
SELECTION-SCREEN END OF LINE.
* Plant
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text9 FOR FIELD p_plant.
PARAMETERS: p_plant TYPE werks_d .
SELECTION-SCREEN END OF LINE.
* Complete Deliver
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text10 FOR FIELD p_autlf.
PARAMETERS: p_autlf TYPE autlf DEFAULT 'X'.
SELECTION-SCREEN END OF LINE.
* Data declarations.
DATA: v_vbeln LIKE vbak-vbeln.
DATA: header LIKE bapisdhead1.
DATA: headerx LIKE bapisdhead1x.
DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
DATA: lt_schedules_ink TYPE STANDARD TABLE OF bapisdhead1
WITH HEADER LINE.
* Initialization.
INITIALIZATION.
v_text = 'Order type'.
v_text1 = 'Sales Org'.
v_text2 = 'Distribution channel'.
v_text3 = 'Division'.
v_text4 = 'Sold-to'.
v_text5 = 'Ship-to'.
v_text6 = 'Material'.
v_text7 = 'Quantity'.
v_text9 = 'Plant'.
v_text10 = 'Complete delivery'.
* Start-of-selection.
START-OF-SELECTION.
* Header data
* Sales document type
header-doc_type = p_auart.
headerx-doc_type = 'X'.
* Sales organization
header-sales_org = p_vkorg.
headerx-sales_org = 'X'.
* Distribution channel
header-distr_chan = p_vtweg.
headerx-distr_chan = 'X'.
* Division
header-division = p_spart.
headerx-division = 'X'.
headerx-updateflag = 'I'.
*Complete delivery
header-COMPL_DLV = p_autlf.
header-COMPL_DLV = 'X'.
* Partner data
* Sold to
partner-partn_role = 'AG'.
partner-partn_numb = p_sold.
APPEND partner.
* Ship to
partner-partn_role = 'WE'.
partner-partn_numb = p_ship.
APPEND partner.
* ITEM DATA
itemx-updateflag = 'I'.
* Line item number.
item-itm_number = '000010'.
itemx-itm_number = 'X'.
* Material
item-material = p_matnr.
itemx-material = 'X'.
* Plant
item-plant = p_plant.
itemx-plant = 'X'.
* Quantity
item-target_qty = p_menge.
itemx-target_qty = 'X'.
* item category
itemx-ITEM_CATEG = 'X'.
APPEND item.
APPEND itemx.
* ITEM DATA
itemx-updateflag = 'I'.
* Line item number.
item-itm_number = '000020'.
itemx-itm_number = 'X'.
* Material
item-material = p_matnr.
itemx-material = 'X'.
* Plant
item-plant = p_plant.
itemx-plant = 'X'.
* Quantity
item-target_qty = p_menge.
itemx-target_qty = 'X'.
APPEND item.
APPEND itemx.
* Fill schedule lines
lt_schedules_in-itm_number = '000010'.
lt_schedules_in-sched_line = '0001'.
lt_schedules_in-req_qty = p_menge.
APPEND lt_schedules_in.
* Fill schedule line flags
lt_schedules_inx-itm_number = '000010'.
lt_schedules_inx-sched_line = '0001'.
lt_schedules_inx-updateflag = 'X'.
lt_schedules_inx-req_qty = 'X'.
APPEND lt_schedules_inx.
* Fill schedule lines
lt_schedules_in-itm_number = '000020'.
lt_schedules_in-sched_line = '0001'.
lt_schedules_in-req_qty = p_menge.
APPEND lt_schedules_in.
* Fill schedule line flags
lt_schedules_inx-itm_number = '000020'.
lt_schedules_inx-sched_line = '0001'.
lt_schedules_inx-updateflag = 'X'.
lt_schedules_inx-req_qty = 'X'.
APPEND lt_schedules_inx.
* Call the BAPI to create the sales order.
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
* Check the return table.
LOOP AT return WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'Error in creating document'.
ELSE.
* Commit the work.
COMMIT WORK AND WAIT.
WRITE: / 'Document ', v_vbeln, ' created'.
ENDIF.
Code Formatted by: Alvaro Tejada Galindo on Dec 26, 2008 10:58 AM
Maybe you are looking for
-
Can you get newsstand on your iMac or Macbook Pro
How do you connect ipad to internet if you only have an ethernet cable on your macbook pro ??
-
My old posted messages are not shown
Hi I posted some queries on sep4th and 5th but those are not shown now on 6th sep. prasanth a.s.
-
UCBATCH00 and UCBATCH01 execute task
Hi All, I have to upload my consolidation data in SEM BCS using a task. WE have two program UCBATCH00 to execute a task. When i use this program in foreground then it gives me statistical report about uploaded data. When ever i execute the same progr
-
And I delete the application and download again, same msg come out
-
Master data Attribute Load failure issue
Hi ALL: While trying to load Attribute and text of a Infoobject from a ODS, the text load is going through fine,but The attribute Load is failing everyday due to duplicate issue and it is showing the below messages. 2 duplicate record found. 77 recor