SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

BAPI_SALESORDER_CREATEFROMDAT1



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> SD
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Thu Sep 20, 2007 11:08 am    Post subject: BAPI_SALESORDER_CREATEFROMDAT1 Reply with quote

BAPI_SALESORDER_CREATEFROMDAT1 - Sales order: Create Sales Order

Functionality
You can use this method to create sales orders.

Code:
 DATA: l_salesdocument LIKE  bapivbeln-vbeln,                             
        l_return        LIKE  bapireturn1,                                 
        l_header LIKE  bapisdhead.                                         
  DATA: i_items LIKE bapiitemin OCCURS 10 WITH HEADER LINE,                 
        i_partners LIKE  bapipartnr OCCURS 1 WITH HEADER LINE,             
        i_return LIKE bapireturn1 OCCURS 1 WITH HEADER LINE,               
        l_fin.                                                             
                                                                                                                                         
  LOOP AT i_list.                                                           
    AT NEW waers.                                                           
* Informamos los datos de cabecera de la BAPI                           
      CLEAR l_header.                                                       
      l_header-doc_type   = 'ZPED'.                                         
      l_header-purch_no_c = 'Referencia'.                                     
      l_header-price_date = i_list-fecha.                                   
      l_header-sales_org  = 'VORG'.                                         
      l_header-distr_chan = 'TI'.                                           
      l_header-division   = '00'.                                           
      l_header-price_date = i_list-fecha.                                   
      l_header-currency   = i_list-waers.                                   
                                                                           
      CLEAR i_partners.                                                     
      i_partners-partn_role = 'AG'."Tipo de interlocutor               
      i_partners-partn_numb = '0000000056'.                                 
      APPEND i_partners.                                                   
                                                                           
      REFRESH i_items.                                                     
    ENDAT.                                                                 
                                                                           
    CLEAR i_items.                                                         
    i_items-material   = i_list-matnr.                                     
    i_items-req_qty    = i_list-menge * 1000.                               
    i_items-po_itm_no  = i_list-posnr.                                     
    i_items-item_categ = 'ZPO1'.                                           
    i_items-plant      = p_werks.                                           
    i_items-store_loc  = i_list-lgort.                                     
    APPEND i_items.                                                         
                                                                           
    CLEAR l_fin.                                                           
    AT END OF waers.                                                       
      l_fin = 'X'.                                                         
    ENDAT.                                                                 
                                                                           
    IF l_fin = 'X'.                                                         
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'                   
           EXPORTING                                                       
                order_header_in = l_header                                 
           IMPORTING                                                       
                salesdocument   = l_salesdocument                           
                return          = l_return                                 
           TABLES                                                           
                order_items_in  = i_items                                   
                order_partners  = i_partners.                               
                                                                           
      IF l_salesdocument IS INITIAL.                                       
  * Error                                                       
      ELSE.                                                                 
  * Éxito                                             
      ENDIF.                                                               
    ENDIF.                                                                 
  ENDLOOP.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> SD All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.