Hi Gurus!
In my smartform I am trying to get get the adress for ship to of my billing item and sometime it shows up and sometime it dosent depending upon the address being updated or not. This is in my main windows section. Right now its getting the addess directly from the customer master and thats why the address not shoing up sometimes in some case is taking place. I would like to change my code in such a way that the address that its getting for my ship topartner of teh billing item is not pulled directly from the customer master and instead check the address number from vbpa table and then pull the address details.Please advice if possible with some help.
clear: gs_vbpa.
* get location from shipto of billing doc
select single * from vbpa into gs_vbpa where
vbeln eq gs_gen_del-bil_number and
posnr eq gs_gen_del-itm_number and
parvw eq 'WE'.
if sy-subrc = 0.
gs_kna1 = zcl_kna1=>get_kna1( gs_vbpa-kunnr ).
else.
* get location from shipto of sales order if no updated shipto from bill doc
loop at is_bil_invoice-it_reford into gs_it_reford where
bil_number = gs_gen_del-bil_number and
itm_number = gs_gen_del-itm_number.
select single * from vbpa into gs_vbpa where
vbeln eq gs_it_reford-order_numb and
parvw eq 'WE'.
if sy-subrc = 0.
gs_kna1 = zcl_kna1=>get_kna1( gs_vbpa-kunnr ).
endif.
endloop.
endif.
* get g_shipto_print
if g_old_shipto = gs_vbpa-kunnr.
g_shipto_print = ' '.
g_dotted_line_print = ' '.
elseif g_old_shipto is initial.
g_shipto_print = 'X'.
g_dotted_line_print = ' '.
g_old_shipto = gs_vbpa-kunnr.
else.
g_shipto_print = 'X'.
g_dotted_line_print = 'X'.
g_old_shipto = gs_vbpa-kunnr.
endif.
Regards