How to implement GOS for standard transaction VA01VA02VA03

作者:郑德鼎 约 5 分钟阅读 更新日期:2024-02-22 2 年前更新 标签:工具, 技术
目录

How to implement GOS for standard transaction VA01/VA02/VA03

FollowRSS feedLike

3 Likes 11,660 Views 5 Comments

How to implement GOS for standard transaction VA01/VA02/VA03

Contents

Problem Statement

1.1         Issue

1.2         Example.

1.3         Resolution Approach

Process to be followed

2.1         Step 1

2.2         Step 2

2.3         Step 3

2.4         Step 4

2.5         Step 5

Steps to create attachments for Sales Order

3.1         Step 1

3.2         Step 2

3.3         Step 3

3.4         Step 4

3.5         Step 5

3.6         Step 6

Appendix. 1

1. Problem Statement

There is a requirement of attaching supporting documents whenever business users will create new credit-memo or debit memo request (Sales Order) in SAP system through the transaction VA01. While attaching those supporting documents following challenge must occur:

1.1  Issue

SAP standard supports create/change/display/delete of attachments on VA02 and VA03 (change and display sales order respectively) transactions with the help of value ‘X’ on parameter ‘SD_SWU_ACTIVE’. There is no provision to attach/view attachment while credit memo requests are being created. Objective of this RICEF is to enable this attachment functionality for ‘create’ transactions also.

1.2  Example

For the Sales Order Creation screen (VA01), the GOS tool bar is not provided by standard SAP.

See screen shot below

We will see below how we can activate the GOS toolbar using above class for transactions VA01/VA02/VA03

1.3  Resolution Approach

To resolve the above issue, we can use a SAP provided toolbar “Generic Object services” or “GOS toolbar”.

Following is the step by step instruction to use GOS Toolbar for resolving attachment issue.

2.  Process to be followed

2.1 Step 1: To activate it we need to do an enhancement in include ‘SAPMV45A’ inside form SP_TAGGING.

2.2 Step 2: Object key is required to activate the generic object services. Now object types for corresponding sales orders are as below:

Credit memo request (VA01/VA02/VA03) — BUS2094

Debit memo request (VA01/VA02/VA03) — BUS2096

Sales Order (VA01/VA02/VA03) — BUS2032

2.3 Step 3: The object key can be found out from the object type. Enter the object type in transaction ‘SWO1’

Click on display.

P.S: For above three Object types, object key is same and that is Sales Document.

2.4 Step 4

CL_GOS_MANAGER is a standard SAP class available within R/3 SAP systems depending on the version and release level. It is useful to manage attachments on a report. It lets you upload and download files related any object inside your report. To activate CL_GOS_MANAGER, we need to create instance of the class first. This instance can be created by calling a constructor method. In the constructor method code, object type and object key need to be set as variable and passed through instance of the class. The code needs to be written either inside above implicit enhancement point

Following is the syntax

DATA:   lr_gos_manager TYPE REF TO cl_gos_manager,

ls_borident    TYPE        borident.

STATICS lv_flag TYPE c.

IF sy-tcode = ‘VA01’ AND lv_flag <> ‘X’.

CLEAR ls_borident.

CASE vbak-vbtyp.

WHEN ‘K’.                               “Credit memo request

ls_borident-objtype = ‘BUS2094’.

WHEN ‘L’.                               “Debit memo request

ls_borident-objtype = ‘BUS2096’.

WHEN ‘C’.                               “Orders

ls_borident-objtype = ‘BUS2032’.

WHEN OTHERS.

CLEAR ls_borident-objtype.

ENDCASE.

IF NOT ls_borident-objtype IS INITIAL.

CONCATENATE ‘ZGOSVA01’ sy-uname sy-datum sy-uzeit   INTO ls_borident-objkey.

EXPORT ls_borident-objkey TO MEMORY ID ‘ZGOSVA01’ .

CREATE OBJECT lr_gos_manager

EXPORTING

is_object        = ls_borident

ip_start_direct  = ‘ ‘

ip_no_commit     = ‘X’

EXCEPTIONS

object_invalid   = 1

callback_invalid = 2

OTHERS           = 3.

lv_flag = ‘X’. ENDIF.
ENDIF.

[Here with the help of static variable (LV_FLAG), we are making sure that this piece of code will be triggered only once in an entire session of sales order creation. There was another challenge regarding object key. At this moment sales order number was not generated in SAP, so we have created a default unique key concatenating a text ‘ ZGOSVA01’ and username and date and time. We will use it later in our code]

2.5 Step 5: We have to attach that document to newly created sales order. So code needs to be added in user exit MV45AFZZ inside form USEREXIT_SAVE_DOCUMENT.

The Syntax is

DATA: lt_services    TYPE tgos_sels,    “Services table type

ls_source      TYPE sibflporb,    “Source

ls_target      TYPE sibflporb,    “Target

ls_borident    TYPE borident,

lv_temp_object TYPE borident-objkey.

CLEAR: ls_source,

ls_target,

ls_borident-objkey.

CASE vbak-vbtyp.

WHEN ‘K’.                               “Credit memo request

ls_source-typeid = ‘BUS2094’. ls_target-typeid = ‘BUS2094’.

WHEN ‘L’.                               “Debit memo request

ls_source-typeid = ‘BUS2096’. ls_target-typeid = ‘BUS2096’.

WHEN ‘C’.                               “Orders

ls_source-typeid = ‘BUS2032’. ls_target-typeid = ‘BUS2032’.

WHEN OTHERS.

CLEAR: ls_source,

ls_target.

ENDCASE.

IF NOT ls_source-typeid IS INITIAL.

IMPORT ls_borident-objkey FROM MEMORY ID ‘ZGOSVA01’ .

lv_temp_object = ls_borident-objkey.

* Source

ls_source-instid =  lv_temp_object. ls_source-catid  = ‘BO’.

* Target

ls_target-instid = vbak-vbeln. ls_target-catid  = ‘BO’.

*  Move file from Temporary Object to Sales Order Object

cl_gos_service_tools=>move_linked_objects(

is_source             = ls_source is_target             = ls_target it_service_selection  = lt_services

).

ENDIF.

[Here we are moving attached file from temporary object to sales order object]

3.   Steps to create attachments for Sales Order

Following are the step by step instructions to create any attachment for sales order:

3.1 Step 1

3.2 Step 2: Click on the GOS toolbar. Different options will be displayed.

3.3 Step 3: Click on ‘Create-> Create attachment’ option.

3.4 Step 4: A pop-up window will be opened to find a file or attachment as shown below.  Select the file and click on open.

3.5 Step 5: A success message will be displayed in the task bar.

3.6 Step 6: If we open sales order in display/change mode, you can see the document in Service: Attachment list tab.

4.0   Appendix

This document would be useful for different groups of business users while creation of new credit-memo or debit memo request (Sales Order) in SAP system. In the above way, using ‘Generic Object services toolbar’ or ‘GOS toolbar’ different files can be attached.

Alert Moderator

Assigned tags

ABAP Extensibility

GOS for VA01/va02/va03

Related Blog Posts

Activating Generic Object Services Toolbar in SAP Objects

By Abhijeet Kapgate, Nov 21, 2012

Transaction and Screen Variants for specific User groups and adopting it in the standard Transactions

By Former Member, Aug 16, 2013

Transaction and Screen Variants for limiting Standard Transactions

By Former Member, Jul 18, 2013

Related Questions

How to add a custom tab into va03.

By Former Member, Dec 03, 2008

BADI for Tab-additional data B for sale order Header

By Former Member, May 14, 2010

To add column(Zfield) in table control of SALES tab using the transaction variants for VA01 transaction

By Former Member, May 04, 2012

5 Comments

Robert Forster

April 3, 2017 at 1:11 pm

Hi,

thats nice.

I had the same problem and found only the note 1466810, which states that it is (in standard) not possible.

Like(0)

Reply

Alert Moderator

Veselina Peykova

April 11, 2017 at 1:03 pm

It appears, that now this is now available via 2413663 - File attachments in sales documents creation.

Like(0)

Reply

Alert Moderator

Chris g

June 2, 2017 at 6:54 am

Hi,

we implemented note 2413663. So the GOS are now visible in VA01 and I am able to add a attachment.

But unfortunately I cannot add a "Business Document" in VA01. I have only the Options "Create attachment" and "Create note". Has somebody solved that?

VA01

VA02

Like(0)

Reply

Alert Moderator

Anusitt sereesuchart

October 27, 2017 at 2:15 am

Hi,

Very interesting blog and really appreciate of sharing however we are on 604

Cannot apply note 2413663

There is no form SP_TAGGING in ‘SAPMV45A’

Any suggestion, what can we do on the 604?

Thanks in advances,

Like(0)

Reply

Alert Moderator

Robert Forster

March 6, 2018 at 8:03 am

Hi,

i did ti within

SPAN {

font-family: "Courier New";

font-size: 10pt;

color: #000000;

background: #FFFFFF;

}

MV45AFZZ userexit_field_modification

BR

Like(0)

Reply

Alert Moderator

郑德鼎

关于作者:郑德鼎

企业信息化与 SAP 技术顾问,长期专注 SAP ABAP、FI/CO、MM、SD 等模块的技术分享与实战经验总结。查看更多介绍

来源说明:本文内容由「How to implement GOS for standard transaction VA01VA02VA03.docx」整理生成,仅用于内部技术分享与学习交流。