Revenue po,GR/IR clearing in migo

Dear Sir,
As per my client they do manual entry of base value ,BED and ECS in excise item in Migo.
They want the same base value to be captured at Gr/IR in FI documents.
In all the other material documents its happening this way..only in one material document is is deducting the BED ,ECS and Vat value and then appearing in Gr/Ir clearing.
Pls anyone can suggest why this can happen and how to avoid this.
Thanks

Dear Sir,
Both of you are correct,MRP indicator is ticked and this is a Deal;er scenario.
Please note:-
in one PO
base value is XXX and the same is reflecting in the Gr/Ir clearing in FI documents in MIGO
here tax code is vat 14%...still there is no deductions for GR/IR
Another PO
Base Value is YYY but it is showing the value at Gr/Ir as YYY-(BEDECSSces+Vat 5%)
here tax code is vat 5%...still there is deduction of (BEDECSSces+Vat 5%
I have also checked that MRP details of the materails taken in the PO
For 1st PO MRP1 is not mainatianed and for the second PO MRP 1 is maintained and that could be the reason for this defference.
So I tried testing in,I created the PO of the material without maintaining MRP1 is material master to there was no deduction,when I maintained the MRP1 details it was showing deduction...
BUt now Only one issue:-when I maintain MRP1 deductions are happening but not for the VAT..so can anyone advise from where is the system picking this VAT 5% deduction in GR/IR clearing.
KIndly help.
Thanks

Similar Messages

  • Profit center at GR IR Clearing Account - MIGO (Account Assignment Q)

    Dear all,
    We are implementing SAP into a Real estate business client and based on requirements from the Finance we have agreed to have profit centre level balance sheet for each of tower
    Hence lets take an example
    There is a project with PC1 (Common Costs) and 3 buildings (PC2, PC3 and PC4 for each building). We have one plant for one project and hence in material master plant is given as PC1.
    If we procure Raw materials specific to each building (account assignment Q) with WBS element of tower one and PC2 defined in account assignment of WBS master data, below is the mentioned entry which I am getting
    Inventory A/c Dr. PC2
    Clearing A/c Dr. PC1
              To GR IR Clearing PC1
               To Clearing A/c     PC2
    Profit center document splitting and zero balancing is active in my scenario
    My issue is that GR IR Clearing should not take profit center from MM master, however it should override profit center of WBS element if procurement is done with account assignment Q
    Request you to give your thoughts
    Thanks
    Nishu

    Hi Kavita,
    The purpose of creating profit center for each tower was to identify vendors / customers balance from Finance through profit center reporting
    As mentioned in above scenario it does not makes sense to have inventory at tower profit center and GR / IR or vendor at HO Profit center
    Any method available with which we can bypass material master profit center through document splitting or account assignment setting in material master.
    My MM team is also working on it and they are not keen to have one plant for one profit center. Hence we are looking to find a workaround for the above situation
    Thanks
    Nishu

  • MIGO receiving not being cleared

    Hello,
    We are receiving items against MIGO (101) and we are checking each item as received. However the items are not being removed from the MIGO when we re-enter the purchase order. The items are showing as received but not cleared from MIGO. I vaguely remember having to check some boxes in MM02 but I don't remember exactly where. Please help.

    If anyone runs into this problem, it is the driver. You need to install the latest driver from Zebra. I had the same problem. After I installed the driver, the problem disappeared. Hopefully this will save you a lot of time.

  • Changing GL Code for "Clring Account Revenue from Asst Sale" (TCode: AO90)

    Dear Experts,
    We have a requirement to change "Clearing Account Revenue from Asset Sale" from currently used GL Account (Eg; 22840020) with another GL account (Eg; 22840022).  Both these GL Accounts are Balance Sheet Accounts. We have created required GL Account in desired conpany codes.
    When we try to change respective GL Account in T-Code: AO90 (Balance Sheet Accounts) we get below message with green colour message type:
    "Account "22840022" not allowed to be Balance sheet account"
    "Account "22840019" not defined as P22840019L account"
    (There are no red colour message type)
    Please help. Should we go ahead with the change? Will there be any risk involved in doing so? Is there any other prereqisite to be followed?
    - Nilesh

    Dear Atif,
    Thanks A lot for explanation.
    Though fundamentaly it is right what you are saying, Our Client is using Balance Sheet Account 22840020 since many years as "Revenue from Asset Sale Clearing Account". Now they want to replace this GL Code with 22840022 (Balance Sheet Account). With previous GL Code there were no problems. And message given by system is relevant to what you are saying, but it is not an error message.
    What I understand is, they are sufficing their requirement with Balance sheet account. So after replacing GL Code with B/S account there should not be any problem.
    They do the retirement without customer and sale is not on credit basis also.
    Please suggest for more clarity.
    Thanks in Advance.
    - Nilesh

  • How to deal with unknown costs & load on the material

    Hi,
    I have asked similar question a many times but so far not have got any satisfying suggestion to this.Here I am putting it again.
    This is a Intercompany scenario.
    ICT PO is raised and subsequently Delivery/picking-pgi done.
    Then Billing is done and goods are sent to the receiving location of another company code.
    This transfer of goods involve some 2-3 types of delivery costs which are not known till the goods are received by the receiving location .
    Many a times what happens is that goods are dispatched to the receiving location by clubbing the number of POs.It could be possible that user clubs some 20-30 POs and send the goods against them in one container.
    The problem which the receiving location faces is how to book these additional delivery costs on the material at the time of GR as they(users) only know these costs when they receive invoices from the local vendors for the resepective expenses.
    Even if they decide to change PO before they do GR it is not possible or becomes very difficult for the user to split the total additional delivery costs and distribute in all the 30 POs(assume he is receiving goods against all 30 POs in one container).
    Is there any best way to handle this scenario ?
    I am sure this is a typical requirement & it must be happening in most of the industries.
    Even for a single PO, how the additional cost can be distributed based on PO value.
    All these additional costs should be loaded on to material while GR.
    Please suggest
    Thanks in advance
    Regards,
    BM

    hi arjman!
       1) You do MIGO for all the purchase order in one document
    enter the PO no and execute
    *again without saving the document enter the next PO no and execute
    *continously do this for all PO's
    *now post the docu - only one material document is created.
    2) * Now you post the invoice in MIRO by entering the first PO and execute.
    Without saving go to the arrow symbol next to the place where you enter the PO no.
    There u enter all other PO no's and execute.
    Now all the PO's cleared in migo will get in the same invoice document. Still dont save the document.
    3) Now the you have to map the cost which have incurred during GR. These costs are called as UNPLANNED COSTS.
    These upc are entered collectively in the header data in the Detail field of the MIRO document.
    You can set how you can post this unplanned costs -- whether to post in Material account or in separate GL a/c. For this you do settings in IMG>MATERIAL MANAGEMENT>LOGISTIC INVOICE VERIFICATION>INCOMING INVOICE>CONFIGURE HOW UPDC IS POSTED.
    Thata it.
    reward if useful.
    yuvi.

  • Customer GL Account Updates by Creating a Sales Order

    Dear all,
    I would like to know detailed information about customer GL Account updates based on Sales Order creation.
    We have a POS system, there we are creating Sales Orders for the customers.
    As per my knowledge by creating a sales order system is performing the following jobs.
    Debiting Customer Account
    Crediting Sales Account.
    Please suggest me that my understanding is right or not.
    What else job is performed with regards to financial accounts for the customer.
    Where can I see these updations at each level starting from Sales Order creation, Delivery and Invoice.
    Please educate to get a clear idea of the process. your suggestions will be highly appreciated.
    Thank you
    Raghu Ram

    Hi,
    there will no accounting entry at sales order creation.
    Here is the sd cycle:
    sales order no accounting effect
    goods deleivery to customer
    COGS a/c dr
    to stock
    Billing to customer
    customer a/c dr
    to sales revenue
    Hope this is clear
    pls assign points if it was
    Thanks
    Vamsi

  • Mail report spool as an attachment in a background job :)

    Hi all,
    I am trying to write a BDC for some transaction .The program runs in background .So it genertaes the spool . Now I want to mail the whole spool as an attachment . I have tried in many ways but in vain . Even the previous posts in this forum did not help much .
    <b>Two quoestions for whch I couldnt find answers are :
    How do I capture the spool ?
    How do I make an attachment with the contents of the spool ?</b>
    Can anyone please help me out with suggestions to work out this process ?
    Regards,
    Vijay . .

    hi
    check the following code. recetly i worked on the same scenario.
    *& Report ZGL0080 *
    report zgl0080 "FI DOCUMENT POSTING INTERFACE
    no standard page heading
    line-size 160. "120.
    Program Name : ZGL0080
    Program Title : FI DOCUMENT POSTING INTERFACE
    Copied from : N/A
    Release : ecc 5.0
    Module : FI
    Description : This program will read the data (given in the
    required format) either from the frontend or from
    the server and will post the FI document using
    that data.
    Authority Check : Auhority Check for Reading the Input Data File on
    the Server is done.
    Note : Ensure the 'Do not copy tax code' option in the Editing option
    is marked.
    Modification History
    Mod.
    Date Code Changed by Description
    ddmmyy M001
    I N C L U D E P R O G R A M S *
    include zglp001.
    include rsbdcil3.
    data: v_vbund(6) type c.
    Copy from RSBDC_PROTOCOL
    data: begin of bdclm occurs 0.
    include structure bdclm.
    data: counter type i,
    longtext type bdc_mpar,
    end of bdclm.
    data: save_mpar type bdc_mpar.
    data:
    digits(10) type c value '0123456789',
    mtext(124) type c, "Messagetext
    mtext1(124) type c, "Messagetext
    mtext2(273) type c, "Messagetext
    do_condense type c,
    mtvaroff type i,
    parcnt type i,
    mparcnt type i,
    x(1) type c value 'X'.
    data: "Aufbereitung Messagetext
    begin of mttab occurs 4,
    off(02) type n,
    len(02) type n,
    text(80),
    end of mttab.
    data: "ParameterAufbereitung
    begin of par,
    len(02) type n,
    text(254),
    end of par.
    field-symbols:
    End of Copy from RSBDC_PROTOCOL
    TYPE GROUPS *
    type-pools: slis,
    sabc.
    T A B L E S *
    tables: bbkpf, "Doc Header for Accntng Document (Batch Input Structure)
            bbseg, "Accounting Document Segment (Batch Input Structure)
            bwith, "Document-withholding tax info (batch input structure)
            bbtax, "Document Taxes (Batch Input Structure)
            ztif_file,"Interface Data Filenames
            t100, "Messages
            t003,"Document Types
            t041c, "Reasons for Reverse Posting
            t007a,"Tax Keys
            t036,"Planning levels
            t880, "trading partner
            ztifpr, "interface files that are processed
            t856, "consolidation transaction types
            tka02."Controlling area assignment
    S E L E C T I O N S C R E E N *
    selection-screen begin of block b1 with frame title text-105."Parameters
    PC Filename
    selection-screen begin of line.
    parameters: p_rpfile radiobutton group rgp default 'X'.
    selection-screen comment 6(40) text-p01 for field p_rpfile.
    selection-screen position 47.
    parameters: p_pfile like rlgrap-filename
    default 'c:     emp ipost.txt'.
    selection-screen end of line.
    PC File format in tab delimited format
    selection-screen begin of line.
    selection-screen position 3.
    parameters: p_pctab radiobutton group rgp2 default 'X'.
    selection-screen comment 5(20) text-p10 for field p_pctab.
    PC File format in comma delimited format (csv)
    selection-screen position 27.
    parameters: p_pccsv radiobutton group rgp2.
    selection-screen comment 29(20) text-p18 for field p_pccsv.
    PC File format in fixed length format
    selection-screen position 51.
    parameters: p_pcfix radiobutton group rgp2.
    selection-screen comment 53(20) text-p11 for field p_pcfix.
    selection-screen end of line.
    selection-screen skip.
    Read from interface directory <NFS>
    selection-screen begin of line.
    parameters:p_rnfile radiobutton group rgp. "File on the Server
    selection-screen comment 5(40) text-p19 for field p_rnfile.
    *selection-screen position 47.
    *parameters: p_nffile type c length 98 lower case
    default '/usr/sap/XXX/int/XXX/in'.
    selection-screen end of line.
    Interface file in Directory
    selection-screen begin of line.
    selection-screen comment 3(43) text-p20.
    selection-screen position 47.
    parameters: p_nffile type c length 90 lower case
    default 'leave blank!!!'.
    default '/usr/sap/CRD/interface/FMS/'.
    default '/sapdata/interface/as400/'.
    selection-screen end of line.
    selection-screen skip.
    Server Filename
    selection-screen begin of line.
    parameters:p_rsfile radiobutton group rgp. "File on the Server
    **parameters:p_rsfile(1) type c no-display.
    selection-screen comment 5(40) text-p02 for field p_rsfile.
    selection-screen position 47.
    parameters: p_sfile type c length 98 lower case
    default 'fipost.txt'.
    default 'fipost.txt' no-display.
    selection-screen end of line.
    Server File Input Directory
    selection-screen begin of line.
    selection-screen comment 3(40) text-p03.
    selection-screen position 47.
    parameters: p_sdir type c length 40 lower case"OBLIGATORY
    default '/usr/sap/SYSID/interface/xxx/in/'.
    default '/usr/sap/CRD/interface/FMS/'.
    default '/sapdata/interface/as400/'.
    selection-screen end of line.
    Server File Output Directory
    selection-screen begin of line.
    selection-screen comment 3(40) text-p04.
    selection-screen position 47.
    parameters: p_sdiro type c length 40 lower case"OBLIGATORY
    default '/usr/sap/SYSID/interface/xxx/out/'.
    default '/sapdata/interface/as400/'.
    selection-screen end of line.
    Name of Batch input session
    selection-screen begin of line.
    selection-screen comment 3(40) text-p13.
    selection-screen position 47.
    parameters: p_group(9) default 'FIPOST' obligatory.
    selection-screen end of line.
    remove trading partner value if GL account is NOT found in table ZTGL003
    selection-screen skip.
    parameters: p_tdpr as checkbox default 'X'.
    Keep Server File after processed
    *selection-screen begin of line.
    *selection-screen position 3.
    parameters: p_keep as checkbox default 'X'.
    parameters: p_keep default ' ' no-display.
    *selection-screen comment 6(40) text-p09 for field p_keep.
    *selection-screen end of line.
    selection-screen skip.
    Daily Files from table
    selection-screen begin of line.
    parameters: p_rdfile radiobutton group rgp.
    parameters: p_rdfile no-display.
    selection-screen comment 3(40) text-p05 for field p_rdfile.
    selection-screen end of line.
    selection-screen skip.
    selection-screen skip.
    Weekly Files from table
    selection-screen comment 3(40) text-p06.
    selection-screen begin of line.
    parameters: p_rw1f radiobutton group rgp.
    parameters: p_rw1f no-display.
    selection-screen comment 5(10) text-pw1 for field p_rw1f.
    selection-screen position 17.
    parameters: p_rw2f radiobutton group rgp.
    parameters: p_rw2f no-display.
    selection-screen comment 19(10) text-pw2 for field p_rw2f.
    selection-screen position 31.
    parameters: p_rw3f radiobutton group rgp.
    parameters: p_rw3f no-display.
    selection-screen comment 33(10) text-pw3 for field p_rw3f.
    selection-screen position 45.
    parameters: p_rw4f radiobutton group rgp.
    parameters: p_rw4f no-display.
    selection-screen comment 47(10) text-pw4 for field p_rw4f.
    selection-screen position 59.
    parameters: p_rw5f radiobutton group rgp.
    parameters: p_rw5f no-display.
    selection-screen comment 61(10) text-pw5 for field p_rw5f.
    selection-screen end of line.
    selection-screen begin of line.
    parameters: p_rw6f radiobutton group rgp.
    parameters: p_rw6f no-display.
    selection-screen comment 5(10) text-pw6 for field p_rw6f.
    selection-screen position 17.
    parameters: p_rw7f radiobutton group rgp.
    parameters: p_rw7f no-display.
    selection-screen comment 19(10) text-pw7 for field p_rw7f.
    selection-screen end of line.
    selection-screen skip.
    selection-screen skip.
    Monthly Files from table
    selection-screen comment 3(40) text-p07.
    selection-screen begin of line.
    parameters: p_rm1f radiobutton group rgp.
    parameters: p_rm1f no-display.
    selection-screen comment 5(15) text-pm1 for field p_rm1f.
    selection-screen position 21.
    parameters: p_rm4f radiobutton group rgp.
    parameters: p_rm4f no-display.
    selection-screen comment 23(15) text-pm4 for field p_rm4f.
    selection-screen end of line.
    selection-screen skip.
    Yearly Files from table
    selection-screen begin of line.
    parameters: p_ryfile radiobutton group rgp.
    parameters: p_ryfile no-display.
    selection-screen comment 3(40) text-p08 for field p_ryfile.
    selection-screen end of line.
    Single Files from table
    selection-screen begin of line.
    parameters: p_rafile radiobutton group rgp.
    parameters: p_rafile no-display.
    selection-screen comment 3(40) text-p12 for field p_rafile.
    selection-screen position 47.
    parameters: p_fileno like ztif_file-fileno.
    parameters: p_fileno no-display.
    matchcode object zsh_if_file.
    selection-screen end of line.
    selection-screen end of block b1.
    Batch Input Parameters
    selection-screen begin of block b2 with frame title text-119.
    selection-screen begin of line.
    selection-screen comment 1(40) text-p15. "Data Transfer Mode
    selection-screen end of line.
    Posting via batch mode
    selection-screen begin of line.
    parameters: p_rmodeb radiobutton group rgp3 default 'X'.
    selection-screen comment 3(25) text-p16 for field p_rmodeb.
    Direct posting
    selection-screen position 29.
    parameters: p_rmodec radiobutton group rgp3.
    selection-screen comment 31(25) text-p17 for field p_rmodec.
    selection-screen end of line.
    parameters: p_mode like ctu_params-dismode default 'N'.
    selection-screen skip.
    parameters: p_test as checkbox default 'X'. "Test Run
    selection-screen end of block b2.
    D A T A D E C L A R A T I O N *
    constants: c_fb01 like bbkpf-tcode value 'FB01',
    c_fbv1 like bbkpf-tcode value 'FBV1',
    c_fbb1 like bbkpf-tcode value 'FBB1',
    c_fbs1 like bbkpf-tcode value 'FBS1'.
    constants: c_daily value 'D',
    c_weekly value 'W',
    c_monthly value 'M',
    c_yearly value 'Y',
    c_filelength type i value 128,
    no_data value '/', "no data character
    c_server_tmp_path type string
    value '/usr/sap/interface/tmp/',
    c_error value 'E',
    c_success value 'S'.
    data: c_server_tmp_path type string
    value '/usr/sap/CRD/interface/fms/out/'.
    data: t_rawfile(1000) occurs 0 with header line,
    t_errfile(1000) occurs 0 with header line.
    data: begin of g_file_hdr_rec,
    stype type bbkpf-stype,"Batch Input Interface Record Type
    tcode type bbkpf-tcode,"Transaction Code
    bldat type bbkpf-bldat,"Document Date (batch input)
    blart type bbkpf-blart,"Document type
    bukrs type bbkpf-bukrs,"Company Code
    budat type bbkpf-budat,"Posting Date (batch input)
    waers type bbkpf-waers,"Currency Key
    kursf type bbkpf-kursf,"Exchange Rate Direct Quotation
    xblnr type bbkpf-xblnr,"Reference Document Number
    bktxt type bbkpf-bktxt,"Document Header Text
    vbund type bbkpf-vbund,"Company ID of Trading Partner
    stodt type bbkpf-stodt,"Reversal Posting Date (batch input)
    stgrd type bbkpf-stgrd,"Reason for Reversal
    end of g_file_hdr_rec.
    data: begin of g_file_item_rec,
    stype type bbseg-stype,"Batch Input Interface Record Type
    newbs type bbseg-newbs,"Posting Key for the Next Line Item
    newko type bbseg-newko,"Account or Matchcode for Next Line Item
    wrbtr type bbseg-wrbtr,"Amount in document currency
    dmbtr type bbseg-dmbtr,"Amount in local currency
    fwbas type bbseg-fwbas, "Tax Base Amount in Document Currency
    hwbas type bbseg-hwbas, "Tax Base Amount in Local Currency
    mwskz type bbseg-mwskz,"Tax on Sales/Purchases Code
    zuonr type bbseg-zuonr,"Assignment number
    sgtxt type bbseg-sgtxt,"Item Text
    fdlev type bbseg-fdlev,"Planning level
    zfbdt type bbseg-zfbdt,"Baseline Date
    zterm type bbseg-zterm,"Terms of payment key
    zlsch type bbseg-zlsch,"Payment Method
    zlspr type bbseg-zlspr,"Payment Block Key
    qsskz_i type bbseg-qsskz,"Withholding Tax Code for Invoice
    qsskz_p type bbseg-qsskz,"Withholding Tax Code for Payment
    kostl type bbseg-kostl,"Cost Center
    aufnr type bbseg-aufnr,"Order Number
    prctr type bbseg-prctr,"Profit Center
    vbund type bbseg-vbund,"Company ID of Trading Partner
    newum like bbseg-newum, "Spl G/L Indicator for Next Line Item
    newbw like bbseg-newbw, "asset transaction type
    gsber like bbseg-gsber, "business area
    hbkid like bbseg-hbkid, "house bank
    for extended withholding tax at invoice
    witht_i like bwith-witht, "withhold tax type
    wt_qsshb_i like bwith-wt_qsshb, "withhold tax base amt in Doc Curry
    wt_qsshh_i like bwith-wt_qsshh, "withhold tax base amt in Loc Curry
    wt_qbuihb_i like bwith-wt_qbuihb, "withholding tax amt in Doc Curry
    wt_qbuihh_i like bwith-wt_qbuihh, "withholding tax amt in Loc Curry
    for extended withholding tax at payment
    witht_p like bwith-witht, "withhold tax type
    wt_qsshb_p like bwith-wt_qsshb, "withhold tax base amt in Doc Curry
    wt_qsshh_p like bwith-wt_qsshh, "withhold tax base amt in Loc Curry
    wt_qbuihb_p like bwith-wt_qbuihb, "withholding tax amt in Doc Curry
    wt_qbuihh_p like bwith-wt_qbuihh, "withholding tax amt in Loc Curry
    valut like bbseg-valut, "value date
    bewar like bbseg-bewar, "consolidation transaction type
    end of g_file_item_rec.
    data: begin of t_doc_hdr occurs 1,
    file_row_no type i,
    runno(10).
    include structure g_file_hdr_rec.
    data: hwaer like bkpf-hwaer.
    data: end of t_doc_hdr.
    data: begin of t_doc_item occurs 1,
    file_row_no type i,
    runno(10),
    item_no type i.
    include structure g_file_item_rec.
    data: rke_prctr like bbseg-rke_prctr,
    katyp like cskb-katyp,
    end of t_doc_item.
    data: t_bidoc_hdr like t_doc_hdr occurs 1 with header line,
    t_bidoc_item like t_doc_item occurs 1 with header line.
    data: t_errdoc_hdr like t_doc_hdr occurs 1 with header line,
    t_errdoc_item like t_doc_item occurs 1 with header line.
    data: t_datafile type string occurs 1 with header line.
    data: t_abaplist like abaplist occurs 0 with header line,
    t_asciilist like solisti1 occurs 0 with header line.
    data: g_server_file like ibipparms-path,
    g_server_tmp_file like ibipparms-path,
    g_server_prc_file like ibipparms-path,
    g_server_err_file like ibipparms-path.
    data: g_doc_hdr_err,
    g_doc_item_err,
    g_doc_hdr_read_cnt type i,
    g_doc_item_read_cnt type i,
    g_total_rec_read_cnt type i.
    data: g_doc_check type i,
    g_doc_posted type i,
    g_doc_error type i.
    data: g_title2 like sy-title.
    data: g_session_name like bgr00-group,
    g_bdc_prog_name like sy-repid value 'RFBIBL01'.
    data: g_start_time like sy-uzeit,
    g_end_time like sy-uzeit.
    data: g_prog_call_mode.
    data: g_job_error. "To indicate overall job is success
    data: gztifpr type ztifpr,
    g_housekeep_stat(1) type c.
    data: subrc_file like sy-subrc,
    i_listfile LIKE BTCXPM OCCURS 0 WITH HEADER LINE.
    data: fname LIKE RLGRAP-FILENAME.
    constants: cmd_listfile LIKE SXPGCOLIST-NAME VALUE 'ZLIST_FILE',
    opt_listfile LIKE SXPGCOLIST-PARAMETERS VALUE '$file'.
    ranges: r_tcode for bbkpf-tcode.
    A T S E L E C T I O N - S C R E E N *
    *checking for the blank entry in the file name field
    at selection-screen.
    if p_rpfile = 'X' and p_rsfile = 'X'. "this occurs during submit program again
    clear p_rpfile. "hence has to reset p_rpfile as this is default to X.
    elseif p_rnfile = 'X' and p_rsfile = 'X'.
    clear p_rnfile.
    endif.
    if p_rpfile = 'X'.
    if p_pfile is initial.
    message e398(00) with 'Enter PC filename'.
    endif.
    else.
    if p_sfile is initial.
    message e398(00) with 'Enter Server filename'.
    endif.
    if p_sdir is initial.
    message e398(00) with 'Enter Server input directory'.
    endif.
    if p_rafile = 'X' and p_fileno is initial.
    message e398(00) with 'Enter file no in table'.
    endif.
    endif.
    *getting the value of the frontend filename field
    at selection-screen on value-request for p_pfile.
    call function 'F4_FILENAME'
    EXPORTING
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    IMPORTING
    file_name = p_pfile.
    at selection-screen on value-request for p_fileno.
    perform f4_help_on_p_fileno.
    TOP-OF-PAGE *
    top-of-page.
    perform page_header using t_doc_hdr-bukrs sy-title g_title2.
    S T A R T O F D A T A S E L E C T I O N *
    start-of-selection.
    if p_test is initial.
    g_title2 = '(Actual run)'.
    else.
    g_title2 = '(Test run)'.
    endif.
    g_job_error = 'N'.
    concatenate '/usr/sap/' sy-sysid '/interface/temp/' into c_server_tmp_path.
    perform write_start_message_log.
    if p_rnfile = 'X'. "read from interface directory
    perform submit_files_fr_interface_dir.
    perform write_end_message_log.
    concatenate p_group 'Overview' into p_sfile
    separated by space.
    perform send_mail_to_user.
    stop.
    endif.
    if p_rdfile = 'X' or
    p_rw1f = 'X' or p_rw2f = 'X' or p_rw3f = 'X' or p_rw4f = 'X' or
    p_rw5f = 'X' or p_rw6f = 'X' or p_rw7f = 'X' or
    p_rm1f = 'X' or p_rm4f = 'X' or p_ryfile = 'X' .
    perform submit_multiple_files.
    perform write_end_message_log.
    stop.
    endif.
    if p_rpfile = 'X' and sy-batch = 'X'.
    write: at /3 'PC file cannot be uploaded using background mode'.
    perform stop_processing.
    elseif p_rpfile = 'X'.
    perform read_pc_file.
    elseif p_rsfile = 'X'.
    perform read_server_file.
    elseif p_rafile = 'X'.
    perform read_single_job_file.
    endif.
    perform validate_file_data.
    clear g_housekeep_stat.
    if p_test is initial and g_job_error = 'N'.
    perform post_data.
    endif.
    if p_test is initial and g_job_error <> 'N'.
    perform file_housekeep.
    endif.
    perform write_end_message_log.
    perform send_mail_to_user.
    end-of-selection.
    S U B - R O U T I N E S *
    *& Form get_internal_format
    Convert number fields to prefix with '0'
    form get_internal_format changing p_runno type c."LIKE itab_head-runno.
    call function 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = p_runno
    IMPORTING
    output = p_runno.
    endform. " get_internal_format
    *& Form build_data_file
    Prepare internal table to format into structure for FI posting
    form build_data_file.
    data: t_bgr00 like bgr00.
    data: begin of t_bbkpf occurs 0,
    runno(10).
    include structure bbkpf.
    data: end of t_bbkpf.
    data: begin of t_bbseg occurs 0,
    runno(10).
    include structure bbseg.
    data: end of t_bbseg.
    data: begin of t_bwith occurs 0,
    runno(10).
    include structure bwith.
    data: end of t_bwith.
    data: begin of t_bbtax occurs 0,
    runno(10).
    include structure bbtax.
    data: end of t_bbtax.
    data: s_bbkpf like dfies occurs 0 with header line.
    data: s_bbseg like dfies occurs 0 with header line.
    data: s_bbtax like dfies occurs 0 with header line.
    data: s_bwith like dfies occurs 0 with header line.
    data: itab_lfbw like lfbw occurs 0 with header line.
    data: ind_itab like sy-tabix.
    data: fname(61),
    f_line type i,
    l_acctno like bseg-saknr,
    l_acct_type like tbsl-koart,
    l_saknr like skb1-saknr,
    l_ktopl like t001-ktopl.
    field-symbols: .
    *populate the document item data strcuture
    loop at t_bidoc_item where runno = t_bidoc_hdr-runno
    and fwbas is initial and hwbas is initial. "syp
    move-corresponding t_bidoc_item to bbseg.
    If item has trading partner value, remove trading partner value
    if GL account is NOT found in ZTGL003
    if not t_bidoc_item-vbund is initial and not p_tdpr is initial.
    clear: l_acct_type, l_saknr, l_acctno, l_ktopl.
    select single koart into l_acct_type
    from tbsl
    where bschl = t_bidoc_item-newbs.
    if l_acct_type = 'S'.
    l_saknr = t_bidoc_item-newko.
    perform get_internal_format changing l_saknr.
    select single ktopl into l_ktopl from t001 where bukrs = t_bidoc_hdr-bukrs.
    select single glacc into l_acctno from ZTGL003
    where coa = l_ktopl and
    ( type = 'F' or type = 'Z' )
    and glacc = l_saknr.
    if sy-subrc <> 0.
    remove trading partner value
    clear bbseg-vbund.
    endif.
    endif.
    endif.
    bbseg-tbnam = 'BBSEG'.
    clear: bbseg-fwbas, bbseg-hwbas.
    if t_bidoc_hdr-waers = t_bidoc_hdr-hwaer.
    clear: bbseg-hwbas.
    endif.
    perform check_doc_and_local_currency using t_bidoc_hdr-bukrs
    t_bidoc_hdr-waers
    changing bbseg-dmbtr.
    perform conver_date_int_to_ext
    changing bbseg-zfbdt.
    perform conver_date_int_to_ext
    changing bbseg-valut.
    perform get_internal_format changing bbseg-newko.
    if not bbseg-kostl is initial.
    perform get_internal_format changing bbseg-kostl.
    endif.
    if not bbseg-prctr is initial.
    perform get_internal_format changing bbseg-prctr.
    endif.
    if not bbseg-aufnr is initial.
    perform get_internal_format changing bbseg-aufnr.
    endif.
    *pass company code to the CO-PA structure
    if not bbseg-rke_prctr is initial or
    not bbseg-rke_wwbsg is initial or
    not bbseg-rke_wwspn is initial or
    not bbseg-rke_wwprd is initial or
    not bbseg-rke_wwchl is initial or
    not bbseg-rke_wwcst is initial or
    not bbseg-rke_wwtmk is initial or
    not bbseg-rke_wwexc is initial.
    if t_bidoc_item-katyp = '11'.
    bbseg-rke_bukrs = t_bidoc_hdr-bukrs.
    endif.
    assign bbseg to  = '/'.
    endif.
    endif.
    enddo.
    t_datafile = bbseg.
    append t_datafile.
    move-corresponding bbseg to t_bbseg.
    t_bbseg-runno = t_bidoc_item-runno.
    append: t_bbseg.
    clear: t_bbseg, t_datafile,bbseg.
    check not ( t_bidoc_item-qsskz_i is initial and
    t_bidoc_item-qsskz_p is initial ).
    unassign: .
    perform get_vendor_wt_tax_info tables itab_lfbw
    using t_bidoc_item-newko
    t_bidoc_hdr-bukrs.
    loop at itab_lfbw where wt_subjct = 'X'.
    bwith-stype = t_bidoc_item-stype.
    bwith-tbnam = 'BWITH'.
    if itab_lfbw-witht = 'IV'.
    if itab_lfbw-witht = t_bidoc_item-witht_i.
    bwith-witht = t_bidoc_item-witht_i.
    bwith-wt_withcd = t_bidoc_item-qsskz_i.
    bwith-WT_QSSHB = t_bidoc_item-wt_qsshb_i.
    bwith-WT_QBUIHB = t_bidoc_item-wt_qbuihb_i.
    if t_bidoc_hdr-waers <> t_bidoc_hdr-hwaer.
    bwith-WT_QSSHH = t_bidoc_item-wt_qsshh_i.
    bwith-WT_QBUIHH = t_bidoc_item-wt_qbuihh_i.
    endif.
    elseif itab_lfbw-witht = 'PM'.
    elseif itab_lfbw-witht = t_bidoc_item-witht_p.
    bwith-witht = t_bidoc_item-witht_p.
    bwith-wt_withcd = t_bidoc_item-qsskz_p.
    bwith-WT_QSSHB = t_bidoc_item-wt_qsshb_p.
    bwith-WT_QBUIHB = t_bidoc_item-wt_qbuihb_p.
    if t_bidoc_hdr-waers <> t_bidoc_hdr-hwaer.
    bwith-WT_QSSHH = t_bidoc_item-wt_qsshh_p.
    bwith-WT_QBUIHH = t_bidoc_item-wt_qbuihh_p.
    endif.
    else.
    that is vendor master has withholding tax type and it does
    not exist in the file; need to set to zero.
    bwith-witht = itab_lfbw-witht.
    bwith-wt_withcd = itab_lfbw-witht.
    bwith-WT_QSSHB = 0.
    bwith-WT_QBUIHB = 0.
    if t_bidoc_hdr-waers .
    *populate the tax data structure
    loop at t_bidoc_item where runno = t_bidoc_hdr-runno.
    if ( not t_bidoc_item-fwbas is initial )
    or ( not t_bidoc_item-hwbas is initial ).
    bbtax-stype = t_bidoc_item-stype.
    bbtax-tbnam = 'BBTAX'.
    bbtax-fwste = t_bidoc_item-wrbtr.
    bbtax-fwste = bbtax-fwste * 100.
    PERFORM get_internal_format CHANGING bbtax-fwste.
    bbtax-mwskz = t_bidoc_item-mwskz.
    bbtax-bschl = t_bidoc_item-newbs.
    bbtax-hwste = t_bidoc_item-dmbtr.
    perform check_doc_and_local_currency using t_bidoc_hdr-bukrs
    t_bidoc_hdr-waers
    changing bbtax-hwste.
    assign bbtax to  = '/'.
    endif.
    endif.
    enddo.
    t_datafile = bbtax. append t_datafile.
    move-corresponding bbtax to t_bbtax.
    t_bbtax-runno = t_bidoc_item-runno.
    append t_bbtax.
    clear: t_bbtax,t_datafile, bbtax.
    endif.
    clear t_bidoc_item.
    endloop.
    clear: t_bbkpf.
    endloop.
    endform. " build_data_file
    *& Form fill_structure_with_no_data
    form fill_structure_with_no_data using p_t_bgr00" structure bgr00
    p_no_data.
    call function 'FILL_STRUCTURE'
    EXPORTING
    fill_value = p_no_data
    CHANGING
    fill_struc = p_t_bgr00.
    endform. " fill_structure_with_no_data
    *& Form get_table_fields
    form get_table_fields tables p_tab_struct structure dfies
    using value(p_tabname) like dcobjdef-name.
    call function 'RM_TABLE_FIELDS_GET'
    exporting
    tabname = p_tabname
    IMPORTING
    GOTSTATE =
    tables
    c_table_struct = p_tab_struct
    C_ERROR_ITAB =
    endform. " get_table_fields
    *& Form transfer_data_file_to_server
    form transfer_data_file_to_server.
    data: l_msg(60),
    l_cnt type i.
    CONCATENATE '/sapdata/interface/tmp/' sy-cprog sy-datum
    get time.
    concatenate c_server_tmp_path sy-cprog '_' sy-datum '_'
    sy-uzeit '_' sy-uname into g_server_tmp_file.
    open dataset g_server_tmp_file for output in text mode
    encoding default message l_msg.
    if sy-subrc ne 0.
    write: at /3 'Error in writing to temporary file:',
    (70) g_server_tmp_file.
    write: at /3 'Error message:', l_msg.
    perform stop_processing.
    else.
    write: at /3 'Writing to temporary file:', (70) g_server_tmp_file.
    endif.
    clear l_cnt.
    loop at t_datafile.
    transfer t_datafile to g_server_tmp_file.
    add 1 to l_cnt.
    endloop.
    close dataset g_server_tmp_file.
    write: at /3 'No. of records written:', (10) l_cnt.
    skip.
    endform. " transfer_data_file_to_server
    *& Form call_update_program
    form call_update_program.
    call function 'LIST_FREE_MEMORY'
    TABLES
    listobject = t_abaplist.
    submit rfbibl01
    with ds_name = g_server_tmp_file
    with fl_check = p_test
    with callmode = p_mode
    with max_comm = '1000'
    with pa_xprot = 'X'
    with xlog = 'X'
    exporting list to memory
    and return.
    call function 'LIST_FROM_MEMORY'
    TABLES
    listobject = t_abaplist
    EXCEPTIONS
    not_found = 1
    others = 2.
    if sy-subrc = 0.
    call function 'LIST_TO_ASCI'
    EXPORTING
    list_index = -1
    TABLES
    listasci = t_asciilist
    listobject = t_abaplist
    EXCEPTIONS
    empty_list = 1
    list_index_invalid = 2
    others = 3.
    if sy-subrc = 0.
    skip.
    write: at /3 'Batch Input Session Log'.
    write: at /3 '----
    loop at t_asciilist.
    write: at /3(117) t_asciilist-line.
    endloop.
    endif.
    endif.
    skip.
    endform. " call_update_program
    *& Form conver_date_int_to_ext
    form conver_date_int_to_ext changing p_date.
    data: f_date1 like sy-datum,
    f_date2(10),
    f_date3(8),
    slen type i,
    pos1(2)." TYPE i,
    pos2(2)." TYPE i.
    f_date1 = p_date.
    write f_date1 to f_date2.
    slen = strlen( f_date2 ).
    do slen times.
    pos1 = sy-index - 1.
    pos2 = sy-index.
    if f_date2+pos1(01) co digits.
    concatenate f_date3 f_date2+pos1(01) into f_date3.
    endif.
    enddo.
    p_date = f_date3.
    endform. " conver_date_int_to_ext
    *& Form check_doc_and_local_currency
    form check_doc_and_local_currency using p1_bukrs
    p1_waers
    changing p1_dmbtr.
    data: wa_t001 like t001.
    call function 'FI_COMPANY_CODE_DATA'
    EXPORTING
    i_bukrs = p1_bukrs
    IMPORTING
    e_t001 = wa_t001
    EXCEPTIONS
    system_error = 1
    others = 2.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    if wa_t001-waers = p1_waers.
    clear p1_dmbtr.
    endif.
    endform. " check_doc_and_local_currency
    *& Form get_vendor_wt_tax_info
    form get_vendor_wt_tax_info tables p_itab_lfbw structure lfbw
    using p_newko
    p_bukrs.
    data: f_lifnr like lfb1-lifnr.
    refresh p_itab_lfbw.
    shift p_newko left deleting leading '0'.
    f_lifnr = p_newko.
    perform get_internal_format changing f_lifnr.
    call function 'FI_WT_READ_LFBW'
    exporting
    i_lifnr = f_lifnr
    i_bukrs = p_bukrs
    I_TYPE =
    tables
    t_lfbw = p_itab_lfbw
    exceptions
    not_found = 1
    others = 2
    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. " get_vendor_wt_tax_info
    *& Form validate_file_data
    form validate_file_data.
    data: begin of l_t001.
    include structure t001.
    data: kalsm like t007a-kalsm,
    end of l_t001.
    data: l_pc_bukrs like t001-bukrs.
    data: l_saknr like skb1-saknr,
    l_lifnr like lfb1-lifnr,
    l_kunnr like knb1-kunnr,
    l_witht like lfbw-witht,
    l_qsskz like lfbw-wt_withcd,
    l_acct_type like tbsl-koart,
    l_umskz like tbslt-umskz,
    l_account like bbseg-newko,
    l_asset like anla-anln1,
    l_subasset like anla-anln2,
    l_sep_anln2(1) type c.
    data: l_fwbas like bseg-fwbas,
    l_hwbas like bseg-hwbas,
    l_amount like bseg-dmbtr.
    data: l_wt_qsshb_i like bwith-wt_qsshb,
    l_wt_qsshb_p like bwith-wt_qsshb,
    l_wt_qsshh_i like bwith-wt_qsshh,
    l_wt_qsshh_p like bwith-wt_qsshh,
    l_gsber like tgsb-gsber,
    l_bwasl like tabw-bwasl,
    l_hbkid like bseg-hbkid,
    l_vbund like bseg-vbund,
    l_shkzg like bseg-shkzg,
    l_trtyp like t856-trtyp.
    data: lt_lfbw like lfbw occurs 0 with header line.
    data: l_subrc like sy-subrc.
    data: lt_item like t_doc_item occurs 1 with header line.
    data: l_doc_err_cnt type i,
    l_doc_ok_cnt type i,
    l_item_no type i.
    data: begin of l_cost_element,
    kstar type cskb-kstar,
    katyp type cskb-katyp,
    end of l_cost_element.
    data: l_debit_docamt like bseg-wrbtr,
    l_credit_docamt like bseg-wrbtr,
    l_debit_locamt like bseg-dmbtr,
    l_credit_locamt like bseg-dmbtr,
    e_gjahr like bkpf-gjahr,
    e_monat like bkpf-monat,
    l_pdate like bkpf-budat,
    l_monat like t001b-frpe1,
    lchar type string.
    define transaction_codes.
    r_tcode-sign = 'I'.
    r_tcode-option = 'EQ'.
    r_tcode-low = &1.
    append r_tcode.
    end-of-definition.
    transaction_codes c_fb01.
    transaction_codes c_fbv1.
    transaction_codes c_fbb1.
    transaction_codes c_fbs1.
    write: at /3 'Validating input file.'.
    skip.
    describe table t_doc_hdr lines g_doc_hdr_read_cnt.
    if g_doc_hdr_read_cnt = 0.
    write: at /3 'No document header records found.'.
    perform stop_processing.
    endif.
    describe table t_doc_item lines g_doc_item_read_cnt.
    if g_doc_item_read_cnt = 0.
    write: at /3 'No document item records found.'.
    perform stop_processing.
    endif.
    g_total_rec_read_cnt = g_doc_hdr_read_cnt + g_doc_item_read_cnt.
    loop at t_doc_hdr.
    clear: g_doc_hdr_err,
    g_doc_item_err.
    add 1 to g_doc_check.
    Check Transaction code
    if not t_doc_hdr-tcode in r_tcode.
    perform output_doc_hdr_err using
    'Invalid transaction code :'
    t_doc_hdr-tcode.
    endif.
    Check document date
    perform check_date using t_doc_hdr-bldat
    'Y'
    'Y'
    'Document date'.
    Check document type
    select single * from t003
    where blart = t_doc_hdr-blart.
    if not sy-subrc is initial.
    perform output_doc_hdr_err using
    'Invalid document type :'
    t_doc_hdr-blart.
    endif.
    Check Company Code
    if t_doc_hdr-bukrs ne l_t001-bukrs or
    l_t001-bukrs is initial.
    clear l_t001.
    select single * into corresponding fields of l_t001
    from t001
    where bukrs = t_doc_hdr-bukrs.
    if sy-subrc <> 0.
    perform output_doc_hdr_err using
    'Invalid company code :'
    t_doc_hdr-bukrs.
    else.
    select single kalsm into l_t001-kalsm
    from t005
    where land1 = l_t001-land1.
    select single *
    from tka02 into tka02
    where bukrs = l_t001-bukrs.
    endif.
    endif.
    t_doc_hdr-hwaer = l_t001-waers.
    Check Posting Date
    perform check_date using t_doc_hdr-budat
    'Y'
    'Y'
    'Posting date'.
    Check Currency key
    call function 'READ_TCURC'
    EXPORTING
    i_waers = t_doc_hdr-waers
    EXCEPTIONS
    not_found = 1
    others = 2.
    if sy-subrc <> 0.
    perform output_doc_hdr_err using
    'Invalid currency :'
    t_doc_hdr-waers.
    endif.
    Check trading partner
    if not t_doc_hdr-vbund is initial.
    clear l_vbund.
    l_vbund = t_doc_hdr-vbund.
    perform get_internal_format changing l_vbund.
    select single * from t880 where rcomp = l_vbund..
    if not sy-subrc is initial.
    perform output_doc_hdr_err using
    'Trading Partner cannot be entered at header level :'
    t_doc_hdr-vbund.
    endif.
    endif.
    Check reversal date
    if t_doc_hdr-tcode = 'FBS1'.
    reversal date is required
    perform check_date using t_doc_hdr-stodt
    'Y'
    'Y'
    'Reversal date'.
    else.
    perform check_date using t_doc_hdr-stodt
    'Y'
    'N'
    'Reversal date'.
    endif.
    Check Reversal Reason
    if not t_doc_hdr-stgrd = space.
    select single *
    from t041c
    where stgrd = t_doc_hdr-stgrd.
    if not sy-subrc is initial.
    perform output_doc_hdr_err using
    'Invalid Reversal Reason :'
    t_doc_hdr-stgrd.
    endif.
    endif.
    Check whether posting period is open
    call function 'RP_CHECK_DATE'
    EXPORTING
    date = t_doc_hdr-budat
    EXCEPTIONS
    date_invalid = 1
    others = 2.
    if sy-subrc = 0.
    write t_doc_hdr-budat to l_pdate DD/MM/YYYY.
    CALL FUNCTION 'FI_PERIOD_DETERMINE'
    EXPORTING
    i_budat = l_pdate
    i_bukrs = t_doc_hdr-bukrs
    IMPORTING
    e_gjahr = e_gjahr
    e_monat = e_monat
    EXCEPTIONS
    OTHERS = 8.
    if sy-subrc = 0.
    l_monat = e_monat.
    CALL FUNCTION 'FI_PERIOD_CHECK'
    EXPORTING I_BUKRS = t_doc_hdr-bukrs
    I_GJAHR = e_gjahr
    I_KOART = '+'
    I_KONTO = '+'
    I_MONAT = l_monat
    EXCEPTIONS OTHERS = 4.
    if not sy-subrc is initial.
    perform output_doc_hdr_err using
    'Posting period for posting date not open :'
    t_doc_hdr-budat.
    endif.
    endif.
    endif.
    refresh lt_item.
    clear l_item_no.
    clear: l_debit_docamt, l_credit_docamt, l_debit_locamt, l_credit_locamt.
    Check items
    loop at t_doc_item where runno = t_doc_hdr-runno.
    add 1 to l_item_no.
    t_doc_item-item_no = l_item_no.
    Check posting key
    clear: l_acct_type, l_shkzg.
    select single koart shkzg into (l_acct_type, l_shkzg)
    from tbsl
    where bschl = t_doc_item-newbs.
    if sy-subrc ne 0.
    perform output_doc_item_err using
    'Invalid posting key:'
    t_doc_item-newbs.
    endif.
    check for invalid characters in amount field.
    clear lchar.
    lchar = t_doc_item-wrbtr.
    if not lchar co '1234567890.'.
    perform output_doc_item_err using
    'Invalid characer in document amount field:'
    t_doc_item-wrbtr.
    endif.
    clear lchar.
    lchar = t_doc_item-dmbtr.
    if not lchar co '1234567890.'.
    perform output_doc_item_err using
    'Invalid characer in local currency amount field:'
    t_doc_item-dmbtr.
    endif.
    sum up total debit and credit for line items in each document
    if l_shkzg = 'S'. "debit.
    l_debit_docamt = l_debit_docamt + t_doc_item-wrbtr.
    l_debit_locamt = l_debit_locamt + t_doc_item-dmbtr.
    else.
    l_credit_docamt = l_credit_docamt + t_doc_item-wrbtr.
    l_credit_locamt = l_credit_locamt + t_doc_item-dmbtr.
    endif.
    Check special G/L indicator
    select single umskz into l_umskz
    from tbslt
    where spras = sy-langu
    and bschl = t_doc_item-newbs
    and umskz = t_doc_item-newum.
    if sy-subrc ne 0.
    perform output_doc_item_err using
    'Invalid special G/L indicator:'
    t_doc_item-newum.
    endif.
    Check the account (gl,vendor,customer)
    if t_doc_item-newko is initial.
    perform output_doc_item_err using
    'Enter account'
    t_doc_item-newko.
    endif.
    if not l_t001-bukrs is initial.
    if l_acct_type = 'S'.
    shift t_doc_item-newko left deleting leading '0'.
    l_saknr = t_doc_item-newko.
    perform get_internal_format changing l_saknr.
    call function 'FI_GL_ACCOUNT_CHECK'
    EXPORTING
    i_bukrs = l_t001-bukrs
    i_saknr = l_saknr
    EXCEPTIONS
    gl_account_a = 1
    gl_account_b = 2
    others = 3.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid G/L account :'
    t_doc_item-newko.
    endif.
    elseif l_acct_type = 'K'.
    shift t_doc_item-newko left deleting leading '0'.
    l_lifnr = t_doc_item-newko.
    if l_lifnr(2) <> 'JD'.
    perform get_internal_format changing l_lifnr.
    call function 'FI_VENDOR_CHECK'
    EXPORTING
    i_bukrs = t_doc_hdr-bukrs
    i_lifnr = l_lifnr
    EXCEPTIONS
    vendor = 1
    others = 2.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid vendor account :'
    t_doc_item-newko.
    endif.
    else.
    If vendor number start with JDE, this is old vendor number,
    need to lookup LFB1 to search for actual vendor number,
    shift l_lifnr left by 2 places.
    select lifnr into t_doc_item-newko
    from lfb1
    where bukrs = t_doc_hdr-bukrs
    and altkn = l_lifnr.
    exit.
    endselect.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid JDE vendor number :'
    t_doc_item-newko.
    endif.
    endif.
    clear t_doc_item-prctr.
    elseif l_acct_type = 'D'.
    shift t_doc_item-newko left deleting leading '0'.
    l_kunnr = t_doc_item-newko.
    perform get_internal_format changing l_kunnr.
    call function 'FI_CUSTOMER_CHECK'
    EXPORTING
    i_bukrs = t_doc_hdr-bukrs
    i_kunnr = l_kunnr
    EXCEPTIONS
    customer = 1
    others = 2.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid customer account :'
    t_doc_item-newko.
    endif.
    clear t_doc_item-prctr.
    elseif l_acct_type = 'A'.
    shift t_doc_item-newko left deleting leading '0'.
    l_account = t_doc_item-newko.
    perform get_internal_format changing l_account.
    l_sep_anln2 = '-'.
    clear: l_asset, l_subasset.
    call function 'AM_ASSET_NUMBER_INPUT'
    EXPORTING
    i_input = l_account
    i_separator = l_sep_anln2
    IMPORTING
    e_anln1 = l_asset
    e_anln2 = l_subasset.
    call function 'ASSET_EXISTENCE_CHECK'
    EXPORTING
    i_bukrs = t_doc_hdr-bukrs
    i_anln1 = l_asset
    i_anln2 = l_subasset
    EXCEPTIONS
    ANLAGE_DEAKTIV = 1
    ANLAGE_GELOESCHT = 2
    ANLAGE_NOT_FOUND = 3
    ANLAGE_IST_INVM = 4
    ANLAGE_GESPERRT = 5
    OTHERS = 6.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid asset number :'
    t_doc_item-newko.
    endif.
    else.
    perform output_doc_item_err using
    'Account type (posting key) not catered for:'
    l_acct_type.
    endif.
    endif.
    Check amount in Document currency must ne 0 if tcode ne FBB1
    l_amount = t_doc_item-wrbtr.
    if l_amount is initial and t_doc_hdr-tcode ne 'FBB1'.
    perform output_doc_item_err using
    'Enter amount in document currency.'
    endif.
    Checking Tax code
    if t_doc_item-mwskz ne space.
    select single * from t007a where kalsm = l_t001-kalsm and
    mwskz = t_doc_item-mwskz.
    if not sy-subrc is initial.
    perform output_doc_item_err using
    'Invalid tax code :'
    t_doc_item-mwskz.
    endif.
    endif.
    Check tax amount
    l_fwbas = t_doc_item-fwbas.
    if l_fwbas is initial.
    clear t_doc_item-fwbas.
    endif.
    l_hwbas = t_doc_item-hwbas.
    if l_hwbas is initial.
    clear t_doc_item-hwbas.
    endif.
    Checking planning level
    if t_doc_item-fdlev ne space.
    select single * from t036 where ebene = t_doc_item-fdlev.
    if not sy-subrc is initial.
    perform output_doc_item_err using
    'Invalid planning level :'
    t_doc_item-fdlev.
    endif.
    endif.
    Check baseline date
    perform check_date using t_doc_item-zfbdt
    'N'
    'N'
    'Baseline date'.
    perform check_date using t_doc_item-valut
    'N'
    'N'
    'Value date'.
    Check payment method
    if t_doc_item-zlsch ne space and
    not l_t001-land1 is initial.
    call function 'T042Z_SINGLE_READ'
    EXPORTING
    i_land1 = l_t001-land1
    i_zlsch = t_doc_item-zlsch
    EXCEPTIONS
    not_found = 1
    others = 2.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid payment method :'
    t_doc_item-zlsch.
    endif.
    endif.
    Check withholding tax code
    if not t_doc_item-qsskz_i is initial or
    not t_doc_item-qsskz_p is initial.
    perform get_vendor_wt_tax_info tables lt_lfbw
    using t_doc_item-newko
    t_doc_hdr-bukrs.
    endif.
    if not t_doc_item-qsskz_i is initial.
    l_witht = 'IV'.
    l_witht = t_doc_item-witht_i.
    l_qsskz = t_doc_item-qsskz_i.
    elseif not t_doc_item-qsskz_p is initial.
    l_witht = 'PM'.
    l_witht = t_doc_item-witht_p.
    l_qsskz = t_doc_item-qsskz_p.
    endif.
    if not t_doc_item-qsskz_i is initial or
    not t_doc_item-qsskz_p is initial.
    l_lifnr = t_doc_item-newko.
    perform get_internal_format changing l_lifnr.
    read table lt_lfbw with key lifnr = l_lifnr
    bukrs = t_doc_hdr-bukrs
    witht = l_witht
    wt_withcd = l_qsskz.
    clear l_lifnr.
    if not sy-subrc is initial.
    perform output_doc_item_err using
    'Invalid withholding tax type/tax code :'
    l_qsskz.
    endif.
    endif.
    Check withholding tax base amount
    l_wt_qsshb_i = t_doc_item-wt_qsshb_i.
    if l_wt_qsshb_i is initial.
    clear t_doc_item-wt_qsshb_i.
    endif.
    l_wt_qsshb_p = t_doc_item-wt_qsshb_p.
    if l_wt_qsshb_p is initial.
    clear t_doc_item-wt_qsshb_p.
    endif.
    l_wt_qsshh_i = t_doc_item-wt_qsshh_i.
    if l_wt_qsshh_i is initial.
    clear t_doc_item-wt_qsshh_i.
    endif.
    l_wt_qsshh_p = t_doc_item-wt_qsshh_p.
    if l_wt_qsshh_p is initial.
    clear t_doc_item-wt_qsshh_p.
    endif.
    Check cost element type
    if l_acct_type = 'S'.
    if l_saknr ne l_cost_element-kstar.
    clear l_cost_element.
    select single * into corresponding fields of l_cost_element
    from cskb
    where kokrs = tka02-kokrs
    and kstar = l_saknr
    and datbi >= sy-datum.
    endif.
    else.
    clear l_cost_element.
    endif.
    t_doc_item-katyp = l_cost_element-katyp.
    if not l_cost_element is initial.
    if l_cost_element-katyp <> '01'.
    No cost center required for revenue element <not true for CapitaLand>
    cost centre is now required for revenue and expense accounts
    clear t_doc_item-kostl.
    if l_cost_element-katyp = '11'.
    t_doc_item-rke_prctr = t_doc_item-prctr.
    endif.
    elseif l_cost_element-katyp = '01' and
    else.
    if t_doc_item-kostl is initial.
    perform output_doc_item_err using
    'Missing cost center for account'
    t_doc_item-newko.
    endif.
    endif.
    else.
    clear: t_doc_item-kostl.
    endif.
    Check cost center
    if t_doc_item-kostl ne space.
    perform get_internal_format changing t_doc_item-kostl.
    call function 'K_COSTCENTER_EXISTENCE_CHECK'
    EXPORTING
    kokrs = tka02-kokrs
    kostl = t_doc_item-kostl
    bypassing_buffer = 'X'
    EXCEPTIONS
    not_at_all = 1
    others = 2.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid cost center :'
    t_doc_item-kostl.
    endif.
    endif.
    Check internal order
    if t_doc_item-aufnr ne space.
    perform get_internal_format changing t_doc_item-aufnr.
    perform read_order using t_doc_item-aufnr
    changing l_subrc.
    if l_subrc <> 0.
    perform output_doc_item_err using
    'Invalid internal order :'
    t_doc_item-aufnr.
    endif.
    endif.
    check business area
    if not t_doc_item-gsber is initial.
    clear l_gsber.
    select single gsber into l_gsber from tgsb
    where gsber = t_doc_item-gsber.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid business area :'
    t_doc_item-gsber.
    endif.
    endif.
    check asset transaction type
    if not t_doc_item-newbw is initial.
    clear l_bwasl.
    select single bwasl into l_bwasl from tabw
    where bwasl = t_doc_item-newbw.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid transaction type :'
    t_doc_item-newbw.
    endif.
    endif.
    check consolidation transaction type
    if not t_doc_item-bewar is initial.
    clear l_trtyp.
    select single trtyp into l_trtyp from t856
    where trtyp = t_doc_item-bewar.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid transaction type :'
    t_doc_item-bewar.
    endif.
    endif.
    Check house bank
    if not t_doc_item-hbkid is initial.
    clear l_hbkid.
    select single hbkid into l_hbkid from t012
    where bukrs = t_doc_hdr-bukrs
    and hbkid = t_doc_item-hbkid.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid house bank :'
    t_doc_item-hbkid.
    endif.
    endif.
    Check profit center
    if not t_doc_item-prctr is initial.
    perform get_internal_format changing t_doc_item-prctr.
    select single bukrs into l_pc_bukrs
    from cepc_bukrs
    where kokrs = tka02-kokrs
    and prctr = t_doc_item-prctr.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid profit center :'
    t_doc_item-prctr.
    endif.
    endif.
    Check trading partner
    if not t_doc_item-vbund is initial.
    v_vbund = t_doc_item-vbund.
    clear l_vbund.
    l_vbund = t_doc_item-vbund.
    perform get_internal_format changing l_vbund.
    if strlen( v_vbund ) = 1.
    concatenate '00000' v_vbund into v_vbund.
    elseif strlen( v_vbund ) = 2.
    concatenate '0000' v_vbund into v_vbund.
    elseif strlen( v_vbund ) = 3.
    concatenate '000' v_vbund into v_vbund.
    elseif strlen( v_vbund ) = 4.
    concatenate '00' v_vbund into v_vbund.
    elseif strlen( v_vbund ) = 5.
    concatenate '0' v_vbund into v_vbund.
    endif.
    select single * from t880 where rcomp = t_doc_item-vbund.
    select single * from t880 where rcomp = l_vbund.
    if not sy-subrc is initial.
    perform output_doc_item_err using
    'Invalid Trading Partner entered at item level :'
    t_doc_item-vbund.
    endif.
    endif.
    modify t_doc_item.
    append t_doc_item to lt_item.
    endloop. "End of check items loop
    Check total debit and credit in document is equal
    if not ( l_debit_docamt = l_credit_docamt and
    l_debit_locamt = l_credit_locamt ).
    perform output_doc_hdr_err using
    'Total debit amount not equal to total credit amount' ''.
    endif.
    if g_doc_hdr_err = 'Y' or g_doc_item_err = 'Y'.
    add 1 to l_doc_err_cnt.
    append t_doc_hdr to t_errdoc_hdr.
    append lines of lt_item to t_errdoc_item.
    else.
    add 1 to l_doc_ok_cnt.
    append t_doc_hdr to t_bidoc_hdr.
    append lines of lt_item to t_bidoc_item.
    endif.
    modify t_doc_hdr.
    endloop.
    skip.
    write: at /3 'No. of document headers read :',
    (6) g_doc_hdr_read_cnt,
    at /3 'No. of document items read :',
    (6) g_doc_item_read_cnt,
    at /3 'Total

  • Required AutoAccounting types for AR invoices?

    Hi all,
    I am doing AR invoices conversion and I got error "Not all AutoAccounting types are defined" from Autoinvoice process after inserting to AR interface. I import regular invoices, credit memo and debit memo to AR and the business analyst so far only have Receivable, Revenue and Tax AutoAccounting types set up.
    Can any one please let me know what are the other AutoAccounting types I may need?
    Thanks! Mike.

    Hi Mike,
    All the following 7 Transaction Types must be setup:
    1.     Freight
    2.     Receivable
    3.     Revenue
    4.     AutoInvoice Clearing
    5.     Tax
    6.     Unbilled Receivable
    7.     Unearned Revenue
    Vik

  • Different Purchase order

    Hello
      One of my vendor who is supplying 10 items has 10 different purchase orders, while supplying the material he will be combing all the 10  Purchase orders into a single invoice , so can i do grn for the same , what is the process
    rakesh

    HI!
    1) You do MIGO for all the purchase order in one document
    enter the PO no and execute
    *again without saving the document enter the next PO no and execute
    *continously do this for all PO's
    *now post the docu - only one material document is created.
    2) * Now you post the invoice in MIRO by entering the first PO and execute.
    Without saving go to the arrow symbol next to the place where you enter the PO no.
    There u enter all other PO no's and execute.
    Now all the PO's cleared in migo will get in the same invoice document. Save the document.
    Reward if useful.
    yuvi.

  • RECEIVABLES ISSUE

    Hi all
    We are facing a very unique problem in our unit. We are not able to run auto invoice master program or unable to create supplementary or credit memo invoice due to the following error..
    ORA-01006: bind variable does not exist
    Error calling arcdaa_do_autoaccounting()
    Error calling raaddl()
    Error calling raapic()
    Can anybody please help me in this regard..
    Regards
    Gaurav

    Hello,
    Check if all Transaction Types are correctly setup in AR
    Setup --> Transactions --> Autoaccounting
    Setup for the following must be defined:
    1.     Freight
    2.     Receivable
    3.     Revenue
    4.     AutoInvoice Clearing
    5.     Tax
    6.     Unbilled Receivable
    7.     Unearned Revenue
    HTH,
    Vik

  • C & F Agents

    Hi Gurus,
    I will be working on C & F scenario for the 1st time.
    I understand it is handled by creating these agents as plants and doing a STO.
    Is the Excise handled in the std manner?
    Can someone suggest the steps required in the scenario.
    Thanks,
    MR

    Hi
    You can enter this stock transfer using the one-step or the two-step procedure.
    During the stock transfer, two accounting documents are created in addition to the material document:
    u2022     An accounting document for the removal from storage at the issuing company code
    u2022     An accounting document for the placement into storage at the receiving company code
    The stock posting is offset against a company code clearing account which can be configured in t.code: OBYA
    To display the value of the cross-company-code stock in transit with a report, choose Environment Stock  Stock in transit Cc.
    Characteristics of the Various Stock Transfer Procedures
    The following table lists the characteristics of the individual procedures used for stock transfer.                         
         Plant to plant     Plant to plant     St. trnsp. ord. w/o SD     St. trnsp. ord. with SD     St. trnsp. ord. with billing
         1 step     2 steps               
    Order type     -     -     UB     UB     NB
    MM-PUR                         
    Movement type     Transfer postg. using 301     GI: 303     GI: 351     GI: 641     GI: 643
    MM-IM          GR: 305     GR: 101     GR: 101     GR: 101
    Delivery type SD     -     -     -     NL     NLCC
    Billing type SD     -     -     -     -     IV
    Doc. type MM-IV     -     -     -     -     RE
    Price     Valuation price     Valuation price     Valuation price     Valuation price     Pricing in SD and MM
    Planning via...     Reservation     -     Purchase order     Purchase order     Purchase order
    Stock after GI     -     Stock in transfer     Stock in Transit     Stock in Transit     (Stock in transit CC)
    Delivery costs     -     -     yes     yes     yes
    Cross-company-code via...     Company code clearing     Company code clearing     Company code clearing     Company code clearing     Revenue account;
                             GR/IR clearing
    With Regards
    baalakrushnan.da

  • MB51 showing data for just one Posting date

    Hi All,
    MB51 is showing material docs for just one posting date while we searched for whole one year from 01/01/2008 to 12/01/2008.
    Please tell what should i do ASAP.
    Thanks
    Madhur

    HI,
    MB51 is showing material docs for just one posting date while we searched for whole one year from 01/01/2008 to 12/01/2008.
    year from 01/01/2008 to 12/01/2008 i Think this is MM.DD.YYYY format,
    Ok can you clear your MIGO posting date fromat i.e MM.DD.YYYY or DD.MM.YYYY,check it at your end
    or try this give only plant and movement type 101 and execute report
    Regards
    Kailas Ugale

  • Value difference for GR/IR Clearing Account in case of MIGO and MIRO.

    Hello Experts,
    One of our client has asked me about clarification regarding GR/IR Clearing Account shows different values when MIGO and MIRO posting. Scenario is that,
    SEZ
    Calculation of import Duty
    Input goods
    Material Base Value
           2,171,385
    Landing Cost
                 21,714
    For computing Customs landing charges need to be added
    BED @
    10%
               219,310
    Loaded in material cost
    CVD, @
    12%
               289,489
    Credit taken
    Customs Education Cess
    3%
                 15,264
    Loaded in material cost
    ADDL Duty
    4%
               108,686
    Credit taken
    Customs Duty
               632,749
    CVD
    12%
               219,310
    All duty
    4%
               108,686
    Cenvat
               327,996
    CST
           43,427.70
    2214812.7
    Hence Material cost in GR/IR should be Rs. 22,14,813
    Diff (2219092-2214813= 4279)
    Whereas it is taking Rs. 22,19,092
    My concern is that GR/IR Clearing Account consider only Material cost and non deductible tax amount i.e. CST which is loaded on material cost but system consider some different values, please check the above calculation. When user post MIRO in that case system automatically konck off GR/IR Clearing Account and post difference amount i.e. RS. 4279 to Inventory Account which is wrong. I dont know how system behaves in such manner.
    Please giude me on this issue as soon as possible.
    Regards,
    Vishal Jadhav

    Discussion moved. Please use Internationalization and Unicode for CIN related queries.

  • GR/IR clearing account getting debited during MIGO

    We have a  unique problem. We have created an Import PO with Acc assignment category as 'K'. Delivery costs captured. PO has been created with 1.00 GBP. Delivery costs are much higher. During GR GR/IR clearing account is debited.  Please help. Everything in the PO is correct. How can we sort this?

    Hi,
    Have a look on the below SAP Notes, may be helpful for you,
    1644255  - Foreign Currency Valuation does not recognize Debit entries in WRX GR/IR Clearing Account
    Note 1773682 - MAA2: MIGO incorrect values in document currency

  • B/S Profit Center for GR/IR clearing act in MIGO is fine but not in MIRO

    Hi Experts,
    Can you please help on the below as am posting this after reviewing the existing postings:
    We are in ECC 6.0 and implementing Classic GL.
    While posting MIGO and MIRO the GR/IR clearing account (B/S account) is getting the Profit enter from expense line item.
    Requirement is to have the B/S profit center from 3KEH.
    As an option we created one Substitution so getting B/S profit center only for MIGO but MIRO is still getting the exp Profit center.
    How to get the B/S profit center for MIRO also?
    Thanks,
    Sudha

    Hello
    ANy suggestion for question & if solved do let me know

Maybe you are looking for