on 07-02-2018 1:57 PM
Hello experts,
I have a simple problem, but do not find a solution for it.
The task is to create a document address on a one order document like a service order.
This is my code:
" create partner entity
DATA(lo_partner) = lo_header_entity->create_related_entity(
'BTPartnerAll' ) .
lo_partner->set_property(: iv_attr_name = 'PARTNER_FCT'
iv_value = '00000001' ),
iv_attr_name = 'PARTNER_NO'
iv_value = '<some business partner>' ).
" reset values on partner entity for setting document address
lo_partner->set_property(: iv_attr_name = 'ADDR_NR'
iv_value = ' ' ),
iv_attr_name = 'ADDR_NP'
iv_value = ' ' ),
iv_attr_name = 'STD_BP_ADDRESS'
iv_value = ' ' ),
iv_attr_name = 'ADDR_ORIGIN'
iv_value = 'B' ). " this is necessary to allow the change for new business partner (COM_PARTNER_FIELDSELECTION_OW)
" create partner address entity
DATA(lo_doc_addr) = lo_partner->create_related_entity(
'BTPartnerAddress' ).
" maintain address fields
lo_doc_addr->set_property(:
iv_attr_name = 'ADDR_NO' iv_value = ' ' ),
iv_attr_name = 'PERS_NO' iv_value = ' ' ),
iv_attr_name = 'CITY' iv_value = ls_addr-city ),
iv_attr_name = 'STREET' iv_value = ls_addr-street ),
iv_attr_name = 'COUNTRY' iv_value = ls_addr-countr ),
iv_attr_name = 'POSTL_COD1' iv_value = ls_addr-postl_cod1 ),
iv_attr_name = 'HOUSE_NO' iv_value = ls_addr-house_no ),
iv_attr_name = 'HOUSE_NO2' iv_value = ls_addr-house_no2 ).
lo_bol_core->modify( ).
This code will lead to retrieving the business partner address first (if the bp exists) and then the address values are maintained on that existing address. Then I have a document address which is merged/mixed containing the old and the new address data.
What is the right way to create a document address with BOL?
Any idea would be highly appreciated.
Thanks and regards,
Andre
Hi
That's the right way - just add a modify( 😞
" create partner address entity
DATA(lo_doc_addr) = lo_partner->create_related_entity(
'BTPartnerAddress' ).
lo_bol_core->modify( ). "<<<
" maintain address fields
lo_doc_addr->set_property(:
iv_attr_name = 'ADDR_NO' iv_value = ' ' ),
iv_attr_name = 'PERS_NO' iv_value = ' ' ),
iv_attr_name = 'CITY' iv_value = ls_addr-city ),
iv_attr_name = 'STREET' iv_value = ls_addr-street ),
iv_attr_name = 'COUNTRY' iv_value = ls_addr-countr ),
iv_attr_name = 'POSTL_COD1' iv_value = ls_addr-postl_cod1 ),
iv_attr_name = 'HOUSE_NO' iv_value = ls_addr-house_no ),
iv_attr_name = 'HOUSE_NO2' iv_value = ls_addr-house_no2 ).
lo_bol_core->modify( ).
regards
Domi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.