Code: Alles auswählen.
SELECT SINGLE pargr hityp_pr vbtyp
FROM tvak INTO (l_pargr, l_hityp_pr,l_vbtyp)
WHERE auart EQ s_auart.
*
l_wa_vtcom-kunnr = l_kunag.
l_wa_vtcom-vkorg = s_vkorg-low.
l_wa_vtcom-vtweg = s_vtweg-low.
l_wa_vtcom-spart = s_spart-low.
l_wa_vtcom-vbobj = 'A'.
l_wa_vtcom-pargr = l_pargr.
l_wa_vtcom-hityp_pr = l_hityp_pr.
l_wa_vtcom-vbtyp = l_vbtyp.
l_wa_vtcom-auart = s_auart.
*
CALL FUNCTION 'VIEW_KUAGV'
EXPORTING
comwa = l_wa_vtcom
we_input = l_kunwe
fif_objecttype = 'BUS2032'
fif_no_dialog = 'X'
fiv_hi_date = sy-datlo
TABLES
vbuv_tab = lt_vbuv_tab
xsadr = lt_xsadr
xvbpa = lt_xvbpa
EXCEPTIONS
no_kna1 = 1
no_knvv = 2
no_kuagv = 3
no_tvta = 4
no_cpd_address = 5
no_tpakd = 6
no_authorization = 7
no_address = 8
no_reference_customer_found = 9
no_language = 10
OTHERS = 11.
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 : gv_kunre, gv_kunrg.
LOOP AT lt_xvbpa INTO l_wa_xvbpa.
CASE l_wa_xvbpa-parvw.
WHEN 'RE'.
gv_kunre = l_wa_xvbpa-kunnr.
WHEN 'RG'.
gv_kunrg = l_wa_xvbpa-kunnr.
ENDCASE.
ENDLOOP.