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

issue onDelete subitems in sales order change using BAPI _salesorder_change

Hi experts,

i have developed one screen for user enter the header data and items data for repair order create or change.User don't want go to the VA01/VA02 tcode to create or change the repair order. He will enter the data on new screen the bapi will create or change the repair request order.when delete the one item in new screen we need to handle that in BAPI.i am trying to delete the repair order items by using FM bapi_salesorder_change.it not allow to delete the items Because that item have subitem how we can delete subitem as well as item by using above FM.

please give ur valuble suggestions.

Regards,

pandu.

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 Jul 28, 2007 at 03:03 AM

    please refer this program.

    ***********************************************************************

    ** Program ID :

    ** Program Desc : SALESORDER CHANGE UING BDC

    ** Process Overview : SD

    ** Created By : P.KARTHIKEYAN

    REPORT ZBAPI_SALESORDER_CHANGE LINE-SIZE 132 MESSAGE-ID ZMMBAPI .

    ----


    • Internal table definition *

    ----


    *****<<<< BAPI Sales Order>>>>>>>>>>>>>>>>>>>>>>>

    DATA: GT_SALESDOCUMENT LIKE BAPIVBELN-VBELN,

    ******<<<<Communication Fields: SD Order Header>>>

    GT_ORDER_HEADER_IN LIKE BAPISDH1,

    ******<<<<<Checkbox List: SD Order Header>>>>>>>>>

    GT_ORDER_HEADER_INX LIKE BAPISDH1X,

    *****<<<Return Parameter>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    GT_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,

    *******<<<<<<<Communication Fields: Sales and Distribution Document Item>>

    GT_ORDER_ITEM_IN LIKE BAPISDITM OCCURS 0 WITH HEADER LINE,

    *******<<<<<<<Communication Fields: Sales and Distribution Document Item>>

    GT_ORDER_ITEM_INX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE,

    *******<<<<<<<<Communication Fields for Maintaining Conditions in the Order

    GT_CONDITIONS_IN LIKE BAPICOND OCCURS 0 WITH HEADER LINE,

    *******<<<<<<<<Communication Fields for Maintaining Conditions in the Order

    GT_CONDITIONS_INX LIKE BAPICONDX OCCURS 0 WITH HEADER LINE.

    ----


    • FLAT FLIE Internal table definition *

    ----


    DATA: BEGIN OF GT_FT_SALES OCCURS 0,

    SALESDOCUMENT(10), "SALESDOCUMENT

    SALES_ORG(4) , "Sales Organization

    DISTR_CHAN(2), "Sales Organization

    DIVISION(2) , " DIVISION

    PURCH_NO_C(35) , "Customer purchase order number

    SALES_DIST(6) , "Sales district

    INCOTERMS1(3) , "INCOTERMS1

    PMNTTRMS(4) , "Terms of payment key

    ITM_NUMBER(6) , "Sales Document Item

    PO_ITM_NO(6) , "Item Number of the Underlying Purchase Order

    MATERIAL(18), "Material Number

    END OF GT_FT_SALES,

    MSG(240) TYPE C, " Return Message

    E_REC(8) TYPE C, " Error Records Counter

    REC_NO(8) TYPE C, " Records Number Indicator

    S_REC(8) TYPE C, " Successful Records Counter

    T_REC(8) TYPE C, " Total Records Counter

    ERR_ORDER(10) TYPE C. " Order Number Indicator

    • selection block for EXCEL UPLOAD FILE>>>>>>>>>>>>>>>>>>>>>>>>

    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.

    PARAMETERS FILE TYPE IBIPPARMS-PATH OBLIGATORY.

    SELECTION-SCREEN END OF BLOCK B1.

    *<<<<AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .>>>>>>>>>>>>

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .

    CALL FUNCTION 'F4_FILENAME'

    EXPORTING

    PROGRAM_NAME = SYST-CPROG

    DYNPRO_NUMBER = SYST-DYNNR

    IMPORTING

    FILE_NAME = FILE.

    **<<<<<<<<<<<<<<<<<START-OF-SELECTION.>>>>>>>>>>>>>>>>>>>>>>>>>>>

    START-OF-SELECTION.

    CALL FUNCTION 'WS_UPLOAD' "#EC *

    EXPORTING

    FILENAME = FILE

    FILETYPE = 'DAT'

    TABLES

    DATA_TAB = GT_FT_SALES

    EXCEPTIONS

    CONVERSION_ERROR = 1

    FILE_OPEN_ERROR = 2

    FILE_READ_ERROR = 3

    INVALID_TYPE = 4

    NO_BATCH = 5

    UNKNOWN_ERROR = 6

    INVALID_TABLE_WIDTH = 7

    GUI_REFUSE_FILETRANSFER = 8

    CUSTOMER_ERROR = 9

    NO_AUTHORITY = 10

    OTHERS = 11.

    IF SY-SUBRC <> 0 .

    MESSAGE E000.

    ENDIF.

    SKIP 3.

    FORMAT COLOR COL_HEADING INVERSE ON.

    WRITE 40 TEXT-001.

    FORMAT COLOR COL_HEADING INVERSE OFF.

    SKIP 1.

    FORMAT COLOR COL_NEGATIVE INVERSE ON.

    WRITE :/ TEXT-002, 13 SY-MANDT , 104 TEXT-003, 111 SY-UNAME,

    / TEXT-004, 13 SY-DATUM , 104 TEXT-005, 111 SY-UZEIT.

    FORMAT COLOR COL_NEGATIVE INVERSE OFF.

    SKIP 3.

    LOOP AT GT_FT_SALES.

    PERFORM UPLOAD_FILE.

    ENDLOOP.

    T_REC = E_REC + S_REC.

    SKIP 3.

    FORMAT COLOR COL_TOTAL INVERSE ON.

    WRITE: /38 TEXT-007, T_REC.

    FORMAT COLOR COL_TOTAL INVERSE OFF.

    FORMAT COLOR COL_NEGATIVE INVERSE ON.

    WRITE: /38 TEXT-008, E_REC.

    FORMAT COLOR COL_NEGATIVE INVERSE OFF.

    FORMAT COLOR COL_TOTAL INVERSE ON.

    WRITE: /38 TEXT-009, S_REC.

    FORMAT COLOR COL_TOTAL INVERSE OFF.

    &----


    *& Form UPLOAD_FILE

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM UPLOAD_FILE .

    ********<<<< BAPI Sales Order>>>>>>>>>>>>>>>>>>>>>>>

    GT_SALESDOCUMENT = GT_FT_SALES-SALESDOCUMENT . " '0000000233' "Order Number

    ******<<<<Communication Fields: SD Order Header>>>

    GT_ORDER_HEADER_IN-SALES_ORG = GT_FT_SALES-SALES_ORG . "'0001' "Sales Organization

    GT_ORDER_HEADER_IN-DISTR_CHAN = GT_FT_SALES-DISTR_CHAN . "Distribution Channel

    GT_ORDER_HEADER_IN-DIVISION = GT_FT_SALES-DIVISION . "Division

    GT_ORDER_HEADER_IN-PURCH_NO_C = GT_FT_SALES-PURCH_NO_C . "Customer purchase order number

    GT_ORDER_HEADER_IN-SALES_DIST = GT_FT_SALES-SALES_DIST . " Sales district

    GT_ORDER_HEADER_IN-INCOTERMS1 = GT_FT_SALES-INCOTERMS1 . "Incoterms (part 1)

    GT_ORDER_HEADER_IN-PMNTTRMS = GT_FT_SALES-PMNTTRMS . "Terms of payment key

    ******<<<<Communication Fields: SD Order Header FLAG>>>

    GT_ORDER_HEADER_INX-UPDATEFLAG = 'U'.

    GT_ORDER_HEADER_INX-SALES_ORG = 'X'. "Sales Organization

    GT_ORDER_HEADER_INX-DISTR_CHAN = 'X'. "Distribution Channel

    GT_ORDER_HEADER_INX-DIVISION = 'X'. "Division

    GT_ORDER_HEADER_INX-PURCH_NO_C = 'X' ."Customer purchase order number

    GT_ORDER_HEADER_INX-SALES_DIST = 'X'. " Sales district

    GT_ORDER_HEADER_INX-INCOTERMS1 = 'X'."Incoterms (part 1)

    GT_ORDER_HEADER_INX-PMNTTRMS = 'X'. "Terms of payment key

    *******<<<<<<<Communication Fields: Sales and Distribution Document Item>>

    GT_ORDER_ITEM_IN-ITM_NUMBER = GT_FT_SALES-ITM_NUMBER . "'000010' "Sales Document Item

    GT_ORDER_ITEM_IN-PO_ITM_NO = GT_FT_SALES-PO_ITM_NO . "'PO-129' "Item Number of the Underlying Purchase Order

    GT_ORDER_ITEM_IN-MATERIAL = GT_FT_SALES-MATERIAL . "'M-24' "Material Number

    APPEND GT_ORDER_ITEM_IN.

    *******<<<<<<<Communication Fields: Sales and Distribution Document Item>>

    GT_ORDER_ITEM_INX-UPDATEFLAG = 'U'.

    GT_ORDER_ITEM_INX-ITM_NUMBER = '000010'. "Sales Document Item

    GT_ORDER_ITEM_INX-PO_ITM_NO = 'X'. "Item Number of the Underlying Purchase Order

    GT_ORDER_ITEM_INX-MATERIAL = 'X'. "Material Number

    APPEND GT_ORDER_ITEM_INX.

    *******<<<<<<<<Communication Fields for Maintaining Conditions in the Order>>>>

    GT_CONDITIONS_IN-ITM_NUMBER = GT_FT_SALES-ITM_NUMBER . "'000010' "Condition item number

    APPEND GT_CONDITIONS_IN.

    *******<<<<<<<<Communication Fields for Maintaining Conditions in the Order FLAG>>>

    GT_CONDITIONS_INX-ITM_NUMBER = '000010' ."Condition item number

    APPEND GT_CONDITIONS_INX.

    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

    EXPORTING

    SALESDOCUMENT = GT_SALESDOCUMENT

    ORDER_HEADER_IN = GT_ORDER_HEADER_IN

    ORDER_HEADER_INX = GT_ORDER_HEADER_INX

    TABLES

    RETURN = GT_RETURN

    ORDER_ITEM_IN = GT_ORDER_ITEM_IN

    ORDER_ITEM_INX = GT_ORDER_ITEM_INX

    CONDITIONS_IN = GT_CONDITIONS_IN

    CONDITIONS_INX = GT_CONDITIONS_INX.

    IF GT_RETURN-TYPE EQ 'E'.

    ERR_ORDER = GT_RETURN-MESSAGE_V1.

    READ TABLE GT_RETURN WITH KEY ID = 'V1'.

    E_REC = E_REC + 1.

    CONCATENATE TEXT-006 ERR_ORDER ':' GT_RETURN-MESSAGE INTO MSG SEPARATED BY SPACE .

    CONDENSE MSG.

    FORMAT COLOR COL_NEGATIVE INVERSE ON.

    WRITE / MSG .

    FORMAT COLOR COL_NEGATIVE INVERSE OFF.

    ELSEIF GT_RETURN-TYPE EQ 'S'.

    S_REC = S_REC + 1.

    FORMAT COLOR COL_POSITIVE INVERSE ON.

    WRITE / GT_RETURN-MESSAGE .

    FORMAT COLOR COL_POSITIVE INVERSE OFF.

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

    EXPORTING

    WAIT = 'X'

    IMPORTING

    RETURN = GT_RETURN.

    ENDIF.

    ENDFORM. " UPLOAD_FILE

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 18, 2011 at 06:30 AM

    I am stuck in same problem..

    help!!

    Regards,

    Rajat

    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.