Problem in BDC for VA01 transaction TEXTS tab(Upgrading from 4.5b to ECC6)

Hi All,
I am working in upgrade project from 4.5b version to ECC6 version.
I am facing problem in TEXTS tab of VA01 transaction. In earlier version it is a table control containing of Language, Description & First line but, in ECC6 the screen is modified with texteditor, a list box for language key and a Text type at the left.
Now my problem is how to record this in BDC and how to read the text in the texteditor?
Thanks in Advance,
Ravi Kiran.

Hi Seshagiri,
In this case i would suggest the use of BAPI if there's no compulsion to use BDC.
BAPI_SALESORDER_CHANGE                     Sales order: Change Sales Order
BAPI_SALESORDER_CONFIRMDELVRY
BAPI_SALESORDER_CREATEFROMDAT1    Sales order: Create Sales Order
BAPI_SALESORDER_CREATEFROMDAT2    Sales order: Create Sales Order
BAPI_SALESORDER_CREATEFROMDATA    Create Sales Order, No More
BAPI_SALESORDER_GETLIST        Sales order: List of all Orders for Customer
BAPI_SALESORDER_GETSTATUS      Sales Order: Display Status
BAPI_SALESORDER_SIMULATE       Sales Order: Simulate Sales Order
try using these for creation or change of orders instead of bdcs.
hope this helps and revert for more clarifications if any.
<b>Always reward points to useful suggestions.</b>
regards,
Vikas

Similar Messages

  • Problem in BDC for VA01

    Dear Experts,
    I have developed a BDC Program for transaction VA01, if there is change in price it shows warning message as 'Condition PR00 has been changed' and loose the control, at that time if click on enter it will regain the control and proceed further.
    I have added an extra code for 'enter' but its not working, please share your ideas to fix this issue.
    thanks in advance...
    Venkat

    Hi Madhukar,
    thanks for writing.
    yes when I execute program in forground it shows warning message and looses the control.
    If execute in background it will not create SO at all.
    I tried to do recording for this case again but even while recording also it looses the control when I press enter then it will regain the control but that wont recorded.
    Regards,
    Venkat

  • Error while running a BDC for the Transaction F-02

    Hi,
           I'm getting an error <b><i>"Parking not possible during Batch Input"</i></b> while running a BDC for the transaction F-02.
           When i click on the error message it displays the message [b<i>]"In Customizing, you can control whether an error message is issued."</b></i>
            How to solve this issue?.
            Waiting for ur replies.........
    Regards
    N.Senthil

    Hi,
    When you are doing the recording in SHDB, and in the same screen where the TCODE to be recorded is given, there are options that you can choose called "Recording Parameters"...Select the checkbox which says "Not a Batch Input Session", this will set the sy-binpt variable to " "(in a recording by default it is "X")...and you will not get this error...
    Also make sure while writing the BDC program to make use of the "bdc options" parameter which has this property to switch of sy-binpt...
        Refer below theard for sample bdc code for f-02.
    https://forums.sdn.sap.com/click.jspa?searchID=5126766&messageID=1538409
    Regards

  • Problem in BDC for VA31

    Hi Experts ,
    I am creating BDC for VA31 transaction.
    If there are multiple line items then i have to select first line item and then go to forcast delivery schedule button .
    I have to do this procedure for every line item.
    Is there any way or function code to pick line item.
    Thanks
    Sonal

    Search with BDC for Table control.

  • Enhancement for 6201 screen in SAPLV69A for VA01 transaction

    hi experts,
    i need to enhance the 6201 screen in SAPLV69A program for VA01 application,
    is there any user exit for this particular screen.

    Hi,
    Check all for VA01
    Transaction Code - VA01                     Create Sales Order                                                                               
    Exit Name           Description                                                                               
    SDTRM001            Reschedule schedule lines without a new ATP check                               
    V45A0001            Determine alternative materials for product selection                           
    V45A0002            Predefine sold-to party in sales document                                       
    V45A0003            Collector for customer function modulpool MV45A                                 
    V45A0004            Copy packing proposal                                                           
    V45E0001            Update the purchase order from the sales order                                  
    V45E0002            Data transfer in procurement elements (PRreq., assembly)                        
    V45L0001            SD component supplier processing (customer enhancements)                        
    V45P0001            SD customer function for cross-company code sales                               
    V45S0001            Update sales document from configuration                                        
    V45S0003            MRP-relevance for incomplete configuration                                      
    V45S0004            Effectivity type in sales order                                                 
    V45W0001            SD Service Management: Forward Contract Data to Item                            
    V46H0001            SD Customer functions for resource-related billing                              
    V60F0001            SD Billing plan (customer enhancement) diff. to billing plan                                                                               
    No of Exits:         15      
    Rewards if useful.............
    Minal

  • Bdc for 3 transactions

    Hi gurus
    I am writing a bdc for 3 transaction , it runs fines if i execute them seperately , can u let me know who do i merge 3 transactions in one BDC . transactions used are FBRA, F.80 and F-04 .
    is their any specific way .... pls send the code if possible.....
    thanks in advance.
    its urgent

    Hi Shweta
    do u want to run all 3 transaction at a time or run separtely..
    If u want 3 at a time then
    define 3 internal table and 3 BDC struture.
    In FM BDC_INSERT use appropriate internal for correct transactio.
    Like...
    FM BDC_OPEN_GROUP..
    Call Function 'BDC_INSERT'
    Exporting
    tcode = 'FRBA'
    importing
    table = itab1.
    Call Function 'BDC_INSERT'
    Exporting
    tcode = 'F-04'
    importing
    table = itab2.
    Call Function 'BDC_INSERT'
    Exporting
    tcode = 'F.80'
    importing
    table = itab3.
    call FM "BDC_CLOSE_GROUP.
    Reward me if its useful
    Regards
    Ravi

  • I have been having problem for cad access since I upgrade from OSX 10.6 to OSX 10.8  Now it is akin me to select a certificate, but there is none listed

    I have been having problem for cac access since I upgrade from OSX 10.6 to OSX 10.8.   Now it is aking me to select a certificate, but there is none listed.

    Is the SW  you are using campaitible with 10.8.x?

  • How to solve the problem related with inputing of the text into Wordpress from Firefox 9 and 9.0.1. The problem is that after inputing the formatting gets lost. Taking in account high popularity of Wordpress I suppose the problem is quite serious.

    How to solve the problem related with inputing of the text into Wordpress from Firefox 9 and 9.0.1.
    The problem is that after inputing the formatting gets lost.
    Taking in account high popularity of Wordpress I suppose the problem is quite serious.

    Perform the suggestions mentioned in the following articles:
    * [https://support.mozilla.com/en-US/kb/Template:clearCookiesCache/ Clear Cookies & Cache]
    * [[Troubleshooting extensions and themes]]
    * Clipboard not working -> [http://kb.mozillazine.org/Clipboard_not_working]
    * Rich Text Editing -> [http://kb.mozillazine.org/Rich_text_editing]
    * Update All your Firefox Plugins -> [https://www.mozilla.org/en-US/plugincheck/]
    Check and tell if its working.
    Might not be related to your problem but some of your Plugins are out-dated
    * Update All your Firefox Plugins -> [https://www.mozilla.org/en-US/plugincheck/]
    * '''When Downloading Plugins Update setup files, Remove Checkmark from Downloading other Optional Softwares with your Plugins (e.g. Toolbars, McAfee, Google Chrome, etc.)'''

  • I am trying to license my recent download of Lightroom 5 onto my recently purchased Macbook with the serial number of the disk I purchased last year for my Windows PC (an upgrade from Lightroom 4).  I receive an error "The serial number you entered is inv

    I am trying to license my recent download of Lightroom 5 onto my recently purchased Macbook with the serial number of the disk I purchased last year for my Windows PC (an upgrade from Lightroom 4).  I receive an error "The serial number you entered is invalid".  Why does CC not recognize this as a valid serial number?

    Soyouca how did you install Photoshop Lightroom?  Please uninstall the current installation using the uninstaller located in Applications/Utilities/Adobe Installers.
    Once Photoshop Lightroom is removed please download a fresh copy of the installation files from Adobe - Lightroom : For Macintosh.  The update contains the full installer so please download the latest version of Photoshop Lightroom 5.
    You may be asked to enter your serial number for Photoshop Lightroom 4.  You can find information on how to locate the serial numbers under your account at Find your serial number quickly - http://helpx.adobe.com/x-productkb/global/find-serial-number.html.

  • Problem with OPERATION TEXT(LTXA1) uploading using BDC For C202 Transaction

    Hi Experts,
    Im presently doing a BDC for the trransaction C202 (Change Master Recipe),my task was to upload the 'OPERATION TEXT' field PLPOD-LTXA1 which is actually Long text to an existing master recipe from a flat file during updation of the 'OPERATION TEXT the number of lines i was able to were 34 which we number lines on the displayed page and while updating the 35th line using the concept of bdc table control it is failing to insert the update text.
    I used all the ok codes but failed to update more than 34 lines.So,can someone tell me how to update the longtext beyound it.
    This is the Screenshot of my problem:
    [BDC_C202_error|http://www.freeimagehosting.net/uploads/79af6bac49.jpg]
    Thanx in advance.

    Hi,
    There is a better way of doing the long text upload in SAP. In your BDC, if I change the text editor, the BDC will not work.
    Hence ,
    Use function module " Save_Text" to update long texts in SAP.
    Please check its FM documentation or perform a search for this FM in SDN for more clarity.
    Write back in case you face further issues.
    Regards,
    Rijuraj
    Edited by: Rijuraj Raju on Sep 10, 2010 3:05 PM

  • Bdc for sales header text va01

    we need to write a bdc program for va01. In that we need to
    upload header text also .
    So please kindly tell me how to upload flat file to va01 along with
    header text.And how we need to declare the flat file.
    if it is not possible through bdc then tell me how to do with bapi.
    thank you so much for all the replies

    Record the transaction properly for header text along with other fields properly, it will generate the code for you when you save the recording and create the Program using the Recording.
    if not You can go with the BAPI,
    BAPI : BAPI_SALESORDER_CREATEFROMDAT2
    Table parameter ORDER_TEXT is used for the creation of the text.
    Read the documentation of the BAPI.

  • Problem in BDC for Transaction F-02

    Hi Friends,
    I am struck up in BDC for TransactionF-02.i am unable to load the data of my test data.when i am loading its loading the second record not the first record.
    Below is the test data
    H,RAWATEB,1
    M,11072006,ZE,1000,11072006,20,SAR,,,,,RAWATIB,,SALARIES,1000
    D,50,482000,3648.61,Z1,,,1000,1111,,,,,,
    D,40,113001,3648.61,Z1,,,1000,,,,,,,
    D,17,001011,3000000.00,Z1,,,1000,,,,,,,
    D,40,113001,3000000.00,Z1,,,1000,,,,,,,
    M,17082004,ZE,1000,11072006,20,SAR,,,,,RAWATIB,,SALARIES,1000
    D,50,482000,3202.82,Z1,,,1000,1112,,,,,,
    D,40,113001,3202.82,Z1,,,1000,,,,,,,
    D,50,482000,2600000.00,Z1,,,1000,1111,,,,,,
    D,40,001011,2600000.00,Z1,,,1000,,,,,,,
    T,0000000002
    <b></b>
    the report is below
    REPORT ZFGLDR0030 line-count 60
                      line-size 160
                      message-id 00.
    ====================================================================
    ****************************TABLES**********************************
    ====================================================================
    tables: bkpf.
    ====================================================================
    **************************RECORD LAYOUTS****************************
    ====================================================================
    Data: begin of bdc_tab occurs 200.
            include structure bdcdata.
    data: end   of bdc_tab.
    Data: Begin of tmp_tab occurs 200,
           fld1(255)   type   c,
          end of tmp_tab.
    DATA: BEGIN OF upload_tab OCCURS 200,
            fld1(1)    type   c,
            fld2(10)   type   c,
            fld3(10)   type   c,
            fld4(16)   type   c,
            fld5(10)   type   c,
            fld6(2)    type   c,
            fld7(4)    type   c,
            fld8(10)   type   c,
            fld9(10)   type   c,
            fld10(10)  type   c,
            fld11(10)  type   c,
            fld12(12)  type   c,
            fld13(25)  type   c,
            fld14(50)  type   c,
            fld15(4)   type   c,
            fld16(1)   type   c,
          END OF upload_tab.
    data : tmp_rec like upload_tab.
    DATA: BEGIN OF upload1_tab OCCURS 200,
            fld1(1)    type   c,
            fld2(10)   type   c,
            fld3(10)   type   c,
            fld4(16)   type   c,
            fld5(10)   type   c,
            fld6(2)    type   c,
            fld7(4)    type   c,
            fld8(10)   type   c,
            fld9(10)   type   c,
            fld10(10)  type   c,
            fld11(10)  type   c,
            fld12(12)  type   c,
            fld13(25)  type   c,
            fld14(50)  type   c,
            fld15(4)   type   c,
            fld16(1)   type   c,
          END OF upload1_tab.
    Data: upload2_tab like tmp_rec occurs 200 with header line.
    Data: Del_tab like tmp_rec occurs 200 with header line.
    DATA: V_SYTABIX TYPE I,
          v_kunnr     like knb1-kunnr,
          v_brsch     like kna1-brsch,
          v_datum     like sy-datum,
          v_tmp(1)    type c,
          v_flag      type i,
          v_ccode(10) type c,
          v_glcd(10)  type c,
          v_len       type n,
          v_rem(50)   type c,
          v_docno(12) type c,
          v_dtype(3)  type c,
          v_sno(8)    type n,
          v_upd_flag  type i,
          v_idx       like sy-tabix,
          v_budat     like bkpf-budat,
          v_fld5(10)  type c,
          v_date(10)  type c.
    ====================================================================
    *********************SELECTION-SCREEN******************************
    ====================================================================
    selection-screen: begin of block b1 with frame .
    parameters:p_fl_mct  like  rlgrap-filename
                         default 'C:\test' obligatory,
               p_sesid   like apqi-groupid default 'RAWATIB',
               p_user    like apqi-userid default sy-uname.
    selection-screen: end of block b1.
    selection-screen: begin of block b2 with frame .
    parameters:p_opt1    radiobutton group grp1 default 'X',
               p_opt2    radiobutton group grp1,
               p_budat   like bkpf-budat.
    selection-screen: end of block b2.
    ====================================================================
    Validate SELECTION-SCREEN **************************
    ====================================================================
    At Selection-screen.
      translate p_fl_mct to upper  case.
      if p_opt2 = 'X' and p_budat = '00000000'.
        message e398(00) with 'Please enter date to use as Posting date'.
      endif.
    at selection-screen on value-request for p_fl_mct.
      data : v_mask(120)          type c.
      v_mask = ',IT2 files (.),.'.
      CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
                DEF_FILENAME     = ' '
                DEF_PATH         = ' '
                MASK             = v_mask
                TITLE            = 'File Selection for Upload'
           IMPORTING
                FILENAME         = p_fl_mct
               RC               =
           EXCEPTIONS
                INV_WINSYS       = 1
                NO_BATCH         = 2
                SELECTION_CANCEL = 3
                SELECTION_ERROR  = 4
                OTHERS           = 5.
    end-of-selection.
    ====================================================================
    *****************************CONSTANTS******************************
    ====================================================================
    ====================================================================
    *****************************VARIABLES******************************
    ====================================================================
    ====================================================================
    TOP OF PAGE*******************************
    ====================================================================
    top-of-page.
    start-of-selection.
      v_upd_flag = 0.
      perform initialise_process.
      perform bdc_open.
      perform process_upload_tab.
      perform terminate_process.
    end-of-selection.
    ====================================================================
    Form : Initialise_Process                                          *
    ====================================================================
    FORM initialise_process.
       Initialises variables                                           *
      move : sy-repid to sy-tvar0,
             sy-uname to sy-tvar1,
             p_sesid  to sy-tvar2,
             sy-pagno to sy-tvar3.
      write: sy-datum to sy-tvar4,
             sy-uzeit to sy-tvar5.
    Selecting the GL codes to be updated**********************
      call function 'WS_UPLOAD'
        EXPORTING
          FILENAME         = p_fl_mct
          FILETYPE         = 'ASC'
        TABLES
          data_tab         = Tmp_tab
        EXCEPTIONS
          CONVERSION_ERROR = 1
          FILE_OPEN_ERROR  = 2
          OTHERS           = 10.
      if sy-subrc <> 0.
        message e398(00) with 'Unable to upload data'.
      endif.
    Validation for Upload file **********************
      read table tmp_tab index 1.
      split tmp_tab-fld1 at ',' into tmp_rec-fld1
                                     tmp_rec-fld2
                                     tmp_rec-fld3
                                     tmp_rec-fld4
                                     tmp_rec-fld5
                                     tmp_rec-fld6
                                     tmp_rec-fld7
                                     tmp_rec-fld8
                                     tmp_rec-fld9
                                     tmp_rec-fld10
                                     tmp_rec-fld11
                                     tmp_rec-fld12
                                     tmp_rec-fld13
                                     tmp_rec-fld14
                                     tmp_rec-fld15
                                     v_tmp.
      if tmp_rec-fld2 <> 'RAWATEB'.
        message e398(00) with 'Invliad file format, cannot upload'.
      endif.
      loop at tmp_tab.
        clear upload_tab.
        v_tmp = tmp_tab-fld1+0(1).
        if v_tmp = 'M' or v_tmp = 'D'.
          split tmp_tab-fld1 at ',' into upload_tab-fld1
                                         upload_tab-fld2
                                         upload_tab-fld3
                                         upload_tab-fld4
                                         upload_tab-fld5
                                         upload_tab-fld6
                                         upload_tab-fld7
                                         upload_tab-fld8
                                         upload_tab-fld9
                                         upload_tab-fld10
                                         upload_tab-fld11
                                         upload_tab-fld12
                                         upload_tab-fld13
                                         upload_tab-fld14
                                         upload_tab-fld15
                                         v_tmp.
          if upload_tab-fld1 = 'M'.
            clear tmp_rec.
            move upload_tab to tmp_rec.
          else.
            clear upload1_tab.
            move upload_tab to upload1_tab.
            upload1_tab-fld10  = tmp_rec-fld2.
            upload1_tab-fld12 = tmp_rec-fld12.
            upload1_tab-fld15 = tmp_rec-fld15.
            append upload1_tab.
          endif.
          append upload_tab.
        endif.
      endloop.
    Mark the already uploaded Transaction to skip ***********
      Loop at upload_tab.
        if upload_tab-fld1 = 'M'.
          v_idx = sy-tabix.
          move upload_tab-fld24(4) to v_budat0(4).
          move upload_tab-fld22(2) to v_budat4(2).
          move upload_tab-fld20(2) to v_budat6(2).
          Select single * from bkpf where BLART = upload_tab-fld3 and
                                          BUKRS = upload_tab-fld4 and
                                          XBLNR = upload_tab-fld12 and
                                          budat = v_budat.
          if sy-subrc = 0.
            do 1000 times.
              clear del_tab.
              move upload_tab to del_tab.
              append del_tab.
              upload_tab-fld16 = '*'.
              modify upload_tab index v_idx.
              v_idx = v_idx + 1.
              Read table upload_tab index v_idx.
              if upload_tab-fld1 = 'M' or sy-subrc <> 0.
                exit.
              endif.
            enddo.
          endif.
        endif.
      endloop.
    ENDFORM.                    "initialise_process
    ====================================================================
    Form : Process_Ord_itab                                            *
    ====================================================================
    FORM process_upload_tab .
      v_flag = 0.
      loop at upload_tab where fld16 <> '*' .
    Performing the Save at the end of Transaction *************
        if upload_tab-fld1 = 'M' and v_flag = 1.
          perform load_save.
          perform bdc_insert.
        endif.
    Putting the Header information of the document ************
        if upload_tab-fld1 = 'M'.
          perform load_header.
          v_date = v_fld5.
          v_rem  = upload_tab-fld14.
          v_flag = 0.
        endif.
    Putting the Detail information of the document ************
        if upload_tab-fld1 = 'D'.
          if upload_tab-fld2 = '40' or upload_tab-fld2 = '50'  .
            perform Load_next.
            v_tmp = v_glcd.
            v_len = strlen( upload_tab-fld3 ).
            If ( v_tmp = '2' or v_tmp = '4' or v_tmp = '0' )  .
              Perform load_ccenter.
            elseif v_flag = 1.
              perform upload_blank.
            endif.
            perform load_Detail.
            v_flag = 1.
            v_glcd = upload_tab-fld3.
            v_ccode = upload_tab-fld9.
          else.
            perform Load_next.
            v_tmp = v_glcd.
            v_len = strlen( upload_tab-fld3 ).
            perform upload_blank.
            perform load_Detail_301.
            v_flag = 0.
            v_glcd = '1'.
          endif.
        endif.
      endloop.
      if v_flag = 1.
        perform load_save.
      endif.
      perform bdc_insert.
      v_upd_flag = 1.
    ENDFORM.                    "process_upload_tab
    ====================================================================
    Form : BDC_OPEN                                                   *
    ====================================================================
    FORM bdc_open.
      call function 'BDC_OPEN_GROUP'
        EXPORTING
          client = sy-mandt
          group  = p_sesid
          user   = p_user
          keep   = 'X'.
    ENDFORM.                    "bdc_open
    ====================================================================
    Form : Fill_BDC_Tab                                                *
    ====================================================================
    FORM fill_bdc_tab using dynbegin
                            name
                            value.
      if dynbegin = 'X'.
        clear bdc_tab.
        move:  name  to bdc_tab-program,
               value to bdc_tab-dynpro,
               'X'   to bdc_tab-dynbegin.
        append bdc_tab.
      else.
        clear bdc_tab.
        move:  name  to bdc_tab-fnam,
               value to bdc_tab-fval.
        append bdc_tab.
      endif.
    ENDFORM.                    "fill_bdc_tab
    ====================================================================
    Form : BDC_INSERT                                                 *
    ====================================================================
    FORM bdc_insert .
      call function 'BDC_INSERT'
        EXPORTING
          tcode     = 'F-02'
        TABLES
          dynprotab = bdc_tab.
      refresh bdc_tab.
      clear bdc_tab.
    ENDFORM.                    "bdc_insert
    ====================================================================
    Form : BDC_CLOSE                                                  *
    ====================================================================
    FORM bdc_close.
      call function 'BDC_CLOSE_GROUP'.
    ENDFORM.                    "bdc_close
    ====================================================================
    Form : Terminate_Process                                          *
    ====================================================================
    FORM terminate_process.
      perform bdc_close.
    ENDFORM.                    "terminate_process
    *&      Form  load_Header
    FORM load_Header.
      If upload_tab-fld1 = 'M'.
        v_fld5 = upload_tab-fld5.
        if p_opt2 = 'X'.
          move p_budat6(2) to v_fld50(2).
          move p_budat4(2) to v_fld52(2).
          move p_budat0(4) to v_fld54(4).
        endif.
        perform fill_bdc_tab using:
         'X' 'SAPMF05A'     '0100',
         ' ' 'BDC_CURSOR'   'RF05A-NEWKO',
         ' ' 'BKPF-BLDAT'    upload_tab-fld2,
         ' ' 'BKPF-BLART'    upload_tab-fld3,
         ' ' 'BKPF-BUKRS'    upload_tab-fld4,
         ' ' 'BKPF-BUDAT'    v_fld5,
         ' ' 'BKPF-WAERS'    upload_tab-fld7,
         ' ' 'BKPF-XBLNR'    upload_tab-fld12,
         ' ' 'BKPF-BKTXT'    upload_tab-fld13.
      Endif.
    ENDFORM.                    "load_Header
    *&      Form  load_Detail
    FORM load_Detail.
      perform fill_bdc_tab using:
       'X' 'SAPMF05A'     '0300',
       ' ' 'BDC_CURSOR'   'BSEG-WRBTR',
       ' ' 'BSEG-WRBTR'    upload_tab-fld4,
      ' ' 'BSEG-VALUT'    v_date,
       ' ' 'BSEG-SGTXT'    v_rem.
    ENDFORM.                    " LOAD_DATA
    *&      Form  load_Detail
    FORM load_Detail_301.
      perform fill_bdc_tab using:
       'X' 'SAPMF05A'     '0301',
       ' ' 'BDC_CURSOR'   'RF05A-NEWUM',
       ' ' 'BSEG-WRBTR'    upload_tab-fld4,
      ' ' 'BSEG-VALUT'    v_date,
       ' ' 'BSEG-SGTXT'    v_rem.
    ENDFORM.                    " LOAD_DATA
    *&      Form  load_Next
    FORM Load_next.
      perform fill_bdc_tab using:
       ' ' 'RF05A-NEWBS'    upload_tab-fld2,
       ' ' 'RF05A-NEWKO'    upload_tab-fld3,
       ' ' 'BDC_OKCODE'   '/00'.
    ENDFORM.                    "Load_next
    *&      Form  load_Save
    FORM Load_save.
      perform fill_bdc_tab using:
      'X' 'SAPMF05A'     '0300',
       ' ' 'BDC_OKCODE'   '=BU'.
      v_tmp = v_glcd.
      v_len = strlen( upload_tab-fld3 ).
      If ( v_tmp = '2' or v_tmp = '4' or v_tmp = '0' )  .
        Perform load_ccenter.
      elseif v_flag = 1.
        perform upload_blank.
      endif.
      perform fill_bdc_tab using:
       'X' 'SAPMF05A'     '0700',
       ' ' 'BDC_OKCODE'   '=BU'.
    ENDFORM.                    "Load_save
    *&      Form  load_CCenter
    FORM Load_Ccenter.
      perform fill_bdc_tab using:
       'X' 'SAPLKACB'     '0002',
       ' ' 'BDC_CURSOR'   'COBL-KOSTL',
      ' ' 'COBL-KOSTL'   '4200-0451',
       ' ' 'COBL-KOSTL'    v_ccode,
      ' ' 'COBL-KOSTL'   '4200-0295',
       ' ' 'BDC_OKCODE'   '/EENTE'.
    ENDFORM.                    "Load_Ccenter
    *&      Form  load_blank
    FORM UpLoad_blank.
      perform fill_bdc_tab using:
       'X' 'SAPLKACB'     '0002',
       ' ' 'BDC_OKCODE'   '/EENTE'.
    ENDFORM.                    "UpLoad_blank

    ur  code  looking  ok..
    just change  it..
    call function <b>'WS_UPLOAD'</b>--->to  <b>gui_upload</b>
    EXPORTING
    FILENAME = p_fl_mct
    FILETYPE = 'ASC'
    TABLES
    data_tab = Tmp_tab
    EXCEPTIONS
    CONVERSION_ERROR = 1
    FILE_OPEN_ERROR = 2
    OTHERS = 10.
    if sy-subrc <> 0.
    message e398(00) with 'Unable to upload data'.
    endif.

  • Problem in bdc for table control for line items

    Hi experts,
    I am runnig a bdc for ME52.
    i am just entering PR number, in the second screen i have got all the line items. I need to select these line item 10 and double click or hit enter, it takes me to screen 3, there im just checking a checkbox and saving.
    Again i need to select the line item 20 and double click or hit enter. again the same process.
    Again repeat for all the line items.
    But my problem is it is updating everytime for only line item  10. for line item 20 and others it say "no chnge in the data".
    I am pasting my code here. please check and revert me back .plz.
    DATA: w_output LIKE LINE OF i_output.
      REFRESH I_ITAB[].
      SELECT * FROM EBAN
               INTO TABLE i_itab
               WHERE banfn in s_banfn AND
                     bsart in s_bsart AND
                     bstyp in s_bstyp AND
                     matnr in s_matnr AND
                     werks in s_werks AND
                     lfdat in s_lfdat AND
                     pstyp in s_pstyp AND
                     knttp in s_knttp AND
                     estkz in s_estkz AND
                     loekz eq ' '.
      IF sy-subrc = 0.
        CLEAR: w_itab,
                 i_poitab[].
        SORT i_itab by banfn.
        LOOP AT i_itab INTO w_itab where menge GT eban-bsmng.
          IF p_close = 'X' AND p_rep = 'X'.
            IF w_itab-ebakz = 'X'.
              w_itab-ebakz = ' '.
              APPEND w_itab to i_poitab.
            ENDIF.
          ELSEIF p_open = 'X' AND p_rep = 'X'.
            IF w_itab-ebakz = ' '.
              w_itab-ebakz = 'X'.
              APPEND w_itab to i_poitab.
            ENDIF.
          ELSEIF p_close = 'X' AND p_repw = 'X'.
            IF w_itab-ebakz = ' '.
              APPEND w_itab to i_poitab.
            ENDIF.
          ELSEIF p_open = 'X' AND p_repw = 'X'.
            IF w_itab-ebakz = 'X'.
              APPEND w_itab to i_poitab.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDIF.
      LOOP AT i_poitab into w_output.
        APPEND w_output to i_output.
       PERFORM CALL_BDC.
      endloop.
    IF p_rep = 'X'.
    PERFORM CALL_BDC.
    ENDIF.
    ENDFORM.                    " GET_DATA
    *&      Form  CALL_BDC
          text
    -->  p1        text
    <--  p2        text
    FORM CALL_BDC.
    DATA: seltab(5) TYPE N,
          seltab1(2) TYPE N,
          tempvar(30) TYPE N,
          cnt TYPE N.
    LOOP AT i_output.
    clear: seltab,
           seltab1.
    seltab = i_output-bnfpo.
    seltab1 = seltab+2(2).
    perform bdc_dynpro      using 'SAPMM06B' '0105'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EBAN-BANFN'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'EBAN-BANFN'
                                  i_output-banfn.
    perform bdc_dynpro      using 'SAPMM06B' '0106'.
    clear tempvar.
    *cnt = 1.
    concatenate 'EBAN-BNFPO(' seltab1 ')' into tempvar.
    perform bdc_field       using 'BDC_CURSOR'
                                 'EBAN-BNFPO(seltab1)'.
                                    tempvar.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=DETA'.
    perform bdc_field       using 'RM06B-BNFPO'
                                  i_output-bnfpo.
    perform bdc_field       using 'RM06B-TCSELFLAG(seltab1)'
                                 'X'.
    perform bdc_dynpro      using 'SAPMM06B' '0102'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EBAN-EBAKZ'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'EBAN-EBAKZ'
                                  i_output-ebakz.
    CALL TRANSACTION 'ME52' USING bdc_data MODE 'A'
                                   MESSAGES INTO i_bdcmsg.
        COMMIT WORK AND WAIT.
    ENDLOOP.
    ENDFORM.                    " CALL_BDC
    *&      Form  bdc_dynpro
          text
         -->P_0686   text
         -->P_0687   text
    FORM bdc_dynpro USING    program dynpro.
    CLEAR bdc_data.
      bdc_data-program  = program.
      bdc_data-dynpro   = dynpro.
      bdc_data-dynbegin = 'X'.
      APPEND bdc_data.
      CLEAR bdc_data.
    ENDFORM.   
    thanks,
    N

    Looks like table control logic is wrong -- do compare with below program...
    only table contril area
    REPORT ZPadmam
    NO STANDARD PAGE HEADING LINE-SIZE 255.
    DATA : BEGIN OF itab OCCURS 0,
    i1 TYPE i,
    lifnr LIKE rf02k-lifnr,
    bukrs LIKE rf02k-bukrs,
    ekorg LIKE rf02k-ekorg,
    ktokk LIKE rf02k-ktokk,
    anred LIKE lfa1-anred,
    name1 LIKE lfa1-name1,
    sortl LIKE lfa1-sortl,
    land1 LIKE lfa1-land1,
    akont LIKE lfb1-akont,
    fdgrv LIKE lfb1-fdgrv,
    waers LIKE lfm1-waers,
    END OF itab.
    DATA : BEGIN OF jtab OCCURS 0,
    j1 TYPE i,
    banks LIKE lfbk-banks,
    bankl LIKE lfbk-bankl,
    bankn LIKE lfbk-bankn,
    END OF jtab.
    DATA : cnt(4) TYPE n.
    DATA : fdt(20) TYPE c.
    DATA : c TYPE i.
    INCLUDE bdcrecx1.
    START-OF-SELECTION.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\first1.txt'
    filetype = 'DAT'
    TABLES
    data_tab = itab.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\second.txt'
    filetype = 'DAT'
    TABLES
    data_tab = jtab.
    LOOP AT itab.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-KTOKK'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'RF02K-LIFNR'
    itab-lifnr.
    PERFORM bdc_field USING 'RF02K-BUKRS'
    itab-bukrs.
    PERFORM bdc_field USING 'RF02K-EKORG'
    itab-ekorg.
    PERFORM bdc_field USING 'RF02K-KTOKK'
    itab-ktokk.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-LAND1'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFA1-ANRED'
    itab-anred.
    PERFORM bdc_field USING 'LFA1-NAME1'
    itab-name1.
    PERFORM bdc_field USING 'LFA1-SORTL'
    itab-sortl.
    PERFORM bdc_field USING 'LFA1-LAND1'
    itab-land1.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-KUNNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    cnt = 0.
    LOOP AT jtab WHERE j1 = itab-i1.
    cnt = cnt + 1.
    CONCATENATE 'LFBK-BANKS(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-banks.
    CONCATENATE 'LFBK-BANKL(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankl.
    CONCATENATE 'LFBK-BANKN(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankn.
    IF cnt = 5.
    cnt = 0.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=P+'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(02)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    ENDIF.
    ENDLOOP.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0210'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-FDGRV'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFB1-AKONT'
    itab-akont.
    PERFORM bdc_field USING 'LFB1-FDGRV'
    itab-fdgrv.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0215'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-ZTERM'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0220'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB5-MAHNA'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0310'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFM1-WAERS'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFM1-WAERS'
    itab-waers.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-LIFNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=YES'.
    PERFORM bdc_transaction USING 'XK01'.
    ENDLOOP.
    PERFORM close_group.
    Thanks
    Seshu

  • Problem in BDC for MB1B

    Dear Experts ,
    I am doing a BDC for MB1B...
    In my selection screen I am having,
    Plant, Vendor No, text and and options to enter 5 different materials and its corresponding qauntity.
    When the user enter the above details and execute , these details should trigger in MB1B
    ( using BDC background ).
    My problem is i the final stage where the document needs to get saved, as in my case
    its getting saved and also if the user enters only 1 material the loop should happen only once, but here
    its getting looped with balnk values.
    I have pasted my code below, please have look and advice me.
    REFRESH: BDCDATA, MESSTAB.
      PERFORM DYNPRO USING:
      'X' 'SAPMM07M' '0400',
      ' ' 'RM07M-BWARTWA' '941',
      ' ' 'RM07M-WERKS'  itab-WERKS,
      ' ' 'RM07M-LGORT' itab-LGORT,
      ' ' 'MKPF-BKTXT'  itab-BKTXT,
      ' ' 'BDC_OKCODE' '/00',
      'X' 'SAPMM07M' '0421',
      ' ' 'MSEGK-UMWRK' itab-WERKS,
      ' ' 'MSEGK-LIFNR' itab-VEND,
      ' ' 'BDC_OKCODE' 'NLE',
      'X' 'SAPLKACB' '0002',
      ' ' 'BDC_OKCODE' '/00'.
      LOOP AT ITAB1.
      QAN = ITAB1-ERFMG.
      QTY = QAN+6(6).
      CNT = CNT + 1.
      CN = CNT.
      CONCATENATE 'MSEG-MATNR(' CN  ')' INTO FN1.
      CONCATENATE 'MSEG-ERFMG(' CN  ')' INTO FN2.
        PERFORM DYNPRO USING:
        'X' 'SAPMM07M' '0421',
        ' '  FN1 ITAB1-MATNR,
        ' '  FN2 QTY,
        ' ' 'BDC_OKCODE' '/00',
        'X' 'SAPLKACB' '0002',
        ' ' 'BDC_OKCODE' '=ENTE'.
      ENDLOOP.
      CALL TRANSACTION 'MB1B' USING BDCDATA MODE 'A'

    Hi Naga,
    Thanks a lot for ur valuable advice !!
    Now my document is getting posted , while using:
    *CALL TRANSACTION 'MB1B' USING BDCDATA MODE  'A' *
    but when I am using
    *CALL TRANSACTION 'MB1B' USING BDCDATA MODE  'N' *
    I am getting 'S' message  No batch input data for screen SAPLKACB 0002.
    I am pasting my code please have a look and advice me.
    REFRESH: BDCDATA, MESSTAB.
      PERFORM DYNPRO USING:
      'X' 'SAPMM07M' '0400',
      ' ' 'RM07M-BWARTWA' '941',
      ' ' 'RM07M-WERKS' S_WERKS,
      ' ' 'RM07M-LGORT' S_LGORT,
      ' ' 'MKPF-BKTXT'  S_BKTXT,
      ' ' 'BDC_OKCODE' '/00',
      'X' 'SAPMM07M' '0421',
      ' ' 'MSEGK-UMWRK' S_WERKS,
      ' ' 'MSEGK-LIFNR' S_VEND,
      ' ' 'BDC_OKCODE' 'NLE',
      'X' 'SAPLKACB' '0002',
      ' ' 'BDC_OKCODE' '/00'.
      LOOP AT ITAB.
        DELETE ITAB WHERE MATNR IS INITIAL.
        QAN = ITAB-ERFMG.
        QTY = QAN+6(6).
        CNT = CNT + 1.
        CN = CNT.
        CONCATENATE 'MSEG-MATNR(' CN  ')' INTO FN1.
        CONCATENATE 'MSEG-ERFMG(' CN  ')' INTO FN2.
        PERFORM DYNPRO USING:
        'X' 'SAPMM07M' '0421',
        ' '  FN1 ITAB-MATNR,
        ' '  FN2 QTY,
        ' ' 'BDC_OKCODE' '/00'.
      ENDLOOP.
      PERFORM BDC_FIELD       USING  'BDC_OKCODE'
                                  '=BU'.
      PERFORM BDC_FIELD       USING 'DKACB-FMORE'
                                    'X'.
      PERFORM DYNPRO          USING 'X' 'SAPLKACB' '0002'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=ENTE'.
      CALL TRANSACTION 'MB1B' USING BDCDATA MODE 'N'
      MESSAGES INTO MESSTAB.
    Rgds
    Karthik

  • 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.

Maybe you are looking for