Skip to Content
author's profile photo Former Member
Former Member

BAPI

hI,

I was using BAPI_PO_CHANGE..There are two tables in this BAPi.

One is showing header data and another one is of EIKP table oriented.

How to relate the EKKO and EIKP table..Can any one give me a sample code of BAPI_po_change

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 10, 2008 at 10:59 AM

    EKKO-EXNUM = EIKP-EXNUM.

    You could of actually found this out for yourself, it was not difficult.

    Edited by: Martin Shinks on Jun 10, 2008 12:59 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 10, 2008 at 11:03 AM

    Cheers.

    To relate table EKKO with table EIKP just make EIKP-EXNUM (it's primary key) equal to EKKO-EXNUM.

    Code for BAPI:

    * HEADER
      t_header-doc_date   = p_data2.   "data do documento
      t_header-doc_type   = p_tipo.    "tipo de documento
      t_header-doc_cat    = 'F'.       "categoria de doc - pedido
      t_header-co_code    = c_incm.    "empresa
      t_header-purch_org  = c_a001.    "organização de compras
      t_header-pur_group  = c_c06.     "grupo de compradores
      t_header-suppl_plnt = c_p001.    "centro fornecedor
      t_header-created_by = sy-uname.  "usuário que cria o documento
    
    *ITEMS
    LOOP AT t_table.
    
        CLEAR: t_items, t_lote, l_aux, l_item.
    
    *   Calcula nº de item do pedido no formato NUMC 5
        ADD 10 TO l_linha.
        MOVE l_linha TO l_aux.
        CONDENSE l_aux.
        IF l_linha LT 100.
          CONCATENATE '000' l_aux(2) INTO l_item.
        ELSEIF l_linha LT 1000.
          CONCATENATE '00' l_aux(3) INTO l_item.
        ELSE.
          CONCATENATE '0' l_aux(4) INTO l_item.
        ENDIF.
    
    *   Tabela dos items - EKPO
        CONDENSE t_table-destino.
    
        t_items-po_item    = l_item.
        t_items-material   = t_table-zmatnr.
        t_items-pur_mat    = t_table-zmatnr.
        t_items-disp_quan  = t_table-zquant.
        t_items-plant      = p_centro.
        t_items-store_loc  = t_table-destino(4).
        t_items-item_cat   = 7.
        APPEND t_items.
    
    *   Tabela das divisões de remessa - EKET
        t_lote-po_item = l_item.
        t_lote-batch = t_table-charg.
        t_lote-quantity = t_table-zquant.
        t_lote-deliv_date = p_data2.
        APPEND t_lote.
    
      ENDLOOP.
    
    * BAPI
       CALL FUNCTION 'BAPI_PO_CREATE'
             EXPORTING
                  po_header         = t_header
             IMPORTING
                  purchaseorder     = l_pedido2
             TABLES
                  po_items          = t_items
                  po_item_schedules = t_lote
                  return            = t_return.
    

    Regards.

    Valter Oliveira.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.