BAPI to create sales order

Hi friends i am facing problem in this code , i tried a lot but still some errors are coming  can you please suggest how to remove the errors, anwers will be rewarded , thanks in advance
*& Report  Z_TEST_BAPI
REPORT  Z_TEST_BAPI.
data : ORDER_HEADER_IN like BAPISDHD1.
data : ORDER_ITEMS_IN like BAPISDITM occurs 0 with
header line.
data : RETURN like BAPIRET2 occurs 0 with header line.
data : ORDER_PARTNERS like BAPIPARNR occurs 0 with
header line.
DATA : ORDER_KEYS LIKE BAPISDKEY OCCURS 0 WITH HEADER
LINE.
data : ORDER_SCHEDULES_IN like BAPISCHDL occurs 0 with
header line.
data : BEGIN OF TAB OCCURS 0,
        SRNO(4),
        DOC_TYPE like ORDER_HEADER_IN-dOC_TYPE,
        SALES_ORG LIKE ORDER_HEADER_IN-SALES_ORG,
        DISTR_CHAN LIKE ORDER_HEADER_IN-DISTR_CHAN,
        DIVISION like ORDER_HEADER_IN-DIVISION,
       REQ_DATE_H(10),
       PURCH_DATE(10),
        PMNTTRMS LIKE ORDER_HEADER_IN-PMNTTRMS,
        PURCH_NO_C LIKE ORDER_HEADER_IN-PURCH_NO_C,
        ITM_NUMBER like BAPISDITM-ITM_NUMBER,
        MATERIAL   LIKE  ORDER_ITEMS_IN-MATERIAL ,
       CUST_MAT22 LIKE ORDER_ITEMS_IN-CUST_MAT22,
        PLANT LIKE ORDER_ITEMS_IN-PLANT,
        TARGET_QTY LIKE ORDER_ITEMS_IN-TARGET_QTY,
       ITM_NUMBER LIKE ORDER_ITEMS_IN-ITM_NUMBER,
       MATERIAL   LIKE  ORDER_ITEMS_IN-MATERIAL ,
        PARTN_ROLE LIKE ORDER_PARTNERS-PARTN_ROLE,
        PARTN_NUMB LIKE ORDER_PARTNERS-PARTN_NUMB,
      END OF TAB.
*data: tab like alsmex_tabline occurs 0 with header
*line.
DATA: gd_currentrow type i.
data : PURCHASEORDER like ekko-ebeln.
Data: tot_rec type i,     "Total Records
     gd_update type i,   "Main Table Increement Counter
     gd_lines type i,    "Success Table increement Counter
     w_textout like t100-text. "VARIABLE TO GET ERRORLOG
data : begin of it_success occurs 0,
        SALESDOCUMENT LIKE BAPIVBELN-VBELN,  "PROJECT
      end of it_success.
data : begin of it_error occurs 0,
        srno(4),
        err_msg(73) TYPE c,    "TO RETREIVE ERROR MESSAGES
     end of it_error.
data : srno(4).
DATA : SALESDOCUMENT LIKE  BAPIVBELN-VBELN.
selection-screen begin of block b1 with frame.
skip 3.
parameter:p_infile like rlgrap-filename obligatory.
skip 3.
selection-screen end  of block b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_infile.
  PERFORM value_help.
start-of-selection.
CALL FUNCTION 'WS_UPLOAD'
  EXPORTING
    filename                     = p_infile
   FILETYPE                      = 'DAT'
  HAS_FIELD_SEPARATOR           = 'X'
  HEADER_LENGTH                 = 0
  READ_BY_LINE                  = 'X'
  DAT_MODE                      = ' '
  CODEPAGE                      = ' '
  IGNORE_CERR                   = ABAP_TRUE
  REPLACEMENT                   = '#'
  CHECK_BOM                     = ' '
  VIRUS_SCAN_PROFILE            =
  NO_AUTH_CHECK                 = ' '
IMPORTING
  FILELENGTH                    =
  HEADER                        =
  tables
    data_tab                      = tab.
EXCEPTIONS
  FILE_OPEN_ERROR               = 1
  FILE_READ_ERROR               = 2
  NO_BATCH                      = 3
  GUI_REFUSE_FILETRANSFER       = 4
  INVALID_TYPE                  = 5
  NO_AUTHORITY                  = 6
  UNKNOWN_ERROR                 = 7
  BAD_DATA_FORMAT               = 8
  HEADER_NOT_ALLOWED            = 9
  SEPARATOR_NOT_ALLOWED         = 10
  HEADER_TOO_LONG               = 11
  UNKNOWN_DP_ERROR              = 12
  ACCESS_DENIED                 = 13
  DP_OUT_OF_MEMORY              = 14
  DISK_FULL                     = 15
  DP_TIMEOUT                    = 16
  OTHERS                        = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
**perform open_group.
sort tab by row col.
Get first row retrieved
read table tab index 1.
Set first row retrieved to current row
gd_currentrow = tab-row.
loop at tab.
Reset values for next row
   if tab-row ne gd_currentrow.
     append tab .
     clear tab.
     gd_currentrow = tab-row.
   endif.
   SHIFT TAB-VALUE LEFT DELETING LEADING SPACE.
   case tab-col.
     when '0001'.
       TAB-SRNO = tab-value.
     when '0002'.
       TAB-DOC_TYPE = tab-value.
     when '0003'.
       TAB-SALES_ORG = tab-value.
     when '0004'.
       TAB-DISTR_CHAN = tab-value.
     when '0005'.
       TAB-DIVISION = tab-value.
     when '0006'.
       TAB-REQ_DATE_H =  tab-value.
     when '0006'.
       TAB-PURCH_DATE = tab-value.
     when '0007'.
       TAB-PMNTTRMS = tab-value.
     when '0008'.
       TAB-PURCH_NO_C = tab-value.
       when '0009'.
       TAB-ITM_NUMBER = tab-value.
      when '0010'.
       TAB-CUST_MAT22 = tab-value.
     when '0011'.
       TAB-PLANT  = tab-value.
     when '0012'.
       TAB-TARGET_QTY = tab-value.
     when '0013'.
       TAB-PARTN_ROLE = tab-value.
     when '0014'.
       TAB-PARTN_NUMB = tab-value.
   endcase.
endloop.
append tab.
clear tab.
  sort tab by SRNO.
  LOOP AT TAB.
   concatenate tab-REQ_DATE_H+4(4)
*tab-REQ_DATE_H2(2) tab-REQ_DATE_H0(2) into
*tab-REQ_DATE_H.
   concatenate tab-PURCH_DATE+4(4)
*tab-PURCH_DATE2(2) tab-PURCH_DATE0(2) into
*tab-PURCH_DATE.
    SRNO = TAB-SRNO.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT  = tab-PARTN_NUMB
      IMPORTING
        OUTPUT = tab-PARTN_NUMB.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT  = tab-MATERIAL
      IMPORTING
        OUTPUT = tab-MATERIAL.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
          EXPORTING
            input         = tab-ITM_NUMBER
         IMPORTING
           OUTPUT        = tab-ITM_NUMBER .
    IF TAB-SRNO = SRNO.
      ORDER_HEADER_IN-DOC_TYPE = TAB-DOC_TYPE.
      ORDER_HEADER_IN-SALES_ORG = TAB-SALES_ORG.
      ORDER_HEADER_IN-DISTR_CHAN = TAB-DISTR_CHAN.
ORDER_HEADER_IN-REQ_DATE_H = TAB-REQ_DATE_H.
     ORDER_HEADER_IN-PURCH_DATE = TAB-PURCH_DATE.
      ORDER_HEADER_IN-PMNTTRMS = TAB-PMNTTRMS.
      ORDER_HEADER_IN-PURCH_NO_C = TAB-PURCH_NO_C.
      ORDER_HEADER_IN-DIVISION  = tab-DIVISION.
      ORDER_ITEMS_IN-ITM_NUMBER = tab-ITM_NUMBER.
       ORDER_ITEMS_IN-MATERIAL = TAB-MATERIAL.
     ORDER_ITEMS_IN-material = TAB-CUST_MAT22.
      ORDER_ITEMS_IN-PLANT      = TAB-PLANT.
      APPEND ORDER_ITEMS_IN.
      ORDER_PARTNERS-PARTN_ROLE = TAB-PARTN_ROLE.
      ORDER_PARTNERS-PARTN_NUMB = TAB-PARTN_NUMB.
      APPEND ORDER_PARTNERS.
     ORDER_SCHEDULES_IN-ITM_NUMBER = tab-ITM_NUMBER.
      ORDER_SCHEDULES_IN-REQ_QTY = tab-TARGET_QTY.
      append ORDER_SCHEDULES_IN.
    ENDIF.
    AT END OF SRNO.
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
        EXPORTING
           SALESDOCUMENTIN               =
             ORDER_HEADER_IN               = ORDER_HEADER_IN
           ORDER_HEADER_INX              =
           SENDER                        =
           BINARY_RELATIONSHIPTYPE       =
           INT_NUMBER_ASSIGNMENT         =
           BEHAVE_WHEN_ERROR             =
           LOGIC_SWITCH                  =
           TESTRUN                       =
           CONVERT                       = ' '
       IMPORTING
         SALESDOCUMENT                 = SALESDOCUMENT
        TABLES
         RETURN                        = RETURN
             ORDER_ITEMS_IN                = ORDER_ITEMS_IN
           ORDER_ITEMS_INX               =
             ORDER_PARTNERS                = ORDER_PARTNERS
             ORDER_SCHEDULES_IN            = ORDER_SCHEDULES_IN
           ORDER_SCHEDULES_INX           =
           ORDER_CONDITIONS_IN           =
           ORDER_CONDITIONS_INX          =
           ORDER_CFGS_REF                =
           ORDER_CFGS_INST               =
           ORDER_CFGS_PART_OF            =
           ORDER_CFGS_VALUE              =
           ORDER_CFGS_BLOB               =
           ORDER_CFGS_VK                 =
           ORDER_CFGS_REFINST            =
           ORDER_CCARD                   =
           ORDER_TEXT                    =
         ORDER_KEYS                    = ORDER_KEYS
           EXTENSIONIN                   =
           PARTNERADDRESSES              =
      IF SALESDOCUMENT <> SPACE.
        commit work.
        ADD 1 TO gd_update.
        it_success-SALESDOCUMENT = SALESDOCUMENT.
        append it_success.
        CLEAR :SALESDOCUMENT,ORDER_HEADER_IN.
        REFRESH : RETURN,ORDER_ITEMS_IN,ORDER_PARTNERS.
      ELSE.
        loop at return.
          it_error-SRNO = tab-SRNO.
          it_error-err_msg = return-MESSAGE .
          Append it_error.
        ENDLOOP.
        CLEAR :SALESDOCUMENT,ORDER_HEADER_IN.
        REFRESH : RETURN,ORDER_ITEMS_IN,ORDER_PARTNERS.
      ENDIF.
    endat.
  endloop.
  DESCRIBE TABLE it_success LINES gd_lines.
  IF gd_lines GT 0.
    Display result report column headings
    PERFORM display_column_headings.
    Display result report
    PERFORM DISPLAY_SUCESS.
  ENDIF.
IF SUCESS FAILS Display Error Report
  DESCRIBE TABLE it_error LINES gd_lines.
  IF gd_lines GT 0.
    PERFORM errorheadings.
    PERFORM errorreport.
  ENDIF.
*&      Form  display_column_headings
      text
FORM display_column_headings.
  WRITE:2 ' Success Report '(014) COLOR COL_POSITIVE.
  SKIP.
  WRITE:2 'records inserted sucessfully:'(013).
  WRITE:/ sy-uline(15).
  FORMAT COLOR COL_HEADING.
  WRITE:/      sy-vline,
           (10) 'Sales order'(004), sy-vline.
  WRITE:/ sy-uline(15).
ENDFORM.                    "display_column_headings
*Subroutine to display SUCESS REPORT
FORM DISPLAY_SUCESS.
  FORMAT COLOR COL_NORMAL.
  LOOP AT it_success.
    WRITE:/      sy-vline,
        (10)  it_success-SALESDOCUMENT, sy-vline.
    CLEAR it_success.
  ENDLOOP.
  WRITE:/ sy-uline(15).
  REFRESH: it_success.
  FORMAT COLOR COL_BACKGROUND.
ENDFORM.                               "DISPLAY_REPORT
*&      Form  errorreport
      text
FORM errorreport.
  LOOP AT it_error.
    WRITE:/      sy-vline,
            (10) it_error-SRNO, sy-vline,
             (40) it_error-err_msg, sy-vline.
  ENDLOOP.
  WRITE:/ sy-uline(104).
  REFRESH: it_error.
endform.                    "errorreport
*&      Form  ERRORHEADINGS
      text
FORM ERRORHEADINGS.
  SKIP.
  WRITE:2 ' Error Report '(007) COLOR COL_NEGATIVE.
  SKIP.
WRITE:2 'The following records failed during
*update:'(008).
  WRITE:/ sy-uline(104).
  FORMAT COLOR COL_HEADING.
  WRITE:/      sy-vline,
          (10) 'ERROR.'(009), sy-vline.
  WRITE:/ sy-uline(104).
  FORMAT COLOR COL_NORMAL.
ENDFORM.                    "ERRORHEADINGS
**&      Form  value_help
      text
-->  p1        text
<--  p2        text
FORM value_help .
  CALL FUNCTION 'DSVAS_DOC_WS_FILENAME_GET_50'
    EXPORTING
      DEF_FILENAME     = ' '
      DEF_PATH         = ' '
      MASK             = ',.,..'
      MODE             = 'O'
      TITLE            = ' '
    IMPORTING
      FILENAME         = p_infile
    EXCEPTIONS
      INV_WINSYS       = 1
      NO_BATCH         = 2
      SELECTION_CANCEL = 3
      SELECTION_ERROR  = 4
      OTHERS           = 5.
  IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
endform.
test data
1     TA     PB01     01     00     0004     45     10     852     B001     10     AG     8101000000

Hello,
You need to call BAPI_TRANSACTION_COMMIT instead of the commit after each BAPI call to commit the data to the database.
Usually you also have to fill in the _INX structures for header item and schedule line to indicate what fields are to be changed.
Hope that helps,
Michael

Similar Messages

  • BAPI For CREATE SALES ORDER WITH REFERENCE TO ORDER

    Hi ,
    I want to develop a new RFC for 'Creating Sales Order' with reference to another sales order -
    Is there any BAPI available for the same ? (Version 4.7) - I know its available for new create and change
    but couldn't find for create with reference to Order ...
    Thanks in advance ...
    Regards
    Rajesh.

    Hi,
    You can use this FM "/SAPNEA/SMAPI_ORDER_CREATE". I haven;t tried this but you can still give it a try. Mention the Reference Order Type and other data in the header work area and pass it to the FM.
    Reward if it's useful.
    Thanks,
    Anil

  • BAPI FOR CREATING SALES ORDER WITH REFFERENCE TO QUOTATION

    Hi All,
    I am creating sales order with refference to quotation by using bapi "BAPI_SALESORDER_CREATEFROMDATA".Able to create sales order but its not refferencing qutation.Is there any other bapi for this scenario.Please guide me.
    Regards,
    Suresh

    Hi ,
    Thank you for giving reply I tried by using bapi BAPI_SALESORDER_CREATEFROMDAT2 after execution it giving sales order number but when I am trying to see that sales order system is giving error message as document is not exist.
    Please guide me.
    Suresh

  • Bapi To create sales order with reference of sales order.

    Hi all,
          Having requerment To create sales order with reference of onother  open sales order.
    Example: there open sales order which having qty of 20 for that 10 qty as already billed , for remain  10 qty as to create the new sales order with reference to the excsiting one.
    Please guide me how do it.
    Regards,
    Santosh
    Edited by: santosh jajur on May 15, 2010 11:47 AM

    Hi Santhosh,
    check this thread.
    Re: Open Sales Order Migration
    The last part of the thread says done.
    hope you get a hint from that.
    Also this one
    Re: how to create open sales order using BAPI....?
    http://abaplovers.blogspot.com/2008/02/bapi-sales-order-create-code.html
    Regs,
    SuryaD.
    Edited by: SuryaD on May 15, 2010 9:09 PM
    Edited by: SuryaD on May 15, 2010 9:10 PM
    Edited by: SuryaD on May 15, 2010 9:11 PM

  • BAPI to create Sales Order with reference to contract

    Hi All,
    I am trying to create Sales Order with reference to Contract, but although the
    order gets created, it does not contain reference document information. 
    The BAPI I am using is BAPI_SALESORDER_CREATEFROMDAT2. 
    Would someone know which parameters I have to papulate,or have any other suggestion
    how to accomplish my task? 
    Thank you so much, 
    Mayank

    Hi - Try Filling these three fields in the Item details.
    REF_DOC
    REF_DOC_IT
    REF_DOC_CA
    Reward points if helpful

  • How to use Bapi for creating sales order

    Dear All,
    I am facing problem in creating Sales orders using BAPI.
    Actually I am getting one file as an input and after validating the contents in the file i am preparing an internal table which has 6 fields - Customer number,PO Number,Material Number,Quantity,Price,Unit of measure.
    Now  my doubt is that while using BAPI_SALESORDER_CREATEFROMDAT2 , I am not getting how to pass PO Number and Customer number.
    Please Help.
    Regards,
    Shweta

    Hi shweta upadhyay
    I have gone through you are post i have done some coding for creating sales order using bapi , I think it is helpful for you.
    *& Report  YOBJ_BAPI_SALESORDER
    *& REPORT : CREATING SALES ORDER USING STANDARD BAPI
    *& AUTHOR : S.PAVAN KUMAR INUMARTHY
    REPORT  YOBJ_BAPI_SALESORDER.
    DATA : ORDER_HEADER_IN LIKE STANDARD TABLE OF BAPISDHD1 WITH HEADER LINE.
    DATA : ORDER_ITEMS_IN LIKE STANDARD TABLE OF BAPISDITM WITH HEADER LINE.
    DATA : ORDER_PARTNERS LIKE STANDARD TABLE OF BAPIPARNR WITH HEADER LINE.
    DATA : RETURN TYPE STANDARD TABLE OF BAPIRET2 WITH HEADER LINE.
    DATA : SALESDOCUMENT LIKE BAPIVBELN-VBELN.
    *APPENDING VALUES FOR HEADER.
    ORDER_HEADER_IN-DOC_TYPE = 'TA'.
    ORDER_HEADER_IN-SALES_ORG = '1000'.
    ORDER_HEADER_IN-DISTR_CHAN = '10'.
    ORDER_HEADER_IN-DIVISION = '00'.
    ORDER_HEADER_IN-SALES_GRP = '130'.
    ORDER_HEADER_IN-SALES_OFF = '1030'.
    APPEND ORDER_HEADER_IN.
    *APPENDING VALUES FOR ITEM
    ORDER_ITEMS_IN-MATERIAL = 'M-13'.
    ORDER_ITEMS_IN-PLANT = '1000'.
    ORDER_ITEMS_IN-SALES_UNIT = 'ST'.
    ORDER_ITEMS_IN-DIVISION = '07'.
    ORDER_ITEMS_IN-GROSS_WGHT = '28000'.
    ORDER_ITEMS_IN-NET_WEIGHT = '28000'.
    ORDER_ITEMS_IN-UNTOF_WGHT = 'KG'.
    ORDER_ITEMS_IN-VOLUME = '0.780'.
    ORDER_ITEMS_IN-VOLUNIT = 'M3'.
    APPEND ORDER_ITEMS_IN.
    *APPENDING VALUES FOR PARTNER
    ORDER_PARTNERS-PARTN_ROLE = 'AG'.
    ORDER_PARTNERS-PARTN_NUMB = '0000001000'.
    ORDER_PARTNERS-COUNTRY = 'DE'.
    ORDER_PARTNERS-TRANSPZONE = 'D000080000'.
    APPEND ORDER_PARTNERS.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
    *   SALESDOCUMENTIN               =
        ORDER_HEADER_IN               = ORDER_HEADER_IN
    *   ORDER_HEADER_INX              =
    *   SENDER                        =
    *   BINARY_RELATIONSHIPTYPE       =
    *   INT_NUMBER_ASSIGNMENT         =
    *   BEHAVE_WHEN_ERROR             =
    *   LOGIC_SWITCH                  =
    *   TESTRUN                       =
    *   CONVERT                       = ' '
    IMPORTING
       SALESDOCUMENT                  = SALESDOCUMENT
      TABLES
       RETURN                         = RETURN
       ORDER_ITEMS_IN                 = ORDER_ITEMS_IN
    *   ORDER_ITEMS_INX               =
        ORDER_PARTNERS                = ORDER_PARTNERS
    *   ORDER_SCHEDULES_IN            =
    *   ORDER_SCHEDULES_INX           =
    *   ORDER_CONDITIONS_IN           =
    *   ORDER_CONDITIONS_INX          =
    *   ORDER_CFGS_REF                =
    *   ORDER_CFGS_INST               =
    *   ORDER_CFGS_PART_OF            =
    *   ORDER_CFGS_VALUE              =
    *   ORDER_CFGS_BLOB               =
    *   ORDER_CFGS_VK                 =
    *   ORDER_CFGS_REFINST            =
    *   ORDER_CCARD                   =
    *   ORDER_TEXT                    =
    *   ORDER_KEYS                    =
    *   EXTENSIONIN                   =
    *   PARTNERADDRESSES              =
              IF SY-SUBRC = 0.
              CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    *           EXPORTING
    *             WAIT          =
    *           IMPORTING
    *             RETURN        =
               ENDIF.
    WRITE : 'SALES ORDER IS :', SALESDOCUMENT.
    This will be very helpful for you .
    this one is the correct answer I have tried it and I am posting it for you.
    Message was edited by: pavan inumarthy

  • BAPIs to create sales orders for Returns and Debit Memo Request

    Hi,
    I have to create a sales order for document type Returns as well as a debit memo request.The BAPI 'BAPI_SALESORDER_CREATEFROMDAT2' is giving the following error message for Debit Memo Request document creation as well as for Returns.
    761 Unpermitted combination of business object BUS2032 and sales doc. category L
    I found BAPIs:
    ‘BAPI_CUSTOMERRETURN_CREATE’ for creating sales document of type ZDRE and SD document category ‘H’.
    ‘BAPI_DEBITREQUEST_PROXY_CREATE’ for creating sales document of type ZDDR and SD document category ‘L’.
    please let me know if anybody have used them. If so what values need to be passed to I_UPLOAD_ID,I_DESTIN,I_SFA_REL parameters of BAPI_DEBITREQUEST_PROXY_CREATE. Are there any alternative solutions using the Salesorder bapi.
    I have to create documents based on the flat file data no reference sales document numbers are available.
    Appreciate your help..
    Good Day
    Regards
    Bhargavi

    Look at the code done by me
    Program Name:                                                        *
    SAP Name    : ZAXXXXXX               Version    :                    *
    Programmer  : Chris Dong of ITDC                    *
    Description :                                                        *
    Includes        :                                                    *
    Function Modules: XX_XXXXXX                                          *
    Transactions    :                                                    *
    Programs        :                                                    *
    REPORT  XXXXXXXX LINE-SIZE  80
                     LINE-COUNT 65
                     MESSAGE-ID ZA
                     NO STANDARD PAGE HEADING.
    CLEAR l_order_partners.
    l_order_partners-partn_role = 'AG'.
    l_order_partners-partn_numb = '0001202491'.
    APPEND l_order_partners TO li_order_partners.
    CLEAR l_order_partners.
    l_order_partners-partn_role = 'WE'.
    l_order_partners-partn_numb = '0001202491'.
    APPEND l_order_partners TO li_order_partners.  
    Sales document type
    l_order_header_in-doc_type = 'ZDR'.  
    Sales organization
    l_order_header_in-sales_org = '1000'. 
    Distribution channel
    l_order_header_in-distr_chan = '01'.  
    Division
    l_order_header_in-division = '04'. 
    REF DOCUMENT
    l_order_header_in-REF_DOC = '9100000144'.
    order reason
    l_order_header_in-ord_reason = '925'.
    item number
    l_order_items_in-itm_number = '000001'. 
    material no
    l_order_items_in-material = '000000000007000012'. 
    Qty
    l_order_items_in-target_qty = '0000000000100.000'. 
    APPEND l_order_items_in TO li_order_items_in. 
    *BUS2094 Credit memo request " OSS NOTE 93091
    *BUS2096 Debit memo request " OSS NOTE 93091
    CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA'
    EXPORTING
    ORDER_HEADER_IN = l_order_header_in
    BUSINESS_OBJECT = 'BUS2096'
    WITHOUT_COMMIT = ' '
    CONVERT_PARVW_AUART = ' '
    IMPORTING
    SALESDOCUMENT = l_vbeln
    RETURN = li_return
    TABLES
    ORDER_ITEMS_IN = li_order_items_in
    ORDER_PARTNERS = li_order_partners
    Message was edited by:
            Chris Dong
    null

  • BAPI to create sales order with reference to another sales order

    hi all,
    is there a bapi that allows you to create a sales order with reference to another sales order?
    thanks,
    V

    Hi Valencia,
    I think the normal BAPI (BAPI_SALESORDER_CREATEFROMDAT1)will do. You will have to fill the fields REF_DOC, REF_DOC_IT, REF_DOC_CA of the table ORDER_ITEMS_IN (and make sure that Customizing settings allow you to copy from order to order).
    Regards,
    John.

  • Issue in BAPI for creating sales order

    Dear friends,
    BAPI_SALESORDER_CREATEFROMDAT2
    and
    BAPI_TRANSACTION_COMMIT
    The above standard BAPI's we are using to create SO through third party software and the commit bapi to commit the order in DB, but the issue is now, we have created one new condition type for determining
    1.Loading and Unloading point
    2.Inco1 and Inco2
    3.PayT.
    This will trigger when we are selecting the ORDER Reason, this is working fine when we create the Order manually in SAP, but through Third party software this is not triggering, it is taking its own values from the master.

    Hello Experts,
    I am having issue related to Item category determination.
    Your inputs will be greatly appreciated.
    We have a service order in which Item category is determining correctly. Let’s assume Material as “A” (Material type DIEN, Service,
    Freight , etc..) and item category ZITC
    is determined correctly.
    Let’s assume sales order type as ZSOR
    Now I would like to add another line item as miscellaneous
    charges for the same order and we have a material created for that purpose Let’s
    assume miscellaneous material as “B”
    (Material type DIEN, Service,
    Freight, etc..)
    Both the materials “A” & “B” have Item category Group as “LEIS” (Service w/o Delivery), in material master Sales org 2 view.
    In VOV4 we have config maintained as
             Sa Ty  | ItCGr | Usg | HLevItCa |DfItC
              ZSOR | LEIS |            |                 |ZITC
              ZSOR | LEIS | TEXT|                   | ZITC
    But when I add material “B” (miscellaneous charges)as a line item, I get the below error and item category is not determined.
    No item category
    available (Table T184 ZITC TEXT )
    Message no. V1320
    Thanks in advance

  • BAPI for creating sales order

    Hi Folks,
    I want to create a sales order using BAPI. Can any one tell me the name of that BAPI and how to use that BAPI.
    Siddarth

    Hi
    See tha sample code for sales order creation
    SALES ORDER INPUT CREATION.
    PARAMETERS: p_auart TYPE auart OBLIGATORY.
    PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    PARAMETERS: p_spart TYPE vtweg OBLIGATORY.
    PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
    PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
    *ITEM
    PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
    PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
    PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    PARAMETERS: p_itcat TYPE pstyv OBLIGATORY.
    DATA DECLARATIONS.
    DATA: v_vbeln LIKE vbak-vbeln.
    DATA: header LIKE bapisdhead1.
    DATA: headerx LIKE bapisdhead1x.
    DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
    DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
    DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
    WITH HEADER LINE.
    DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
    WITH HEADER LINE.
    HEADER DATA
    header-doc_type = p_auart.
    headerx-doc_type = 'X'.
    header-sales_org = p_vkorg.
    headerx-sales_org = 'X'.
    header-distr_chan = p_vtweg.
    headerx-distr_chan = 'X'.
    header-division = p_spart.
    headerx-division = 'X'.
    headerx-updateflag = 'I'.
    PARTNER DATA
    partner-partn_role = 'AG'.
    partner-partn_numb = p_sold.
    APPEND partner.
    partner-partn_role = 'WE'.
    partner-partn_numb = p_ship.
    APPEND partner.
    ITEM DATA
    itemx-updateflag = 'I'.
    item-itm_number = '000010'.
    itemx-itm_number = 'X'.
    item-material = p_matnr.
    itemx-material = 'X'.
    item-plant = p_plant.
    itemx-plant = 'X'.
    item-target_qty = p_menge.
    itemx-target_qty = 'X'.
    item-target_qu = 'EA'.
    itemx-target_qu = 'X'.
    item-item_categ = p_itcat.
    itemx-item_categ = 'X'.
    APPEND item.
    APPEND itemx.
    Fill schedule lines
    lt_schedules_in-itm_number = '000010'.
    lt_schedules_in-sched_line = '0001'.
    lt_schedules_in-req_qty = p_menge.
    APPEND lt_schedules_in.
    Fill schedule line flags
    lt_schedules_inx-itm_number = '000010'.
    lt_schedules_inx-sched_line = '0001'.
    lt_schedules_inx-updateflag = 'X'.
    lt_schedules_inx-req_qty = 'X'.
    APPEND lt_schedules_inx.
    Call the BAPI
    CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
    EXPORTING
    sales_header_in = header
    sales_header_inx = headerx
    IMPORTING
    salesdocument_ex = v_vbeln
    TABLES
    return = return
    sales_items_in = item
    sales_items_inx = itemx
    sales_schedules_in = lt_schedules_in
    sales_schedules_inx = lt_schedules_inx
    sales_partners = partner.
    Check the return table.
    LOOP AT return WHERE type = 'E' OR type = 'A'.
    EXIT.
    ENDLOOP.
    IF sy-subrc = 0.
    WRITE: / 'Error in creating document'.
    ELSE.
    COMMIT WORK AND WAIT.
    WRITE: / 'Document ', v_vbeln, ' created'.
    ENDIF.
    Regards

  • BAPI for Creating Sales Order For Variant Configuration Materials

    Dear Gurus,
    Before posting this thread, we have referred many SDN threads, OSS notes and other sites for any sort of help..but no success..All threads and other referrals are not much of help as they are kind of incomplete( Perhaps, we are unable to understand them..no offense).
    Few checked threads on this subjects are:
    http://scn.sap.com/thread/34590
    http://scn.sap.com/thread/851070
    http://scn.sap.com/community/abap/blog/2014/04/23/update-vc-variant-configuration-data-using-standard-bapi-in-sales-order
    http://scn.sap.com/community/abap/blog/2014/07/15/creating-orders-with-variant-configured-items-using-bapisalesordercreatefromdat2
    http://scn.sap.com/community/abap/blog/2014/04/23/update-vc-variant-configuration-data-using-standard-bapi-in-sales-order
    http://scn.sap.com/thread/120144
    OSS: 549563
    Well, we're using the BAPI (BAPI_SALESORDER_CREATEFROMDAT2) which creates the sales order successfully but without the characteristic values in line items.
    We're passing data to the following parameters - ORDER_CFGS_REF, ORDER_CFGS_INST, ORDER_CFGS_VALUE to create the variant config but not able to see it getting created.
    Pls find attached BAPI coding document for your reference.
    If you could throw any light on this issue will be of great help for us.
    Thank You in Advance!!!
    Reg,
    Jagan-SD.

    Jagan nath
    Try below.
    you would need miimum of 3 segments to pass variant config data using this bapi
    ORDER_CFGS_REF for each configurable item
    POSEX = ITEM #
    CONFIG_id , root_id - Start with 1 and increment it for each configurable line item
    ORDER_CFGS_INST
    CONFIG_ID - from above
    INST_ID - Start with 1 and increment it for each configurable line item
    OBJ_TYPE = "MARA'
    CLASS_TYPE = '300'
    OBJ_KEY = material #
    ORDER_CFGS_VALUE
    CONFIG_ID for the item, INST_ID for the item
    charc for characteristic value
    VALUE for characteristic value
    Reference thread
    How to Fill Configuration Data in BAPI BAPI_SALESORDER_CREATEFROMDAT2
    Hope it will solve your issue.
    Thanks
    Ritesh

  • Using BAPI to create sales order

    Hi
      i use this BAPI 'BAPI_SALESORDER_CREATEBOS' to create SO, and This BAPI is with SAP E&C solution.
    it is similar to BAPI_SALESORDER_CREATEFROMDAT2. and when i call this BAPI, it give the error 'only quantity 1 ST are permitted (item 000010)'. This because the material i use is service material and with unit 'ST' and only 1. it means one project i sell.
    The partial code is as below.
      i_orderitemsin-itm_number = '000010'.
      i_orderitemsin-material = it_sdmaster-MATNR.
      I_ORDERITEMSIN-SHORT_TEXT = it_sdmaster-ARKTX.
      I_ORDERITEMSIN-TARGET_QU = 'ST '.
      I_ORDERITEMSIN-SALES_UNIT = 'ST '.
      I_ORDERITEMSIN-TARGET_QTY = '1.000'.
      I_ORDERITEMSIN-TARGET_QU = 'ST '.
      I_ORDERITEMSIN-TRG_QTY_NO = 1.
      I_ORDERITEMSIN-TRGQTY_DEN = 1.
      i_orderitemsin-pckg_no = v_package.
      APPEND i_orderitemsin .
      clear i_orderitemsin .
    You see, i have input the unit(ST) and quantity(1). tks for ur advice.

    I think you dont need to pass data in the fields TRG_QTY_NO and TRGQTY_DEN.
    Refer the data element documentation of the above fields.
    -Kiran

  • BAPI vs IDOC in creating Sales Order

    Hi Gurus,
    Good day!
    I would like to seek for your expertise to assess the advantages and disadvantages of using IDOC vs BAPI in creating sales orders?
    Overview of the requirement:
    Sales Orders are automatically created via idoc but we are planning to redesign the process by using BAPI. However, there are concerns when using a BAPI such as.
    1. Error handling/monitoring
    2. reprocess of failed creation of orders
    Thank you in advance.

    Hi Sai Sai,
    those are exactly the disadvantages.
    If you were using other middleware like SAP XI then you would have a place to monitor communications and reprocess messages, so you could use BAPI.
    But if you don't you'd had to create that mechanism in SAP or move that responsibility to your partners.
    BAPIs are useful for online SAP programs but if you require a background process with a maintenance infrastructure then you are better served with IDOCs.
    regards,
    Edgar

  • ISSUE ON CREATE SALES ORDER USING BAPI

    Hi,
       I am creating a sales order using bapi BAPI_SALESORDER_CREATEFROMDAT2.But it it fails to create a sales order abd below is my code pls check and correct me to create a sales order.
    LOOP AT DATA_TAB.
    clear: l_order_header_in,
           l_salesdocument,
           l_order_partners,
           l_order_items_IN,
           l_order_schedules_IN.
    refresh: l_order_items_in,
             l_order_partners,
             l_order_schedules_IN,
             l_return.
    Order header
    l_order_header_in-DOC_TYPE    = DATA_TAB-AUART.
    l_order_header_IN-SALES_ORG   = DATA_TAB-VKORG.
    l_order_header_IN-DISTR_CHAN  = data_tab-vtweg.
    l_order_header_in-division    = DATA_TAB-SPART.
    l_order_header_in-REF_1_S     = DATA_TAB-IHREZ_E.
    l_order_header_in-PURCH_NO_S  = DATA_TAB-BSTKD_E.
    l_order_header_in-PO_DAT_S    = data_tab-bstdk_e.
    l_order_header_in-PO_METH_S   = DATA_TAB-BSARK_E.
    l_order_header_in-DOC_DATE    = DATA_TAB-AUDAT.
    l_order_header_in-REC_POINT   = DATA_TAB-EMPST.
    l_order_header_inX-DOC_TYPE    = 'X'.
    l_order_header_INX-SALES_ORG   = 'X'.
    l_order_header_INX-DISTR_CHAN  = 'X'.
    l_order_header_inX-division    = 'X'.
    l_order_header_inX-REF_1_S     = 'X'.
    l_order_header_inX-PURCH_NO_S  = 'X'.
    l_order_header_inX-PO_DAT_S    = 'X'.
    l_order_header_inX-PO_METH_S   = 'X'.
    l_order_header_inX-DOC_DATE    = 'X'.
    l_order_header_inX-REC_POINT   = 'X'.
    Partner data SOLD TO PARTY
    l_order_partners-ITM_NUMBER = DATA_TAB-POSNR.
    l_order_partners-partn_role = 'SP'.
    l_order_partners-partn_numb = DATA_TAB-kunnr1.
    append l_ordeR_partners.
    Partner data SHOP TO PARTY
    l_order_partners-ITM_NUMBER = DATA_TAB-POSNR.
    l_order_partners-partn_role = 'SH'.
    l_order_partners-partn_numb = DATA_TAB-kunnr2.
    append l_ordeR_partners.
    Order items
    l_order_items_IN-ITM_NUMBER = DATA_TAB-POSNR.
    l_order_items_IN-material   = DATA_TAB-MABNR.
    l_order_items_IN-BATCH      = DATA_TAB-CHARG.
    l_order_items_IN-REASON_REJ = DATA_TAB-ABGRU.
    append l_order_items_IN.
    l_order_items_INX-ITM_NUMBER = DATA_TAB-POSNR.
    l_order_items_INX-material   = 'X'.
    l_order_items_INX-BATCH      = 'X'.
    l_order_items_INX-REASON_REJ = 'X'.
    append l_order_items_INX.
    Schedules for quantity
    l_order_schedules_IN-itm_number = DATA_TAB-POSNR.
    l_order_schedules_IN-req_qty    = DATA_TAB-KWMENG.
    append l_order_schedules_IN.
    Schedules for quantity
    l_order_schedules_INX-itm_number = data_tab-posnr.
    l_order_schedules_INX-req_qty    =  'X'.
    append l_order_schedules_INX.
    Conditions for value
    l_order_conditions_IN-itm_number = DATA_TAB-POSNR.
    l_order_conditions_IN-cond_type  = DATA_TAB-KSCHL.
    l_order_conditions_IN-cond_value = DATA_TAB-KBETR.
    l_order_conditions_IN-currency   = DATA_TAB-KOEIN.
    append l_order_conditions_IN.
    Conditions for value
    l_order_conditions_INX-itm_number = DATA_TAB-POSNR.
    l_order_conditions_INX-cond_type  = 'X'.
    l_order_conditions_INX-cond_value = 'X'.
    l_order_conditions_INX-currency   = 'X'.
    append l_order_conditions_INX .
    endloop.
    BAPI to create sales order
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
    EXPORTING
    SALESDOCUMENTIN =
      ORDER_HEADER_IN =      l_order_header_IN
      ORDER_HEADER_INX =     l_order_header_INX
    IMPORTING
      SALESDOCUMENT =        l_salesdocument
    TABLES
      RETURN =               l_return
      ORDER_ITEMS_IN =       l_order_items_IN
      ORDER_ITEMS_INX =      l_order_items_INX
      ORDER_PARTNERS =       l_order_partners
      ORDER_SCHEDULES_IN =   l_order_schedules_in
      ORDER_SCHEDULES_INX =  l_order_schedules_inX
      ORDER_CONDITIONS_IN =  l_order_conditions_in
      ORDER_CONDITIONS_INX = l_order_conditions_inX
    IF SY-SUBRC = 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
       WAIT           = C_X
    IMPORTING
      RETURN        =
    ENDIF.
      Pls help me to solve the issue.
    Thanks,
    Rajendra.

    Hi Raj
    This is the sameple code which works fine for me,
    REPORT  zkb_sales_order.
    DATA: w_order_header_in TYPE bapisdhd1,
          i_order_partners TYPE TABLE OF bapiparnr,
          w_order_partners TYPE bapiparnr,
          i_return TYPE TABLE OF bapiret2,
          w_return TYPE bapiret2,
         i_order_items_in TYPE TABLE OF bapisditm,
         w_order_items_in TYPE  bapisditm,
         i_order_items_inx TYPE TABLE OF  bapisditmx,
         w_order_items_inx TYPE  bapisditmx,
        i_order_conditions_in TYPE TABLE OF bapicond,
        w_order_conditions_in TYPE bapicond,
        i_order_conditions_inx TYPE TABLE OF bapicondx,
        w_order_conditions_inx TYPE TABLE OF bapicondx.
    CLEAR w_order_header_in.
    w_order_header_in-doc_type  = 'ZSO'.
    w_order_header_in-sales_org =  '1000'.
    w_order_header_in-distr_chan = '01'.
    w_order_header_in-division =  '01'.
    w_order_header_in-req_date_h  = sy-datum.
    w_order_header_in-sales_dist =   '000001'.
    CLEAR: i_order_items_in,w_order_items_in.
    w_order_items_in-material = 77.
    w_order_items_in-salqtynum = 1.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = w_order_items_in-material
      IMPORTING
        output = w_order_items_in-material.
    APPEND w_order_items_in TO i_order_items_in.
    * SP
    CLEAR: i_order_partners,w_order_partners.
    w_order_partners-partn_role = 'AG'.
    w_order_partners-partn_numb = '2000016'.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = w_order_partners-partn_numb
      IMPORTING
        output = w_order_partners-partn_numb.
    APPEND w_order_partners TO i_order_partners.
    CLEAR: i_order_conditions_in,w_order_conditions_in.
    w_order_conditions_in-itm_number =  '000010'.
    w_order_conditions_in-cond_type  =   'PR00'.
    w_order_conditions_in-cond_value =  100.
    APPEND w_order_conditions_in TO i_order_conditions_in.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
    *   SALESDOCUMENTIN               =
        order_header_in               = w_order_header_in
    *   ORDER_HEADER_INX              =
    *   SENDER                        =
    *   BINARY_RELATIONSHIPTYPE       =
    *   INT_NUMBER_ASSIGNMENT         =
    *   BEHAVE_WHEN_ERROR             =
    *   LOGIC_SWITCH                  =
    *   TESTRUN                       =
    *   CONVERT                       = ' '
    * IMPORTING
    *   SALESDOCUMENT                 =
      TABLES
       return                        = i_return
       order_items_in                = i_order_items_in
    *   ORDER_ITEMS_INX               =
        order_partners                = i_order_partners
    *   ORDER_SCHEDULES_IN            =
    *   ORDER_SCHEDULES_INX           =
       order_conditions_in           = i_order_conditions_in
    *   ORDER_CONDITIONS_INX          =
    *   ORDER_CFGS_REF                =
    *   ORDER_CFGS_INST               =
    *   ORDER_CFGS_PART_OF            =
    *   ORDER_CFGS_VALUE              =
    *   ORDER_CFGS_BLOB               =
    *   ORDER_CFGS_VK                 =
    *   ORDER_CFGS_REFINST            =
    *   ORDER_CCARD                   =
    *   ORDER_TEXT                    =
    *   ORDER_KEYS                    =
    *   EXTENSIONIN                   =
    *   PARTNERADDRESSES              =
    READ TABLE i_return INTO w_return WITH KEY type = 'E'.
    IF sy-subrc NE 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDIF.
    LOOP AT i_return INTO w_return .
      WRITE: / w_return-type,
      w_return-id,
      w_return-number,
      w_return-message.
    ENDLOOP.
    Regards
    Kathirvel

  • Creating Sales order texts while using BDC session method is not working

    Hi All,
    I have an existing program which creates sales order using BDC session method.( Actual program uses BAPI to create sales order and in case if any error occurs during creation of sales order BDC session is generated so that user can process it later and i am facing issues in this part of code where it uses BDC)
    I wanted to modify this BDC sesion  to update the sales order text also. I tried recording VA01 for creationg sales order text unfortunatly it is not capturing the data i am entering in the text fields.
    Please suggest if there is any way to create sales order using BDC.
    Regards
    Sheeba

    Hi Madhu,
    '=TP_CREATE' is the OK code i am getting for creating TEXTS. But the text entered are not captured in BDC.
    Part of BDC program generated for cretaing sales order texts.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=%_GC 128 22'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_CREATE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=%_GC 128 22'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_CREATE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SICH'.
    Regards,
    Sheeba

Maybe you are looking for

  • Timing for Data Acquisition Using Notifiers

    I'm trying to use notifiers to transfer data from an acquisition (master) loop to the slave loop. I want data to be transferred for analysis only when the VI is in a certain state - not in all states. That's why I'm preferring to use notifiers instea

  • I need help disentangling gmail and Thunderbird

    The article "Thunderbird and Gmail" would be very helpful if I were setting up my email from the beginning. but I set it up a long time ago and I need help straightening things out. The folders at the left hand side of the Thunderbird screen are very

  • Layout in Standard report s_alr_87012357

    Hi,     I just added few fileds that were hidden in this standard report by making a layout variant.    But these fields comes in the second line.     The report looks quite bad.     Can any suggest what else do I need to do so that it comes in the f

  • Error in AS2 RCV adapter.. SEEBURGER AS2: 307 Temporary Redirect #

    Hi all, Iam just doing File to File scenario and passing the resultant file to Partner system through AS2 adapter. I gave the following details in AS2 RCV adapter.. SND>XI->Webdispatcher--->Partner. My message will be reached to webdispatcher.. from

  • Facebook not loading properly

    I don't know if this is an issue with Facebook, or an issue with Firefox (maybe someone more "in the know" could tell me), but regardless... I have had issues TWICE THIS WEEK with Firefox not loading Facebook. While it is easily solvable by resetting