Fb01 bdc

hi all,
      I'm facing problem while entering multiple lineitem for fb01 transaction. i can finish my debt either with two lineitem or with 100 lineitem also. but i'm getting screen error from 2nd lieitem onwards while uploading data from my excel.
Please help in this regard. its very urgent for me.
With thanks,
subbu.

Hi,
we should give in flat file one common field like s.no in both header and line items.

Similar Messages

  • FB01 BDC Program Posting Error in a coding block

    Hi,
    I am trying to write a BDC for fb01 transaction with posting key 31 and 40.
    But I am getting a coding block as a popup in FB01 trsanction on screen number 'SAPLKACB' '0002'.
    I am passing costcentre and Internal Order and then passing an Enter f code for this...But still i am getting a message that Input data not passed to this screen..
    If i run this in All screen mode by manually putting enter its working if i try to put an enter programatically its not working..
    Your Answers will be Appreciated..
    Please let me know if you come across this any time..
    Thanks
    Srinivasa

    Hi,
    I personally feel that instead of doing a BDC for accounting document post using FB01, please use the BAPI - bapi_acc_document_post
    Regards,
    Sridevi

  • FB01 BDC substitution problem

    Hi,
    I wrote a batch program to transfer GL data from text file to SAP. It uses FB01.
    Everything works fine except for some GL accounts that do not need cost center input. When such account inserted my program has an error
    saying that there is no field 'COBL-KOSTL' in the form.
    To fix the problem my program has to access substitution rule and either insert or not incert line: PERFORM bdc_field USING 'COBL-KOSTL' itab-kostl. "Cost center
    Question: how to access substitution rules from ABAP program? Or may be I have to access basic set generated by substitution? Or may be any other way?
    Thank you,
    Vitaly

    Hi,
    These tables might help you.
    GB03                           Validation/Substitution User
    GB03T                          Validation/Substitution Application Area T
    GB31                           Validation/Substitution Callup Points
    GB31T                          Validation/Substitution Callup Point Text
    GB907                          Rule: Usage of Rules in Substitutions
    GB92                           Substitutions
    GB921                          Substitution Conditions
    GB921T                         Substitution: Text Table for Substitution
    GB922                          Substitution Constants
    GB925                          Usage of Substitutions
    GB92T                          Texts for Substitutions
    I have not checked the details of which table to use exactly but I am sure it would help you in some sense.
    Regards
    Nishant

  • How to move ahead using RFBIBLOO for FB01 BDC

    Can anyone guide me how to fill in the three structures namely BGR00, BBKPF and BBSEG with my data in order to use RFBIBLOO standard program for data upload for FB01.
    Thanx in advance,
    Alok.

    Hello,
    Check this thread,
    Re: Input File in RFBIBL00.
    and
    Check out the program, <b>RFBIBLT0</b>
    Regards,
    Naimesh

  • FB01 and BAPI_ACC_DOCUMENT_POST

    Hello,
    I'm using BAPI_ACC_DOCUMENT_POST to simulate FB01.
    Someone has used this BAPI to simulate FB01??
    I cant find the Posting Key (BSEG-BSCHL) in this BAPI, and i really need that.
    Can anyone tell me if i should use this BAPI to simulate FB01 or exists another one.
    And can someone help me to find the Posting Key in this BAPI?
    Thanks in advance
    Best regards.

    Hi,
    The posting key is decided automatically by the BAPI, it depends on the sign you have assigned to the amounts.
    In this case I suppose the BAPI'll use the postig key 40/50:
    - 40 if the amount is greater than 0,
    - 50 if the amount is less than 0,
    So you can have some problem only if you need to use some keys different from 40/50.
    In this case I believe you have to use the BAPI BAPI_ACC_DOCUMENT_POST, here you can choose which posting keys to be used in order to transaction key (<b>KOTSL).</b>
    See the table T030B
    If I could make a suggestion why dont you use <b>LSMW</b> for the same
    The standard object is 0100.
    It uses the standard program RFBIBL00 itself. But you should be able to format it easily
    Here is a document on how you can use the tool.
    http://sapabap.iespana.es/sapabap/manuales/pdf/lsmw.pdf
    <b>Or you can Do BDC</b>
    Look at the below threads, these threads have the sameple code also
    BDC For FB01
    BDC  for FB01  Transaction.
    Suggest you to Search in SDN with key - FB01
    Will get few more useful related Posts.
    Reward points if this Helps.
    Manish
    Message was edited by:
            Manish Kumar

  • FB02 Question

    We wrote a program to batch load stuff via FB01 but there was an data load issue. Now we need to relog just the line text (SGTXT) for all teh documents it created. If there a faster way to batch update the line text in FB02 then a BDC program? I have a file of all the documents and line texts it needs to update.
    Thanks,
    David

    Maybe I didn't explain it well enough. I'm looking to mass update FI documents by document number and update the line text (SGTXT).
    Ex:
    Doc#      Line text
    5000432 Facility 1006
    5000434 Facility 1243
    5000435 Facility 2537
    So each document will have it's own different line text. I know I can do a CALL TRANSACTION 'FB02' BDC to update them but that's time consuming so I'm wondering if there's some function or another way to loop a set of FI documents then update the line text. In the original FB01 BDC the line text was off by one record so all the line text got posted to the wrong documents.

  • How to add long text in bdc for transaction fb01 ?

    IN the existing program of bdc fb01
    i have to add a long text field
    but it gets stuck while i process in sm35
    is there a fm to add the field directly
    thanks in a advance

    Hi
    You can upload the Long texts separately into the transaction using the CREATE_TEXT fun module
    Need to pass the correct parameters like OBJECT,ID, OBJECTNAME and LANGuage with the proper declarations.
    see the sample code and do accordingly
    REPORT zmm_longtext_sm
           NO STANDARD PAGE HEADING
           LINE-SIZE 255.
    Description :   This Program is used to Upload the Service Master
                 :   Long Texts using the Fun Module CREATE_TEXT
    Internal Table for Upload of Long Texts Data
    DATA: BEGIN OF itab OCCURS 0,
            asnum like asmd-asnum,    " Service No
            text  LIKE tline-tdline,  " Long Text
          END OF itab.
    To create Long Text lines for CREATE_TEXT function module
    DATA:BEGIN OF dt_lines OCCURS 0.
            INCLUDE STRUCTURE tline.   " Long Text
    DATA:END OF dt_lines.
    Variable declarations for CREATE_TEXT function module
    DATA : dl_name TYPE thead-tdname,   " Object Name
           dl_lan TYPE thead-tdspras.   " Language
    Constants
    CONSTANTS:
    Object ID for Long Text of Service Master
      c_best     TYPE thead-tdid VALUE 'LTXT',
      c_material TYPE thead-tdobject VALUE 'ASMD'. " Object
    Parameters
    PARAMETERS p_file LIKE rlgrap-filename.
    At selection-screen on Value Request for file Name
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Get the F4 Values for the File
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
        IMPORTING
          file_name     = p_file.
    Start Of Selection
    START-OF-SELECTION.
    *To Upload Flat file
      CALL FUNCTION 'UPLOAD'
        EXPORTING
          filename                = p_file
          filetype                = 'DAT'
        TABLES
          data_tab                = itab
        EXCEPTIONS
          conversion_error        = 1
          invalid_table_width     = 2
          invalid_type            = 3
          no_batch                = 4
          unknown_error           = 5
          gui_refuse_filetransfer = 6
          OTHERS                  = 7.
    Upload the Texts
      SORT itab BY asnum.
      LOOP AT itab.
        dt_lines-tdformat = 'ST'.
        dt_lines-tdline = itab-text.
        APPEND dt_lines.
        dl_lan = sy-langu.
        concatenate '00000000000' itab-asnum into dl_name.
    Call the Function Module to Create Text
        CALL FUNCTION 'CREATE_TEXT'
          EXPORTING
            fid         = c_best
            flanguage   = dl_lan
            fname       = dl_name
            fobject     = c_material
            save_direct = 'X'
            fformat     = '*'
          TABLES
            flines      = dt_lines
          EXCEPTIONS
            no_init     = 1
            no_save     = 2
            OTHERS      = 3.
        IF sy-subrc <> 0.
          WRITE:/ 'Long Text Creation failed for Service No'(001),
                 itab-asnum.
        ELSE.
          WRITE:/ 'Long Text Created Successfully for Service No'(002),
                 itab-asnum.
        ENDIF.
        AT END OF asnum.
          REFRESH dt_lines.
        ENDAT.
      ENDLOOP.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Document numbers missing while posting a batch of GL documents via BDC FB01

    Hi all,
    While posting a batch of GL documents using a BDC program for FB01, all the documents are posted except for a few document numbers getting skipped while posting. For instance, in posting 100 documents, if 101-200 is the document numbers expected to be generated, we are getting a list of doc. numbers from 101-185 and 187-201 thereby skipping the document number 186. But when we post another set of GL documents, the skipped doc. number 186 is first taken and remaining from doc. number 202. Could any one have comes across this scenario or somebody can help to throw some light for the reason behind this. Thanks.

    Hi Mahalingam,
    There could be various reasons for document number skipping. SAP has given various notes on this.
    Note 175047 - Causes for FI document number gaps (RF_BELEG). The note is very comprehensive and has a reference of lot many notes.
    Thanks
    Aravind

  • Standard BDC for t.code: FB01

    Hi,
    Is there any standard BDC available for T.code: FB01.
    Thanks and Regards,
    VK

    Hi,
    You can use standard program RFBIBL00 or BAPI BAPI_ACC_DOCUMENT_POST for this purpose.
    Creating BDC for FB01 mainly depends on your need. A generic one is difficult to be created due to multiple alternative screeens.
    Regards,
    Gaurav

  • BDC for AR Posting (Tcode - FB01)

    Dear All,
    I am unable to post multiple line items while postnig AR Invoice using BDC recording of FB01.
    Can anyone provide me the BDC program code to post multiple line items.
    Thanks in Advance,
    Harish

    hi,
    please check your document type with tcode oba7
    field cust./vend. check (t003-XKKPR) -> set value = X
    pls reward useful answers
    thx.
    Andreas

  • BDC For FB01

    Hi Friends,
    Anyone who had developed the BDC for FB01 T-code, please send me the source code . I am not able to create BDC for both header and line itemswise.
    Deepak.

    Hi Deepak,
    check BDC standard program RFBIBL00 or FM
    BAPI_ACC_GL_POSTING_POST
    BAPI_ACC_DOCUMENT_POST
    Also check
    Re: LSMW: problem with object RFBIBL00 tx FB01 (sapmf05a no data)
    Hope this helps
    Thanks
    Lakshman

  • BDC OR BAPI - FOR FB01 T-CODE

    Dear all,
    I am facing one problem for upload the data from excel to FB01 T-code..
    here my excel sheet is like this
    Doc Date Posting date Doc type Posting key GL account Amount Posting key GL account Amount
    03.04.2010     03.04.2010          40     60011     8391                          50 & GL & TAX again repeate....
    04.04.2010     04.04.2010          40     60011     5496     40     60012     2198   50 & GL & TAX
    05.04.2010     05.04.2010          40     60011     7887     40     60012     0        50 & GL & TAX
    How should i do the program.....
    plz give me any bapi program or bdc program for this type excel sheet....
    plz help me..
    Regards
    margani

    Posting FI documents is one of the more frequently discussed topics here, please search before posting. Do not expect complete solutions for requirements, always work yourself first.
    Thread locked.
    Thomas

  • BDC upoad for FB01 always gives the same msg in output even when file is ok

    Hi1
    I have created a BDC upload program to upload data through a csv file . Whenever i run the program with teh file name with the data from teh csv file I just get the same error message in the output be it any data when its corect data .
    the message is as follows.
    Line          1    Error in document: BKPFF $ DEV010
    Line          1    G/L account 924831 is not defined in chart of accounts TRLS
    Line          1    G/L account 924831 is not defined in chart of accounts TRLS
    Line          1    G/L account 924831 is not defined in chart of accounts TRLS
    In this case the the file that I uploaded has the following information:
    09042009;KR;2000;09242009;;USD;151278;001096;31;924831;11331.4;Z005;09042009;A;210903;40;3998;11331.4;1;EA;054;730019;730019
    when I go and check in the FB01 transaction and put the posting key as 31 and drop down on the account number it gives me a list of vendor account numbers and maybe thats the reason for teh file saying 924831 does not exits in the chart of G/L accounts. I am not sure but thats what teh message showing up whenever I upload any file , when i go to posting key 40 it does have the account number.
    Kindly help.
    thanks

    Hi!
    I am refreshing the message table but the message appears for the first line of the data itself and also placing extra zeros in the data dosent resolve teh issue. What my code says is:
    form validate_data  using tp_rc.
        clear tp_rc.
      sort ta_upload by id bldat bukrs xblnr.
      loop at ta_upload into tw_upload.
        check tp_rc is initial.
        clear: wa_gl, wa_curr,wa_header.
        refresh: ta_gl, ta_curr.
        clear wa_header.
        wa_header-username   = sy-uname.
        wa_header-bus_act    = 'RFBU'.
        concatenate tw_upload-bldat+4(4) tw_upload-bldat+2(2) tw_upload-bldat(2)
                    into wa_header-doc_date.          "Document Date(1)
        wa_header-doc_type   = tw_upload-blart.          "Document Type(3)
        wa_header-comp_code  = tw_upload-bukrs.          "Company Code(4)
        concatenate tw_upload-budat+4(4) tw_upload-budat+2(2) tw_upload-budat(2)
                    into wa_header-pstng_date.          "Posting Date(2)
        wa_header-fis_period = tw_upload-monat.
        wa_header-ref_doc_no = tw_upload-xblnr.          "Reference
        wa_header-header_txt = tw_upload-bktxt.         "Header Text
        wa_gl-itemno_acc         = 1.                  "Item No
        wa_gl-gl_account         = tw_upload-newko.              "General Ledger Account
        wa_gl-item_text          = tw_upload-sgtxt.
        wa_gl-fis_period         = tw_upload-monat.
        wa_gl-pstng_date         = wa_header-pstng_date.
        append wa_gl to ta_gl.
        clear wa_gl.
        wa_gl-itemno_acc         = 2.                  "Item No
        wa_gl-gl_account         = tw_upload-newko_2.              "General Ledger Account
        wa_gl-item_text          = tw_upload-sgtxt_2.
        wa_gl-fis_period         = tw_upload-monat.
        wa_gl-pstng_date         = wa_header-pstng_date.
        wa_gl-costcenter         = tw_upload-kostl.              "Cost Center
        wa_gl-profit_ctr         = tw_upload-prctr.              "Profit Center
        append wa_gl to ta_gl.
         call function 'BAPI_ACC_DOCUMENT_POST'
    Thanks
    Edited by: Aarav  Agnihotri on Nov 18, 2009 7:49 PM

  • BDC  for FB01  Transaction.

    Hi Experts,
    I am having the bdc recording of the transaction FB01 in shdb transaction.I have converted the recording into an program.I am finding difficulty in Line items posting. As I am new to FI module.
    How to go about for the line item positng with respect to  psoting key is NEWBS.
    Thanks in Advance
    Irfan Hussain

    Hi,
    FB01 is a transaction very nice to learn BDC
    Here a code (with french comment)
    report z_fi_in_01 no standard page heading
                      line-size 80
                      line-count 65.
    *-------------------------------- DATA --------------------------------*
    data : v_infile(200) type c ,              " Chemin physique fich.
           v_periode(4)  type n ,              " Periode
           v_t_code(20)  type c value 'FB01' , " Code transaction.
           v_count(3)    type n ,              " Compteur de poste piec
           v_decimal(1)  type c ,              " Representation decimal
           v_nb_blanc(6) type n ,              " Nb ligne montant nul
           v_date(8)     type c .              " Date comptable
    data : begin of itab_fichier_in occurs 0,
             societe(4)   type c ,                  " Société
             poste(2)     type c ,                  " Poste -> type piece
             centre(8)    type c ,                  " Centre de couts
             compte(10)   type c ,                  " Compte comptable
             code_dc(1)   type c ,                  " Code debit/credit C/D
             montantc(13) type p decimals 2 ,       " Montant credit
             montantd(13) type p decimals 2 ,       " Montant debit
           end of itab_fichier_in.
    data: begin of bdc_tab occurs 100.
            include structure bdcdata.
    data: end of bdc_tab.
    data : begin of itab_piece occurs 0 ,
             typepiece(2) type c ,
             montantc(13) type p decimals 2 ,       " Montant credit
             montantd(13) type p decimals 2 ,       " Montant debit
             solde(13)    type p decimals 2 ,       " Solde
           end of itab_piece.
    *--------------------------- PARAMETERS -------------------------------*
    parameters : p_infile(100) type c
                               default '.dat'
                               lower case
                               obligatory ,
                 p_nom(12) type c
                            default 'Z_PAIE'
                            obligatory ,
                 p_waers like t001-waers
                            obligatory .
    *-------------------------------- MAIN --------------------------------*
    start-of-selection.
    * Recherche des chemins physique à partir des chemins logiques.
      perform p_recherche_chemin.
    * Copie du contenu du fichier dans la table interne ITAB_FICHIER_IN.
      perform p_lecture_input.
    * Test si les données sont bien equilibrées.
      perform p_test_donnee.
    * Ouverture du dossier.
      perform open_bdc using p_nom.
    * Transformation des données type pleiade au format SAP.
      perform p_creation_batch.
    * Fermeture du dossier.
      perform close_bdc.
    * Edition.
      perform p_edition.
    end-of-selection.
    *------------------------------ PROCEDURE -----------------------------*
    *   Procédure P_RECHERCHE_CHEMIN.                                      *
    *   Recherche des chemins de fichiers physiques à partir des chemins   *
    *   de fichiers logiques.                                              *
    form p_recherche_chemin.
    * Fonction de recherche du chemin physique depuis le chemin logique
    * On passe en parametre le nom du fichier.
      call function 'FILE_GET_NAME'
           exporting
                client           = sy-mandt
                logical_filename = 'Z_FI_PAIE_PLEIADE_FILE'
                operating_system = sy-opsys
                parameter_1      = p_infile
           importing
                file_name        = v_infile
           exceptions
                file_not_found   = 1
                others           = 2.
    * Si probleme d ouverture message et on arrete tout.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        stop.
      endif.
    endform.                               " P_RECHERCHE_CHEMIN
    *   Procédure P_LECTURE_INPUT.                                         *
    *   Ouverture, lecture, fermeture du fichier de paie.                  *
    form p_lecture_input.
      data : v_msg(100)    type c ,     " Message d erreur ouverture fichier
             v_buffer(200) type c.      " Buffer lecture fichier
    * Ouverture du fichier en entrée.
      open dataset v_infile for input in text mode message v_msg.
      if sy-subrc ne space.
        write : /1 'ERREUR FATALE !' color 3,
                   'IMPOSSIBLE D OUVRIR LE FICHIER EN ENTREE :',
                   p_infile ,
                /1 v_msg.
        stop.
      endif.
    * Lecture sequentiele du fichier en entrée.
      do.
        read dataset v_infile into v_buffer.
    *   Test fin de fichier.
        if sy-subrc ne space.
          exit.
        endif.
    *   Transfert du buffer dans la table interne.
        move : v_buffer+6(4)   to v_periode ,
               v_buffer+10(8)  to itab_fichier_in-centre ,
               v_buffer+18(10) to itab_fichier_in-compte ,
               v_buffer+28(2)  to itab_fichier_in-poste ,
               v_buffer+32(1)  to itab_fichier_in-code_dc ,
               v_buffer+33(18) to itab_fichier_in-montantc ,
               v_buffer+51(18) to itab_fichier_in-montantd .
    *   Allimente le code société.
        if     v_buffer+0(2) eq '04'.
          move '1614' to itab_fichier_in-societe.
        elseif v_buffer+0(2) eq '09'.
          move '2826' to itab_fichier_in-societe.
        else.
          write : /1 'Société inconnue ! traitement interrompu !' ,
                     v_buffer+0(2) .
        endif.
    *   On replace la decimale sur le montant.
        itab_fichier_in-montantc = itab_fichier_in-montantc / 100.
        itab_fichier_in-montantd = itab_fichier_in-montantd / 100.
    *   Enregistrement de la ligne dans la table interne ITAB_FICHIER_IN.
        append itab_fichier_in.
        clear  itab_fichier_in.
      enddo.
    * Fermeture du fichier en entrée.
      close dataset v_infile.
    * Trie de la table interne ITAB_FICHIER_IN.
      sort itab_fichier_in by societe poste compte centre.
    endform.                               " P_LECTURE_INPUT.
    *   Procédure P_TEST_DONNEE.                                           *
    *   Verifie si la somme des debits est egale a la somme des credits.   *
    *   Verifie si n y a pas de montant nul.                               *
    *   Verifie que les differents type de piece sont equilibrés entre     *
    *   eux.                                                               *
    *   Force le centre de cout à 91001038 pour les comptes comptables     *
    *   commencent par 481801.                                             *
    form p_test_donnee.
      data : v_montantc(13) type p decimals 2 ,
             v_montantd(13) type p decimals 2 .
    * Cumul les montants debit et credit.
      loop at itab_fichier_in.
        v_montantc = v_montantc + itab_fichier_in-montantc.
        v_montantd = v_montantd + itab_fichier_in-montantd.
      endloop.
    * Test si debit = credit.
      if v_montantc ne v_montantd.
        skip 2.
        write : /1 'ATTENTION LE FICHIER N EST PAS EQUILIBRE !!' color 3.
        skip 2.
        write : /5 'Total montant debit  :',
                   v_montantd ,
                /5 'Total montant credit :' ,
                   v_montantc .
        stop.
      endif.
    * Verifie s il n y a pas de montant nul. Si oui on efface.
      loop at itab_fichier_in.
        if itab_fichier_in-montantc eq space and
           itab_fichier_in-montantd eq space.
          v_nb_blanc = v_nb_blanc + 1.
          delete itab_fichier_in.
        endif.
      endloop.
    * Verifie que les differents postes sont equilibrés.
      clear : v_montantc, v_montantd.
      loop at itab_fichier_in.
        v_montantc = v_montantc + itab_fichier_in-montantc.
        v_montantd = v_montantd + itab_fichier_in-montantd.
        at end of poste.
          if v_montantc ne v_montantd.
            skip 2.
            write : /1 'ATTENTION LE FICHIER N EST PAS EQUILIBRE !!'
                        color 3 ,
                    /1 'Au moins un type de piece n''est pas equilibré.'.
            skip 2.
            write : /5 'Montant debit  :',
                       v_montantd ,
                    /5 'Montant credit :' ,
                       v_montantc .
            stop.
          endif.
          clear : v_montantc, v_montantd.
        endat.
      endloop.
    * Si le compte comptable commence par 481801 on force le centre de
    * couts à 91001038.
      loop at itab_fichier_in
           where compte(6) = '481801'.
        move '91001038' to itab_fichier_in-centre.
        modify itab_fichier_in.
      endloop.
    endform.                               " P_TEST_DONNEE.
    *   Procédure P_CREATION_BATCH.                                        *
    *   Application de regle de gestion :                                  *
    *     - La date est obtenue à partir de la zone période. On prend le   *
    *       dernier jour du mois indiqué dans le fichier en entrée.        *
    *     - Si le poste est PR alors le type de document est AC sinon il   *
    *       est SA.                                                        *
    *     - Si c est un debit la clé est 40, si c est un credit 50.        *
    *     - Le montant du fichier en entrée est exprimé en centime.        *
    form p_creation_batch.
      data : v_totald(13)  type p decimals 2 ,   " Total debit
             v_totalc(13)  type p decimals 2 ,   " Total credit
             v_total(13)   type p decimals 2 ,   " Total general
             v_clef(2)     type n ,              " Clef 50/40
             v_montant(13) type p decimals 2 ,   " Montant temporaire
             v_flag_fin(1) type n .              " Indicateur fin piece
    * Recherche de la date de fin de mois de la periode
      perform p_last_day_of_month using    v_periode
                                  changing v_date.
    * Recherche de la constante utilisateur sur la decimal.
      perform p_decimal.
    * Boucle sur la table interne.
      loop at itab_fichier_in.
    *   Compteur de poste de piece.
        v_count = v_count + 1.
    *   Gestion du cumul des montants.
        if itab_fichier_in-code_dc eq 'D'.
          v_total  = v_total  + itab_fichier_in-montantd.
          v_totald = v_totald + itab_fichier_in-montantd.
        else.
          v_total  = v_total  - itab_fichier_in-montantc.
          v_totalc = v_totalc + itab_fichier_in-montantc.
        endif.
    *   -= Au changement de poste. =-
        at new poste.
    *     Nouvelle entete
          perform p_entete_piece using itab_fichier_in-societe
                                       itab_fichier_in-poste
                                       v_date.
    *     Initialisation compteur de poste de piece.
          v_count = 1.
        endat.
    *   -= A la fin du poste. =-
        at end of poste.
    *     Modifie l indicateur de dernier poste.
          v_flag_fin = 1.
        endat.
    *   Si c est le dernier poste de la piece on ferme...
        if v_flag_fin = 1.
          if itab_fichier_in-code_dc eq 'D'.
            move 40 to v_clef.
            perform p_fermeture_piece using v_clef
                                            itab_fichier_in-compte
                                            itab_fichier_in-centre
                                            itab_fichier_in-montantd.
          else.
            move 50 to v_clef.
            perform p_fermeture_piece using v_clef
                                            itab_fichier_in-compte
                                            itab_fichier_in-centre
                                            itab_fichier_in-montantc.
          endif.
    *     Gestion de l indicateur de fin de piece.
          move 0 to v_flag_fin.
    *     Gestion de la table des pieces pour l edition.
          move : itab_fichier_in-poste  to itab_piece-typepiece ,
                 v_totalc               to itab_piece-montantc ,
                 v_totald               to itab_piece-montantd .
          append itab_piece.
          clear : v_totalc, v_totald, itab_piece.
    *   Cas normal d un poste de la piece.
        else.
    *     Recherche de la clef.
          if itab_fichier_in-code_dc eq 'D'.
            move 40 to v_clef.
            perform p_poste_piece using itab_fichier_in-societe
                                        v_clef
                                        itab_fichier_in-compte
                                        itab_fichier_in-centre
                                        itab_fichier_in-montantd
                                        v_date.
          else.
            move 50 to v_clef.
            perform p_poste_piece using itab_fichier_in-societe
                                        v_clef
                                        itab_fichier_in-compte
                                        itab_fichier_in-centre
                                        itab_fichier_in-montantc
                                        v_date.
          endif.
        endif.
    *   -= Poste de piece. =-
    *   Si plus de 900 postes dans la piece on equilibre et on contre-passe
    *   dans une nouvelle piece.
        if v_count gt 900.
    *     Recherche de la clef pour l'equilibrage (inverse de la normal).
          if v_total gt 0.
            move 50 to v_clef.
            v_montant = v_total.
          elseif v_total lt 0.
            move 40 to v_clef.
            v_montant = 0 - v_total.
          endif.
    *     Equilibrage.
          perform p_fermeture_piece using v_clef
                                          '2122010900'
                                          v_montant.
    *     Nouvelle entete de piece.
          perform p_entete_piece using itab_fichier_in-societe
                                       itab_fichier_in-poste
                                       v_date.
    *     Initialization de la variable de poste de piece.
          v_count = 1.
    *     Recherche de la clef pour la contre-partie.
          if v_total gt 0.
            move 40 to v_clef.
            v_montant = v_total.
          elseif v_total lt 0.
            move 50 to v_clef.
            v_montant = 0 - v_total.
          endif.
    *     Contre-partie.
          perform p_poste_piece using itab_fichier_in-societe
                                      v_clef
                                      '2122010900'
                                      v_montant
                                      v_date.
    *     Gestion de la table des pieces pour l edition.
          move : itab_fichier_in-poste  to itab_piece-typepiece ,
                 v_totalc               to itab_piece-montantc ,
                 v_totald               to itab_piece-montantd .
          append itab_piece.
          clear : v_totalc, v_totald, itab_piece.
        endif.                  " Supperieur 900 lignes.
      endloop.
    endform.                               " P_CREATION_BATCH
    *   Procédure P_LAST_DAY_OF_MONTH.                                     *
    *   Calcul du dernier jour du mois.                                    *
    form p_last_day_of_month using    i_datum
                             changing e_tt.
      data: datmm   type i ,
            datjj   type i ,
            year(4) type n ,
            date(8) type n ,
            rest    type i ,
            zw_tt   type i .
    * Initialization
      clear e_tt.
    * Recherche du mois.
      datmm = i_datum+2(2).
    * Nombre de jour par mois.
      case datmm.
        when 1.  zw_tt = 31.
        when 2.  zw_tt = 28.
        when 3.  zw_tt = 31.
        when 4.  zw_tt = 30.
        when 5.  zw_tt = 31.
        when 6.  zw_tt = 30.
        when 7.  zw_tt = 31.
        when 8.  zw_tt = 31.
        when 9.  zw_tt = 30.
        when 10. zw_tt = 31.
        when 11. zw_tt = 30.
        when 12. zw_tt = 31.
      endcase.
    * Cas particulier du mois de fevrier.
      if datmm = 2.
        move : '20'          to year(2) ,
                i_datum+0(2) to year+2(2) .
        datjj = year.
        rest  = datjj mod 4.
        if rest = 0.
          zw_tt = 29.
        endif.
      endif.
      move : '20'         to date+4(2) ,
             i_datum+0(2) to date+6(2) ,
             i_datum+2(2) to date+2(2) ,
             zw_tt        to date+0(2) .
      e_tt = date.
    endform.
    *   Procédure P_ENTETE_PIECE.                                          *
    *   Regles :                                                           *
    *            Si le poste est PR alors le type de piece est AC, sinon   *
    *            il est SA.                                                *
    form p_entete_piece using v_bukrs
                              poste
                              v_date.
    * Lancement ecran en-tete de piece.
      perform bdc_dynpro using 'SAPMF05A' '0100'.
    * Validation.
      perform bdc_field using 'BDC_OKCODE' '/00'.
    * Date de piece.
      perform bdc_field using 'BKPF-BLDAT' v_date.
    * Date comptable.
      perform bdc_field using 'BKPF-BUDAT' v_date.
    * Type de piece.
      if poste eq 'PR'.
        perform bdc_field using 'BKPF-BLART' 'AC'.
      else.
        perform bdc_field using 'BKPF-BLART' 'SA'.
      endif.
    * Société.
      perform bdc_field using 'BKPF-BUKRS' v_bukrs.
    * Devise.
      perform bdc_field using 'BKPF-WAERS' p_waers.
    endform.
    *   Procédure P_POSTE_PIECE.                                           *
    *   En fonction de la marque de decimale choisi par l'utilisateur      *
    *   on passe les ',' en '.'  ou inversement.                           *
    form p_poste_piece using v_bukrs
                             v_clef
                             v_compte
                             v_centre
                             v_total
                             v_date.
      data : v_data(25) type c ,           " data temporaire pour valeurs
             v_text like bseg-sgtxt ,      " Texte du poste de la piece
             v_fdlev like skb1-fdlev.      " Niveau trésorerie
    * Vérifie que le compte est traité en trésorerie.
      select single fdlev
             into v_fdlev
             from skb1
             where bukrs eq v_bukrs
             and   saknr eq v_compte.
    * Gestion de la zone texte de poste de la piece.
      move : v_compte to v_text ,
             '/'      to v_text+10 ,
             v_centre to v_text+11 ,
             '/'      to v_text+19 ,
             text-001 to v_text+22 .
    * Gestion zone P -> C
      move v_total to v_data.
      shift v_data left deleting leading space.
    * Test la constante utilisateur marquant la decimale.
      if v_decimal eq 'X'.
        replace ',' with '.' into v_data.
      else.
        replace '.' with ',' into v_data.
      endif.
    * Test s il sagit du premier poste de la piece.
      if v_count eq 1.
    *   Clé de comptabilisation.
        perform bdc_field using 'RF05A-NEWBS' v_clef.
    *   Compte comptable.
        perform bdc_field using 'RF05A-NEWKO' v_compte.
      else.
        perform bdc_dynpro using 'SAPMF05A' '0300'.
        perform bdc_field using 'BDC_OKCODE' '/00'.
    *   Clé de comptabilisation.
        perform bdc_field using 'RF05A-NEWBS' v_clef.
    *   Compte comptable.
        perform bdc_field using 'RF05A-NEWKO' v_compte.
    *   Inconnu ...
        perform bdc_field using 'BDC_SUBSCR' 'SAPLKACB'.
    *   Indique de ne pas repasser sur la saisie des centres de couts ...
        perform bdc_field using 'DKACB-FMORE' ' '.
      endif.
    * Lancement ecran poste de piece.
      perform bdc_dynpro using 'SAPMF05A' '0300'.
    * Validation.
      perform bdc_field using 'BDC_OKCODE' '/00'.
    * Si compte gestion tresorerie alors on positionne la date.
      if v_fdlev ne space.
        perform bdc_field using 'BSEG-VALUT' v_date.
      endif.
    * Montant.
      perform bdc_field using 'BSEG-WRBTR' v_data.
    * Texte du poste de la piece.
      perform bdc_field using 'BSEG-SGTXT' v_text.
    * Inconnu ...
      perform bdc_field using 'BDC_SUBSCR' 'SAPLKACB'.
    * Si le centre de couts est vide on ne traite pas l ecran
    * de saisie du centre de couts.
      if v_centre ne space.
    *   Indique de passer sur le dynpro de saisie centre de couts ...
        perform bdc_field using 'DKACB-FMORE' 'X'.
    *   Ecran de saisie des centres de couts.
    *   Saisie des données du poste de la piéce.
        perform bdc_dynpro using 'SAPLKACB' '0002'.
        perform bdc_field using 'BDC_OKCODE' '/EENTE'.
    *   Centre de coûts.
        perform bdc_field using 'COBL-KOSTL' v_centre.
    *   Encore un inconnu ...
        perform bdc_field using 'BDC_SUBSCR' 'SAPLKACB'.
      else.
    *   Indique de passer sur le dynpro de saisie centre de couts ...
        perform bdc_field using 'DKACB-FMORE' ' '.
      endif.
    endform.
    *   Procédure P_FERMETURE_PIECE.                                       *
    form p_fermeture_piece using v_clef
                                 v_compte
                                 v_centre
                                 v_total.
      data : v_data(25) type c ,           " data temporaire pour valeurs
             v_text like bseg-sgtxt.
    * Gestion de la zone texte de poste de la piece.
      move : v_compte to v_text ,
             '/'      to v_text+10 ,
             v_centre to v_text+11 ,
             '/'      to v_text+19 ,
             text-001 to v_text+22 .
    * Gestion zone P -> C
      move v_total to v_data.
      shift v_data left deleting leading space.
    * Test la constante utilisateur marquant la decimale.
      if v_decimal eq 'X'.
        replace ',' with '.' into v_data.
      else.
        replace '.' with ',' into v_data.
      endif.
      perform bdc_dynpro using 'SAPMF05A' '0300'.
      perform bdc_field using 'BDC_OKCODE' '/00'.
    * Clé de comptabilisation.
      perform bdc_field using 'RF05A-NEWBS' v_clef.
    * Compte comptable.
      perform bdc_field using 'RF05A-NEWKO' v_compte.
    * Inconnu ...
      perform bdc_field using 'BDC_SUBSCR' 'SAPLKACB'.
    * Indique de ne pas repasser sur la saisie des centres de couts ...
      perform bdc_field using 'DKACB-FMORE' ' '.
      perform bdc_dynpro using 'SAPMF05A' '0300'.
      perform bdc_field using 'BDC_OKCODE' '=BU'.
    * Montant.
      perform bdc_field using 'BSEG-WRBTR' v_data.
    * Texte du poste de la piece.
      perform bdc_field using 'BSEG-SGTXT' v_text.
    * Inconnu ...
      perform bdc_field using 'BDC_SUBSCR' 'SAPLKACB'.
      if v_centre ne space.
    *   Indique de passer sur la saisie des centres de couts ...
        perform bdc_field using 'DKACB-FMORE' 'X'.
    *   Ecran de saisie des centres de couts.
    *   Saisie des données du poste de la piéce.
        perform bdc_dynpro using 'SAPLKACB' '0002'.
        perform bdc_field using 'BDC_OKCODE' '/EENTE'.
    *   Centre de coûts.
        perform bdc_field using 'COBL-KOSTL' v_centre.
    *   Encore un inconnu ...
        perform bdc_field using 'BDC_SUBSCR' 'SAPLKACB'.
      else.
    *   Indique de ne pas repasser sur la saisie des centres de couts ...
        perform bdc_field using 'DKACB-FMORE' ' '.
      endif.
    * Transfert du dossier.
      perform insert_bdc using v_t_code.
      refresh bdc_tab.
      clear bdc_tab.
    endform.
    *   Form OPEN_BDC                                                      *
    *   Ouverture du dossier Batch-Input.                                  *
    form open_bdc using v_nom_dossier.
      call function 'BDC_OPEN_GROUP'
           exporting
                client              = sy-mandt          " Numéro de mandant
                group               = v_nom_dossier     " Nom dossier batch
                keep                = 'X'               " Code
                user                = sy-uname          " Nom utilisateur
           exceptions
                client_invalid      = 1
                destination_invalid = 2
                group_invalid       = 3
                group_is_locked     = 4
                holddate_invalid    = 5
                internal_error      = 6
                queue_error         = 7
                running             = 8
                system_lock_error   = 9
                user_invalid        = 10
                others              = 11.
      if sy-subrc ne 0.
        write : /1 text-001 ,
                /1 'Erreur :' , sy-subrc.
      endif.
      refresh bdc_tab.
      clear   bdc_tab.
      exit.
    endform.                       " OPEN_BDC
    *   Form CLOSE_BDC                                                     *
    *   Fermeture du dossier BTCI                                          *
    form close_bdc.
      call function 'BDC_CLOSE_GROUP'
           exceptions
                not_open    = 1
                queue_error = 2
                others      = 3.
      if sy-subrc ne 0.
        write : /1 text-002 ,
                /1 'Erreur :' , sy-subrc.
      endif.
    endform.                     " CLOSE_BDC
    *   Form BDC_DYNPRO                                                    *
    *   Alimentation de la ligne d'entête de BDCTAB                        *
    form bdc_dynpro using value(progname)
                          value(dynpronr).
    * Efface la header-line.
      clear bdc_tab.
    * Insertion des valeurs.
      bdc_tab-program  = progname.
      bdc_tab-dynpro   = dynpronr.
      bdc_tab-dynbegin = 'X'.
    * Enregistrement des valeurs.
      append bdc_tab.
    endform.                    " BDC_DYNPRO
    *   Form BDC_FIELD                                                     *
    *   Traitement des enregistrements de la structure BDCTAB              *
    *      --> FIELDNAME  Nom du champ                                     *
    *      --> FIELDVALUE Valeur du champ                                  *
    form bdc_field using value(fieldname) value(fieldvalue).
    * Efface la header-line.
      clear bdc_tab.
    * Insertion des valeurs.
      bdc_tab-fnam = fieldname.
      bdc_tab-fval = fieldvalue.
    * Enregistrement des valeurs.
      append bdc_tab.
    endform.                " BDC_FIELD
    * Form BDC_CURSOR                                                      *
    * Positionnement du curseur sur un champ particulier                   *
    form bdc_cursor using value(fieldname) value(fieldvalue).
    * Efface la header-line.
      clear bdc_tab.
    * Insertion des valeurs.
      bdc_tab-fnam = fieldname.
      bdc_tab-fval = fieldvalue.
    * Enregistrement des valeurs.
      append bdc_tab.
    endform.              " BDC_CURSOR
    *   Form  INSERT_BDC                                                   *
    *   Insertion dans le dossier BTCI                                     *
    *   Attention : la transaction est codée en dur                        *
    form insert_bdc using t_code.
      call function 'BDC_INSERT'
           exporting
                tcode            = t_code
           tables
                dynprotab        = bdc_tab
           exceptions
                internal_error   = 1
                not_open         = 2
                queue_error      = 3
                tcode_invalid    = 4
                printing_invalid = 5
                posting_invalid  = 6
                others           = 7.
      if sy-subrc ne 0.
        write : /1 text-003 ,
                /1 'Erreur :' , sy-subrc.
      endif.
    endform.                  " INSERT_BDC
    *   Procédure P_DECIMAL.                                               *
    form p_decimal.
    * Recherche de la constante utilisateur sur la virgule decimale.
      select single dcpfm
             into v_decimal
             from usr01
             where bname eq sy-uname.
    endform.
    *   Procédure P_EDITION.                                               *
    *   Procédure d'edition du resultat de la génération du dossier        *
    *   Batch-Input.                                                       *
    form p_edition.
      data : v_solde(13) type p decimals 2.
      skip 1.
      write : /1 'Comptabilisation de la paie venant de Pléïades.'.
    * Le mois.
      skip 2.
      case v_periode+2(2).
        when 01.
          write : /1 'Mois : Janvier'.
        when 02.
          write : /1 'Mois : Fevrier'.
        when 03.
          write : /1 'Mois : Mars'.
        when 04.
          write : /1 'Mois : Avril'.
        when 05.
          write : /1 'Mois : Mai'.
        when 06.
          write : /1 'Mois : Juin'.
        when 07.
          write : /1 'Mois : Juillet'.
        when 08.
          write : /1 'Mois : Aout'.
        when 09.
          write : /1 'Mois : Septembre'.
        when 10.
          write : /1 'Mois : Octobre'.
        when 11.
          write : /1 'Mois : Novembre'.
        when 12.
          write : /1 'Mois : Decembre'.
      endcase.
    * La date comptable.
      skip 1.
      write : /1  'Date comptable :' ,
               18 v_date+0(2) ,
               20 '/' ,
               21 v_date+2(2) ,
               23 '/' ,
               24 v_date+4(4).
    * Piece SA.
      skip 2.
      write : /1  'Piece(s) SA :' ,
              /10 'Montant Debit' ,
               40 'Montant Credit' ,
               70 'Solde'.
      loop at itab_piece where typepiece ne 'PR'.
        v_solde = itab_piece-montantd - itab_piece-montantc.
        write : /1  itab_piece-montantd ,
                 31 itab_piece-montantc ,
                 61 v_solde.
      endloop.
    * Piece AC.
      skip 2.
      write : /1  'Piece(s) AC :' ,
              /10 'Montant Debit' ,
               40 'Montant Credit' ,
               70 'Solde'.
      loop at itab_piece where typepiece eq 'PR'.
        v_solde = itab_piece-montantd - itab_piece-montantc.
        write : /1  itab_piece-montantd ,
                 31 itab_piece-montantc ,
                 61 v_solde.
      endloop.
      skip 4.
      write : /1 'Anomalie :' ,
              /1 'Nombre de lignes dont le montant est nul :' ,
                 v_nb_blanc no-zero.
    endform.

  • BDC Related to FB01

    Hi,
    This is regarding an issue related to Posting of a Document using FB01.A BDC has been created to Post the document based on the Tax A1 and the Calculation is happening pretty smmothly. Now when we use the the Tax code as A3 the posting does not take place instead it will be parked and will be displayed in blue.on double clicking on it, it posts the document.
    pls give me a solution on how to go about creating a BDC.
    if code is available pls post it
    Thanks in advance
    Naveen

    You say this: The documentation for function POSTING_INTERFACE_DOCUMENT is quite good. It can create a batch or process immediately.
    You call POSTING_INTERFACE_START to specify if a batch session is to be created or processing will be done immediately with All, Errors or No stopping.
    1. i have a program use this function but my problem i don't know how in batch session specify will be done inmediately.
    2. where is the official documentation. i can't find it!
    Thanks for you answers!
    Christian

Maybe you are looking for

  • DMS BAPI_DOCUMENT_CREATE2 Class type Technical Document Category, object ty

    Hello Experts! The problem is that DMS import functionality stoped working after supp. pack implementation. The process is based on BAPI_DOCUMENT_CREATE2 functionality. The first problem was an error "The status set requires a previous status" which

  • Full-screen problem on YouTube

    This just started a few weeks ago: When I go to full-screen mode on YouTube, I get a weird, messed up image that looks like an x-ray or something.  Very dark overall, with blurry and unreadable graphics. Hulu is fine in full-screen mode.  Youtube is

  • Import and location of datafiles

    Hello. I need to import full database from Oracle8i datadump to Oracle10g Express. I did: C:\> exp80 'user/user as sysdba' FILE=db.dmp FULL=y, and then on new server with Oracle10g: C:\> imp 'user/user as sysdba' FILE=db.dmp FULL=y and I get: IMP-000

  • Last argument in AGO function

    Hi Everyone... Hope everyone is good . So we have this requirement where user want to see selected quarter last month, then previous quarter last month and previous year last month based on Year and Quarter selection. for example. Prompts: Year - 201

  • GW8 Spell checker error

    A user is getting the error 'Cannot load spell checker resource module' when spell checking an email before sending it. We have uninstalled, ran cleaner, reinstalled GW but it is still giving the error. We are running GW8 SP2. It has been working for