*&---------------------------------------------------------------------*
*& Report  ZBAPITEST
*&
*&---------------------------------------------------------------------*

REPORT ZBAPITEST.

tables: knmt.

data: i_salesorgrange type standard table of bapi_rangesvkorg with header line,
      i_distrchanrange type standard table of bapi_rangesvtweg with header line,
      i_customerrange type standard table of bapi_rangeskunnr with header line,
      i_materialrange type standard table of bapi_rangesmatnr with header line,
      i_customermaterialinfo type standard table of bapi_bus3033_boid with header line,
      i_customermaterialinfodetail type standard table of bapi_bus3033_knmt_disp with header line,
      i_return type standard table of bapiret2 with header line.


selection-screen begin of block b1 with frame title text-001.
    select-options: p_sorg for knmt-vkorg,
                    p_dcha for knmt-vtweg,
                    p_cust for knmt-kunnr.
selection-screen end of block b1.

start-of-selection.

    move p_sorg[] to i_salesorgrange[].
    move p_dcha[] to i_distrchanrange[].
    move p_cust[] to i_customerrange[].

    call function 'BAPI_CUSTMATINFO_GETLIST'
        tables
            salesorgrange                    = i_salesorgrange[]
            distrchanrange                   = i_distrchanrange[]
            customerrange                    = i_customerrange[]
            customermaterialinfo             = i_customermaterialinfo[]
            customermaterialinfodetail       = i_customermaterialinfodetail[]
            return                           = i_return[].

    loop at i_customermaterialinfodetail.
        write:/ i_customermaterialinfodetail-customer,' - ',i_customermaterialinfodetail-material,' - ',
                i_customermaterialinfodetail-mat_nr_cus.
    endloop.

end-of-selection.
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com