‎2006 Oct 02 6:04 PM
Hi All,
I have a requirement where I have to change the address details of functional location(t-code : IL02 in CS module). <b>Can anybody suggest some standard BAPI for functional location with the help of which I can change the address details.</b>
Note: <b>I have already seen BAPI: BAPI_FUNCLOC_CHANGE but I think that doesn't change the address details.</b>
Urgent help is required.
Any solution to this will be appreciated and rewarded with points.
Thanks & Regards
Prabhat
‎2006 Oct 02 6:12 PM
Hi Prabhat,
Have you looked FM FUNC_LOCATION_UPDATE or FUNC_LOCATION_SAVE?
Regards,
Ferry Lianto
‎2006 Oct 02 6:19 PM
Prabhat,
Follow the below step:
Get the address number
Use the 'ISU_ADDRESS_PROVIDE' fm to get the address details with the address number.
Use the 'ADDR_UPDATE' and 'ADDR_MEMORY_SAVE' FM to change the address details.
CALL FUNCTION 'ADDR_UPDATE'
EXPORTING
address_data = wa_addr1_data_dev
address_number = ws_devloc_addrno
language = sy-langu
check_address = space
IMPORTING
returncode = wsl_rcode
TABLES
error_table = il_rtab
EXCEPTIONS
address_not_exist = 1
parameter_error = 2
version_not_exist = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
RAISE address_updation_failed.
ELSE.
CALL FUNCTION 'ADDR_MEMORY_SAVE'
EXPORTING
execute_in_update_task = space
EXCEPTIONS
address_number_missing = 1
person_number_missing = 2
internal_error = 3
database_error = 4
reference_missing = 5
OTHERS = 6.
IF sy-subrc <> 0.
RAISE address_updation_failed.
ENDIF.
ENDIF.
Hope it is helpfull.
check the sample program for updating the device location address details.
&----
*& Report YPRA_SAMPLE8 *
&----
Program to update Address details of Device Location *
&----
REPORT ypra_sample8.
TYPE-POOLS: isu65.
TABLES iflo.
DATA: wsl_peraddr LIKE adrc-pers_addr, "Values = 'X' or Space
wsl_handle LIKE szad_field-handle VALUE 'ADDR',
wsl_addrnum LIKE adrc-addrnumber,
wsl_addr_ref LIKE addr_ref,
ws_addr1 LIKE addr1_data.
DATA: wsl_rcode LIKE szad_field-returncode,
iflo_wa LIKE iflo,
il_rtab LIKE addr_error OCCURS 0 WITH HEADER LINE .
DATA: wa_eadrdat_con LIKE eadrdat,
wa_eadrdat_dev LIKE eadrdat,
ws_con LIKE iflo_wa-tplma,
ws_devloc LIKE iflo_wa-tplnr.
DATA: o_connobj TYPE REF TO cl_isu_connobj,
o_devloc TYPE REF TO cl_isu_device_location,
x_property TYPE string VALUE 'ADDRNUMBER',
ws_connobj_addrno TYPE ehau-addrnumber,
x_property1(5) TYPE c VALUE 'ADRNR',
x_property2 TYPE epd_attrid VALUE 'ADRNR',
ws_devloc_addrno TYPE egpl-adrnr,
ws_addr_no TYPE egpl-adrnr,
x_property3 TYPE string VALUE 'PREMS',
ws_premise TYPE ehau-prems.
DATA: wa_obj TYPE isu65_devloc,
wa_auto TYPE isu01_devloc_auto,
xy_obj TYPE isu65_devloc,
y_db_update LIKE regen-db_update,
y_exit_type LIKE regen-exit_type,
y_new_egpl LIKE egpl.
CLASS cl_isu_connobj DEFINITION LOAD.
CLASS cl_isu_device_location DEFINITION LOAD.
CLEAR:wsl_peraddr, wsl_addr_ref.
ws_addr1-country = 'GB'.
ws_addr1-street = 'Allapkco road'.
ws_addr1-city1 = 'Bilton ioadedc'.
ws_addr1-post_code1 = '8KEY ME9'.
ws_addr1-title = '0002'.
ws_addr1-name1 = 'Prakash'.
ws_addr1-city1 = 'LONDON'.
ws_addr1-str_suppl1 = 'Sample'.
ws_addr1-location = 'GH'.
ws_addr1-extension1 = '15859'.
ws_addr1-taxjurcode = 'ZXZ'.
ws_addr1-deflt_comm = 'BTG'.
ws_devloc = '80002231'.
Open the Device Location
CALL FUNCTION 'ISU_O_DEVLOC_OPEN'
EXPORTING
x_devloc = ws_devloc
x_wmode = '2'
x_upd_online = 'X'
x_no_dialog = 'X'
IMPORTING
y_obj = wa_obj
y_auto = wa_auto
y_iflo = iflo_wa
EXCEPTIONS
not_found = 1
existing = 2
foreign_lock = 3
invalid_key = 4
invalid_connobj = 5
number_error = 6
system_error = 7
not_authorized = 8
not_customized = 9
auto_data = 10
status = 11
OTHERS = 12.
IF sy-subrc EQ 0.
To Get Address no of Connection Object
CALL METHOD cl_isu_connobj=>select
EXPORTING
x_connobjid = iflo_wa-tplma
RECEIVING
r_connobjref = o_connobj.
CALL METHOD o_connobj->get_property_conn
EXPORTING
x_property = x_property
IMPORTING
y_value = ws_connobj_addrno.
CALL METHOD o_connobj->get_property_conn
EXPORTING
x_property = x_property3
IMPORTING
y_value = ws_premise.
To Get Address no of Device Location
CALL METHOD cl_isu_device_location=>select
EXPORTING
x_devlocid = iflo_wa-tplnr
RECEIVING
y_devloc = o_devloc.
CALL METHOD o_devloc->get_property
EXPORTING
x_property = x_property1
IMPORTING
y_value = ws_devloc_addrno.
IF ws_connobj_addrno = ws_devloc_addrno.
wsl_addr_ref-appl_table = 'ILOA'.
wsl_addr_ref-appl_field = 'ADRNR'.
wsl_addr_ref-appl_key(3) = sy-mandt.
wsl_addr_ref-appl_key+3(12) = iflo-iloan.
wsl_addr_ref-addr_group = 'PM01'.
wsl_addr_ref-owner = space.
CALL FUNCTION 'ADDR_INSERT'
EXPORTING
address_data = ws_addr1
address_group = 'PM01'
address_handle = wsl_handle
language = sy-langu
check_address = space
EXCEPTIONS
address_exists = 1
parameter_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'ADDR_NUMBER_GET'
EXPORTING
address_handle = wsl_handle
address_reference = wsl_addr_ref
personal_address = space
IMPORTING
address_number = wsl_addrnum
EXCEPTIONS
address_handle_not_exist = 1
internal_error = 2
parameter_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
CLEAR: wsl_rcode,
il_rtab,
il_rtab[].
CALL FUNCTION 'ADDR_UPDATE'
EXPORTING
address_data = ws_addr1
address_number = wsl_addrnum
language = sy-langu
check_address = space
IMPORTING
returncode = wsl_rcode
TABLES
error_table = il_rtab
EXCEPTIONS
address_not_exist = 1
parameter_error = 2
version_not_exist = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
CALL FUNCTION 'ADDR_MEMORY_SAVE'
EXPORTING
execute_in_update_task = space
EXCEPTIONS
address_number_missing = 1
person_number_missing = 2
internal_error = 3
database_error = 4
reference_missing = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
wa_obj-egpl-adrnr = wsl_addrnum.
wa_obj-egpl-adrnri = 'D'.
MOVE-CORRESPONDING wa_obj TO xy_obj.
MOVE-CORRESPONDING wa_auto TO xy_obj-auto.
xy_obj-contr-wmode = '2'.
CLEAR iflo_wa.
CALL FUNCTION 'ISU_O_DEVLOC_ACTION'
EXPORTING
x_okcode = 'SAVE'
IMPORTING
y_iflo = iflo_wa
CHANGING
xy_obj = xy_obj
EXCEPTIONS
cancelled = 1
open_error = 2
not_allowed = 3
general_fault = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'ISU_O_DEVLOC_CLOSE'
IMPORTING
y_db_update = y_db_update
y_exit_type = y_exit_type
y_new_egpl = y_new_egpl
CHANGING
xy_obj = xy_obj.
IF sy-subrc EQ 0.
COMMIT WORK.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ELSE.
CALL FUNCTION 'ADDR_UPDATE'
EXPORTING
address_data = ws_addr1
address_number = ws_devloc_addrno
language = sy-langu
check_address = space
IMPORTING
returncode = wsl_rcode
TABLES
error_table = il_rtab
EXCEPTIONS
address_not_exist = 1
parameter_error = 2
version_not_exist = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
CALL FUNCTION 'ADDR_MEMORY_SAVE'
EXPORTING
execute_in_update_task = space
EXCEPTIONS
address_number_missing = 1
person_number_missing = 2
internal_error = 3
database_error = 4
reference_missing = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Prakash.
‎2006 Oct 02 7:35 PM
Hi,
Check the function modules,
FUNC_LOCATION_SAVE,
FUNC_LOCATION_UPDATE,
IFLOTX_UPDATE,
IFLO_UPDATE,
FUNC_LOCATION_CALL and BAPI_FUNCLOC_CHANGE
Regards,
Azaz.
‎2013 May 01 7:14 PM
FUNC_LOCATION_UPDATE did not end up working for me -
Instead I used - CALL FUNCTION 'IFLO_UPDATE'
DATA update(1) VALUE 'U'.
DATA: iflo_new LIKE iflo,
iflo_old LIKE iflo,
riupd_new LIKE riupd,
riupd_old LIKE riupd.
CALL FUNCTION 'FUNC_LOCATION_READ'
EXPORTING
tplnr = functional_location
IMPORTING
iflo_wa = iflo_old.
MOVE-CORRESPONDING iflo_old TO iflo_new.
SELECT SINGLE adrnr FROM iflo INTO iflo_new-adrnr WHERE tplnr = functional_location.
MOVE:
functional_location TO iflo_new-tplnr,
update TO riupd_old-indupd,
update TO riupd_new-indupd1.
CALL FUNCTION 'IFLO_UPDATE'
EXPORTING
iflo_new = iflo_new
iflo_old = iflo_old
riupd_new = riupd_new
riupd_old = riupd_old.
‎2013 May 15 1:03 PM