This code you can get Delivery Address for Purchase Order in SAP, It can use for your ABAP Program or Smartforms.


Explanation : You can get Address Number from table and field EKPO-ADRN2 and then get address data from table ADRC-ADDRNUMBER.

Source Code

DATA : lw_adrc_dlv TYPE adrc,
       li_ekpo type table of ekpo with header line.


 READ TABLE li_ekpo WITH KEY ebeln = lw_data-ebeln
                                  ebelp = lw_data-ebelp.
      IF sy-subrc EQ 0.

SELECT SINGLE * INTO lw_adrc_dlv FROM adrc
                      WHERE addrnumber = li_ekpo-adrn2.

CONCATENATE lw_adrc_dlv-street lw_adrc_dlv-str_suppl1 lw_adrc_dlv-str_suppl2 lw_adrc_dlv-str_suppl3
            lw_adrc_dlv-location lw_adrc_dlv-city2 lw_adrc_dlv-city1 lw_adrc_dlv-post_code1 
            INTO gw_report-deliv_address SEPARATED BY space.

Leave a Reply