[ABAP] Adressenaufbereitung mit ADDRESS_INTO_PRINTFORM

* https://www.berater-wiki.de/Adressenaufbereitung#Funktionsbaustein_ADDRESS_INTO_PRINTFORM

DATA: lv_address TYPE bapiaddr3.
DATA: it_bapi_return TYPE STANDARD TABLE OF bapiret2 WITH DEFAULT KEY.

CALL FUNCTION 'BAPI_USER_GET_DETAIL'
  EXPORTING
    username = sy-uname
  IMPORTING
    address  = lv_address
  TABLES
    return   = it_bapi_return.

DATA: ls_address TYPE  adrs1.
ls_address-title_text = lv_address-title_p.
ls_address-name1      = lv_address-fullname.
ls_address-street     = lv_address-street.
*  ls_address-po_box     = is_customer-postbox.
ls_address-post_code1 = lv_address-postl_cod1.
*  ls_address-region     = is_customer-region.
ls_address-city1      = lv_address-city.
ls_address-country    = lv_address-country.
DATA: lv_sender_country TYPE land1.
lv_sender_country = 'US'.

DATA: it_address_lines TYPE szadr_printform_table.
CALL FUNCTION 'ADDRESS_INTO_PRINTFORM'
  EXPORTING
    address_1               = ls_address
    address_type            = '1' "normal/company
    sender_country          = lv_sender_country
    *    number_of_lines         = 5
  IMPORTING
    address_printform_table = it_address_lines.
    
cl_demo_output=>write_data( ls_address ).
cl_demo_output=>write_data( lv_sender_country ).
cl_demo_output=>write_data( it_address_lines ).
cl_demo_output=>display( ).