Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Createfromdat2 and sale_to problem

Hi there,

i have a problem with the bapi_salesorder_createfromdat2. It is always telling me i have to give it a sale_to partner which i do

here is the code.

  LOOP AT lt_sumtab INTO ls_sumtab.
    IF ls_sumtab2-zzfaleierb <> ls_sumtab-zzfaleierb OR
       ls_sumtab2-zzfaleiemp <> ls_sumtab-zzfaleiemp OR
       ls_sumtab2-zzfakttyp <> ls_sumtab-zzfakttyp OR
       ls_sumtab2-zzverperiode <> ls_sumtab-zzverperiode.
*     Neuer Kundenauftrag
      IF ls_header IS NOT INITIAL.
        CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
          EXPORTING
            order_header_in = ls_header
            testrun         = 'X'
          TABLES
            return          = lt_return
            order_items_in  = lt_item
            order_partners  = lt_partner.
*        Return prüfen, commit oder rollback veranlassen, fehler ausgeben
        CLEAR ls_header.
        CLEAR lt_partner.
        CLEAR lt_item.
      ENDIF.
      l_itm_no = l_itm_no + 1.

      ls_header-doc_type = 'ZVER'.
      ls_header-sales_org = ls_sumtab-zzfaleierb.
      ls_header-distr_chan = '01'.
      ls_header-division = '01'.

*        READ TABLE lt_outtab INTO ls_outtab_data WITH KEY zzfaleierb = ls_sumtab-zzfaleierb.
*        MOVE  ls_outtab_data-zzfaleierb_txt to l_text.
*        CONCATENATE 'Verrechnung von' l_text 'an' INTO l_text SEPARATED BY space.
*        READ TABLE lt_outtab INTO ls_outtab_data WITH KEY zzfaleiemp = ls_sumtab-zzfaleiemp.
*        CONCATENATE l_text ls_outtab_data-zzfaleiemp_txt 'für Periode' ls_sumtab-zzverperiode INTO l_text SEPARATED BY space.
*        ls_header-purch_no_s = l_text.
*         CLEAR l_text.
*         CLEAR ls_outtab_data.


      ls_partner-partn_role = 'AG'.
      ls_partner-partn_numb = '0000023731'."ls_sumtab-zzfaleiemp
      ls_partner-itm_number = l_itm_no.
      APPEND ls_partner TO lt_partner.
*      CLEAR ls_partner.
*      ls_partner-partn_role = 'WE'.
*      ls_partner-partn_numb = '10059'.
*      ls_partner-itm_number = l_itm_no.
*      APPEND ls_partner TO lt_partner.
*      CLEAR ls_partner.
*      ls_partner-partn_role = 'PL'.
*      ls_partner-partn_numb = '10004'."ls_sumtab-zzfaleiemp
*      ls_partner-itm_number = l_itm_no.
*      APPEND ls_partner TO lt_partner.
*      CLEAR ls_partner.


      CLEAR ls_sumtab2.
      ls_sumtab2-zzfaleierb = ls_sumtab-zzfaleierb.
      ls_sumtab2-zzfaleiemp =  ls_sumtab-zzfaleiemp .
      ls_sumtab2-zzfakttyp = ls_sumtab-zzfakttyp.
      ls_sumtab2-zzverperiode =  ls_sumtab-zzverperiode.

    ENDIF.
*   Hier Auftragspositionen
    ls_item-item_categ = 'ZVE2'.
*        READ TABLE ls_outtab INTO ls_outtab_data with KEY
        ls_item-material = '110106'.
    READ TABLE lt_outtab INTO ls_outtab_data WITH KEY kdauf = ls_sumtab-kdauf.
    ls_item-profit_ctr = ls_outtab_data-prctr.

    CONCATENATE ls_outtab_data-name1 ls_sumtab-kdauf ls_sumtab-kdpos ls_sumtab-pernr INTO l_text SEPARATED BY space.
    ls_item-short_text = l_text.
    CLEAR l_text.
    CLEAR ls_outtab_data.

    ls_item-purch_no_s = ls_sumtab-kdauf.
    ls_item-poitm_no_s = ls_sumtab-kdpos.
*        TARGET_QTY = zzmengewb
    ls_item-target_qu = ls_sumtab-mengeneinheit.
    ls_item-itm_number = l_itm_no.
    APPEND ls_item TO lt_item.
    CLEAR ls_item.

  ENDLOOP.
  IF ls_header IS NOT INITIAL.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
        order_header_in = ls_header
        testrun         = 'X'
      TABLES
        return          = lt_return
        order_items_in  = lt_item
        order_partners  = lt_partner.
*        Return prüfen, commit oder rollback veranlassen, fehler ausgeben
    CLEAR ls_header.
    CLEAR lt_partner.
    CLEAR lt_item.
  ENDIF.

if i test the bapi in se37 with the exacet same values there is no problem at all, in the debugger my partner table is properly filled, so where is the problem?

thanks in advance

Mathias

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question