select sales Orders with BAPI Function BAPISDORDER_GETDETAILEDLIST



Αξιολόγηση Χρήστη:  / 0
ΧειρότεροΚαλύτερο 
Λεπτομέρειες

This simple ABAP program explain how to select Sales Order data with BAPI function BAPISDORDER_GETDETAILEDLIST :

View source
*&---------------------------------------------------------------------*
*&  www.developerpages.gr                                              *
*&                                                                     *
*&  select sales Orders with BAPI Function BAPISDORDER_GETDETAILEDLIST *
*&                                                                     *
*&---------------------------------------------------------------------*
 
REPORT  ZSELECT_SDORDER.
 
 
parameters : p_vbeln like vbak-vbeln.
 
 
 
 
data: p_I_BAPI_VIEW like ORDER_VIEW,
      p_SALES_DOCUMENTS type TABLE OF SALES_KEY with HEADER LINE.
 
data : begin of  p_ORDER_HEADERS_OUT occurs 100.
        include structure BAPISDHD.
data : end of p_ORDER_HEADERS_OUT.
 
data : begin of p_ORDER_ITEMS_OUT occurs 100.
        include structure BAPISDIT.
data : end of p_ORDER_ITEMS_OUT.
 
data : begin of p_ORDER_BUSINESS_OUT occurs 100.
        include structure BAPISDBUSI.
data : end of p_ORDER_BUSINESS_OUT.
 
data : begin of p_ORDER_PARTNERS_OUT occurs 100.
        include structure BAPISDPART.
data : end of p_ORDER_PARTNERS_OUT.
 
data : i_SALESDOCUMENT LIKE  BAPIVBELN-VBELN,
       i_ORDER_HEADER_IN like BAPISDHD1,
       i_ORDER_HEADER_INX like BAPISDHD1X.
 
data : begin of i_return occurs 100.
        include STRUCTURE BAPIRET2.
data : end of i_return.
 
p_I_BAPI_VIEW-HEADER = 'X'.
p_I_BAPI_VIEW-ITEM = 'X'.
p_I_BAPI_VIEW-BUSINESS = 'X'.
p_I_BAPI_VIEW-PARTNER = 'X'.
 
p_SALES_DOCUMENTS-vbeln = p_vbeln.
append p_SALES_DOCUMENTS.
 
CALL FUNCTION 'BAPISDORDER_GETDETAILEDLIST'
  EXPORTING
    I_BAPI_VIEW                   = p_I_BAPI_VIEW
*   I_MEMORY_READ                 =
  TABLES
    SALES_DOCUMENTS               = p_SALES_DOCUMENTS
    ORDER_HEADERS_OUT             = p_ORDER_HEADERS_OUT
    ORDER_ITEMS_OUT               = p_ORDER_ITEMS_OUT
    "ORDER_SCHEDULES_OUT           =
    ORDER_BUSINESS_OUT            = p_ORDER_BUSINESS_OUT
    ORDER_PARTNERS_OUT            = p_ORDER_PARTNERS_OUT
*   ORDER_ADDRESS_OUT             =
*   ORDER_STATUSHEADERS_OUT       =
*   ORDER_STATUSITEMS_OUT         =
*   ORDER_CONDITIONS_OUT          =
*   ORDER_COND_HEAD               =
*   ORDER_COND_ITEM               =
*   ORDER_COND_QTY_SCALE          =
*   ORDER_COND_VAL_SCALE          =
*   ORDER_CONTRACTS_OUT           =
*   ORDER_TEXTHEADERS_OUT         =
*   ORDER_TEXTLINES_OUT           =
*   ORDER_FLOWS_OUT               =
*   ORDER_CFGS_CUREFS_OUT         =
*   ORDER_CFGS_CUCFGS_OUT         =
*   ORDER_CFGS_CUINS_OUT          =
*   ORDER_CFGS_CUPRTS_OUT         =
*   ORDER_CFGS_CUVALS_OUT         =
*   ORDER_CFGS_CUBLBS_OUT         =
*   ORDER_CFGS_CUVKS_OUT          =
*   ORDER_BILLINGPLANS_OUT        =
*   ORDER_BILLINGDATES_OUT        =
*   ORDER_CREDITCARDS_OUT         =
*   EXTENSIONOUT                  =
          .
 
loop at p_ORDER_HEADERS_OUT.
  write :/ 'Sales Order : ', p_ORDER_HEADERS_OUT-DOC_NUMBER.
  write :/ 'Date        : ', p_ORDER_HEADERS_OUT-DOC_date.
  write :/ 'Customer    : ', p_ORDER_HEADERS_OUT-SOLD_TO.
  write :/ 'Sales Org.  : ', p_ORDER_HEADERS_OUT-SALES_ORG.
  skip 1.
 
  write :/ '--------------------------------------------------'.
  write :/ 'Item   Material                   Quantity'.
  write :/ '--------------------------------------------------'.
  loop at p_ORDER_ITEMS_OUT where doc_number = p_ORDER_HEADERS_OUT-DOC_NUMBER.
    write :/ p_ORDER_ITEMS_OUT-ITM_NUMBER, p_ORDER_ITEMS_OUT-material, p_ORDER_ITEMS_OUT-REQ_QTY.
  endloop.
  skip 1.
endloop.


You have no rights to post comments

   
   

     

© Developerpages