Sei sulla pagina 1di 3

Disclaimer: This document is a draft, and provided as a courtesy.

This document is not to be considered


final, and all information contained herein is subject to change. As such, this document is not to be
quoted, cited in any reference, or used by anyone for any purpose other than as a draft document

------------------------------------------------------------------------------------------------------------------------------------------

SAMPLE CODE FOR UPDATING GST_PARTNER, HSN_SAC CODE AND PLACE OF SUPPLY

1. Create a Z implementation for the filter BAdI ‘BADI_ACC_DOCUMENT’.


2. The filter value must be ‘BKPFF’.
3. Copy and paste the sample code within the method ‘Change’.

DATA: wa_accit TYPE accit,


wa_lfa1 TYPE lfa1,
lv_country TYPE land1,
lv_ind TYPE c.

LOOP AT c_accit INTO wa_accit.

CALL FUNCTION 'J_1BSA_COMPONENT_ACTIVE'


EXPORTING
bukrs = wa_accit-bukrs
component = '**'
* COUNTRY =
IMPORTING
active_component = lv_country
* OUT_COUNTRY =
* EXCEPTIONS
* COMPONENT_NOT_ACTIVE = 1
* OTHERS = 2
.
IF lv_country = 'IN'.
lv_ind = 'X'.
ELSE.
EXIT.
ENDIF.

IF wa_accit-lifnr IS NOT INITIAL AND lv_ind = 'X'.


wa_accit-gst_part = wa_accit-lifnr.

CALL FUNCTION 'GET_VENDOR_DETAILS'


EXPORTING
i_lifnr = wa_accit-lifnr
* I_GET_ADDRESS = ' '
IMPORTING
e_lfa1 = wa_lfa1
* E_NAME =
* E_ADDR1 =
* E_ADDR2 =
* E_ADDR3 =
* E_ADDR4 =
EXCEPTIONS
not_found = 1
parameter_error = 2
OTHERS = 3.

wa_accit-plc_sup = wa_lfa1-regio.

MODIFY c_accit FROM wa_accit TRANSPORTING gst_part plc_sup.


CLEAR: wa_accit.

ELSEIF ( wa_accit-shkzg = 'S' AND wa_accit-


koart = 'S' AND wa_accit-taxit = ' ' ) AND lv_ind = 'X'.

CALL FUNCTION 'J_1IG_GET_HSN_SAC'


EXPORTING
im_matnr = wa_accit-matnr
im_werks = wa_accit-werks
* im_asnum =
im_country = 'IN'
IMPORTING
ex_hsn_sac = wa_accit-hsn_sac.

MODIFY c_accit FROM wa_accit TRANSPORTING hsn_sac.


CLEAR: wa_accit.
ENDIF.

ENDLOOP.

NOTE: The logic shall be enhanced to update additional fields like ‘Profit center’, ‘Business Area’ etc. as
per your business needs.

4. Save and activate the implementation.

Disclaimer

Disclaimer: © 2016 SAP SE or an SAP affiliate company. All rights reserved. No part of this publication
may be reproduced or transmitted in any form or for any purpose without the express permission of
SAP SE or an SAP affiliate company. SAP and other SAP products and services mentioned herein as well
as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate
company) in Germany and other countries. Please see http://global12.sap.com/corporate-
en/legal/copyright/index.epx for additional trademark information and notices.
Some software products marketed by SAP SE and its distributors contain proprietary software
components of other software vendors.

National product specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for informational purposes only,
without representation or warranty of any kind, and SAP SE or its affiliated companies shall not be liable
for errors or omissions with respect to the materials. The only warranties for SAP SE or SAP affiliate
company products and services are those that are set forth in the express warranty statements
accompanying such products and services, if any. Nothing herein should be construed as constituting an
additional warranty. In particular, SAP SE or its affiliated companies have no obligation to pursue any
course of business outlined in this document or any related presentation, or to develop or release any
functionality mentioned therein. This document, or any related presentation, and SAP SE’s or its
affiliated companies’ strategy and possible future developments, products, and/or platform directions
and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at
any time for any reason without notice. The information in this document is not a commitment,
promise, or legal obligation to deliver any material, code, or functionality. All forward-looking
statements are subject to various risks and uncertainties that could cause actual results to differ
materially from expectations. Readers are cautioned not to place undue reliance on these forward-
looking statements, which speak only as of their dates, and they should not be relied upon in making
purchasing decisions.

Potrebbero piacerti anche