Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

GOS enhancement in sales order

Former Member
0 Kudos

Hi All,

Could you please tell me how to do enhancement when uploading attachment in sales order edit mode VA02? We've a requirement to send email to related users when someone upload a new attachment for specific document type in VA02, I did google but have no clear clue. I only know there are some FMs named GOS_* and objects named CL_GOS_*, then I try to put breakpoint on all of them and upload file in VA02, I got the result when first click the GOS icon in VA02, the CHECK_STATUS method of CL_GOS_SRV_ATTACHMENT_CREATE is triggered, but it's not triggered for all other methods. I also tried to create a new class inherit from CL_GOS_SERVICE and do similiar work as CL_GOS_SRV_ATTACHMENT_CREATE does, then register the new class for service PCATTA_CREA by customizing SGOSATTR in SM30, but it still not triggered.

Does anyone have experience about similiar requirement? what exact class or FM will be triggered when uploading attachments in VA02? and how can I enhance them to add our own logic of sending email for specific document type?

Any suggestion is very appreciated.

Best Regards,

Jeff

消息编辑者为:Jeff liu

1 ACCEPTED SOLUTION

gokul_radhakrishnan3
Active Participant
0 Kudos

Hi Jeff,

The method you followed is correct.  What I would normally do is,  create a new class, inheriting from CL_GOS_SRV_ATTACHMENT_CREATE and redefine method EXECUTE. One thing which you may check is, while registering this in SGOSATTR , you may have to change the service type (TYPE) to "Single service" to make it trigger. And you have to give the new class name there in CLSNAME. Put a break point in your new EXECUTE. It should trigger.

Regards,

Gokul

10 REPLIES 10

gokul_radhakrishnan3
Active Participant
0 Kudos

Hi Jeff,

The method you followed is correct.  What I would normally do is,  create a new class, inheriting from CL_GOS_SRV_ATTACHMENT_CREATE and redefine method EXECUTE. One thing which you may check is, while registering this in SGOSATTR , you may have to change the service type (TYPE) to "Single service" to make it trigger. And you have to give the new class name there in CLSNAME. Put a break point in your new EXECUTE. It should trigger.

Regards,

Gokul

0 Kudos

Another solution would be to use BAdI GOS_SRV_REQUEST "GOS: Catch Request of a Generic Service" to override the calling of the Generic Object Services. You could encapsulate the standard call in your code or you could also call the copied class created using Gokul suggestion.

Regards,
Raymond

PS: When I discovered this BAdI, I was able to put SGOSATTR data back to its standard values.

0 Kudos

Hi Gokul,

Thank you for the information. But actually I did just the same as you. Below is my steps:

1. create a new class ZCL_GOS_SRV_ATTACHMENT_CREATE inherit from CL_GOS_SRV_ATTACHMENT_CREATE, as a test, in all the methods I did nothing but just call SUPER->method. Then put breakpoint in methods IF_GOS_SERVICE_ON_CREATE~ON_OBJECT_CREATED, EXECUTE, ON_SERVICE_SUCCEEDED, CHECK_STATUS.

2. register ZCL_GOS_SRV_ATTACHMENT_CREATE in SGOSATTR, here I select service name PCATTA_CREA, I put ZCL_GOS_SRV_ATTACHMENT_CREATE in field "Class f.Gen.Service", select "Single Service" in field "Service Type".

3. start VA02, then click GOS icon, the method CHECK_STATUS get triggered for several times, after that, the GOS menu can be used, then I click again the GOS icon and in the menu choose "Create"->"Create Attachment". The import file pop-up window appears, but after I select a file and click open button. None of the breakpoint gets triggered now. But I can see the file actually has been uploaded.

4. I also tried to use "Attachment list" menu under GOS icon in VA02 and then click "New" button to do the same upload process and still the methods not triggered.

Is there any step that I made mistake?

PS: We are using SAPKA70103 package, is it because of patch version? I searched notes but could not find anything mentioned patch level reason, so I think it should not because of package.

Thank you again!

Jeff

0 Kudos

Hi Raymond,

I also tried your BADI GOS_SRV_REQUEST in SE19 but seems it still not work. The method I implement is if_ex_gos_srv_request~start_service. I also did nothing but just set a breakpoint and then activate the BADI, then I did as upper steps and found it still not get triggered. Looks very strange.

Jeff

Former Member
0 Kudos

Declare your class into table SGOSCUST not in  SGOSATTR

0 Kudos

Hi George,

Also tried your solution but still not work. Below is my steps, to make you better understand, I also attached some screen shots:

1. Create class ZCL_GOS_SRV_ATTACHMENT_CREATE inherit from CL_GOS_SRV_ATTACHMENT_CREATE

2. Set break point in method EXECUTE

3. Register it into SGOSCUST as you suggested

4. start uploading in VA02

After I select a file from my gui client, the file successfully imported but the break point still not triggered. So I think your suggestion does not work.

Please correct me if something wrong. Thanks!

Also it looks very strange that after the file imported, I think there should have some message prompting the result, but actually it doesnot happen, just like nothing happened, but when I open the attachment list, the file is really imported.

Jeff

0 Kudos

Hi Jeff

do not panic just set an external breakpoint and will work GOS services use RFC to work

0 Kudos

Hi,

I agree with George. Try external break point. I also tried the same earlier.

Regards,

Gokul

0 Kudos

Hi George,

Thank you very much for pointing out my mistake. yes, you are right. I set external break point and found the method EXECUTE get triggered while clicking menu "create"->"create attachment". Then I pressed F8 to continue and saw the import file window pop-up. But after I selected a file, it comes back to the end of the EXECUTE method, if i go on pressing F8, the other break points in my class like IF_GOS_SERVICE_ON_CREATE~ON_OBJECT_CREATED and ON_SERVICE_SUCCEEDED still not triggered. When I press F6 in EXECUTE method, the FM SGOS_OBJECT_ADD_TO_HISTORY then object CL_GOS_DIRECT method START_SERVICE then FM GOS_EXECUTE_SERVICE are called by sequence but seems not able to enhance them freely. How can I do then?

0 Kudos

Hi George and Gokul,

Sorry, I was totally confused by the break point issue. I didn't realize after the file import screen, i can get the result, if no exception occurred, then i can write my own logic in the method EXECUTE, just after CALL METHOD SUPER->EXECUTE.

Thank you again!

Jeff