cancel
Showing results for 
Search instead for 
Did you mean: 

VA01 with COPA at item level in Account assign tab via BAPI_SALESORDER_CREATEFROMDAT2

Pankaj13
Explorer
0 Kudos

Dear Experts,

I have sincerely explored a lot about this, and unfortunately could not find any solution. Apologies if there exists any solution and could not find on my own, need your help.

Scenario :-

I am running in Implementation project where I need to create sales order via custom program using BAPI_SALESORDER_CREATEFROMDAT2. Problem lies here, in my scenario, we have Account based COPA activated, hence there are COPA fields in line item of sales Order(VA01) at Account Assignment Tab on clicking PROFITABILITY SEGMENT button.

Here I am unable to pass COPA fields in BAPI. Kindly help to achieve this cumbersome requirement.

For example in MM MIGO BAPI - BAPI_GOODSMVT_CREATE to pass COPA fields, we can use

COPA_PROFITABILITY_SEGMENT, but this doesn't helps in BAPI_SALESORDER_CREATEFROMDAT2.

If any information missing, kindly let me know, I shall respond promptly. Many thanks in advance for helping and guiding.

Accepted Solutions (1)

Accepted Solutions (1)

Pankaj13
Explorer
0 Kudos

One of my team mate has figured out the solution, narrating here if anyone needs it for their scenario.

Suppose there are 3 CO-PA fields out of which 2 are to be manually entered and 1 will be automatically derived based on other 2 fields.

Created these 3 fields (i.e. ZWW002, ZWW003, etc as defined for COPA) extension/custom fields at Line order level i.e. VBAP level.

In KEDR transaction maintain the Table lookup as shown in screen shot KEDR.

Pass these COPA fields in EXTENSIONIN in BAPI for creating sales Order....just like other custom fields are pushed via EXTENSION after appending required structures. Once done, these copa fields will get populated in VBAP and also will get populated in COPA sales order table

CE41000_ACCT. Derivation will also happen correctly.

Answers (3)

Answers (3)

Pankaj13
Explorer
0 Kudos

Hello Experts,

Have explored this with two approaches.

Approach 1 - Used BAPI_SALESORDER_CREATEFROMDAT2 and exported COPA related information and captured/imported same in

exit ZXKKEU11. This way out of 3 COPA fields, 2 are populated where as third 1 (which is supposed to be derived based on other 2) remains blank (hence derivation for this 3rd field is not happening) Another challenge, when same Sales order opened in VA02 and saved (without touching COPA fields) all the values remains intact but COPA fields get blank 😞

Approach 2 - Used BAPI_SALESORDER_CREATEFROMDAT2 to create Sales order (without COPA fields) after wards used COPA FM - COPA_PROFITABILITY_SEGMENT to push COPA fields. I could see the data in CE41000_ACCT but problem is this generates new PAOBJNR and this new PAOBJNR is not linked with Line item of sales order(VBAP-PAOBJNR). Ideally this new PAOBJNR number generated by

COPA_PROFITABILITY_SEGMENT should be mapped in VBAP-PAOBJNR.

Avoiding BDC here, cannot opt it.

Hence in Gist, both Approaches are not helping, can someone please put some light.

phanikumar_v3
Active Contributor
0 Kudos

***For COPA fields, it needs to be entered manually when creating via VA01***

any derivation rules exists--pl check that as well..

Pl talk to your FI Guy there(correct person is CO guy) and on what basis they are deriving profitability segments(if they do manually also-some technic based on Sales org level or Document type level or else..)

hope that can help you better to conclude the input fields.

Phanikumar

Pankaj13
Explorer
0 Kudos

Thanks PhaniKumar. Yes derivation rule exist in our scenario, but this derivation populates only 1 field. But this derivation happens on the basis of another inputted custom characteristic.

In gist, we have 3 COPA characteristics, out of which 2 needs to be manually entered and the third field is derived automatically based on the derivation rule. These two fields I am unable to pass in BAPI.

phanikumar_v3
Active Contributor
0 Kudos

Looks like you are a Abaper and try to solve--what is happening when you try to create this sales order manually with these BAPI inputs...if you are able to create with manual effort with these BAPI input fields-Please check your field assignments again as you are using Standard...

Do you use any derivation rules in deriving the profit center into sales order other than material master plant data-Pl check this as well.

If you still miss the profitability segment-then You can try with Custom BAPI(may be a little cubersome)-else upload this field with some BDC after this Standard BAPI..(i am just giving an idea-You can correct me here)

Phanikumar

Pankaj13
Explorer
0 Kudos

Thanks PhaniKumar for responding.

Yes, you are correct I am technical person. When we caret Order manually via VA01, it gets created successfully. For COPA fields, it needs to be entered manually when creating via VA01. Problem lies here, I am unable to find place/parameters to be passed in BAPI_SALESORDER_CREATEFROMDAT2 for COPA fields (eg. WW002/WW003/WW004....)

For BDC exploration, I am reluctant to that as it is interface piece being hit from third party, hence am looking for BAPI part where I can punch/pass those COPA fields.

Kindly help...let me know if more information required.