|Home • Trainings • Quiz • Tips • Tutorials • Functional • Cert Q's • Interview Q's • Jobs • Testimonials • Advertise • Contact Us|
Copying Sales Order attachments to the invoice using BADI SD_CIN_LV60AU02
By Jayshree Santosh Mahajan, Cognizant
Sales Order attachments to the invoice
Recently, I got a requirement to copy
sales order attachment to the invoice. I
searched a lot on this; however I could not get one.
Here is the solution I have used.
to the transaction code VA02/VA03. You will see below button.
an attachment to the sales order as shown below.
Attachment list is disabled here.
Attachment list is enabled now.
when an invoice with this sales order is created, all the attachments should be
copied to the corresponding invoice.
see how this can be achieved.
a function module with below parameters and code. Make it as remote enabled (as
we cannot use commit work in BADI, we will call this FM in separate task).
DATA: lt_services TYPE tgos_sels.
" Services table type
DATA: ls_service TYPE
Services structure type
DATA: ls_source TYPE
CONSTANTS : lc_service TYPE sgs_srvnam VALUE 'PCATTA_CREA',
char1 VALUE 'I',
char2 VALUE 'EQ',
sibflporb-catid VALUE 'BO'.
Service needs to be performed
ls_service-sign = lc_i.
ls_service-option = lc_eq.
APPEND ls_service TO lt_services.
ls_source-instid = i_source_instid.
ls_source-typeid = 'BUS2032'.
" Sales order BOR
ls_source-catid = lc_catid.
ls_target-instid = i_target_instid.
ls_target-typeid = 'VBRK'.
" Invocie BOR
ls_target-catid = lc_catid.
Copy the objects between Source and Target
it_service_selection = lt_services
BOR can be determined using FM “SD_OBJECT_TYPE_DETERMINE”.
can call this FM in the BADI SD_CIN_LV60AU02.
an implementation of BADI and call FM in this implementation.
DATA : ls_vbrp TYPE
" Work area for billing item
" Work area for billing header
t180-trtyp. " Transaction
CONSTANTS : lc_trtyp_h TYPE t180-trtyp VALUE 'H',
lc_trtyp_v TYPE t180-trtyp VALUE 'V'.
Get transaction type for current transaction
SELECT SINGLE trtyp
WHERE tcode = sy-tcode.
If transaction type is Add or change, copy the sales order attachment to the
IF l_trtyp = lc_trtyp_h OR l_trtyp = lc_trtyp_v .
READ TABLE xvbrk INTO ls_vbrk INDEX 1.
IF sy-subrc = 0.
READ TABLE xvbrp INTO ls_vbrp INDEX 1.
IF sy-subrc = 0.
CALL FUNCTION 'ZSO_COPY_ATTACHMENTS' STARTING NEW TASK 'T'
i_so_instid = ls_vbrp-vgbel
i_tg_instid = ls_vbrk-vbeln.
Create an invoice
transaction code VF01.
In this way, we can
copy the sales order attachments to the invoice. This will work for the
transactions VF01 and VF02.
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM
©2006-2007 SAPTechnical.COM. All rights reserved.
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG.
Graphic Design by Round the Bend Wizards