Customer goods receipt  for Job work

Dear Experts:
1.Material received from customer with challan for job work.
How to handle this scenario.
Regards,
Sridhar.N

Hi,
You could use serial number concept or bacth managment here to separate within the material code.
Regards

Similar Messages

  • Good receipt for job work from other plant

    Dear Experts:
    1.Material Received from Other Plant for job work with challan and how to bring the Material into Stock at receiving plant.
    The same material stock number available in this plant also.
    Regards,
    Sridhar.N

    Hi,
    You could use serial number concept or bacth managment here to separate within the material code.
    Regards

  • Doing a goods receipt for a customer material that is ASEQ status

    We are needing to find a way to be able to do a goods receipt for a child part in ASEQ status.  Most of our customers will send in their part after disassembling it themselves.  Since we can not receive the part our present process is to dismantle so the system status changes to ESTO and we can receive.  The problem with this is that the end user forgets to assemble the part back and we end up breaking the linkage.
    We have looked into using User Status in the equipment master and have configured that.  However the user status button, nor name shows up in the equipment master.  I have looked at the field selection in IMG and it is not hidden.  I am assuming it is being supressed by a user exit we have.
    Can anyone give me any suggestions on how we can improve the process using SAP for material that is ASEQ status and being able to create an inbound delivery so we can receive in our warehouse for this status without dismatling the unit? 
    We are on ECC

    Hello Kimberly
    You lost me while describing your current process, so  please provide more details as to how you dismantle and reinstall etc.  Also how the part goes back to the customer.
    However I can provide you  clarifications to some questions you raised..
    You see both system and user statuses in the field 'Status' itself. This is the 3rd row in the Equipment display screen under Equipment number and Description. If you see carefully you will see 2 sections, the one on left is system status and the one on right is User status. If you click on the i (info) icon, you will be taken to a screen where you see more info like status and business processes etc.
    ASEQ is a system status and it is determined by what you did ( example dismantling) and can't be changed by you (user). If you see the 'Business Processes' tab, you will also see the this won't allow assignment to a Delivery and so on. So my point is having a user status will not help you. Based on the combination of system and user statuses, some processes are permitted, some not. For example if Goods Receipts are allowed, may be you can receive without an Inbound delivery.  I am mentioning this as a thought initiator, I know you will have a Return/Repair order process including a return delivery.
    I guess you have to systematically prevent the user from  doing whatever they are doing out of turn, e.g., forgetting to reassemble (install?) and for this User statuses can help.
    Let us know your process more in detail and I am sure SAP will have a standard way to receive a child part of a big assembly. Other members will share their practices also.
    Take care.

  • Ssinging service tax assignment to customer for job work taxinn

    dear sir
    assinging service tax assignment to customer for job work taxinn,procedure ,kindly give me step by step procedure
    thanks

    Hi,
    Enter the correct tax code  or maintain the Tax code VR in the transaction code FTXP.
    Regards,
    Manish

  • Steps For Goods Receipt For Work Order Using Handling Units

    Hello MM gurus,
    I'm new to HU Management.  Can you please share with me the steps for executing a "Goods Receipt For Work Order" using Handling Units?
    I created a HU (1000000026), and then using transaction COWBHUWE I tried using that HU to create a goods receipt, but I keep getting the message below:
    Handling unit 1000000026 is not provided for goods receipt
    Message no. VHURM046
    Do you have to assign/plan HUs to Process Orders first? I think the problem is that I'm not understanding the process or the requirements for a goods receipt for work order using HU.

    Hello Manish Kumar,
    I've been doing Handling Units testing in our sandbox environment and I've been trying to Pack a Finished Product for a Process Order using
    1-Transaction code HU02 to create the Handling Unit
    2-Transaction COWBHUE after creating the HU to enter the production order number and the HU number and propose it, but the it doesn't work. When I propose it, nothing happens.
    3.-I also tried COWBPACK, but for some reason, when I go into COWBPACK, key in the Process Order, and then press enter, I get the following message:
    You do not have authorization to create handling units for plant BP08
    Message no. VHUPD500
    Do you know how to solve this issue?

  • Post Goods Receipt for Inbound Delivery using WHSCON IDoc

    Dear All
    Currently I am working on a big project dealing with EDI connections to our logistics partner for the Export business. The entire message flow between Lindt and our partner should be via EDI. Our SAP release is (still) 4.6c.
    We will create two kinds of despatch advice messages, one for inbound deliveries and one for outbound deliveries for customers.
    I would appreciate your support in the following problem that I am facing with the inbound delivery scenario:
    We create stock transport orders (purchase orders, POs) for the goods intended to be delivered into the plant at our partner
    We create a delivery (type NL = replenishment delivery) for this POs
    As soon as we post the goods issue we send the despatch advice (as EANCOM D96A DESADV message) to our partner.
    At this point the delivery is basically completed, i.e. packing status (PS) and goods movement status (GM / GS) are equal to 'C' (= completed).
    Our logistics partner uses the same EDI message to send us the goods receipts data, e.g.:
    We dispatched 50 units of a product => QTY:50:12
    The partner received indeed 50 units => QVR:50:66
    Please note that we do not use the QVR segment for the quantity difference (between despatched and received quantity) but it contains the received units. This way we avoid negative values in the QVR segment.
    When the logistics partner sends back the DESADV message containing the received quantities (QVR segment) we want to make
    the goods receipts for the products in the original stock transport order and
    upate the message flow in the delivery
    My idea was to transform the incoming DESADV message into a WHSCON.DELVRY03 IDoc based on the documentation in: [Delivery Interface|http://help.sap.com/saphelp_crm40/helpdata/en/e2/654b15a9f411d184ec0000e81ddea0/content.htm]
    In the delivery header control E1EDL18 I used QUALF = 'PGI' (Post goods issue).
    I prepared an inbound WHSCON IDoc according to the documentation mentioned below. I managed to get some feedback from the Idoc processing implying that the system tried to do the goods receipt in the PO but failed.
    To make a long story short here are my questions:
    Can an inbound WHSCON IDoc used for doing both the goods receipt in the PO and the update of the message flow in the delivery?
    Does anybody have an example on how to fill the WHSCON IDoc?
    Or is my approach a cul-de-sac ?
    Kind Regards
       Uwe
    PS: A related question can be found here: Goods Receipt in PO AND Message Flow Update in Inb. Delivery using WMMBXY

    Hi Uwe,
    Can an inbound WHSCON IDoc used for doing both the goods receipt in the PO and the update of the message flow in the delivery?
    The binary answer would be no. You should use WMMBXY or MBGMCR instead.
    But if we are doing goods receipt against Inbound delivery then answer is YES with additionally E1EDL18-QUALF = 'PIC' populated. But please remember no partial receipt is possible against Inbound Delivery.
    We should populate E1EDL20-VBELN with our Inbound delivery number and line item info should go to E1EDL24.
    I have done a similar interface recently where we are doing receipt against Inbound delivery. But our case was a bit complex because we had to support against Inbound delivery. So we had to go for a custom solution on top of IDOC_INPUT_DELVRY.
    Hope this helps. Let me know if you have more questions.
    Regards,
    Rudra

  • Need ED for job work material

    Dear Sir,
    We have a scenario like, we are sending material to Vendor for job work and he is sending back the same material without adding any materials in it but he is collecting Excise Duty as well as service charge. Now for service charge I will rise service P.O and for excise duty I will rise ordinary P.O. but at the time of GRN and MIRO transaction material value should not flow, only Excise duty to be posted in MRO transaction. Please provide your suggestions.
    Thanks,
    Manoj

    Hi,
    Why is it necessary for you to pay excise duty. Subcontracting is exempt from Excise duty if the raw materials have been converted to finish materials and the same returned within 180 days. This requires the creation of a Subcontracting challan.
    The steps are as follows:
    ME21N- Create Subcontracting PO with Item category as "L" and provide BOM inside.
    MB1B  - Transfer posting components with respect to PO.
    J1IF01 - Create Subcontracting Challan
    MIGO  - Goods Receipt of Finish Material in 101 and consumption of components in 543 movement type.
    J1IFQ  - Reconciliation of Challan.
    J1IF13 - Completion of Challan.
    J1IFR  - Annexure IV Report
    MIRO  - Invoice for conversion charges(Service charges).
    Regards
    Binoy

  • Error while doing Goods receipt for process order. Error code: "BS027"

    I am getting error while doing GR for a day whereas previous day(s) GR is already done and also 2 days post that day are also done successfully.
    Error :  ""Goods receipt for prodn. order" is not allowed (ORD XX-CEMTSAL) " (XX = First two characters of plant code)
    Error code: BS027.
    Thanks to all in advance.

    Hello,
    This issue would occur when you want to post a confirmation for a production order. The error message is generated if you wanted to post a backflush for a component and if this component was assigned to a sales order stock. The sales order itself was assigned to a work breakdown structure element which should be debited with the actual costs. However, the business transaction 'Confirm' is not permitted for a work breakdown structure.
    Please look into SAP Note 62367 and 64370
    Hope the information is helpful
    regards

  • Goods receipt for inbound delivery

    Hi,
    I'm using idoc  DELVRY03 in order to post a goods issue. And It's working very well.
    I want to make a goods receipt for an inbound delivery using idoc DELVRY03. When I use this idoc for this (To make a goods receipt), my delivery can't be updated any more (Just like if the goods issue was done) and Its status are updated. And I can't to make the goods receipt manually. But the stock isn't updated, No item document is generated, and the quantity received is still equal to 0.
    Can any one please tell me if there is a special thing I need to do in order It works. And If It's not possible, to make the goods receipt using delvry03, what's the idoc type allowing to do this.
    Thanks in advance

    Hi
    Please try using idoc type DESADV01.
    Please award points if  you find this helpful
    rgds

  • Make goods receipt for the items w/difference after the proof of delivery

    Hello experts,
    I do like to know how finish the process of proof of delivery, when I does have items with differences over the quantities that arrived to my client. For example, one sales order for 20 units. I did the delivery note, and posted the goods issue. Then I did the Proof of Delivery, confirming 19 units and the deviation reasons, saving the document. Then I made my billing document for 19 units of material.
    The deviation reasons was a damage material, my questions is: How does make goods receipt for the items with difference over the quantities after the confirming of proof of delivery?
    Thanks in advance
    Edited by: Johnattan Company on Sep 8, 2009 3:45 PM
    Edited by: Johnattan Company on Sep 8, 2009 3:59 PM

    Hello Chetan,
    Thinking in the process, I have found a solution to do it. If the differences was caused by unknowing reasons, like stolen or whatever reasons and the material will not enter again in the warehouse, we donu2019t need to make any process.
    But if the causes was a broken material, a lapsed date expired or unknowing others reasons as a consequence the material will enter again in the warehouse; I have customized a returns order, and a returns item with the option not relevant for billing to conclude the process.
    Thanks for your help.

  • Goods receipt for import material

    Dear all,
    The excise tab does not appear during goods receipt of imported material. But when are doing the goods receipt for domestic material the tab does appear.
    Even after posting goods receipt and while trying to capture excise details in J1IEX i.e. incase of imports CVD, CVD-Ecess, CVD-HEcess and additional duty, the system asks for the invoice number and then throws a message that PO does not contain any selectable items. We have defined as separate pricing procedure for imports.Have maintained the material and vendor details in J1ID.
    Request to kindly suggest any settings that we need to check so that the excise tab appears for imported material also.
    regards,
    mahesh.

    Hi,
    Import Process: -
    1. ME21N - Create Import PO
    2. MIRO - Customs Invoice
    3. J1IEX - Capture Bill of Entry
    4. MIGO - Goods Receipt
    5. J1IEX - Post Bill of Entry
    6. MIRO - LIV for Vendor Invoice
    7. MIRO - LIV for Clearing Agent
    Following condition types to be used in MM Pricing.
    JCDB     IN:Basic Custom Duty
    JCV1     IN : CVD
    JECV     IN : Ed Cess on CVD
    J1CV     IN : H&SECess on CVD
    JEDB     IN : Ed Cess on BCD
    JSDB     IN : H&SECess on BCD
    JADC     Addnl Duty of Custom
    Mandatorily, use a Zero % Tax Code in Import PO.
    Import Duties will not come from J1ID, in J1ID only you have to mainatin material and Vendor (Customs Office and Import both) excise details.
    Above all, check the Excise Defaults for CVD conditions in SPRO > LO > Tax on Goods Movement > India > Basic Settings > Mainatin Excise Deafults

  • Call BAPI_GOODSMVT_CREATE to create a goods receipt for purchase order

    Hi,
    I'm calling the bapi BAPI_GOODSMVT_CREATE to create a goods receipt for purchase order, but the following code doesn't work. It doesn't give me any kind of error message but it does nothing as well...
    Can anyone help me please?
    Thank You
    Hugo
    Code
    DATA: wa_goodsmvt_header  LIKE bapi2017_gm_head_01,
                            wa_goodsmvt_code    LIKE bapi2017_gm_code,
                            wa_bapi2017_gm_head TYPE bapi2017_gm_head_ret-mat_doc.
                      DATA: it_goodsmvt_item LIKE bapi2017_gm_item_create OCCURS  0 WITH HEADER LINE,
                            it_return        LIKE bapiret2 OCCURS  0 WITH HEADER LINE.
                      wa_goodsmvt_header-pstng_date = SY-DATUM.
                      wa_goodsmvt_header-doc_date   = SY-DATUM.
                      wa_goodsmvt_header-ref_doc_no = '4500000020'.
                      wa_goodsmvt_code-gm_code = '01'.          "Goods receipt for purchase Order
                      it_goodsmvt_item-stge_loc  = 'BPF2'.
                      it_goodsmvt_item-move_type = '101' .
                      it_goodsmvt_item-entry_qnt = 17.
                      it_goodsmvt_item-entry_uom = 'KG'.
                      it_goodsmvt_item-mvt_ind   = 'B'.
                      it_goodsmvt_item-po_number = '4500000020'.
                      it_goodsmvt_item-po_item   = '00010'.
                      it_goodsmvt_item-material  = '50'.
                      APPEND it_goodsmvt_item.
                      CALL FUNCTION  'BAPI_GOODSMVT_CREATE'
                        EXPORTING
                          goodsmvt_header  = wa_goodsmvt_header
                          goodsmvt_code    = wa_goodsmvt_code
                        IMPORTING
                          materialdocument = wa_bapi2017_gm_head
                        TABLES
                          goodsmvt_item    = it_goodsmvt_item
                          return            = it_return.
                        data: begin of errmsg occurs 10.
                                include structure bapiret2.
                        data: end of errmsg.
                        data: wmenge like iseg-menge,
                              errflag.
                        clear errflag.
                        loop at errmsg.
                          if errmsg-type eq 'E'.
                            write:/'Error in function', errmsg-message.
                            errflag = 'X'.
                          else.
                            write:/ errmsg-message.
                          endif.
                        endloop.
                        if errflag is initial.
                          commit work and wait.
                          if sy-subrc ne 0.
                            write:/ 'Error in updating'.
                            exit.
                          else.
                            write:/ 'Ok'.
                          endif.
                        endif.
                        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
                        EXPORTING
                        wait = ' '.

    Hi,
    Thank you for the asnwer! I'm a rookie at ABAP so please forgive my stupid questions
    I've changed the code to:
    DATA: wa_goodsmvt_header  LIKE bapi2017_gm_head_01,
                            wa_goodsmvt_code    LIKE bapi2017_gm_code,
                            wa_bapi2017_gm_head TYPE bapi2017_gm_head_ret-mat_doc.
                      DATA: it_goodsmvt_item LIKE bapi2017_gm_item_create OCCURS  0 WITH HEADER LINE,
                            it_return        LIKE bapiret2 OCCURS  0 WITH HEADER LINE.
                      wa_goodsmvt_header-pstng_date = SY-DATUM.
                      wa_goodsmvt_header-doc_date   = SY-DATUM.
                      wa_goodsmvt_header-ref_doc_no = '4500000020'.
                      wa_goodsmvt_code-gm_code = '01'.          "Goods receipt for purchase Order
                      it_goodsmvt_item-plant     = 'BP01'.
                      it_goodsmvt_item-stge_loc  = 'BPF2'.
                      it_goodsmvt_item-move_type = '101' .
                      it_goodsmvt_item-entry_qnt = 10.
                      it_goodsmvt_item-entry_uom = 'KG'.
                      it_goodsmvt_item-mvt_ind   = 'B'.
                      it_goodsmvt_item-po_number = '4500000020'.
                      it_goodsmvt_item-po_item   = '10'.
                      it_goodsmvt_item-material  = '50'.
                      APPEND it_goodsmvt_item.
                      CALL FUNCTION  'BAPI_GOODSMVT_CREATE'
                        EXPORTING
                          goodsmvt_header  = wa_goodsmvt_header
                          goodsmvt_code    = wa_goodsmvt_code
                        IMPORTING
                          materialdocument = wa_bapi2017_gm_head
                        TABLES
                          goodsmvt_item    = it_goodsmvt_item
                          return            = it_return.
                          write:/ it_return-message.
    And the return message is : Material document data and PO data do not match (Material)
    Any idea of what might be the problem?
    Thanks

  • Movement type for a goods receipt for u201CRelease order for a PRqRel"

    There is an intercompany sales at our case. Plant B enters the customer order by VA01. The requirements rooting from the customer order are bought from plant A  by Plant B. u201CRelease order for a stock transfer requisitionu201D is created automatically by entering the customer order and later using the TCode MD02. By this way Plant A can see the reauirements fort he customer order at Plant B. For the test purposes, I want to make a goods receipt for the u201CRelease order for a stock transfer requisitionu201D. The receipr will be at the Plant A but the customer order is at the Plant B. By the way, I have to point out that Plant A and Plant B are assigned to different company codes. How can I make the goods receipt? I cannot use 561 E. Because customer order belongs to differen company code. I fact, production should be done for this aspect but I donu2019t have enough experience for producing the goods by myself. Which movement type should I use for making a goods receipt for the u201CRelease order for a stock transfer requisitionu201D at Plant A?
    Thanks in advance fort he answersu2026

    Hi,
    This is controlled by the schedule line category In VOV6.
    Just check which category is used in your scenarion and change the movement type here. (I think your entry is NC)
    They are determined by the item category and MRP type in SPRO - SD > Sales > Sales Documents > Schedule lines
    Steve B

  • Problem for Goods Receipt for Subcontracting Purchase Order

    Dear all,
    Presently, we are using SAP version 4.6C and we need to introduce GR for
    Subcontracting Purchase Order. We have developed a ABAP program to handle
    subcon Goods Receipt by uploading flat-files from our subcontractor. The
    scenario is as follows :
    Goods Receipt for Subcontracting Purchase Order
    1. In the ABAP program, function BAPI_GOODSMVT_CREATE will be used for goods
    movement.
    2. Data provided to the function are as follows :
    - Posting date
    - Document date
    - Material number
    - Plant
    - Storage location
    - Batch
    - Movement type (101)
    - Quantity
    - Purchase order number
    - Purchase order item
    - Movement indicator (B - Goods receipt for purchase order)
    3. The function will do data verification and automatically determine GI
    item for subcon stock:
    - Movement type (543)
    - Special stock (O - parts prov. vendor)
    - Material
    - Quantity
    - Plant
    Our problem is that :
    Only the GR item in the interface is to be transferred and the GI item is
    determined by the system. So, the quantity for subcon stock cannot be
    changed using this BAPI. Then the system will continue processing the goods
    receipt and create material document.
    Manually, by using transaction code MIGO, the user can display the subcon
    stock data and then change the quantity.
    By using transaction code MB01, after the user fills in all the GR fields,
    the system comes to line item 002 (subcon stock data) and then quantity can
    be changed.
    As per user requirement, quantity for GI item must be same with the quantity
    that has been transferred to subcon vendor in Delivery for Subcon
    (transaction code VL02N).
    We cannot achieve this requirement by using the BAPI mentioned above. Would
    appreciate any valuable help from anyone who is able to help us on this
    matter. Are there any other BAPI's that can help us to achieve the same
    result ?
    Thank you in advance and best regards.

    As far as i understood the problem I suggest u to create the
    BDC according to user actions that are performed in he manual
    operation.
    I can't say that the BAPI performs the exac solution what you want.
    I have done some BDC work using MB01 and suggest you to be careful
    and try to keep the complete in the logic as some chages in rows in BDC will
    change the complete scenario.And throw correct quantity val in correct
    material
    row.
    This methodology will help u even in mass uploads.
    Or in case of automation u can perform the call transaction BDC in
    background mode.
    so As per my understanding bdc program is the solution. pls try and let me
    know.

  • Goods receipt for subcontracting order! BAPI_GOODSMVT_CREATE

    I wanna use BAPI "BAPI_GOODSMVT_CREATE"  to create goods receipt for subcontracting order.
    But it says that this combination is not possible.  Combination of my movement type and this BAPI.
    What can i do to solve it?
    thanks in advance.

    >
    Julia Nikiforva wrote:
    > I wanna use BAPI "BAPI_GOODSMVT_CREATE"  to create goods receipt for subcontracting order.
    > But it says that this combination is not possible.  Combination of my movement type and this BAPI.
    >
    > What can i do to solve it?
    >
    > thanks in advance.
    Might work
    report zbapi_goodsmovement.
    parameters: p-file like rlgrap-filename default
    'c:\sapdata\TEST.txt'.
    parameters: e-file like rlgrap-filename default
    'c:\sapdata\gdsmvterror.txt'.
    parameters: xpost like sy-datum default sy-datum.
    data: begin of gmhead.
    include structure bapi2017_gm_head_01.
    data: end of gmhead.
    data: begin of gmcode.
    include structure bapi2017_gm_code.
    data: end of gmcode.
    data: begin of mthead.
    include structure bapi2017_gm_head_ret.
    data: end of mthead.
    data: begin of itab occurs 100.
    include structure bapi2017_gm_item_create.
    data: end of itab.
    data: begin of errmsg occurs 10.
    include structure bapiret2.
    data: end of errmsg.
    data: wmenge like iseg-menge,
    errflag.
    data: begin of pcitab occurs 100,
    ext_doc(10), "External Document Number
    mvt_type(3), "Movement Type
    doc_date(8), "Document Date
    post_date(8), "Posting Date
    plant(4), "Plant
    material(18), "Material Number
    qty(13), "Quantity
    recv_loc(4), "Receiving Location
    issue_loc(4), "Issuing Location
    pur_doc(10), "Purchase Document No
    po_item(3), "Purchase Document Item No
    del_no(10), "Delivery Purchase Order Number
    del_item(3), "Delivery Item
    prod_doc(10), "Production Document No
    scrap_reason(10), "Scrap Reason
    upd_sta(1), "Update Status
    end of pcitab.
    call function 'WS_UPLOAD'
    exporting
    filename = p-file
    filetype = 'DAT'
    IMPORTING
    FILELENGTH =
    tables
    data_tab = pcitab
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_READ_ERROR = 2
    NO_BATCH = 3
    GUI_REFUSE_FILETRANSFER = 4
    INVALID_TYPE = 5
    OTHERS = 6
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    exit.
    endif.
    gmhead-pstng_date = sy-datum.
    gmhead-doc_date = sy-datum.
    gmhead-pr_uname = sy-uname.
    gmcode-gm_code = '01'. "01 - MB01 - Goods Receipts for Purchase Order
    loop at pcitab.
    itab-move_type = pcitab-mvt_type.
    itab-mvt_ind = 'B'.
    itab-plant = pcitab-plant.
    itab-material = pcitab-material.
    itab-entry_qnt = pcitab-qty.
    itab-move_stloc = pcitab-recv_loc.
    itab-stge_loc = pcitab-issue_loc.
    itab-po_number = pcitab-pur_doc.
    itab-po_item = pcitab-po_item.
    concatenate pcitab-del_no pcitab-del_item into itab-item_text.
    itab-move_reas = pcitab-scrap_reason.
    append itab.
    endloop.
    loop at itab.
    write:/ itab-material, itab-plant, itab-stge_loc,
    itab-move_type, itab-entry_qnt, itab-entry_uom,
    itab-entry_uom_iso, itab-po_number, itab-po_item,
    pcitab-ext_doc.
    endloop.
    call function 'BAPI_GOODSMVT_CREATE'
    exporting
    goodsmvt_header = gmhead
    goodsmvt_code = gmcode
    TESTRUN = ' '
    IMPORTING
    goodsmvt_headret = mthead
    MATERIALDOCUMENT =
    MATDOCUMENTYEAR =
    tables
    goodsmvt_item = itab
    GOODSMVT_SERIALNUMBER =
    return = errmsg
    clear errflag.
    loop at errmsg.
    if errmsg-type eq 'E'.
    write:/'Error in function', errmsg-message.
    errflag = 'X'.
    else.
    write:/ errmsg-message.
    endif.
    endloop.
    if errflag is initial.
    commit work and wait.
    if sy-subrc ne 0.
    write:/ 'Error in updating'.
    exit.
    else.
    write:/ mthead-mat_doc, mthead-doc_year.
    perform upd_sta.
    endif.
    endif.
    FORM UPD_STA *
    form upd_sta.
    loop at pcitab.
    pcitab-upd_sta = 'X'.
    modify pcitab.
    endloop.
    call function 'WS_DOWNLOAD'
    exporting
    filename = p-file
    filetype = 'DAT'
    IMPORTING
    FILELENGTH =
    tables
    data_tab = pcitab
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_READ_ERROR = 2
    NO_BATCH = 3
    GUI_REFUSE_FILETRANSFER = 4
    INVALID_TYPE = 5
    OTHERS = 6
    endform.

Maybe you are looking for