BAPI_CUSTMATINFO_GETLIST - Customer Material Info

This is a sample program using BAPI to get the customer material information.

*&---------------------------------------------------------------------*
*& 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.

Get help for your ABAP problems
Do you have a ABAP Question?

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

More ABAP Tips

Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.