Application Development and Automation 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: 
Read only

ADDR_NUMBER_GET and ADDR_PERSON_NUMBER_GET

Tammie
Participant
0 Kudos
2,097

Hi all,

I am trying to use FMs ADDR_PERSON_NUMBER_GET and ADDR_NUMBER_GET but keep getting errors "Person handle invalid" and "Address handle invalid".

Does anyone know the correct way to populate the PERSON_HANDLE and ADDRESS_HANDLE parameters for passing to the function modules?

I tried to copy some code from program SAPMF02D (transaction VAP1) but it doesn't seem to work.

Thanks in advance.

Regards,

Tammie

1 ACCEPTED SOLUTION
Read only

former_member221770
Contributor
0 Kudos
975

Hi Tammie,

Not sure if you have tried this but maybe take a look at BAPI_ADDRESSPERS_SAVEREPLICA. This BAPI calls ADDR_PERSON_NUMBER_GET and ADDR_NUMBER_GET. In the doco for this BAPI it shows an example of how to use the BAPI. WOuld try using this and debugging the BAPI to see how it populates the HANDLE parameters.

Just a suggestion for first thing inthe morning here.

Hope this helps.

Cheers,

Pat.

4 REPLIES 4
Read only

former_member221770
Contributor
0 Kudos
976

Hi Tammie,

Not sure if you have tried this but maybe take a look at BAPI_ADDRESSPERS_SAVEREPLICA. This BAPI calls ADDR_PERSON_NUMBER_GET and ADDR_NUMBER_GET. In the doco for this BAPI it shows an example of how to use the BAPI. WOuld try using this and debugging the BAPI to see how it populates the HANDLE parameters.

Just a suggestion for first thing inthe morning here.

Hope this helps.

Cheers,

Pat.

Read only

Former Member
0 Kudos
975

Check this link

Read only

Former Member
0 Kudos
975

the order in which you would be doing for inserting an address record in adrc is

1) call addr_insert fm

2) call addr_number_get

3)call addr_memory_save

4)call addr_memory_clear

for updating

1) call addr_update

2)call addr_memory_save

3)call addr_memory_clear

to fill the parameters addr_handle or any other paramters u dont know, put a breakpoint in the above fm and try to do the insert/update through a transaction.

in my case i was updating addr. in sales doc. and i found out that addr_handle is 'Y1 $00000' ( parvw followed by the wildcard)

this temp. adrnr will be converted to a permanent ADRNR after u call addr_number_get and ADDR_MEMORY_SAVE.

hope this helps..

Read only

Former Member
0 Kudos
975

Hi Tammie,

I used these function modules in the order that KP said, and it worked. Here's how I did, maybe it'll be of help:

"1) call addr_insert fm

"2) call addr_number_get

"3) call addr_memory_save

"4) call addr_memory_clear

data: wa_ref type addr_ref.

clear wa_addr.

move:

wa_proiecte-name1 to wa_addr-name1,

wa_proiecte-city1 to wa_addr-city1,

wa_proiecte-street to wa_addr-street,

wa_proiecte-bzirk to wa_addr-region,

wa_proiecte-str_suppl1 to wa_addr-str_suppl1,

wa_proiecte-str_suppl2 to wa_addr-str_suppl2,

'RO' to wa_addr-country.

append wa_addr to it_addr.

call function 'ADDR_INSERT'

exporting

address_data = wa_addr

address_group = 'SD01'

address_handle = 'AG $00000'

date_from = '00010101'

language = sy-langu

check_empty_address = 'X'

check_address = ' ' "old 'X'

importing

  • ADDRESS_DATA =

returncode = l_ok

tables

error_table = it_error

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.

clear: l_vbeln.

call function 'NUMBER_GET_NEXT'

exporting

nr_range_nr = '09'

object = 'RV_BELEG'

quantity = '1'

" SUBOBJECT = 'AMBI'

  • TOYEAR = '0000'

  • IGNORE_BUFFER = ' '

importing

number = l_vbeln

  • QUANTITY =

  • RETURNCODE =

exceptions

interval_not_found = 1

number_range_not_intern = 2

object_not_found = 3

quantity_is_0 = 4

quantity_is_not_1 = 5

interval_overflow = 6

buffer_overflow = 7

others = 8

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

concatenate sy-mandt l_vbeln into wa_ref-appl_key.

move: 'VBUK' to wa_ref-appl_table,

'VBELN' to wa_ref-appl_field,

'SD01' to wa_ref-addr_group.

call function 'ADDR_NUMBER_GET'

exporting

address_handle = 'AG $00000'

address_reference = wa_ref

personal_address = ' '

  • NUMBERRANGE_NUMBER = '01'

  • E071K_WA =

  • GENERATE_TRANSPORT_ENTRIES =

  • OWNER = 'X'

  • TABLE_NAME =

  • FIELD_NAME =

  • OBJKEY =

importing

address_number = l_adrnr

  • RETURNCODE_NUMBERRANGE =

  • TABLES

  • E071K_TAB =

  • 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.

endif.

call function 'ADDR_MEMORY_SAVE'

  • EXPORTING

  • EXECUTE_IN_UPDATE_TASK = ' '

  • 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.

call function 'ADDR_MEMORY_CLEAR'

  • EXPORTING

  • FORCE = ' '

  • EXCEPTIONS

  • UNSAVED_DATA_EXIST = 1

  • INTERNAL_ERROR = 2

  • OTHERS = 3

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.