BSEG/RFBLG Performance

Hi ,
After taking the trace ,i found database time is high due to access to few tables like BSEG which is a cluster table of RFBLG.
sql statement
SELECT
  "MANDT" , "BUKRS" , "BELNR" , "GJAHR" , "PAGENO" , "TIMESTMP" , "PAGELG" , "VARDATA"
FROM
  "RFBLG"
WHERE
  "MANDT" = :A0 AND "BUKRS" = :A1 AND "BELNR" = :A2 AND "GJAHR" = :A3
ORDER BY
  "MANDT" , "BUKRS" , "BELNR" , "GJAHR" , "PAGENO"
Abap code
SELECT *
    FROM BSEG
    WHERE BUKRS = S_BSET-BUKRS
      AND BELNR = S_BSET-BELNR
      AND GJAHR = S_BSET-GJAHR
      AND KOART = 'K' .
Can you please guide me this. How do i further tune this . As these are standard tables.Im also not sure why is the abap code and sql statement is different? is it because of cluster table concept??Please help.
Thanks

Hi
That's depends on how many rows are in the main internal table S_BSET, you should check the time for a single selection of BSEG.
Perhaps the single selection takes few time, but there are a very large number of record in S_BSET, that means a very large number of selection of BSEG.
Now you should try to sort the S_BSET table for the fields used to read BSEG:
SORT S_BSET BY BUKRS BELNR GJAHR.
LOOP AT S_BSET.
   IF S_BSET-BUKRS <> BSEG-BUKRS OR
       S_BSET-BELNR <> BSEG-BELNR OR
       S_BSET-GJAHR <> BSEG-GJAHR.
    SELECT * FROM BSEG WHERE ......
    ENDSELECT.
  ENDIF.
ENDLOOP.
In this way you can limit the accesses to BSEG
Max

Similar Messages

  • Performance Problem in using the BSEG table - Required alternative

    Hi All,
    Pl go thru the below program.
    I am unable to change this code
    It is having 46 performance errors
    Pls check the code and suggest.
    *To get Pmt Doc No & Posting Date
      SELECT SINGLE
             BELNR
             ZFBDT
             FROM BSEG
             INTO (WA_ZFT011_FIFO-PAY_DOC_NO, WA_ZFT011_FIFO-POST_DATE)
             WHERE AUGBL = W_CLR_DOC
               AND AUGDT = WA_ZFT011_FIFO-CLR_DATE
               AND BSCHL = '15'.
      IF SY-SUBRC <> 0.
        SELECT SINGLE
               BELNR
               ZFBDT
               FROM BSEG
               INTO (WA_ZFT011_FIFO-PAY_DOC_NO, WA_ZFT011_FIFO-POST_DATE)
               WHERE AUGBL = W_CLR_DOC
                 AND AUGDT = WA_ZFT011_FIFO-CLR_DATE
                 AND BSCHL = '11'.
    The above code is having performance error "NO field of a table Index in WHERE"
    The same error repeated for 45 select statements and for all statements the "BSEG" table is used for selecting data.
    But creating a secondary index on BSEG table columns will not be possible
    So pls suggest me accordingly
    Awaits for the Reply.
    P Kamal

    Hi,
    Perhaps my post here: Re: BSEG table performance issues might help you.
    Regards, Gerd Rother

  • Query is too slow from bseg selection

    SELECT BELNR BLDAT BUDAT XBLNR GJAHR tcode WAERS AWKEY FROM BKPF INTO
      TABLE
      ITBKPF WHERE BUKRS EQ P_BUKRS AND BELNR IN S_BELNR AND BUDAT IN
        P_BUDAT
        AND STBLG = ''
        AND ( TCODE = 'MIRO' OR
                             TCODE = 'MR8M' OR
                             TCODE = 'MB11' OR
                             TCODE = 'MB1B' OR
                            TCODE = 'MIGO_GI' OR
                            TCODE = 'MIGO_TR' OR
                             TCODE = 'MB1A' ).
       IF SY-SUBRC EQ 0.
              SORT itBKPF.
            ELSE.
              MESSAGE 'No data for the relevant date' TYPE 'A'.
             LEAVE LIST-PROCESSING.
            ENDIF.
    SELECT A1LIFNR A1NAME1 A1ORT01 A1STRAS B1~j_1icstno
      INTO TABLE it_werks
      FROM ( LFA1 AS A1 INNER JOIN j_1imocomp AS B1 ON A1werks = B1werks )
    **********************************************this is too slow*************
    SELECT BUKRS BELNR GJAHR BUZEI BUZID BSCHL SHKZG GSBER MWSKZ
            DMBTR HKONT LIFNR LANDL Matnr werks MENGE EBELP xref3
            INTO CORRESPONDING FIELDS OF TABLE ITABBSEG
            FROM BSEG
            FOR ALL ENTRIES IN ITBKPF
            WHERE BELNR = ITBKPF-BELNR
            AND GJAHR = ITBKPF-GJAHR
            AND ( BSCHL = '86' OR BSCHL = '96' or BSCHL = '89' OR BSCHL = '99'  )
            AND WERKS IN S_WERKS
            AND BUZID <> 'F' .
    ****************************************this is too slow
    Moderator message: Please Read before Posting in the Performance and Tuning Forum
    locked by: Thomas Zloch on Aug 5, 2010 2:08 PM

    You should have provided the full key of the cluster file behind BSEG (RFBLG), every key is in BKPF, so add BUKRS
    SELECT bukrs belnr gjahr buzei buzid bschl shkzg gsber mwskz
           dmbtr hkont lifnr landl matnr werks menge ebelp xref3
      INTO CORRESPONDING FIELDS OF TABLE itabbseg
      FROM bseg
      FOR ALL ENTRIES IN itbkpf
      WHERE bukrs = itbkpf-bukrs
        AND belnr = itbkpf-belnr
        AND gjahr = itbkpf-gjahr
        AND ( bschl EQ '86' OR bschl EQ '96' OR bschl EQ '89' OR bschl EQ '99' )
        AND werks IN s_werks
        AND buzid EQ 'F' .
    You could also extract the whole accounting document in the internal table, and then delete record using the not-database-key selections.
    SELECT bukrs belnr gjahr buzei buzid bschl shkzg gsber mwskz
           dmbtr hkont lifnr landl matnr werks menge ebelp xref3
      INTO CORRESPONDING FIELDS OF TABLE itabbseg
      FROM bseg
      FOR ALL ENTRIES IN itbkpf
      WHERE bukrs = itbkpf-bukrs
        AND belnr = itbkpf-belnr
        AND gjahr = itbkpf-gjahr.
    DELETE itabbseg WHERE
      ( bschl NE '86' AND bschl NE '96' AND bschl NE '89' AND bschl NE '99' )
      OR NOT ( werks IN s_werks )
      OR BUZID NE 'F' .
    In both case, perform some tests with tools like SE30 or ST05.
    Regards,
    Raymond

  • BSEG Performans

    Hi ABAPers,
    I have a problem with BSEG table performance.
    When i run this select :
      select bukrs belnr gjahr shkzg dmbtr hkont INTO TABLE itab_bseg_II from BSEG
                         where GJAHR EQ P_RYEAR
                           AND HKONT EQ X011Z-BILKT
                           and PRCTR IN S_PRCTR.
    reduces report performans. How can i increase select perormance? Please help.
    Best regards.
    Munur EBCIOGLU

    Hi,
    BSEG is cluse table and top of that you are not using the full key ( BUKRS, BELNR, GJAHR, BUZEI ) to read BSEG, thats why you have performance problem.
    Also, since BSEG is cluster table you can not create index on it. Instead  i suggest you to use <b>BSIS ( Accounting: Secondary Index for G/L Accounts )</b>.
    You have multiple options here:
    1. If you can somehow get the company code also, use the BUKRS ,HKONT , GJAHR ( in this order only ) as a select condition. And then delete the entries where the profit center does not fall in seletion criteria. So you code would be
    * select data from BSIS
    SELECT bukrs belnr gjahr
                 shkzg dmbtr hkont FROM BSIS
                                             INTO TABLE itab_bsis
                                             WHERE bukrs in s_bukrs      AND
                                                          hkont = x011z-bilkt  AND
                                                          gjahr  = p_ryear.
    * delete record based on profit centers
    DELETE itab_bsis WHERE NOT ( prctr in s_prctr ).
    2. If you cannot get the company code but you want to get the data for all company codes then you should use following given code. Lets say the lowest company code you have is "1000' and highest company code number is '7000'.
    data: l_min_bukrs  like bkpf-bukrs value '1000',
            l_max_bukrs like bkpf-bukrs value '7000'.
    ranges: r_bukrs for bkpf-bukrs.
    r_bukrs-sign   = 'I'.
    r_bukrs-option = 'BT'.
    r_bukrs-low    = l_min_bukrs.
    r_bukrs-high   = l_max_bukrs.
    APPEND r_bukrs.
    * select data from BSIS
    SELECT bukrs belnr gjahr
                 shkzg dmbtr hkont FROM BSIS
                                             INTO TABLE itab_bsis
                                             WHERE bukrs in r_bukrs      AND
                                                          hkont = x011z-bilkt  AND
                                                          gjahr  = p_ryear.
    * delete record based on profit centers
    DELETE itab_bsis WHERE NOT ( prctr in s_prctr ).
    3. Create a index on table BSIS with fields HKONT, GJAHR and PRCTR and use following code.
    SELECT bukrs belnr gjahr
                 shkzg dmbtr hkont FROM BSIS
                                             INTO TABLE itab_bsis
                                             WHERE hkont = x011z-bilkt  AND
                                                          gjahr  = p_ryear       AND
                                                          prctr  IN s_prctr.
    Let me know if you have any questions.
    Regards,
    RS

  • Workaround for BSEG

    Hi,
    Is there any table other than BSEG using which we get the relation between Accounting Document number, Purchasing document and G/L account?
    I have a requirement wherein I have the purchasing doument and G/L account; using these I need to get the accounting document number (field BELNR from BSEG). But, if I use the table BSEG, it takes a lot of time to retrieve data as no key fields are used.
    Please let me know if there is any workaround for this.
    Thanks,
    Dawood.

    Hi Dawood.S.Ghasletwala,
    Please have a look on tables BSIK and BSAK..
    Also have a look on BKPF RSEG
    Also try to pass LIFNR in BSEG for performance and pass GJAHR as well.. and KOART =  K  For Vendors
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7
    ilesh Nandaniya

  • Reading from other object

    Hi Guys,
    I dont know whether am following the correct way , I have a scenerio where I have to show in the report Blocking reasons . I have a field from DS Payment Block Key which is 0PMNT_BLOCK in BI. I have 7 Blocking reasons in one table called BSEG and I have enhanced my 0FI_AP_4 DS to include this 7 fields and mapped to 7 BI Objects 0BLCKRSN_PR for price 0BLCKRSN_QL for quality....Now bringing these fileds from BSEG effecting performance as each time the exit is calling. I do have a Text data source (0PMNT_BLOCK_TEXT) which is having same data as I need...So in order to get this Blocking reasons in to my report without enahcing from BSEG table Iam trying to read it from master data . but its not allowing me to do that....When I say read from master data for one of the info object 0BLCKRSN_PR and press F4 its showing no info object available for reading of master data....Can any one tell me why its showing this error...I do have a Master data object 0PMNT_BLOCK which is having the values A B D H M P , so I want to read the above object 0BLCKRSN_PR from this Object ...as P is for Price and so on....
    Do I need to take the seven info objects as attributes of 0PMNT_BLOCK ?
    If so , I didnt find a DS for attributes in ECC , I have only Text DS 0PMNT_BLOCK_TEXT....
    Please advice me what I need to do for this...Also please shoot me a reply If you ahve any more questions....

    the join produces more rows then the sum of it's parts (e.g. 154). For example:
    select owner, name
    from all_source
    where upper(text) like '%BINARY_INTEGER%'
    633 rows selected.
    select owner, type
    from all_source
    where upper(text) like '%PLS_INTEGER%'
    926 rows selected.
    select ds1.owner, ds1.name, ds2.type
    from all_source ds1 inner join all_source ds2 on (ds1.owner = ds2.owner and ds1.name = ds2.name and ds1.type = ds2.type)
    where upper(ds1.text) like '%BINARY_INTEGER%'
    and upper(ds2.text) like '%PLS_INTEGER%'
    5710 rows selected.
    select owner, count(name) as name_cnt
    from all_source
    where upper(text) like '%BINARY_INTEGER%'
    group by owner
    OWNER NAME_CNT
    SYS 577
    WWW 56
    2 rows selected.
    select owner, count(type)
    from all_source
    where upper(text) like '%PLS_INTEGER%'
    group by owner
    OWNER COUNT(TYPE)
    SYS 909
    WWW 17
    2 rows selected.
    this could be a solution then:
    select ds1.owner, ds1.name_cnt, ds2.type_cnt
    from (select owner, count(name) as name_cnt
    from all_source
    where upper(text) like '%BINARY_INTEGER%'
    group by owner) ds1 inner join (select owner, count(type) as type_cnt
    from all_source
    where upper(text) like '%PLS_INTEGER%'
    group by owner) ds2 on (ds1.owner = ds2.owner)
    OWNER NAME_CNT TYPE_CNT
    SYS 577 909
    WWW 56 17
    2 rows selected.

  • A sample code to check records of a system table?

    hi ABAP4 experts,
    We are pretty new at ABAP4.  We would be appreciated if you can provide a sample code to check how many records and calculate a total amount for a specific field, e.g., DMBTR in a system table, e.g., BSEG.  Note: there is no any selection for this table BSEG, we just want to get the total record count in this table and also the total amount for a specific field e.g. DMBTR in this table.
    Do we have to use an internal table to transfer all the records of BSEG into the internal table to get the result?
    We will give you reward points!

    Hi Kevin,
    Using SUM directly in SQL will NOT work for table BSEG because BSEG is pool table. You will get an ABAP error.
    "Aggregate functions and the addition DISTINCT are not supported in field lists for pooled and cluster tables".
    You need an internal table to transfer all data from BSEG and perform calculation for count and sum.
    Concerning about performance running perhaps you can code something like this.
    REPORT ZZFLTEST NO STANDARD PAGE HEADING.
    TABLES: BSEG.
    DATA: CURS          TYPE CURSOR,
          PACKAGE_SIZE  LIKE RMCS4-MC_CM_PSIZE VALUE '10000'.                                                                               
    DATA: BEGIN OF I_BSEG OCCURS 0,
            BELNR TYPE BSEG-BELNR,
            BURKS TYPE BSEG-BURKS,
            GJAHR TYPE BSEG-GJAHR,       
            BUZEI TYPE BSEG-BUZEI,       
            DMBTR TYPE BSEG-DMBTR,
            SHKZG TYPE BSEG-SHKZG.
    DATA: END OF I_BSEG.
    DATA: TOT_DMBTR TYPE BSEG-DMBTR,
          TOT_REC   TYPE I.
    SELECTION-SCREEN BEGIN OF BLOCK B01 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN SKIP.
    PARAMETERS: P_SIZE LIKE RMCS4-MC_CM_PSIZE DEFAULT '10000'.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN END OF BLOCK B01.
    START-OF-SELECTION.
      PACKAGE_SIZE = P_SIZE.
      OPEN CURSOR WITH HOLD CURS FOR
      SELECT BELNR BURKS GJAHR BUZEI DMBTR SHKZG
      FROM BSEG
      WHERE BELNR <> SPACE
        AND BURKS <> SPACE
        AND GJAHR <> SPACE
        AND BUZEI <> SPACE.
    *Fetch internal table I_BSEG for every 10000 records.
      DO.
        FETCH NEXT CURSOR CURS
        INTO TABLE I_BSEG PACKAGE SIZE PACKAGE_SIZE.
        IF SY-SUBRC <> 0.
          EXIT.
        ENDIF.
      ENDDO.
      CLOSE CURSOR CURS.
      LOOP AT I_BSEG.
        TOT_REC = TOT_REC + 1.
        IF I_BSEG-SHKZG = 'S'.
          TOT_DMBTR = TOT_DMBRT + I_BSEG-DMBTR * -1.
        ELSE.
          TOT_DMBTR = TOT_DMBTR + I_BSEG-DMBTR.
        ENDIF.
      ENDLOOP.
      WRITE: / 'TOTAL BSEG-DMBTR:', TOT_DMBTR,
             / 'TOTAL RECORD:    ', TOT_REC.
    END-OF-SELECTION.
    Hope this will help.
    Regards,
    Ferry Lianto

  • BDC For T-Code F-02

    Dear Friends,
    Do anybody has the code for BDC for Transaction Code F-02.
    If anybody has plz send me.
    Thanks & Reg,
    Nishant

    try this:
    REPORT zfir_f02
           NO STANDARD PAGE HEADING LINE-SIZE 255.
    INCLUDE bdcrecx1.
    TYPES : BEGIN OF tp_flatfile,
            bldat(10),
            doctyp(2),
            comp(4),
            postdate(10),
            period(2),
            currency(5),
            reference(16),
            htext(25),
            postkey(2),
            account(17),
            amount(16),
            profit(10),
            assign(18),
            text(50),
            busarea(4),
            cost(10),
            bline(10),
            base(16),
            postkey2(2),
            account2(17),
            amount2(16),
            profit2(10),
            assign2(18),
            text2(50),
            busarea2(4),
            END OF tp_flatfile.
    DATA : t_flatfile TYPE TABLE OF tp_flatfile WITH HEADER LINE.
    DATA : g_file TYPE string.
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    CONSTANTS:con_tab  TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
    PARAMETERS :  p_file LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    *C-- Selection Screen VALUE-REQUEST FOR File path
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
        IMPORTING
          file_name     = p_file.
      g_file = p_file.
    *START-OF-SELECTION.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = g_file
          filetype                = 'ASC'
          has_field_separator     = 'X'
        TABLES
          data_tab                = t_flatfile
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
         loop at t_flatfile.
         write:/ t_flatfile-doctyp,t_flatfile-amount.
         endloop.
    START-OF-SELECTION.
      PERFORM open_group.
      LOOP AT t_flatfile.
        PERFORM bdc_dynpro      USING 'SAPMF05A' '0100'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RF05A-NEWKO'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'BKPF-BLDAT'
                                      t_flatfile-bldat.
        PERFORM bdc_field       USING 'BKPF-BLART'
                                      t_flatfile-doctyp.
        PERFORM bdc_field       USING 'BKPF-BUKRS'
                                      t_flatfile-comp.
        PERFORM bdc_field       USING 'BKPF-BUDAT'
                                      t_flatfile-postdate.
        PERFORM bdc_field       USING 'BKPF-MONAT'
                                      t_flatfile-period.
        PERFORM bdc_field       USING 'BKPF-WAERS'
                                      t_flatfile-currency.
        PERFORM bdc_field       USING 'BKPF-XBLNR'
                                      t_flatfile-reference.
        PERFORM bdc_field       USING 'BKPF-BKTXT'
                                      t_flatfile-htext.
        PERFORM bdc_field       USING 'FS006-DOCID'
        PERFORM bdc_field       USING 'RF05A-NEWBS'
                                      t_flatfile-postkey.
        PERFORM bdc_field       USING 'RF05A-NEWKO'
                                      t_flatfile-account.
        CASE t_flatfile-postkey.
          WHEN '40' OR '50'.
            PERFORM bdc_dynpro      USING 'SAPMF05A' '0300'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'BSEG-SGTXT'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '/00'.
            PERFORM bdc_field       USING 'BSEG-WRBTR'
                                          t_flatfile-amount.
            PERFORM bdc_field       USING 'BSEG-ZUONR'
                                          t_flatfile-assign.
            PERFORM bdc_field       USING 'BSEG-SGTXT'
                                          t_flatfile-text.
        IF t_flatfile-postkey = '40' and t_flatfile-account > '300000'.
                PERFORM bdc_field       USING 'DKACB-FMORE'
                                          'X'.
        ENDIF.
            PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'COBL-KOSTL'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=ENTE'.
            PERFORM bdc_field       USING 'COBL-GSBER'
                                          t_flatfile-busarea.
           PERFORM bdc_field       USING 'BDC_OKCODE'
                                         '=ENTE'.
            PERFORM bdc_field       USING 'COBL-KOSTL'
                                          t_flatfile-cost.
            PERFORM bdc_field       USING 'COBL-PRCTR'
                                          t_flatfile-profit.
            PERFORM bdc_dynpro      USING 'SAPMF05A' '0300'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'RF05A-NEWKO'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '/00'.
            PERFORM bdc_field       USING 'RF05A-NEWBS'
                                          t_flatfile-postkey2.
            PERFORM bdc_field       USING 'RF05A-NEWKO'
                                          t_flatfile-account2.
            PERFORM debit_credit.
          WHEN '21' OR '31' OR '24' OR '34'.
    **perform bdc_field       using 'RF05A-NEWBS'
                                 '31'.
    **perform bdc_field       using 'RF05A-NEWKO'
                                 '25000'.
         PERFORM bdc_field       USING 'DKACB-FMORE'
                                       'X'.
         PERFORM bdc_dynpro      USING 'SAPMF05A' '0302'.
         PERFORM bdc_field       USING 'BDC_CURSOR'
                                       'RF05A-NEWKO'.
         PERFORM bdc_field       USING 'BDC_OKCODE'
                                       '/00'.
         PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
         PERFORM bdc_field       USING 'BDC_CURSOR'
                                       'COBL-GSBER'.
         PERFORM bdc_field       USING 'BDC_OKCODE'
                                       '=ENTE'.
         PERFORM bdc_field       USING 'COBL-GSBER'
                                       t_flatfile-busarea.
         PERFORM bdc_field       USING 'COBL-KOSTL'
                                       t_flatfile-cost.
            PERFORM bdc_dynpro      USING 'SAPMF05A' '0302'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'RF05A-NEWKO'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '/00'.
            PERFORM bdc_field       USING 'BSEG-WRBTR'
                                          t_flatfile-amount.
            PERFORM bdc_field       USING 'BSEG-GSBER'
                                          t_flatfile-busarea.
            PERFORM bdc_field       USING 'BSEG-ZFBDT'
                                          t_flatfile-bline.
            PERFORM bdc_field       USING 'BSEG-SKFBT'
                                          t_flatfile-base.
            PERFORM bdc_field       USING 'BSEG-ZUONR'
                                          t_flatfile-assign.
            PERFORM bdc_field       USING 'BSEG-SGTXT'
                                          t_flatfile-text.
            PERFORM bdc_field       USING 'RF05A-NEWBS'
                                          t_flatfile-postkey2.
            PERFORM bdc_field       USING 'RF05A-NEWKO'
                                          t_flatfile-account2.
           PERFORM bdc_dynpro      USING 'SAPLFWTD' '0100'.
           PERFORM bdc_field       USING 'BDC_CURSOR'
                                         'WITH_ITEM-WT_WITHCD(01)'.
           PERFORM bdc_field       USING 'BDC_OKCODE'
                                         '=GO'.
            PERFORM debit_credit.
         PERFORM bdc_dynpro      USING 'SAPMF05A' '0300'.
         PERFORM bdc_field       USING 'BDC_CURSOR'
                                       'RF05A-NEWKO'.
         PERFORM bdc_field       USING 'BDC_OKCODE'
                                       '/00'.
         PERFORM bdc_field       USING 'BSEG-WRBTR'
                                       t_flatfile-amount2.
         PERFORM bdc_field       USING 'BSEG-ZUONR'
                                       t_flatfile-assign2.
         PERFORM bdc_field       USING 'BSEG-SGTXT'
                                       t_flatfile-text2.
         PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
         PERFORM bdc_field       USING 'BDC_CURSOR'
                                       'COBL-GSBER'.
         PERFORM bdc_field       USING 'BDC_OKCODE'
                                       '=ENTE'.
         PERFORM bdc_field       USING 'COBL-GSBER'
                                       t_flatfile-busarea2.
         PERFORM bdc_field       USING 'COBL-KOSTL'
                                       t_flatfile-cost.
         PERFORM bdc_field       USING 'COBL-PRCTR'
                                       t_flatfile-profit2.
         PERFORM bdc_dynpro      USING 'SAPMF05A' '0300'.
         PERFORM bdc_field       USING 'BDC_CURSOR'
                                       'RF05A-NEWKO'.
         PERFORM bdc_field       USING 'BDC_OKCODE'
                                       '=BU'.
         PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
         PERFORM bdc_field       USING 'BDC_CURSOR'
                                       'COBL-GSBER'.
         PERFORM bdc_field       USING 'BDC_OKCODE'
                                       '=ENTE'.
          WHEN '01' OR '11' OR '04' OR '14' OR '07' OR '17'.
    *perform bdc_field       using 'RF05A-NEWBS'
                                 '11'.
    *perform bdc_field       using 'RF05A-NEWKO'
                                 '1'.
            PERFORM bdc_dynpro      USING 'SAPMF05A' '0301'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'BSEG-SGTXT'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '/00'.
            PERFORM bdc_field       USING 'BSEG-WRBTR'
                                          t_flatfile-amount.
            PERFORM bdc_field       USING 'BSEG-MWSKZ'
            PERFORM bdc_field       USING 'BSEG-GSBER'
                                          t_flatfile-busarea.
            IF NOT t_flatfile-bline IS INITIAL.
              PERFORM bdc_field       USING 'BSEG-ZFBDT'
                                            t_flatfile-bline.
            ENDIF.
            IF NOT t_flatfile-base IS INITIAL.
              PERFORM bdc_field       USING 'BSEG-SKFBT'
                                            t_flatfile-base.
            ENDIF.
            PERFORM bdc_field       USING 'BSEG-ZUONR'
                                          t_flatfile-assign.
            PERFORM bdc_field       USING 'BSEG-SGTXT'
                                          t_flatfile-text.
            PERFORM bdc_field       USING 'RF05A-NEWBS'
                                          t_flatfile-postkey2.
            PERFORM bdc_field       USING 'RF05A-NEWKO'
                                          t_flatfile-account2.
            PERFORM debit_credit.
        ENDCASE.
    *perform bdc_dynpro      using 'SAPMF05A' '0301'.
    *perform bdc_field       using 'BDC_CURSOR'
                                 'BSEG-WRBTR'.
    *perform bdc_field       using 'BDC_OKCODE'
                                 '=AB'.
    *perform bdc_field       using 'BSEG-WRBTR'
                                 '3,000.00'.
    *perform bdc_field       using 'BSEG-MWSKZ'
    *perform bdc_field       using 'BSEG-GSBER'
                                 'VUSO'.
    *perform bdc_field       using 'BSEG-ZFBDT'
                                 '19.07.2005'.
    *perform bdc_field       using 'BSEG-SKFBT'
                                 '3,000.00'.
    *perform bdc_field       using 'BSEG-ZUONR'
                                 'ASSIGN'.
    *perform bdc_field       using 'BSEG-SGTXT'
                                 'TEXT'.
    PERFORM bdc_dynpro      USING 'SAPMF05A' '0700'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                   'RF05A-NEWBS'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                   '=BU'.
    *perform bdc_field       using 'BKPF-XBLNR'
                                 'REF'.
    *perform bdc_field       using 'BKPF-BKTXT'
                                 'text'.
        PERFORM bdc_transaction USING 'F-02'.
      ENDLOOP.
      PERFORM close_group.
    *&      Form  debit_credit
          text
    FORM debit_credit.
    **SRINI
    IF t_flatfile-postkey = '40' OR t_flatfile-postkey = '50'.
      PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'COBL-GSBER'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=ENTE'.
    ENDIF.
    ***SRINI
      PERFORM bdc_dynpro      USING 'SAPMF05A' '0300'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RF05A-NEWKO'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM bdc_field       USING 'BSEG-WRBTR'
                                    t_flatfile-amount2.
      PERFORM bdc_field       USING 'BSEG-ZUONR'
                                    t_flatfile-assign2.
      PERFORM bdc_field       USING 'BSEG-SGTXT'
                                    t_flatfile-text2.
      PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                   'COBL-KOSTL'.
                                    'COBL-GSBER'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=ENTE'.
      PERFORM bdc_field       USING 'COBL-GSBER'
                                    t_flatfile-busarea2.
         PERFORM bdc_field       USING 'COBL-KOSTL'
                                       t_flatfile-cost.
      PERFORM bdc_field       USING 'COBL-PRCTR'
                                    t_flatfile-profit2.
      PERFORM bdc_dynpro      USING 'SAPMF05A' '0300'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RF05A-NEWKO'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=BU'.
      PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'COBL-GSBER'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=ENTE'.
    ENDFORM.                    "debit_credit
    regards,
    Bikash

  • Problem in bdc PROG

    Dear All,
                Iam facing the problem in BDC Program..the code is..
    LOOP AT IT_RECORD.
    perform bdc_dynpro      using 'SAPMF05A' '0300'.
    perform bdc_field       using 'BDC_CURSOR'  'RF05A-NEWKO'.
    perform bdc_field       using 'BDC_OKCODE'  '/00'.
    perform bdc_field       using 'BSEG-WRBTR'                IT_RECORD-vramt.  "'100000'.
    perform bdc_field       using 'RF05A-NEWBS'                          it_record-pkey.  "'50'.
    perform bdc_field       using 'RF05A-NEWKO'                          it_Record-vrac.  "'24450024'.
    perform bdc_field       using 'DKACB-FMORE'                          'X'.
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_CURSOR'  'COBL-GSBER'.
    perform bdc_field       using 'BDC_OKCODE'  '=ENTE'.
    perform bdc_field       using 'COBL-GSBER'                            it_record-gsber.  "'KABA' .
    COUNT = COUNT + 1.
    WRITE:/ COUNT.
    IF COUNT = 4.
      perform bdc_dynpro      using 'SAPMF05A' '0302'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'BSEG-GSBER'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'BSEG-WRBTR'                        IT_RECORD-VRAMT.   "'50000'.
      perform bdc_field       using 'BSEG-MWSKZ'                           '**'.
      perform bdc_field       using 'BSEG-GSBER'                        IT_RECORD-GSBER ."'kaba'.
      perform bdc_field       using 'BSEG-ZFBDT'                           '03.12.2007'.
      perform bdc_dynpro      using 'SAPMF05A' '0302'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'BSEG-WRBTR'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BS'.
      perform bdc_field       using 'BSEG-WRBTR'                          IT_RECORD-VRAMT. "'50,000.00'.
      perform bdc_field       using 'BSEG-MWSKZ'
      perform bdc_field       using 'BSEG-BUPLA'                            '1800'.
      perform bdc_field       using 'BSEG-GSBER'                            IT_RECORD-GSBER."'KABA'.
      perform bdc_field       using 'BSEG-ZFBDT'                            '03.12.2007'.
      perform bdc_dynpro      using 'SAPMF05A' '0700'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RF05A-NEWBS'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BU'.
      CALL TRANSACTION 'F-02' USING BDCDATA MODE 'A'.
    ELSE.
      CONTINUE.
    ENDIF.
    ENDLOOP.
    here iam using 4 line item(in text file) ..if count = 4 its not going to next screen, its repeating..its not simulating and posting the doc..
    pls guide me friends.

    hi i send the code here, if u can understand clear it..
    report ZBDC_FI_MVF_02 no standard page heading line-size 255.
    DATA : BEGIN OF IT_RECORDS OCCURS 0,
           BLDAT LIKE BKPF-BLDAT,
           BLART LIKE BKPF-BLART,
           BUKRS LIKE BKPF-BUKRS,
           BUDAT LIKE BKPF-BUDAT,
           MONAT LIKE BKPF-MONAT,
           WAERS LIKE BKPF-WAERS,
           NEWBS LIKE RF05A-NEWBS,
           NEWKO LIKE RF05A-NEWKO,
           END OF IT_RECORDS.
    DATA : BEGIN OF IT_RECORD OCCURS 0,
           VRAMT(15),  " LIKE BSEG-WRBTR,
           PKEY  LIKE RF05A-NEWBS,
           VrAC(10),  " LIKE RF05A-NEWKO,
           GSBER LIKE COBL-GSBER,
           END OF IT_RECORD.
    DATA : BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
           DATE1 LIKE SY-DATUM,
           DATE2 LIKE SY-DATUM,
           LOOP(3).
           DATA : COUNT(3).
    start-of-selection.
      PERFORM GET_DATA1.
      PERFORM GET_DATA2.
      PERFORM PROCESS_DATA.
    FORM PROCESS_DATA.
    perform bdc_dynpro      using 'SAPMF05A' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF05A-NEWKO'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
        date1 = it_RecordS-bldat.
        CONCATENATE DATE16(2) DATE14(2) DATE1+0(4) INTO DATE1.
    perform bdc_field       using 'BKPF-BLDAT'               DATE1.  "'03.12.2007'.
    perform bdc_field       using 'BKPF-BLART'               IT_RECORDS-BLART.  "'SA'.
    perform bdc_field       using 'BKPF-BUKRS'               IT_RECORDS-BUKRS.  "'1800'.
        date2 = it_RecordS-bUdat.
        CONCATENATE DATE26(2) DATE24(2) DATE2+0(4) INTO DATE2.
    perform bdc_field       using 'BKPF-BUDAT'               DATE2.  "'03.12.2007'.
    perform bdc_field       using 'BKPF-MONAT'               IT_RECORDS-MONAT.  "'9'.
    perform bdc_field       using 'BKPF-WAERS'               IT_RECORDS-WAERS.  "'INR'.
    perform bdc_field       using 'FS006-DOCID'              '*'.
    perform bdc_field       using 'RF05A-NEWBS'               IT_RECORDS-NEWBS.  "'40'.
    perform bdc_field       using 'RF05A-NEWKO'               IT_RECORDS-NEWKO.  "'24450024'.
    *perform bdc_field       using 'RF05A-NEWBS'               IT_RECORDS-PKEY.  "'50'.
    *perform bdc_field       using 'RF05A-NEWKO'               IT_RECORDS-VENAC.  "'24450024'.
    *perform bdc_field       using 'DKACB-FMORE'  'X'.
    COUNT = '0'.
    LOOP AT IT_RECORD.
    perform bdc_dynpro      using 'SAPMF05A' '0300'.
    perform bdc_field       using 'BDC_CURSOR'  'RF05A-NEWKO'.
    perform bdc_field       using 'BDC_OKCODE'  '/00'.
    perform bdc_field       using 'BSEG-WRBTR'                IT_RECORD-vramt.  "'100000'.
    perform bdc_field       using 'RF05A-NEWBS'                          it_record-pkey.  "'50'.
    perform bdc_field       using 'RF05A-NEWKO'                          it_Record-vrac.  "'24450024'.
    perform bdc_field       using 'DKACB-FMORE'                          'X'.
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_CURSOR'  'COBL-GSBER'.
    perform bdc_field       using 'BDC_OKCODE'  '=ENTE'.
    perform bdc_field       using 'COBL-GSBER'                            it_record-gsber.  "'KABA' .
    COUNT = COUNT + 1.
    IF COUNT = 4.
    clear count.
      perform bdc_dynpro      using 'SAPMF05A' '0302'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'BSEG-GSBER'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'BSEG-WRBTR'                        IT_RECORD-VRAMT.   "'50000'.
      perform bdc_field       using 'BSEG-MWSKZ'                           '**'.
      perform bdc_field       using 'BSEG-GSBER'                        IT_RECORD-GSBER ."'kaba'.
      perform bdc_field       using 'BSEG-ZFBDT'                           '03.12.2007'.
      perform bdc_dynpro      using 'SAPMF05A' '0302'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'BSEG-WRBTR'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BS'.
      perform bdc_field       using 'BSEG-WRBTR'                          IT_RECORD-VRAMT. "'50,000.00'.
      perform bdc_field       using 'BSEG-MWSKZ'
      perform bdc_field       using 'BSEG-BUPLA'                            '1800'.
      perform bdc_field       using 'BSEG-GSBER'                            IT_RECORD-GSBER."'KABA'.
      perform bdc_field       using 'BSEG-ZFBDT'                            '03.12.2007'.
      perform bdc_dynpro      using 'SAPMF05A' '0700'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RF05A-NEWBS'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BU'.
      CALL TRANSACTION 'F-02' USING BDCDATA MODE 'A'.
    ELSE.
      CONTINUE.
    ENDIF.
    ENDLOOP.
    perform bdc_dynpro      using 'SAPMF05A' '0302'.
    perform bdc_field       using 'BDC_CURSOR'
                                   'BSEG-GSBER'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '/00'.
    perform bdc_field       using 'BSEG-WRBTR'                '50000'.
    perform bdc_field       using 'BSEG-MWSKZ'                '**'.
    perform bdc_field       using 'BSEG-GSBER'                'kaba'.
    perform bdc_field       using 'BSEG-ZFBDT'                '03.12.2007'.
    perform bdc_dynpro      using 'SAPMF05A' '0302'.
    perform bdc_field       using 'BDC_CURSOR'
                                   'BSEG-WRBTR'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=BS'.
    perform bdc_field       using 'BSEG-WRBTR'                IT_RECORD-VRAMT.  "'50,000.00'.
    perform bdc_field       using 'BSEG-MWSKZ'                '**'.
    perform bdc_field       using 'BSEG-BUPLA'                '1800'.
    perform bdc_field       using 'BSEG-GSBER'                IT_RECORD-GSBER.  "'KABA'.
    perform bdc_field       using 'BSEG-ZFBDT'                '03.12.2007'.
    perform bdc_dynpro      using 'SAPMF05A' '0700'.
    perform bdc_field       using 'BDC_CURSOR'
                                   'RF05A-NEWBS'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=BU'.
    perform bdc_transaction using 'F-02'.
    *CALL TRANSACTION 'F-02' USING BDCDATA MODE 'A'.
      ENDFORM.
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
      IF FVAL <> ' '.
        CLEAR BDCDATA.
        BDCDATA-FNAM = FNAM.
        BDCDATA-FVAL = FVAL.
        APPEND BDCDATA.
      ENDIF.
    ENDFORM.
    *&      Form  GET_DATA
    form GET_DATA1 .
      CALL FUNCTION 'UPLOAD'
       EXPORTING
         FILENAME                      = 'C:\MVF-02_1.txt'
         FILETYPE                      = 'DAT'
        TABLES
         data_tab                      = IT_RECORDS
       EXCEPTIONS
         CONVERSION_ERROR              = 1
         INVALID_TABLE_WIDTH           = 2
         INVALID_TYPE                  = 3
         NO_BATCH                      = 4
         UNKNOWN_ERROR                 = 5
         GUI_REFUSE_FILETRANSFER       = 6
         OTHERS                        = 7.
      IF sy-subrc <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.                    " GET_DATA
    *&      Form  GET_DATA2
    form GET_DATA2 .
      CALL FUNCTION 'UPLOAD'
       EXPORTING
         FILENAME                      = 'C:\MVF-02_2.TXT'
         FILETYPE                      = 'DAT'
        TABLES
         data_tab                      = IT_RECORD
       EXCEPTIONS
         CONVERSION_ERROR              = 1
         INVALID_TABLE_WIDTH           = 2
         INVALID_TYPE                  = 3
         NO_BATCH                      = 4
         UNKNOWN_ERROR                 = 5
         GUI_REFUSE_FILETRANSFER       = 6
         OTHERS                        = 7
      IF sy-subrc <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.                    " GET_DATA2

  • Problem in chage FB02 item text

    Hi Freinds.
       I got one assignment to change the Item text in FB02(Change Document). I wrote one program to change the item text using FM FI_ITEMS_MASS_CHANGE. It's working fine. But as soon it changes the next line item's text, the previous is also changed to same as this one. And if there are 6 or 7 items ,at the end of the program , all the line items have same text as the last one.
    But we need different textx of line items for one Header document.
    Am I using the correct Function Module? Please suggest.
    Previously I tried doing recording and BDC of FB02, but failed because i think there is some enhancement done in this T-code.
    so please suggest how to complete my assignment.
    Thanx and regrads.
    Prashant Tiwari.

    perform bdc_dynpro    using 'SAPMF05L' '0102'.
    perform bdc_field                    using 'BDC_CURSOR'
                                        'RF05L-GJAHR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF05L-BELNR'
                                  l_belnr..
    perform bdc_field       using 'RF05L-BUKRS'
                                  l_bukrs     .
    perform bdc_field       using 'RF05L-GJAHR'
                                  l_gjahr.
    perform bdc_field       using 'RF05L-BUZEI'
                                  record-BUZEI_004.
    check the line item and call the screen based on the type
    if line item related to screen 300 then
    perform bdc_dynpro  using 'SAPMF05L' '0300'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'BSEG-SGTXT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BSEG-SGTXT'
                                  l_sgtxt.
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'COBL-ANLN1'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    else.
    perform bdc_dynpro      using 'SAPMF05L' '0301'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'BSEG-SGTXT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BSEG-SGTXT'
                                  l_sgtxt.
    endif.
    if line item related to screen 300 then
    perform bdc_dynpro      using 'SAPMF05L' '0301'.
    perform bdc_field          using 'BDC_CURSOR'
                                          'BSEG-ZUONR'.
    perform bdc_field       using 'BDC_OKCODE'
                                         '=AE'.
    perform bdc_dynpro  using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_CURSOR'
                                        'COBL-ANLN1'.
    perform bdc_field       using 'BDC_OKCODE'
                                       '=ENTE'.
    else.
    perform bdc_dynpro      using 'SAPMF05L' '0300'.
    perform bdc_field            using 'BDC_CURSOR'
                                            'BSEG-ZUONR'.
    perform bdc_field       using 'BDC_OKCODE'
                                         '=AE'.
    endif.

  • Problem in BDC: Not Picking the second entry of file

    Dear Friends,
    I have been working on a BDC and have been facing a problem. This code uploads the first entry of my file properly but repeats the same entry again second time, doesn't refresh or take the second entry of the file.
    Please have a look at the code & suggest the necessary corrections.
    Regards,
    Alok.
    report ZFBPS_BDC
           no standard page heading line-size 255.
    data: bdcdata1 like bdcdata occurs 0 with header line.
    data : vf_index type i.
    *include bdcrecx1.
    DATA: BEGIN OF ENTRIES OCCURS 0,
            RECNO(5),
            NEWBS(2),
            NEWKO(17),
            NEWNUM(1),
            WRBTR(13),
            GSBER(4),
            KOSTL(10),
            SECCO(4),
            ZFBDT(8),
            zuonr(18),
            SGTXT(50),
            FMORE(1),
            HKONT(10),
            PRCTR(10),
            AUFNR(3),
            MWSKZ(2),
            XBLNR(16),
            BKTXT(25),
    END OF ENTRIES.
    DATA: TEMP(8),
          DOCDATE(8),
          SPLGL(1),
          PKEY(2),
          GL(17),
          VCHAMT(13),
          BUSAREA(4),
          SECCODE(4),
          FBDT(8),
          zzuonr(18),
          COSTCEN(10),
          AUFNR(3),
          SGTXT(50).
    data : vf_start_col type i value '1',      "start column
           vf_start_row type i value '1',      "start row
           vf_end_col   type i value '256',    "maximum column
           vf_end_row   type i value '65536',  "maximum row
           p_text(20).                         "stores error messages
    Internal Table
    data : it_excel type  kcde_cells occurs 0 with header line.
    */ Field symbol
    field-symbols : <fs>.
    parameters: p_file   LIKE rlgrap-filename MEMORY ID M01,
                NOHEADER AS CHECKBOX.
    parameters: COMPANY(4) TYPE C DEFAULT 'SCL',
                GROUP(12) TYPE C DEFAULT 'BDCTEST',
                USER(12) TYPE C DEFAULT SY-UNAME,
                KEEP(1) TYPE C DEFAULT 'X',
                POSTDATE LIKE SY-DATUM DEFAULT SY-DATUM,
                DOC_TYPE(2) TYPE C DEFAULT 'KR',
                HOLDDATE LIKE SY-DATUM.
    ***********************************************upload data from excel
    CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
      EXPORTING
        filename                      = p_file
        i_begin_col                   = VF_START_COL
        i_begin_row                   = VF_START_ROW
        i_end_col                     = VF_END_COL
        i_end_row                     = VF_END_ROW
      tables
        intern                        = IT_EXCEL
    EXCEPTIONS
       INCONSISTENT_PARAMETERS       = 1
       UPLOAD_OLE                    = 2
       OTHERS                        = 3 .
    IF sy-subrc <> 0.
              WRITE: / 'EXCEL UPLOAD FAILED :', p_file, SY-SUBRC.
    else.
      sort it_excel by row col.
          loop at it_excel.
         IF NOHEADER = 'X'
        AND It_EXCEL-row = 1.
          CONTINUE.
        ENDIF.
         vf_index = it_excel-col.
       assign component vf_index of structure ENTRIES to <fs>.
            move  it_excel-value to <fs>.
          at end of row.
            append ENTRIES.
            clear ENTRIES.
          endat.
          endloop.
      endif.
    start-of-selection.
    LOOP AT ENTRIES.
      WRITE: /  ENTRIES-RECNO,
                ENTRIES-NEWBS,
                ENTRIES-NEWKO,
                ENTRIES-NEWNUM,
                ENTRIES-WRBTR,
                ENTRIES-GSBER,
                ENTRIES-SECCO,
                ENTRIES-ZFBDT,
                ENTRIES-ZUONR,
                ENTRIES-SGTXT.
    ENDLOOP.
    WRITE: / 'THIS IS THE BDC PROGRAM FOR SAMTEL'.
    perform bdc_dynpro      using 'SAPMF05A' '0100'.
    perform bdc_field       using 'BDC_OKCODE' '/00'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR' 'RF05A-NEWKO'.
    TEMP = POSTDATE.
    DOCDATE = TEMP+6(2).
    DOCDATE2(2) = TEMP4(2).
    DOCDATE4(4) = TEMP0(4).
    *PERFORM BDC_FIELD USING 'BKPF-BLDAT' DOCDATE.
    *PERFORM BDC_FIELD USING 'BKPF-BLART' DOC_TYPE.
    *PERFORM BDC_FIELD USING 'BKPF-BUKRS' COMPANY.
    *PERFORM BDC_FIELD USING 'BKPF-WAERS' 'INR'.
    *PERFORM BDC_FIELD USING 'BKPF-BUDAT' DOCDATE.
    *PERFORM BDC_FIELD USING 'BKPF-XBLNR' 'Deepak'.
    *PERFORM BDC_FIELD USING 'BKPF-BKTXT' 'Sahib'.
    LOOP AT ENTRIES.
    REFRESH BDCDATA1.
    perform bdc_dynpro      using 'SAPMF05A' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF05A-NEWKO'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD USING 'BKPF-BLDAT' DOCDATE.
    PERFORM BDC_FIELD USING 'BKPF-BLART' DOC_TYPE.
    PERFORM BDC_FIELD USING 'BKPF-BUKRS' COMPANY.
    PERFORM BDC_FIELD USING 'BKPF-WAERS' 'INR'.
    PERFORM BDC_FIELD USING 'BKPF-BUDAT' DOCDATE.
    PERFORM BDC_FIELD USING 'BKPF-XBLNR' 'Deepak'.
    PERFORM BDC_FIELD USING 'BKPF-BKTXT' 'Sahib'.
    perform bdc_field       using 'RF05A-NEWBS'
                                  ENTRIES-NEWBS.
    perform bdc_field       using 'RF05A-NEWKO'
                                  ENTRIES-NEWKO.
    perform bdc_dynpro      using 'SAPMF05A' '0300'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'BSEG-SGTXT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BSEG-WRBTR'
                                  ENTRIES-WRBTR.
    perform bdc_field       using 'BSEG-ZUONR'
                                  ENTRIES-ZUONR.
    perform bdc_field       using 'BSEG-SGTXT'
                                  ENTRIES-SGTXT.
    perform bdc_field       using 'DKACB-FMORE'
                                  ENTRIES-FMORE.
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'COBL-KOSTL'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    perform bdc_field       using 'COBL-GSBER'
                                  ENTRIES-GSBER.
    perform bdc_field       using 'COBL-KOSTL'
                                  ENTRIES-KOSTL.
    perform bdc_dynpro      using 'SAPMF05A' '0300'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF05A-NEWKO'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BSEG-WRBTR'
                                  ENTRIES-WRBTR.
    perform bdc_field       using 'BSEG-ZUONR'
                                  ENTRIES-ZUONR.
    perform bdc_field       using 'BSEG-SGTXT'
                                  ENTRIES-SGTXT.
    perform bdc_field       using 'RF05A-NEWBS'
                                  ENTRIES-NEWBS.
    perform bdc_field       using 'RF05A-NEWKO'
                                  ENTRIES-NEWKO.
    perform bdc_field       using 'DKACB-FMORE'
                                  ENTRIES-FMORE.
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'COBL-GSBER'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    perform bdc_field       using 'COBL-GSBER'
                                  ENTRIES-GSBER.
    perform bdc_field       using 'COBL-KOSTL'
                                  ENTRIES-KOSTL.
    perform bdc_field       using 'COBL-PRCTR'
                                  ENTRIES-PRCTR.
    perform bdc_dynpro      using 'SAPMF05A' '0300'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF05A-NEWKO'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BSEG-WRBTR'
                                  ENTRIES-WRBTR.
    perform bdc_field       using 'BSEG-SGTXT'
                                  ENTRIES-SGTXT.
    perform bdc_field       using 'RF05A-NEWBS'
                                  ENTRIES-NEWBS.
    perform bdc_field       using 'RF05A-NEWKO'
                                  ENTRIES-NEWKO.
    perform bdc_field       using 'DKACB-FMORE'
                                  ENTRIES-FMORE.
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'COBL-GSBER'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    perform bdc_field       using 'COBL-GSBER'
                                  ENTRIES-GSBER.
    perform bdc_dynpro      using 'SAPMF05A' '0300'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'BSEG-WRBTR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BSEG-WRBTR'
                                  ENTRIES-WRBTR.
    perform bdc_field       using 'DKACB-FMORE'
                                  ENTRIES-FMORE.
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'COBL-GSBER'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    perform bdc_field       using 'COBL-GSBER'
                                  ENTRIES-GSBER.
    perform bdc_dynpro      using 'SAPMF05A' '0300'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF05A-NEWKO'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BSEG-WRBTR'
                                  ENTRIES-WRBTR.
    perform bdc_field       using 'BSEG-SGTXT'
                                  ENTRIES-SGTXT.
    perform bdc_field       using 'RF05A-NEWBS'
                                  ENTRIES-NEWBS.
    perform bdc_field       using 'RF05A-NEWKO'
                                  ENTRIES-NEWKO.
    perform bdc_field       using 'DKACB-FMORE'
                                  ENTRIES-FMORE.
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'COBL-GSBER'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    perform bdc_field       using 'COBL-GSBER'
                                  ENTRIES-GSBER.
    perform bdc_dynpro      using 'SAPMF05A' '0300'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF05A-NEWKO'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BSEG-WRBTR'
                                  ENTRIES-WRBTR.
    perform bdc_field       using 'BSEG-SGTXT'
                                  ENTRIES-SGTXT.
    perform bdc_field       using 'RF05A-NEWBS'
                                  ENTRIES-NEWBS.
    perform bdc_field       using 'RF05A-NEWKO'
                                  ENTRIES-NEWKO.
    perform bdc_field       using 'DKACB-FMORE'
                                  ENTRIES-FMORE.
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'COBL-GSBER'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    perform bdc_field       using 'COBL-GSBER'
                                  ENTRIES-GSBER.
    perform bdc_dynpro      using 'SAPMF05A' '0300'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF05A-NEWKO'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BSEG-WRBTR'
                                  ENTRIES-WRBTR.
    perform bdc_field       using 'BSEG-SGTXT'
                                  ENTRIES-SGTXT.
    perform bdc_field       using 'RF05A-NEWBS'
                                  ENTRIES-NEWBS.
    perform bdc_field       using 'RF05A-NEWKO'
                                  ENTRIES-NEWKO.
    perform bdc_field       using 'DKACB-FMORE'
                                  ENTRIES-FMORE.
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'COBL-GSBER'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    perform bdc_field       using 'COBL-GSBER'
                                  ENTRIES-GSBER.
    perform bdc_dynpro      using 'SAPMF05A' '0302'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'BSEG-SGTXT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=AB'.
    perform bdc_field       using 'BSEG-HKONT'
                                  ENTRIES-HKONT.
    perform bdc_field       using 'BSEG-WRBTR'
                                  ENTRIES-WRBTR.
    perform bdc_field       using 'BSEG-MWSKZ'
                                  ENTRIES-MWSKZ.
    perform bdc_field       using 'BSEG-ZFBDT'
                                  ENTRIES-ZFBDT.
    perform bdc_field       using 'BSEG-SGTXT'
                                  ENTRIES-SGTXT.
    perform bdc_dynpro      using 'SAPLFWTD' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'WITH_ITEM-WT_WITHCD(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=GO'.
    perform bdc_dynpro      using 'SAPMF05A' '0700'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF05A-NEWBS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BS'.
    perform bdc_field       using 'BKPF-XBLNR'
                                  ENTRIES-XBLNR.
    perform bdc_field       using 'BKPF-BKTXT'
                                  ENTRIES-BKTXT.
    perform bdc_dynpro      using 'SAPMF05A' '0700'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF05A-NEWBS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'BKPF-XBLNR'
                                  ENTRIES-XBLNR.
    perform bdc_field       using 'BKPF-BKTXT'
                                  ENTRIES-BKTXT.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    call transaction 'FB01' using bdcdata1 mode 'A'.
    ENDLOOP.
           Start new screen                                              *
    form bdc_dynpro using program dynpro.
       clear bdcdata1.
      bdcdata1-program  = program.
      bdcdata1-dynpro   = dynpro.
      bdcdata1-dynbegin = 'X'.
    append bdcdata1.
    endform.
           Insert field                                                  *
    form bdc_field using fnam fval.
       clear bdcdata1.
        bdcdata1-fnam = fnam.
        bdcdata1-fval = fval.
    append bdcdata1.
    endform.

    Hi
    You better use LSMW instaed of using BDC for FB01 Transaction. The Problem is not with REFRESH.
    Regards,
    Anji

  • Pop of prctr field in programm

    hi,
    i make a bdc using f-27 call trans.
    there it is work fine but a problem in 3rd screen that at time of saving amount data at 3rd screen the (coding block name screen)----> are pop up in this the profit centre field are given as( whaildummy) this is given by me and then data is saved but i want that it directly save as we run the tcode f-27 in actual way witout codes this screen are not come but in my codes it will come at 3rd screen with popup and after given profit centre it save in company code.
    plz help me i am wait for u'r rply plz
    thanks
    jayant
    i am send the codes and flat file
    report ZF27TEST
           no standard page heading line-size 255.
                        I N T E R N A L  T A B L E                       *
    TYPES: BEGIN OF it_output,
           bldat(10)  TYPE  C,           "Document Date
           blart      TYPE  bkpf-blart,  "Document Type
           bukrs      TYPE  bkpf-bukrs,  "Company Code
           budat(10)  TYPE  C,           "Posting Date
           monat      TYPE  bkpf-monat,  "Period
           waers      TYPE  bkpf-waers,  "Currency
           xblnr      TYPE  bkpf-xblnr,  "Reference Field
           docid      TYPE  fs006-docid, "Document ID
           newbs      TYPE  rf05a-newbs, "Posting  Key
           newko      TYPE  rf05a-newko, "Account Code
           wrbtr(16)  TYPE  C,           "Amount in Document currency
           zfbdt(10)  TYPE  C,           "Baseline Date
           newbs2     TYPE  rf05a-newbs, "Account Key2
           newko2     TYPE  rf05a-newko, "Account code2
           wrbtr2(16) TYPE  C,           "Amount2
    END OF it_output.
    DATA lt_output  TYPE  it_output OCCURS 0 WITH HEADER LINE.
    DATA it_bdc     LIKE  bdcdata OCCURS 0 WITH HEADER LINE.
    DATA it_messtab LIKE  bdcmsgcoll OCCURS 1 WITH HEADER LINE.
                               D A T A                                   *
    DATA: message TYPE string.
    DATA: p_file1 type string.
             S E L E C T - O P T I O N S / P A R A M E T E R S           *
    SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME.
    PARAMETERS : p_file  LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK block0.
             A T  S E L E C T I O N - S C R E E N                        *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          static    = 'X'
          mask      = space
        CHANGING
          file_name = p_file.
                   S T A R T - O F - S E L E C T I O N
    START-OF-SELECTION.
      PERFORM  upload.
      PERFORM  bdc.
      PERFORM  write_message.
    *&      Form  bdc
          text
    FORM bdc.
      LOOP AT lt_output.
        READ TABLE lt_output INDEX 1.
    perform bdc_dynpro      using 'SAPMF05A' '0100'.
    perform bdc_field       using 'BDC_CURSOR' 'RF05A-NEWKO'.
    perform bdc_field       using 'BDC_OKCODE' '/00'.
    perform bdc_field       using 'BKPF-BLDAT' lt_output-bldat.
    perform bdc_field       using 'BKPF-BLART' lt_output-blart.
    perform bdc_field       using 'BKPF-BUKRS' lt_output-bukrs.
    perform bdc_field       using 'BKPF-BUDAT' lt_output-budat.
    perform bdc_field       using 'BKPF-MONAT' lt_output-monat.
    perform bdc_field       using 'BKPF-WAERS' lt_output-waers.
    perform bdc_field       using 'BKPF-XBLNR' lt_output-xblnr.
    perform bdc_field       using 'FS006-DOCID' lt_output-docid.
    perform bdc_field       using 'RF05A-NEWBS' lt_output-newbs.
    perform bdc_field       using 'RF05A-NEWKO' lt_output-newko.
    perform bdc_dynpro      using 'SAPMF05A' '0302'.
    perform bdc_field       using 'BDC_CURSOR' 'RF05A-NEWKO'.
    perform bdc_field       using 'BDC_OKCODE' '/00'.
    perform bdc_field       using 'BSEG-WRBTR' lt_output-wrbtr.
    *perform bdc_field       using 'BSEG-ZTERM' 'V030'.
    *perform bdc_field       using 'BSEG-ZBD1T' '30'.
    *perform bdc_field       using 'BSEG-ZFBDT' '08.04.2008'.
    perform bdc_field       using 'RF05A-NEWBS' lt_output-newbs2.
    perform bdc_field       using 'RF05A-NEWKO' lt_output-newko2.
    perform bdc_dynpro      using 'SAPMF05A' '0300'.
    perform bdc_field       using 'BDC_CURSOR' 'BSEG-WRBTR'.
    perform bdc_field       using 'BDC_OKCODE' '=BU'.
    perform bdc_field       using 'BSEG-WRBTR' lt_output-wrbtr2.
    perform bdc_field       using 'DKACB-FMORE' 'X'.
    CALL TRANSACTION 'F-27' USING it_bdc mode 'A'
                               MESSAGES INTO it_messtab.
        CLEAR it_bdc. REFRESH it_bdc.
      ENDLOOP.
    ENDFORM.                    "bdc
    *&      Form  write_message
          text
    FORM write_message.
      LOOP AT it_messtab .
        CLEAR message.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            id   = sy-msgid
            lang = 'EN'
            no   = sy-msgno
            v1   = sy-msgv1
            v2   = sy-msgv2
            v3   = sy-msgv3
            v4   = sy-msgv4
          IMPORTING
            msg  = message.
        CASE it_messtab-msgtyp.
          WHEN 'S'.
            WRITE:/ message.
            CLEAR message.
          WHEN 'E'.
            FORMAT COLOR 6 ON.
            WRITE:/ message.
            CLEAR message.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    "write_message
          FORM BDC_DYNPRO                                               *
    -->  PROGRAM                                                       *
    -->  DYNPRO                                                        *
    FORM bdc_dynpro USING program dynpro.
      it_bdc-program  = program.
      it_bdc-dynpro   = dynpro.
      it_bdc-dynbegin = 'X'.
      APPEND it_bdc.
      CLEAR it_bdc.
    ENDFORM.                    "BDC_DYNPRO
          FORM                                                          *
    FORM bdc_field USING fnam fval.
      it_bdc-fnam = fnam.
      it_bdc-fval = fval.
      APPEND it_bdc.
      CLEAR it_bdc.
    ENDFORM.                    "BDC_FIELD
    *&      Form  upload
          text
    -->  p1        text
    <--  p2        text
    FORM upload .
    p_file1 = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = p_file1
       FILETYPE                      = 'DAT'
      tables
        data_tab                      = lt_output
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " upload
    F O R M A L   E N D - O F - P R O G R A M                           *
    flat file is
    30.04.2008     DA     8601     30.04.2008     4     CNY     REF1           31     90001     500     30.04.2008     40     3990000002     500
    in between REF1 and pstky 31 there is blank tab for DOCID
    thanks

    Hello Suresh,
    The pop-up comes due to an inconsistent settings maintained in SE54. There is a flag called 'Compare Flag', which I am assuming, has been set to Automatically Adjustable in SE54.
    But beyond this, you have manually adjusted the screen parameters, which contradict with the Compare flag settings.
    Goto SE54, and change the flag to Adjustable in Dialog and save the SE54.
    The pop-up should be eliminated.
    Regards,
    Rekha

  • Script- problem in printing the values in from internal table

    Hi all,
    I have a requiremnt that i for a particular document no there are number of invoices are there. i.e for a single document no there are 20 invoices in that. i shoudl display the invoice number , invoice date, invoice amount , number of days of intrest , start date of interest, end date of interest and intrest amount.
    The problem is i should take the invoice number, invoice date, number of days  from TABLE <b>BSEG</b> and  inovice amount and start date, end date from table<b> INTITIT</b>.  for a particular document number there are diffent invoce numbers in both the table.
    i can display everthing but the prob is with invoice amount. it is repating only one values is displying in the ouput. The invoice number in INTITIT Is not changing. I have to write the syntax for that .Please help me The value in Bseg is chaing as per given syntax shown below.
    data:   begin of hbseg occurs 10.
            include structure hsortp.
            include structure bseg.
    data:   end of hbseg.
    data: begin of hsortp,
            sortp1 like sortp1,
            sortp2 like sortp2,
            sortp3 like sortp3,
            sortp4 like sortp4,
            sortp5 like sortp5,
            EKVBD  LIKE KNB1-EKVBD,
          end   of hsortp.
    loop at hbseg.
            WHERE BUKRS = SAVE_BUKRS.
              save_bukrs  = hbseg-bukrs.
              if  ( hbseg-kunnr = save_kunnr
              and   not save_kunnr is initial )
              or  ( hbseg-lifnr = save_lifnr
              and   not save_lifnr is initial ).
               clear bseg.
                move-corresponding hbseg to bseg.
                 *bseg = bseg.
                if bkpf-waers ne *bkpf-waers.
                  perform curr_document_convert_bseg
                              using
                                 bkpf-budat
                                 *bkpf-waers
                                 *bkpf-hwaer
                                 bkpf-waers
                              changing
                                 bseg.
                  if not bseg-pycur is initial.
                    alw_waers = bseg-pycur.
                    perform currency_get_subsequent
                                using
                                   save_repid
                                   bkpf-budat
                                   bkpf-bukrs
                                changing
                                   alw_waers.
                    if alw_waers ne bseg-pycur.
                      bseg-pycur = alw_waers.
                      perform convert_foreign_to_foreign_cur
                                  using
                                     bkpf-budat
                                     *bkpf-waers
                                     *bkpf-hwaer
                                     bseg-pycur
                                  changing
                                     bseg-pyamt.
                    endif.
                  endif.
                endif.
                perform fill_waehrungsfelder_bseg.
                perform fill_waehrungsfelder_bseg_2.
                if bseg-sgtxt(1) ne '*'.
                  bseg-sgtxt = space.
                else.
                  bseg-sgtxt = bseg-sgtxt+1.
                endif.
                clear save_bschl.
                clear save_umskz.
                clear tbslt.
                save_bschl = bseg-bschl.
                save_umskz = bseg-umskz.
                perform read_tbslt.
    ADDING VARIBLE V_GSALDF BY SUNIL 5.11.07******
               v_gsaldf = rf140-gsaldf + rf140-wrshb.
               rf140-gsaldf = v_gsaldf.
               clear v_gsaldf.
    SUNIL *********************
                 *rf140-gsaldf = *rf140-gsaldf + *rf140-wrshb.
                if  xmultk is initial
                and xactiv is initial
                and linecnt = '1'
                and not      xumsst is initial
                and not save_xumstn is initial.
                  if bkpf-bstat = 'V'.
                    perform read_vbset.
                  else.
                    perform read_bset.
                  endif.
                  describe table hbset lines linecnt.
                  if linecnt = '1'.
                    loop at hbset.
                      move-corresponding hbset to bset.
                       *bset = bset.
                      if bkpf-waers ne *bkpf-waers.
                        perform curr_document_convert_bset
                                    using
                                       bkpf-budat
                                       *bkpf-waers
                                       *bkpf-hwaer
                                       bkpf-waers
                                    changing
                                       bset.
                      endif.
                      clear rf140-msatz.
                      clear rf140-vtext.
                      save_ktosl = bset-ktosl.
                      perform read_t687t.
                      rf140-msatz = bset-kbetr / 10.
                       *rf140-msatz = rf140-msatz.
                      rf140-vtext = save_vtext.
                       *rf140-vtext = rf140-vtext.
                      if bset-shkzg = 'H'.
                        rf140-mwshb = bset-fwste.
                         *rf140-mwshb = *bset-fwste.
                        rf140-mdshb = bset-hwste.
                         *rf140-mdshb = *bset-hwste.
                      else.
                        rf140-mwshb = 0 - bset-fwste.
                         *rf140-mwshb = 0 - *bset-fwste.
                        rf140-mdshb = 0 - bset-hwste.
                         *rf140-mdshb = 0 - *bset-hwste.
                      endif.
                      exit.
                    endloop.
                    rf140-wrshb = rf140-wrshb - rf140-mwshb.
                     *rf140-wrshb = *rf140-wrshb - *rf140-mwshb.
                    rf140-dmshb = rf140-dmshb - rf140-mdshb.
                     *rf140-dmshb = *rf140-dmshb - *rf140-mdshb.
                  endif.
                endif.
    *****************Begin of Change by Karthikeyan J********************
                i_count = i_count + 1.
                clear rf140-element.
                clear: it_bseg, i_wrbtr,i_totday,i_tempday,i_day,i_bday.
    comparing with fields belnr AND SELECT * FROM INTITIT added by sunil 3.11.07*********
                select single * from bseg into
                corresponding fields of it_bseg where belnr = bseg-rebzg  anD GJAHR = BSEG-GJAHR.
                select single * from intitit into corresponding fields of  it_intitit where gjahr = bseg-gjahr and belnr_to = bseg-belnr and buzei = '2' OR BELNR = INTITIT-BELNR .
    added by Jayshree on 09/01/2007
                MOVE ' ' TO it_kna1-name1.
                SELECT SINGLE name1
                INTO CORRESPONDING FIELDS OF it_kna1
                FROM ( vbpa AS a INNER JOIN kna1 AS b ON akunnr = bkunnr )
                WHERE a~vbeln = it_bseg-vbeln
                  AND a~parvw = 'zd'.
                SELECT SINGLE fkdat
                INTO CORRESPONDING FIELDS OF it_kna1
                FROM vbrk
                WHERE vbrk~vbeln = it_bseg-vbeln.
    added by Jayshree on 01/02/2007
              CONCATENATE  it_kna1-fkdat6(2) it_kna1-fkdat4(2) it_kna1-fkdat+2(2)
                INTO vfkdat SEPARATED BY '.'.
              CONCATENATE  it_bseg-augdt6(2) it_bseg-augdt4(2) it_bseg-augdt+2(2)
                INTO vaugdt SEPARATED BY '.'.
                i_wrbtr = i_wrbtr + it_bseg-wrbtr.
    added as on 29.06.2007 by jayshree again transport  on 21.07.2007
                tot_wrbtr = tot_wrbtr + i_wrbtr.
                i_totday = it_bseg-zbd1t + it_bseg-zbd2t + it_bseg-zbd3t.
                CALL FUNCTION 'fima_date_create'
                  EXPORTING
                    i_date                        = it_bseg-zfbdt
                 I_FLG_END_OF_MONTH            = ' '
                 I_YEARS                       = 0
                 I_MONTHS                      = 0
                   i_days                        = i_totday
                 I_CALENDAR_DAYS               = 0
                 I_SET_LAST_DAY_OF_MONTH       = ' '
                 IMPORTING
                   e_date                        = i_bday
                 E_FLG_END_OF_MONTH            =
                 E_DAYS_OF_I_DATE              =
    added by JAYSHREE 01.02.2007
                CONCATENATE  i_bday6(2) i_bday4(2) i_bday+2(2)
                INTO vbday SEPARATED BY '.'.
                i_day = it_bseg-augdt - i_bday.
            CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
              EXPORTING
                date1                         = it_bseg-zfbdt
                date2                         = it_bseg-augdt
               OUTPUT_FORMAT                 = '01'
             IMPORTING
               YEARS                         =
               MONTHS                        =
               DAYS                          = i_day
             EXCEPTIONS
               INVALID_DATES_SPECIFIED       = 1
               OTHERS                        = 2
            IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            ENDIF.
    *added by sunil 5.11.07 ***********
    *read table it_intitit with key BELNR_TO = BSEG-BELNR  .
    *LOOP AT IT_INTITIT.
                rf140-element = '521'.
                CALL FUNCTION 'write_form'
                  EXPORTING
                    window  = 'main'
                    element = '521'
                  EXCEPTIONS
                    window  = 1
                    element = 2.
                IF sy-subrc = 1.
                  window = 'main'.
                  PERFORM message_window.
                ENDIF.
                IF sy-subrc = 2.
                  window = 'main'.
                  ereignis = '521'.
                  PERFORM message_element.
                ENDIF.
                IF save_xumstn IS INITIAL.
    *-------Umsatzsteuer -
                  IF xactiv IS INITIAL.
                    save_waers = rf140-waers.
                    PERFORM tax_data.
                    CLEAR taxlines.
                    DESCRIBE TABLE atax LINES taxlines.
                    IF NOT taxlines IS INITIAL.
                      LOOP AT atax.
                        CLEAR ereignis.
                        CLEAR rf140-msatz.
                        CLEAR rf140-vtext.
                        rf140-msatz = atax-msatz.
                         *rf140-msatz = atax-msatz.
                        rf140-vtext = atax-vtext.
                         *rf140-vtext = atax-vtext.
    *******begin of change by karthikeyan on 10.03.06*********************
                        IF sy-tabix = '1'.
                          ereignis = '522'.
                          v_stax = rf140-msatz * rf140-gsaldf / 100.
                        ELSE.
                          ereignis = '523'.
                          v_ecs = rf140-msatz * v_stax / 100.
                          v_total = rf140-gsaldf + v_stax + v_ecs.
                        ENDIF.
                        CALL FUNCTION 'hr_in_chg_inr_wrds'
                          EXPORTING
                            amt_in_num               = v_total
                          IMPORTING
                            amt_in_words             = v_spell
                        EXCEPTIONS
                          DATA_TYPE_MISMATCH       = 1
                          OTHERS                   = 2
                        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                        ENDIF.
    ***************************end of change******************************
                        CLEAR rf140-element.
                        rf140-element = ereignis.
                        IF NOT ereignis IS INITIAL.
                          CALL FUNCTION 'write_form'
                            EXPORTING
                              window  = 'main'
                              element = ereignis
                            EXCEPTIONS
                              window  = 1
                              element = 2.
                          IF sy-subrc = 1.
                            window = 'main'.
                            PERFORM message_window.
                          ENDIF.
                          IF sy-subrc = 2.
                            window = 'main'.
                            PERFORM message_element.
                          ENDIF.
                        ENDIF.
                      ENDLOOP.
                    ENDIF.
                  ENDIF.
                ENDIF.
               ENDLOOP.
              ENDIF.
            ENDLOOP.
    '521' is the element name in the main  window where i should display the values. before select qurey the values are coming in the bseg but not in table INTITIT.  Belnr is the document no with ref to that
    there are number  of invoices nos. so in both the tables it is selecting single value and displaying but in bseg the invoice number is getting refreshed and new number is coming in that place i.e in field bseg-rebzg but in INTITIT  in belnr only it is taking single value it is not getting refreshed.
       move-corresponding hbseg to bseg.
                 *bseg = bseg.
                if bkpf-waers ne *bkpf-waers.
    this is the syntax whr the values in bseg are getting refresh and new invoice number is selecting.
    How to write the syntax for INTITIT? As per invoice number it is giving new values.
    The invoice number in Bseg is different campare to in table INTITIT. in output is shoud show the fields as follows
    it_besg-rebzg(invoice number of besg) it_besg-zuonr(invoice date) INTITIT-INT_BASAMT(base amount) i_day (no of days ) INTITIT-INT_BEGIN (INTREST START DATE) INTITIT-INT_end(INTREST END DATE)  rf140-wrshb(INTREST AMOUNT).
    THE VALUE OF IT_BESG-REBZG IS CHANGING  BUT THE VALUE IN INTITIT-BELNR ( INVOICE NUMBER) IS NOT CHANGING THAT IS WHY IT IS SHOWING
    ONLY SINGLE RECORD.
    for both the table documet no is same. in besg-belnr is the document no. in intitit-BELNR_TO is the document no.
    here in bseg-rebzg is chaning but in INTITIT-BELNR IS  not changing.
    If i take loop at INTITIT. ALL the values are repating so i am unable to take loop. so i want to write
    a syntax such that intitit-belnr should be refreshed and also for every loop it shoud take new invoice no.
    Please help me out it is very urgent.
    <b>USEFUL ANSWERS WILL BE REWARDED.</b>
    regards,
    Sunil kumar.

    assumption: some mistake in ur posting that, How belnr and date r same for both header records, so i guess, either one is different.
    try with AT NEW - ENDAT.
    AT NEW belnr.
    here use looping, READing of ur itabs.---> so, u need to build couple of itabs to move forth and back.
    ENDAT.
    pls. note that, when u use this AT NEW all the CHAR fileds of itab wuld show as STARS **.....so, this is the necessity behind building new itabs.
    thanq
    Edited by: SAP ABAPer on Dec 30, 2008 6:24 PM

  • EITHER BAPI OR BDC IS BEST FOR F-02

    Hello Friends,
    Iam doing bdc for f-02 even bapi to but iam stuck in middle. i want to upload data for F-02 using posting keys
    40 and 50.
    iam sending sample code for it can any one rectify and tell me whats wrong with this....
    Iam sending both bapi and bdc code...
    Regards
    Bohra.
    REPORT  ZBDC_TEST no standard page heading line-size 255.
    INCLUDE BDCRECX1.
    PARAMETERS: filename LIKE rlgrap-filename.
    TYPES : BEGIN OF IT_TAB,
            bldat(2),                  " DOC DATE
            blart(2),                  " DOC TYPE
            bukrs(4),                  " COMPANY CODE
            budat(8),                  " POSTING DATE
            waers(5),                  " CURRENCY
            xblnr(16),                 " HEADER REF
            bktxt(50),                 " HEADER TXT
          newbs(2),                  " POSTING KEY
            accnt(16),                 " ACCOUNT
            umskz(1),                  " SPL GENREAL LEDGER
            wrbtr(13),                 " AMOUNT IN FOR CURRENCY
            dmbtr(13),                 " AMOUNT FOR COMPANY CODE INR
            zterm(4),                  " PAYEMENT TERM
            zfbdt(8),                  " BASELINE DATE
            wt_wit(2),                 " WITH TAX CODE
            wt_qs(15),                 " WITH TAX BASE
            wt_qb(15),                 " WITH TAX AMOUNT
            mwskz(2),                  " TAX CODE
            bupla(4),                  " BUSINESS PLACE
          bukrs(4),
            kostl(10),                 " COST CENTER
            acgl_it(12),               " INTERNAL ORDER
            acgl_i(10),                " PROFIT CENTER
          acgl_it(8),               " PERSONAL NO
            zuonr(18),                 " ASSIGNMENT
            xblnr1(16),                                         " REF1
            xblnr2(16),                                         " REF2
            xblnr3(16),                                         " REF3
            sgtxt(50),                 " LINE TEXT
          END OF IT_TAB.
    DATA: IT_TAB1 TYPE TABLE OF IT_TAB.
    DATA: WA_HEAD LIKE LINE OF IT_TAB1.
    data: it_bdcdata like bdcdata occurs 0 with header line.
    data: it_bdcmsgcoll like bdcmsgcoll occurs 0 with header line.
    data: i_error like itab occurs 0 with header line.
    data: i_sucess like itab occurs 0 with header line.
    data: v_flag.
    data: v_msg(200).
    DATA :  w_file1 TYPE string.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          file_name = filename.
    START-OF-SELECTION.
      w_file1 = filename.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename            = w_file1
          filetype            = 'ASC'
          has_field_separator = 'X'
        TABLES
          data_tab            = it_tab1.
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
      CLIENT                    = SY-MANDT
       GROUP                     = 'F-02'
       KEEP                      = 'X'
       USER                      = SY-UNAME.
       CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          TCODE                  = 'F-02'
         TABLES
           DYNPROTAB              = IT_TAB1.
           CALL FUNCTION 'BDC_CLOSE_GROUP'.
    RECORDING PROGRAM FOR F-02
      loop at it_tab1 into wa_head.
        perform bdc_dynpro using 'SAPMF05A' '0100'.
        perform bdc_field using 'BDC_CURSOR'
                                'RF05A-NEWKO'.
        perform bdc_field using 'BDC_OKCODE'
                                '/00'.
        perform bdc_field using 'BKPF-BLDAT'
                                 WA_HEAD-BLDAT.
        perform bdc_field using 'BKPF-BLART'
                                'SA'.
        perform bdc_field using 'BKPF-BUKRS'
                                 WA_HEAD-BUKRS.
        perform bdc_field using 'BKPF-BUDAT'
                                 WA_HEAD-BUDAT.
        perform bdc_field using 'BKPF-MONAT'
                                '3'.
        perform bdc_field using 'BKPF-WAERS'
                                 WA_HEAD-WAERS.
        perform bdc_field using 'BKPF-XBLNR'
                                 WA_HEAD-XBLNR.
        perform bdc_field using 'BKPF-BKTXT'
                                 WA_HEAD-BKTXT.
        perform bdc_field using 'FS006-DOCID'
        perform bdc_field using 'RF05A-NEWBS'
                                 WA_HEAD-NEWBS.
        perform bdc_field using 'RF05A-NEWKO'
                                '100100'.
        perform bdc_dynpro using 'SAPMF05A' '0300'.
        perform bdc_field using 'BDC_CURSOR'
                                'RF05A-NEWKO'.
        perform bdc_field using 'BDC_OKCODE'
                                '/00'.
        perform bdc_field using 'BSEG-WRBTR'
                                 WA_HEAD-WRBTR.
        perform bdc_field using 'BSEG-VALUT'
                                '03/27/2006'.
        perform bdc_field using 'BSEG-ZUONR'
                                 WA_HEAD-ZUONR.
        perform bdc_field using 'BSEG-SGTXT'
                                 WA_HEAD-SGTXT.
        perform bdc_field using 'RF05A-NEWBS'
                                 WA_HEAD-NEWBS.
        perform bdc_field using 'RF05A-NEWKO'
                                '574130'.
        perform bdc_field using 'DKACB-FMORE'
                                'X'.
        perform bdc_dynpro using 'SAPLKACB' '0002'.
        perform bdc_field using 'BDC_CURSOR'
                                'COBL-GSBER'.
        perform bdc_field using 'BDC_OKCODE'
                                '=ENTE'.
        perform bdc_field using 'COBL-GSBER'
                                '101'.
        perform bdc_dynpro using 'SAPMF05A' '0300'.
        perform bdc_field using 'BDC_CURSOR'
                                'BSEG-SGTXT'.
        perform bdc_field using 'BDC_OKCODE'
                                '=BP'.
        perform bdc_field using 'BSEG-WRBTR'
                                 WA_HEAD-WRBTR.
        perform bdc_field using 'BSEG-VALUT'
                                '03/27/2006'.
        perform bdc_field using 'BSEG-ZUONR'
                                 WA_HEAD-ZUONR.
        perform bdc_field using 'BSEG-SGTXT'
                                 WA_HEAD-SGTXT.
        perform bdc_dynpro using 'SAPLKACB' '0002'.
        perform bdc_field using 'BDC_CURSOR'
                                'COBL-KOSTL'.
        perform bdc_field using 'BDC_OKCODE'
                                 '=ENTE'.
        perform bdc_field using 'COBL-GSBER'
                                '101'.
        perform bdc_field using 'COBL-KOSTL'
                                 WA_HEAD-KOSTL.
      ENDLOOP.
    BAPI PROGRAM----
    *& Report  ZBAPI_TEST
    REPORT  ZBAPI_TEST.
    DATA: BEGIN OF i_data OCCURS 0,
            text(255),
          END OF i_data.
    DATA: i_fico TYPE BAPIACHE09.
    *DATA: I_FICO1 TYPE BAPIACCR08.
    DATA: I_FICO1 TYPE BAPIACGL09.
    DATA: I_FICO3 TYPE BAPIACCR09.
    DATA: I_FICO2 TYPE BAPIACTX09.
    DATA: P_KEY TYPE BBSEG.
    *DATA: it_TAB LIKE TABLE OF i_fico INITIAL SIZE 0  WITH HEADER LINE.
    HEADER DETAILS FROM BAPI STRUCUTE BAPIACHE09
    DATA: BEGIN OF it_TAB1 OCCURS 0,   " BAPIACHE09
          bldat(8),                    " DOC DATE
          blart(2),                    " DOC TYPE
          bukrs(4),                    " COMPANY CODE
          BUDAT(8),                    " POSTING DATE
          XBLNR(16),                   " HEADER REF
          BKTXT(50),                   " HEADER TXT
          END OF IT_TAB1.
    DATA: it_TAB LIKE TABLE OF BAPIACHE09 INITIAL SIZE 0 WITH HEADER LINE .
    ITEM DETAILS FROM STRUCTURE OF BAPI G/L ACCOUNT ITEM BAPIACGL09.
    DATA: BEGIN OF IT_ITAB3 OCCURS 0,  " BAPIACGL09.
          HKONT(10),                   " General Ledger Account
          SGTXT(50),                   " ITEM TXT
          BUKRS(4),                    " Company Code
          KOSTL(10),                   " COST CENTER
          PRCTR(10),                   " PROFIT CENTER
          END OF IT_ITAB3.
    DETIALS OF CURRENCY ITEMS FROM STRUCTURE OF BAPI BAPIACCR09
    DATA: BEGIN OF IT_iTAB4 OCCURS 0,   " BAPIACCR09
          WAERS(5),                     " CURRENCY
          BAPIWRBTR(23),                " Amount in document currency
          BAPIFWBAS(23),                " Tax Base Amount in Document Currency
          END OF IT_ITAB4.
    TAX ITEM DETAILS FROM BAPI STRUCUTE BAPIACTX09.
    DATA: BEGIN OF IT_ITAB5 OCCURS 0,   " BAPIACTX09.
          MWSKZ(2),                     " Sales Tax Code
          TXJCD(15),                    " Tax Jurisdiction
          ACPI_TXJCD_DEEP(15),          " Tax jurisdiction code - jurisdiction for lowest level tax
          END OF IT_ITAB5.
    THIS IS FROM STRUCTURE BBSEG.
    DATA: BEGIN OF IT_TAB6 OCCURS 0,
          NEWBS(2),                     " Posting Key for the Next Line Item
          NEWUM(1),                     " Special G/L Indicator for the Next Line Item
          DMBTR(16),                    " Amount in local currency (batch input field)
          AUFNR(12),                    " Order Number
          DZUONR(18),                   " Assignment number
          ZTERM(4),                     " Terms of payment key
          ZFBDT(8),                     " Baseline Date.
          END OF IT_TAB6.
    DATA: v_index TYPE i.
    DATA: return TYPE TABLE OF bapiret2 INITIAL SIZE 0 WITH HEADER LINE.
    START-OF-SELECTION.
      CALL FUNCTION 'UPLOAD'
    EXPORTING
      CODEPAGE                      = ' '
      FILENAME                      = ' '
      FILETYPE                      = ' '
      ITEM                          = ' '
      FILEMASK_MASK                 = ' '
      FILEMASK_TEXT                 = ' '
      FILETYPE_NO_CHANGE            = ' '
      FILEMASK_ALL                  = ' '
      FILETYPE_NO_SHOW              = ' '
      LINE_EXIT                     = ' '
      USER_FORM                     = ' '
      USER_PROG                     = ' '
      SILENT                        = 'S'
    IMPORTING
      FILESIZE                      =
      CANCEL                        =
      ACT_FILENAME                  =
      ACT_FILETYPE                  =
        TABLES
          data_tab                      = i_data
    EXCEPTIONS
      CONVERSION_ERROR              = 1
      INVALID_TABLE_WIDTH           = 2
      INVALID_TYPE                  = 3
      NO_BATCH                      = 4
      UNKNOWN_ERROR                 = 5
      GUI_REFUSE_FILETRANSFER       = 6
      OTHERS                        = 7
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    CALL FUNCTION 'BAPI_ACC_GL_POSTING_CHECK'
    EXPORTING
      DOCUMENTHEADER       =
       TABLES
         ACCOUNTGL            = it_tab1
      CURRENCYAMOUNT       =
         RETURN               = return.
      CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
        EXPORTING
          DOCUMENTHEADER         =  it_tab
        TABLES
         ACCOUNTGL               = it_Itab3
         ACCOUNTRECEIVABLE       = it_Itab4
      ACCOUNTPAYABLE         =
         ACCOUNTTAX              = it_Itab5
       CURRENCYAMOUNT        =
      CRITERIA               =
      VALUEFIELD             =
      EXTENSION1             =
          RETURN                 =  return.
      loop at return.
        write:/ return-message,return-type.
      endloop.

    Try BAPI_ACC_GL_POSTING_POST.
    CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
      EXPORTING
        DOCUMENTHEADER       =
        IMPORTING
              OBJ_TYPE             =
              OBJ_KEY              =
              OBJ_SYS              =
      TABLES 
             ACCOUNTGL            =   
            CURRENCYAMOUNT       =   
           RETURN               =
             EXTENSION1           =

  • BDC for F-37

    hi,
    I am doing BDC program for F-37 transaction i have no of line items.
    how can i loop only at item level.kindly help me on this.
    Thanks & Regards,
    Mani Malathi.

    Hi,
    Sorry the correct Way is..
    perform bdc_dynpro      using 'SAPMF05A' '0113'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF05A-NEWKO'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BKPF-BLDAT'
                                  record-BLDAT_001.
    perform bdc_field       using 'BKPF-BLART'
                                  record-BLART_002.
    perform bdc_field       using 'BKPF-BUKRS'
                                  record-BUKRS_003.
    perform bdc_field       using 'BKPF-BUDAT'
                                  record-BUDAT_004.
    perform bdc_field       using 'BKPF-MONAT'
                                  record-MONAT_005.
    perform bdc_field       using 'BKPF-WAERS'
                                  record-WAERS_006.
    perform bdc_field       using 'RF05A-NEWKO'
                                  record-NEWKO_007.
    perform bdc_field       using 'RF05A-ZUMSK'
                                  record-ZUMSK_008.
    perform bdc_dynpro      using 'SAPMF05A' '0304'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'BSEG-ZFBDT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BSEG-WRBTR'
                                  record-WRBTR_009.
    perform bdc_field       using 'BSEG-ZFBDT'
                                  record-ZFBDT_010.
    perform bdc_dynpro      using 'SAPMF05A' '0304'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'BSEG-WRBTR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=NP'.
    Loop at it_line item
    perform bdc_field       using 'BSEG-WRBTR'
                                  record-WRBTR_011.
    perform bdc_field       using 'BSEG-ZFBDT'
                                  record-ZFBDT_012.
    perform bdc_field       using 'BSEG-FISTL'
                                  record-FISTL_013.
    perform bdc_field       using 'BSEG-FIPOS'
                                  record-FIPOS_014.
    perform bdc_dynpro      using 'SAPMF05A' '0304'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'BSEG-ZFBDT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BSEG-WRBTR'
                                  record-WRBTR_015.
    perform bdc_field       using 'BSEG-ZFBDT'
                                  record-ZFBDT_016.
    perform bdc_dynpro      using 'SAPMF05A' '0304'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'BSEG-WRBTR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=NP'.
    endloop.
    Try this it will Work Checked....
    Cheers
    Naveen.
    Edited by: Naveen Kumar on Aug 21, 2009 1:46 PM

Maybe you are looking for