cancel
Showing results for 
Search instead for 
Did you mean: 

Activity creation using FM

Former Member
0 Kudos

Hi,

I have requirement to mass create custom activity.

Problem I am having is that I am unable to create the activity with 'status reason'.

It is updating 'activity reason' but has no means to updating 'status reason'.

Wondering if anyone has encountered this issue and can suggest a solution?

I am using standard FM's for this.

Trouble is with the 'service os', which processes the 'activity reason' with out any issue but does not update 'status reason'.

Regards,

Prasad

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member541649
Active Participant
0 Kudos

Hi Prasad,

In general it's a good idea to simulate what you want to achive in crmd_order (or even Web UI) and put a break-point in crm_order_maintain and check what all fields are getting filled and do exactly the same in your code.

There might be some very small thing that you would have missed.

Regards,

Parul

Former Member
0 Kudos

Hi Parul,

I have tried that as well.

The scenario works in CRMD_ORDER as well as WebUI.

The crm_order_maintain FM is giving me subrc as 0.

The error I am getting is as below.

Express document"update was terminated" received from author "Prasad"

My code is in attachment.

I think the error is occurring at crm_order_save!

Warm Regards,

Prasad

former_member541649
Active Participant
0 Kudos

Hi Prasad,

If sy-subrc is 0, then crm_order_maintain won't have any issue.

Have you checked ST22 for further details, if any?

Also you could check if there a ORDER_SAVE BAdI implementation in the system.

And I found this, in case you haven't seen it yet:

Regards,

Parul

Former Member
0 Kudos

Hi Parul,

Bit more background on this.

I need to create the activity with both activity reason and status reason.

So, I used the FM CRM_PS_ACTIVITY_CREATE to first create the activity with activity reason. This FM does not have an option of creating status reason as well.

So, to add the status reason, I am using CRM_ORDER_MAINTAIN. I think the error is due to GUID mismatch!

But am just unable to determine how to rectify it!

Is there a standard way to create activity with both status reason and activity reason?

Regards,

Prasad

Former Member
0 Kudos

Hi Prasad

Try clearing the value first and saving.

Then perform your update. We had a similar issue a while back and this was the only way to get around it.

Regards

Arden

Former Member
0 Kudos

Hi Arden,

Do you mean I should clear the GUID values?

Can you please elaborate a bit on this?

Regards,

Prasad

Former Member
0 Kudos

At a technical level I'm not sure what the developer did.

It was either clear the value of the reason code or deleted the entire entry associated with the record

Former Member
0 Kudos

I copied the standard FM into Z and modified it so that it captures the status reason and activity reason in one go.

The other approach seems terribly inefficient with one step for creation and then change.

Regards,

Prasad

dharmakasi
Active Contributor
0 Kudos

Hi Prasad,

Is your issue got resolved?


If you see the mismatch with guid you can retify it as this way

You can create header guid in first instance itself using guid_create and then call the creation standard function module and then you use the same header guid while changing the activity so that same guid will be maintained till end of program.

Regards,

Dharmakasi.

Former Member
0 Kudos

Hi Dharmakasi,

Yes. That is the correct approach. Found this when I debugged the transaction.

Anyhow, I didn't want this happening in 2 steps, so, I created a new FM, copied from existing one and made changes so that there is only one save.

Regards,

Prasad

deepika_chandrasekar
Active Contributor
0 Kudos

Hi,

Can you share your code what tables you are passing crm_order_maintain fm. It will be easy to identify the issue.

Regards,

Deepika.