Abap bdc's

Exact code to develop a BDC program for Incoming Invoices that updates the records depending on the source data file from the external systems.

Hi
plz check the following code.
If helpful, award the points.
Thanks & Regards
vinsee
REPORT  ZEQUIUPDATE                             .
TABLES : EQUI.
Internal Table declaration
DATA: BEGIN OF ITAB OCCURS 0,
            EQUNR LIKE ITOB-MATNR,
            BUKRS LIKE ITOB-BUKRS,
            DELETED_FLAG TYPE C,
     END OF ITAB.
DATA: T_BDCDATA LIKE BDCDATA    OCCURS 0 WITH HEADER LINE.
DATA: T_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA: V_MODE TYPE C VALUE 'N',
      V_UPDATE TYPE C VALUE 'S'.
DATA: SYSTEM_STATUS LIKE  BAPI_ITOB_STATUS OCCURS 0 WITH HEADER LINE,
      USER_STATUS LIKE  BAPI_ITOB_STATUS OCCURS 0 WITH HEADER LINE,
      V_EQUIPMENT LIKE EQUI-EQUNR.
DATA: BEGIN OF IT_MESSGE OCCURS 0," with header line,
MSSGE(200),
END OF IT_MESSGE.
DATA: LV_MESSGE(200).
Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP.
PARAMETER  S_BUKRS LIKE ITOB-BUKRS OBLIGATORY.
SELECTION-SCREEN SKIP.
PARAMETER P_SCDSN LIKE RLGRAP-FILENAME OBLIGATORY LOWER CASE " Output
        DEFAULT 'C:\test.txt'  .
SELECTION-SCREEN END OF BLOCK B1.
F4 Help For Input File Name                                          *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_SCDSN.
  IF SY-BATCH NE 'X' AND P_SCDSN(1) NE '/'.
    CALL FUNCTION 'F4_FILENAME'
      EXPORTING
        PROGRAM_NAME  = SYST-CPROG
        DYNPRO_NUMBER = SYST-DYNNR
        FIELD_NAME    = 'C:\'
      IMPORTING
        FILE_NAME     = P_SCDSN.
  ENDIF.
START OF SELECTION                                                  *
START-OF-SELECTION.
File upload
  CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
      FILENAME = P_SCDSN
      FILETYPE = 'DAT'
    TABLES
      DATA_TAB = ITAB.
Check for equipment with MARK FOR DELETION
  PERFORM VERIFY_DATA.
Delete MARK FOR DELETION equipments
  DELETE ITAB WHERE DELETED_FLAG = 'X'.
Process ITAB
  LOOP AT ITAB .
    ITAB-BUKRS = S_BUKRS.
    PERFORM BDC_DYNPRO      USING 'SAPMIEQ0' '0100'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RM63E-EQUNR'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'RM63E-EQUNR'
                                  ITAB-EQUNR.
    PERFORM BDC_DYNPRO      USING 'SAPMIEQ0' '0101'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=T\03'.
    PERFORM BDC_DYNPRO      USING 'SAPMIEQ0' '0101'.
    PERFORM BDC_FIELD       USING 'ITOB-BUKRS'
                                 ITAB-BUKRS.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=BU'.
    CALL TRANSACTION 'IE02'
          USING T_BDCDATA  MODE V_MODE  UPDATE V_UPDATE MESSAGES INTO
  T_MESSTAB.
If any error in uploading write error messages
    IF SY-SUBRC <> 0.
      PERFORM FORMAT_MESSAGE.
    ENDIF.
    CLEAR ITAB.
    CLEAR   : T_BDCDATA.
    REFRESH : T_BDCDATA.
DELETE T_MESSTAB WHERE MSGTYP <> 'E'.
  ENDLOOP.
  IF T_MESSTAB IS INITIAL .
    MESSAGE S398(00) WITH 'Record Uploaded Successfully'.
  ENDIF.
       Start new screen                                              *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
  CLEAR T_BDCDATA.
  T_BDCDATA-PROGRAM  = PROGRAM.
  T_BDCDATA-DYNPRO   = DYNPRO.
  T_BDCDATA-DYNBEGIN = 'X'.
  APPEND T_BDCDATA.
ENDFORM.                    "BDC_DYNPRO
       Insert field                                                  *
FORM BDC_FIELD USING FNAM FVAL.
  CLEAR T_BDCDATA.
  T_BDCDATA-FNAM = FNAM.
  T_BDCDATA-FVAL = FVAL.
  APPEND T_BDCDATA.
ENDFORM.                    "BDC_FIELD
*&      Form  format_message
      text
-->  p1        text
<--  p2        text
FORM FORMAT_MESSAGE .
  DATA: L_MSG(100).
  LOOP AT T_MESSTAB.
    IF T_MESSTAB-MSGTYP = 'E'.
      CALL FUNCTION 'FORMAT_MESSAGE'
        EXPORTING
          ID        = T_MESSTAB-MSGID
          LANG      = SY-LANGU
          NO        = T_MESSTAB-MSGNR
          V1        = T_MESSTAB-MSGV1
          V2        = T_MESSTAB-MSGV2
          V3        = T_MESSTAB-MSGV3
          V4        = T_MESSTAB-MSGV4
        IMPORTING
          MSG       = L_MSG
        EXCEPTIONS
          NOT_FOUND = 1
          OTHERS    = 2.
      WRITE:/  T_MESSTAB-MSGV1.
      WRITE: L_MSG.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " format_message
*&      Form  Verify_data
      text
-->  p1        text
<--  p2        text
FORM VERIFY_DATA .
  DATA: L_LENGTH LIKE SY-TABIX,
        L_DELX,
        L_TABIX TYPE SY-TABIX.
  LOOP AT ITAB.
    L_TABIX = SY-TABIX.
Determine whether the equipment is deleted or not
Fetch the deletion status of the equipment
    CLEAR V_EQUIPMENT.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT  = ITAB-EQUNR
      IMPORTING
        OUTPUT = V_EQUIPMENT.
    CALL FUNCTION 'BAPI_EQUI_GETSTATUS'
      EXPORTING
        EQUIPMENT           = V_EQUIPMENT
       LANGUAGE            = SY-LANGU
        LANGUAGE_ISO        =
      IMPORTING
        RETURN              =
      TABLES
        SYSTEM_STATUS       = SYSTEM_STATUS
        USER_STATUS         = USER_STATUS.
if equipment is deleted
    LOOP AT SYSTEM_STATUS WHERE STATUS = 'I0076' OR STATUS = 'I0320'.
      ITAB-DELETED_FLAG = 'X'.
      MODIFY ITAB.
      EXIT.
    ENDLOOP.
Check if the serial number ends with 'X'
    SELECT SINGLE SERNR FROM EQUI INTO EQUI-SERNR WHERE
    EQUNR = V_EQUIPMENT.
    CLEAR: L_LENGTH, L_DELX.
    IF EQUI-SERNR IS NOT INITIAL.
      CONDENSE EQUI-SERNR NO-GAPS.
      L_LENGTH = STRLEN( EQUI-SERNR ) - 1.
      L_DELX = EQUI-SERNR+L_LENGTH(1).
      IF L_DELX EQ 'X'.
        ITAB-DELETED_FLAG = 'X'.
        MODIFY ITAB.
      ENDIF.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " Verify_data

Similar Messages

  • ABAP-BDC & ALV

    HI
    I WANTED TO KNOW ABOUT A GOOD BOOK ON ABAP-BDC & ALV WHICH IS AVAILABLE IN INDIA.ALSO WOULD LIKE TO KNOW WHERE IN INDIA WILL I GET THE BOOK PLEASE.

    Hi Vipul,
           Some of the books that gives a well explanation from the basic concepts are the following :
      1) Sams Teach Yourself ABAP/4 in 21 Days  by Ken Greenwood
      2) The ABAP Quick Reference  by H. Keller
    You can also catch on the Code samples and Forum threads on SDN which will cater you a more advanced programming knowledge.
    Thanks and Regards,
    Siva

  • ABAP - BDC transaction not saving changes to records

    I am trying to write my first ABAP code using BDC recording.  Essentially I would like to flag the "Final Delivery" field (EKPO-EGLKZ) for a range of documents by recording transaction MASS.
    The code runs without errors - but the changes are not saved.  I have run the code in "Processing Mode: A" (Display all screens) and the program successfully loops through each record & saves the updated fields.  When I look at the documents in ME23N the changes have not been saved.   Running the MASS transaction manually results in the changes being successfully saved so I can rule out any data validation issues.
    Does anyone know why the changes refuse to save when running the code below?
    I have considered trying to use BAPI_PO_CHANGE instead of BDC, but I am new to ABAP and I thought the BDC code would be less complex.
    report Z_MASS_REMOVE_FDI_DCI
           no standard page heading line-size 255.
    include bdcrecx1.
    TYPES: BEGIN OF ty_tab,
    MASSOBJTYP(7),
    MASSVARNAM(7),
    DOCNO(9),
    ITEM(1),
    END OF ty_tab.
    DATA : it_tab TYPE STANDARD TABLE OF ty_tab.
    DATA : wa_tab TYPE ty_tab.
    START-OF-SELECTION.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'X:\STO.TXT'
    * FILETYPE = 'ASC
    has_field_separator = 'X'
    TABLES
    data_tab = it_tab
    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.
    END-OF-SELECTION.
    LOOP AT it_tab INTO wa_tab.
    WRITE:/ wa_tab-MASSOBJTYP,
    wa_tab-MASSVARNAM,
    wa_tab-DOCNO,
    wa_tab-ITEM.
    PERFORM open_group.
    perform bdc_dynpro      using 'SAPMMSDL' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MASSSCREEN-OBJECT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MASSSCREEN-OBJECT'
                                  wa_tab-MASSOBJTYP.
    perform bdc_field       using 'MASSSCREEN-VARNAME'
                                  wa_tab-MASSVARNAM.
    perform bdc_dynpro      using 'SAPMMSDL' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MASSSCREEN-OBJECT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=NEXT'.
    perform bdc_dynpro      using 'SAPLMASS_SEL_DIALOG' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MASSFREESEL-LOW(01)'.
    perform bdc_field       using 'MASSFREESEL-LOW(01)'
                                  wa_tab-DOCNO.
    perform bdc_dynpro      using 'SAPLMASS_SEL_DIALOG' '0100'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MASSFREESEL-LOW(02)'.
    perform bdc_field       using 'MASSFREESEL-LOW(02)'
                                  wa_tab-ITEM.
    perform bdc_dynpro      using 'SAPLMASS_SEL_DIALOG' '0100'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=CRET'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MASSFREESEL-LOW(01)'.
    perform bdc_dynpro      using 'SAPLMASSINTERFACE' '0200'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=FDAE'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'NR_ITEMS'.
    perform bdc_dynpro      using 'SAPLMASSINTERFACE' '0200'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SAVE'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'NR_ITEMS'.
    perform bdc_dynpro      using 'SAPLMASSMSGLIST' '0300'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'REOML-MSGTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=EXIT'.
    perform bdc_transaction using 'MASS'.
    ENDLOOP.
    PERFORM close_group.

    Where is BDC_INSERT.
    If u use OPEN and CLOSE_group u need to use INSERT_GROUP also to update in database.
    A session will be created and u nedd to run the Session in Sm35 in order to update the database.
    Edited by: Ranjith Kumar on Sep 18, 2008 6:41 AM

  • ABAP BDC & BAPI

    hi,
    why BAPI is required instead of BDC and what secenario we will use BAPI and BDC?
    Thanks in advance.

    Hi Baskar,
    Difference between BDC and BAPI
    BDC is traditional way of coding the transactions for uploading the legacy data, Sap is changing all transactions to Object oriented programming. Since BAPI is Object based and supports all the new transactions it is preffered over BDC. More over BAPI's process data faster than BDC.
    BAPI is a SAP-supplied function module with a defined interface, which allows you to interact with various business objects. SAP guarantees the integrity of your database for anything updated using a BAPI. BDC is a method of driving screens programatically, for updating SAP data. BAPIs are generally faster than BDCs.
    A BAPI is faster because it is updating the DB "directly". Whereas BDC with call
    transaction goes through the whole screen sequence like any user would do, simply put, fills screens.
    However - there is not always a BAPI for a particular transaction and not all functions that are performed by a transaction can be done by a BAPI. BDCs produce error sessions which can be processed by the user, while BAPIs don't.
    First choose the BAPI ,if there is no BAPI go for BDC.
    why BAPI first not BDC.
    SAP comes up with Change in Version, so each and every time they will change the screens/number etc.
    so you have to change your BDC programs accordingly.
    and also Most of the Latest versions transactions are Enjoy Transaction. they will not support BDC's in Background.
    But Using BAPI's No such disadvantages.
    A BAPI is faster because it is updating the DB "directly" through ABAP code.
    A BDC with call transaction goes through the whole screen sequence like any user would do, simply put, it is filling screens.
    Actually it depends on your requirement but BAPI is more effective as it is standard function module to update SAP databases rather than BDC.
    using bdc over bapi has advantages and also disadvantages
    advantages:
    1. using bdc we can upload data into database tables using 2 ways
    1. foreground -
    means that user interaction is there for each and every record.
    2. back ground -
    no user interaction and tasks are done automatically.
    using these two options is one of the greatest advantage over bapi.
    2. in bdc call transaction method we can control the display of screen resolution which is not possible with bapi's
    3. bdc is generally used for transferring of large amount of data than bapi's
    4.session method of bdc allows us to place data directly in application server and then finally transfered into sap database tables
    disadvantages:
    1.bdc is only used for sap to sap system data transferring
    2. bapis's generally works more faster than bdc's
    3. using bapis we can connect to remote systems and also to non sap systems.
    if useful reward some points.
    A BAPI is a method of a SAP Business Object. BAPI enables SAP and third party applications to interact and integrate
    with each other at the Business Object / Process level.
    Check this link to know more about BAPI.
    http://www.sapgenie.com/abap/bapi/example.htm
    http://sappoint.com/abap/
    Batch Data Communication (BDC) is the oldest batch interfacing technique that SAP provided since the early versions of R/3. BDC is not a
    typical integration tool, in the sense that, it can be only be used for uploading data into R/3 and so it is not bi-directional.
    BDC works on the principle of simulating user input for transactional screen, via an ABAP program. Typically the input comes in the form
    of a flat file. The ABAP program reads this file and formats the input data screen by screen into an internal table (BDCDATA). The
    transaction is then started using this internal table as the input and executed in the background.
    In ‘Call Transaction’, the transactions are triggered at the time of processing itself and so the ABAP program must do the error handling.
    It can also be used for real-time interfaces and custom error handling & logging features. .
    To know more about BDC,
    check the link.
    http://sappoint.com/abap/
    Main differences are...
    In case of bdc data transfer takes place from flat file into sap system ie the file existing in sap system to sap sytem
    where is bapi's r remotly enabled function modules which are assigned to some business objects n used to transfer the data between different business partners who are using different systems other than sap.
    not only that...
    when you plan to upgrade your system version then bdc willnot support those upgradations where as bapi's will support.
    <b>Reward points if this helps.
    Manish</b>

  • Doubt in HR-ABAP BDC Program

    hi all,
        My BDC program is going to dump while execution. Below I'm pasting the report.
        TYPES : BEGIN OF IT_INPUT,
            PERNR TYPE PERNR_D,
            CHOIC TYPE CHOIC,
            BEGDA TYPE CHAR10,
            ENDDA TYPE CHAR10,
            ANREX TYPE ANREX,
            NACHN TYPE NACHN,
            VORNA TYPE VORNA,
            GBPAS TYPE GBPAS,
            SPRSL TYPE SPRSL,
            END OF IT_INPUT.
    TYPES : BEGIN OF IT_RAW,
            LINE TYPE CHAR120,
            END OF IT_RAW.
    INTERNAL TABLES
    DATA : IT_FINAL TYPE STANDARD TABLE OF IT_INPUT.
    DATA : IT_RAW TYPE STANDARD TABLE OF IT_RAW.
    DATA : IT_ERROR TYPE STANDARD TABLE OF BDCMSGCOLL.
    WORK AREA
    DATA : WA_FINAL TYPE IT_INPUT.
    DATA : WA_RAW TYPE IT_RAW.
    DATA : WA_ERROR TYPE BDCMSGCOLL.
    CONSTANTS : C_TAB TYPE C value '/'.
    INCLUDE : BDCRECXY.
    START-OF-SELECTION.
    SUBROUTINE TO READ DATA FROM FLAT FILE
    PERFORM READ_DATA_FROM_FF.
    SUBROUTINE TO MAP DATA TO SCREEN FIELDS
    PERFORM DATA_MAPPING.
    *&      Form  READ_DATA_FROM_FF
          text
    -->  p1        text
    <--  p2        text
    FORM READ_DATA_FROM_FF .
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'E:\RAG\BDC1.txt'
      TABLES
        DATA_TAB                      = IT_RAW
    IF sy-subrc eq 0.
    LOOP AT IT_RAW INTO WA_RAW.
    SPLIT WA_RAW
    AT C_TAB
    INTO WA_FINAL-PERNR
         WA_FINAL-CHOIC
         WA_FINAL-BEGDA
         WA_FINAL-ENDDA
         WA_FINAL-ANREX
         WA_FINAL-NACHN
         WA_FINAL-VORNA
         WA_FINAL-GBPAS
         WA_FINAL-SPRSL.
    APPEND WA_FINAL TO IT_FINAL.
    WRITE : WA_FINAL.
    CLEAR WA_FINAL.
    ENDLOOP.
    ENDIF.
    ENDFORM.                    " READ_DATA_FROM_FF
    *&      Form  DATA_MAPPING
          text
    -->  p1        text
    <--  p2        text
    FORM DATA_MAPPING .
    LOOP AT IT_FINAL INTO WA_FINAL.
    FIRST SCREEN INFORMATION FOR PA30
    perform bdc_dynpro      using 'SAPMP50A' '1000'.
    perform bdc_field       using 'RP50G-PERNR'
                                  WA_FINAL-PERNR.
    *perform bdc_field       using 'BDC_CURSOR'
                                 'T582S-ITEXT(03)'.
    perform bdc_field       using 'RP50G-SELEC(03)'
                                   'X'.
    perform bdc_field       using 'RP50G-TIMR6'
                                   'X'.
    perform bdc_field       using 'RP50G-CHOIC'
                                   '0002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=INS'.
    SECOND SCREEN INFORMATION 0002
    perform bdc_dynpro      using 'MP000200' '2001'.
    *perform bdc_field       using 'BDC_CURSOR'
                                 'Q0002-GBPAS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  'UPD'.
    perform bdc_field       using 'P0002-BEGDA'
                                   WA_FINAL-BEGDA.
    perform bdc_field       using 'P0002-ENDDA'
                                  WA_FINAL-ENDDA.
    perform bdc_field       using 'Q0002-ANREX'
                                  WA_FINAL-ANREX.
    perform bdc_field       using 'P0002-NACHN'
                                  WA_FINAL-NACHN.
    perform bdc_field       using 'P0002-VORNA'
                                  WA_FINAL-VORNA.
    perform bdc_field       using 'Q0002-GBPAS'
                                  WA_FINAL-GBPAS.
    perform bdc_field       using 'P0002-SPRSL'
                                  WA_FINAL-SPRSL.
    perform bdc_transaction tables it_error using 'PA30' 'x' 'a' 'a'.
             IF it_ERROR[] IS NOT INITIAL.
                LOOP AT it_ERROR INTO wa_ERROR.
                WRITE : wa_ERROR.
               ENDLOOP.
              REFRESH it_ERROR.
             ENDIF.
    ENDLOOP.
    Error which I was getting is 'UNABLE TO INTERPRET '/ ' AS  A NUMBER'.

    Hi
    Look out for the error in the flat file which you are uploading. I have seen this error and I found it in Flat file. its a conversion error.
    Just copy few lines from the original file, make a new file and upload it. In this way, you will be able to say whether there is an error in file or in code.
    Regards
    Waz

  • How can we use TABLE CONTROL in BDC and WORK FLOW of ABAP.

    how can we use TABLE CONTROL in BDC and WORK FLOW of ABAP.?
    please explain the important questions.

    How to deal with table control / step loop in BDC
    Steploop and table contol is inevitable in certain transactions. When we run BDC for such transactions, we will face the situation: how many visible lines of steploop/tablecontrol are on the screen? Although we can always find certain method to deal with it, such as function code 'NP', 'POPO', considering some extreme situation: there is only one line visible one the screen, our BDC program should display an error message. (See transaction 'ME21', we you resize your screen to let only one row visible, you can not enter mutiple lines on this screen even you use 'NP')
    Now with the help of Poonam on sapfans.com developement forum, I find a method with which we can determine the number of visible lines on Transaction Screen from our Calling BDC program. Maybe it is useless to you, but I think it will give your some idea.
    Demo ABAP code has two purposes:
    1. how to determine number of visible lines and how to calculte page number;
    (the 'calpage' routine has been modify to meet general purpose usage)
    2. using field symbol in BDC program, please pay special attention to the difference in Static ASSIGN and Dynamic ASSIGN.
    Now I begin to describe the step to implement my method:
    (I use transaction 'ME21', screen 121 for sample,
    the method using is Call Transation Using..)
    Step1: go to screen painter to display the screen 121, then we can count the fixed line on this screen, there is 7 lines above the steploop and 2 lines below the steploop, so there are total 9 fixed lines on this screen. This means except these 9 lines, all the other line is for step loop. Then have a look at steploop itselp, one entry of it will occupy two lines.
    (Be careful, for table control, the head and the bottom scroll bar will possess another two fixed lines, and there is a maximum number for table line)
    Now we have : FixedLine = 9
                  LoopLine  = 2(for table control, LoopLine is always equal to 1)
    Step2: go to transaction itself(ME21) to see how it roll page, in ME21, the first line of new page is always occupied by the last line of last page, so it begin with index '02', but in some other case, fisrt line is empty and ready for input.
    Now we have: FirstLine = 0
              or FirstLine = 1 ( in our case, FirstLine is 1 because the first line of new page is fulfilled)
    Step3: write a subroutine calcalculating number of pages
    (here, the name of actual parameter is the same as formal parameter)
    global data:    FixedLine type i, " number of fixed line on a certain screen
                    LoopLine  type i, " the number of lines occupied by one steploop item
                    FirstLine type i, " possbile value 0 or 1, 0 stand for the first line of new                                                               " scrolling screen is empty, otherwise is 1
                    Dataline  type i, " number of items you will use in BDC, using DESCRIBE to get
                    pageno    type i, " you need to scroll screen how many times.
                    line      type i, " number of lines appears on the screen.
                    index(2)  type N, " the screen index for certain item
                    begin     type i, " from parameter of loop
                    end       type i. " to parameter of loop
    *in code sample, the DataTable-linindex stands for the table index number of this line
    form calpage using FixedLine type i (see step 1)
                       LoopLine  type i (see step 1)
                       FirstLine type i (see step 2)
                       DataLine  type i ( this is the item number you will enter in transaction)
              changing pageno    type i (return the number of page, depends on run-time visible                                                                             line in table control/ Step Loop)
              changing line      type i.(visible lines one the screen)
    data: midd type i,
          vline type i, "visible lines
    if DataLine eq 0.
       Message eXXX.
    endif.
    vline = ( sy-srows - FixedLine ) div LoopLine.
    *for table control, you should compare vline with maximum line of
    *table control, then take the small one that is min(vline, maximum)
    *here only illustrate step loop
    if FirstLine eq 0.
            pageno = DataLine div vline.
            if pageno eq 0.
               pageno = pageno + 1.
            endif.
    elseif FirstLine eq 1.
            pageno = ( DataLine - 1 ) div ( vline - 1 ) + 1.
            midd = ( DataLine - 1 ) mod ( vline - 1).
            if midd = 0 and DataLine gt 1.
                    pageno = pageno - 1.
            endif.
    endif.
    line = vline.
    endform.
    Step4 write a subroutine to calculate the line index for each item.
    form calindex using Line type i (visible lines on the screen)
                        FirstLine type i(see step 2)
                        LineIndex type i(item index)
              changing  Index type n.    (index on the screen)
      if  FirstLine = 0.
            index = LineIndex mod Line.
            if index = '00'.
                    index = Line.
            endif.
      elseif FirstLine = 1.
            index = LineIndex mod ( Line - 1 ).
            if ( index between 1 and 0 ) and LineIndex gt 1.
                    index = index + Line - 1.
            endif.
            if Line = 2.
                    index = index + Line - 1.
            endif.
    endif.
    endform.
    Step5 write a subroutine to calculate the loop range.
    form calrange using Line type i ( visible lines on the screen)
                        DataLine type i
                        FirstLine type i
                        loopindex like sy-index
            changing    begin type i
                        end type i.
    If FirstLine = 0.
       if loopindex = 1.
            begin = 1.
            if DataLine <= Line.
                    end = DataLine.
            else.
                    end = Line.
            endif.
       elseif loopindex gt 1.
            begin = Line * ( loopindex - 1 ) + 1.
            end   = Line * loopindex.
            if end gt DataLine.
               end = DataLine.
            endif.
       endif.
    elseif FirstLine = 1.
      if loopindex = 1.
            begin = 1.
            if DataLine <= Line.
                    end = DataLine.
            else.
                    end = Line.
            endif.
      elseif loop index gt 1.
            begin = ( Line - 1 ) * ( loopindex - 1 ) + 2.
            end =   ( Line - 1 ) * ( loopindex - 1 ) + Line.
            if end gt DataLine.
                    end = DataLine.
            endif.
      endif.
    endif.
    endform.
    Step6 using field sysbol in your BDC, for example: in ME21, but you should calculate each item will correponding to which index in steploop/Table Control
    form creat_bdc.
    field-symbols: <material>, <quan>, <indicator>.
    data: name1(14) value 'EKPO-EMATN(XX)',
          name2(14) value 'EKPO-MENGE(XX)',
          name3(15) value 'RM06E-SELKZ(XX)'.
    assign:         name1 to <material>,
                    name2 to <quan>,
                    name3 to <indicator>.
    do pageno times.
    if sy-index gt 1
    *insert scroll page ok_code"
    endif.
            perform calrange using Line DataLine FirstLine sy-index
                             changing begin end.
    loop at DataTable from begin to end.
            perform calindex using Line FirstLine DataTable-LineIndex changing Index.
            name1+11(2) = Index.
            name2+11(2) = Index.
            name3+12(2) = Index.
            perform bdcfield using <material> DataTable-matnr.
            perform bdcfield using <quan>     DataTable-menge.
            perform bdcfield using <indicator> DataTable-indicator.
    endloop.
    enddo.
    An example abap program of handling Table Control during bdc programming.
    REPORT zmm_bdcp_purchaseorderkb02
           NO STANDARD PAGE HEADING LINE-SIZE 255.
                    Declaring internal tables                            *
    *-----Declaring line structure
    DATA : BEGIN OF it_dummy OCCURS 0,
             dummy(255) TYPE c,
           END OF it_dummy.
    *-----Internal table for line items
    DATA :  BEGIN OF it_idata OCCURS 0,
              ematn(18),      "Material Number.
              menge(13),      "Qyantity.
              netpr(11),      "Net Price.
              werks(4),       "Plant.
              ebelp(5),       "Item Number.
            END OF it_idata.
    *-----Deep structure for header data and line items
    DATA  :  BEGIN OF it_me21 OCCURS 0,
               lifnr(10),      "Vendor A/c No.
               bsart(4),       "A/c Type.
               bedat(8),       "Date of creation of PO.
               ekorg(4),       "Purchasing Organisation.
               ekgrp(3),       "Purchasing Group.
               x_data LIKE TABLE OF it_idata,
             END OF it_me21.
    DATA  :  x_idata LIKE LINE OF it_idata.
    DATA  :  v_delimit VALUE ','.
    DATA  :  v_indx(3) TYPE n.
    DATA  :  v_fnam(30) TYPE c.
    DATA  :  v_count TYPE n.
    DATA  :  v_ne TYPE i.
    DATA  :  v_ns TYPE i.
    *include bdcrecx1.
    INCLUDE zmm_incl_purchaseorderkb01.
                    Search help for file                                 *
    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.
    START-OF-SELECTION.
           To upload the data into line structure                        *
      CALL FUNCTION 'WS_UPLOAD'
        EXPORTING
          filename = p_file
          filetype = 'DAT'
        TABLES
          data_tab = it_dummy.
        Processing the data from line structure to internal tables       *
      REFRESH:it_me21.
      CLEAR  :it_me21.
      LOOP AT it_dummy.
        IF it_dummy-dummy+0(01) = 'H'.
          v_indx = v_indx + 1.
          CLEAR   it_idata.
          REFRESH it_idata.
          CLEAR   it_me21-x_data.
          REFRESH it_me21-x_data.
          SHIFT it_dummy.
          SPLIT it_dummy AT v_delimit INTO it_me21-lifnr
                                           it_me21-bsart
                                           it_me21-bedat
                                           it_me21-ekorg
                                           it_me21-ekgrp.
          APPEND it_me21.
        ELSEIF it_dummy-dummy+0(01) = 'L'.
          SHIFT it_dummy.
          SPLIT it_dummy AT v_delimit INTO it_idata-ematn
                                           it_idata-menge
                                           it_idata-netpr
                                           it_idata-werks
                                           it_idata-ebelp.
          APPEND it_idata TO it_me21-x_data.
          MODIFY it_me21 INDEX v_indx.
        ENDIF.
      ENDLOOP.
                    To open the group                                    *
      PERFORM open_group.
            To populate the bdcdata table for header data                *
      LOOP AT it_me21.
        v_count = v_count + 1.
        REFRESH it_bdcdata.
        PERFORM subr_bdc_table USING:   'X' 'SAPMM06E'    '0100',
                                        ' ' 'BDC_CURSOR'  'EKKO-LIFNR',
                                        ' ' 'BDC_OKCODE'  '/00',
                                        ' ' 'EKKO-LIFNR'  it_me21-lifnr,
                                        ' ' 'RM06E-BSART' it_me21-bsart,
                                        ' ' 'RM06E-BEDAT' it_me21-bedat,
                                        ' ' 'EKKO-EKORG'  it_me21-ekorg,
                                        ' ' 'EKKO-EKGRP'  it_me21-ekgrp,
                                        ' ' 'RM06E-LPEIN' 'T'.
        PERFORM subr_bdc_table USING:   'X' 'SAPMM06E'    '0120',
                                        ' ' 'BDC_CURSOR'  'RM06E-EBELP',
                                        ' ' 'BDC_OKCODE'  '/00'.
        MOVE 1 TO v_indx.
    *-----To populate the bdcdata table for line item data
        LOOP AT it_me21-x_data INTO x_idata.
          CONCATENATE 'EKPO-EMATN(' v_indx ')'  INTO v_fnam.
          PERFORM  subr_bdc_table USING ' ' v_fnam x_idata-ematn.
          CONCATENATE 'EKPO-MENGE(' v_indx ')'  INTO v_fnam.
          PERFORM  subr_bdc_table USING ' ' v_fnam x_idata-menge.
          CONCATENATE 'EKPO-NETPR(' v_indx ')'  INTO v_fnam.
          PERFORM  subr_bdc_table USING ' ' v_fnam x_idata-netpr.
          CONCATENATE 'EKPO-WERKS(' v_indx ')'  INTO v_fnam.
          PERFORM  subr_bdc_table USING ' ' v_fnam x_idata-werks.
          v_indx = v_indx + 1.
          PERFORM subr_bdc_table USING:  'X' 'SAPMM06E'    '0120',
                                         ' ' 'BDC_CURSOR'  'RM06E-EBELP',
                                         ' ' 'BDC_OKCODE'  '/00'.
        ENDLOOP.
        PERFORM subr_bdc_table USING:    'X' 'SAPMM06E'    '0120',
                                         ' ' 'BDC_CURSOR'  'RM06E-EBELP',
                                         ' ' 'BDC_OKCODE'  '=BU'.
        PERFORM bdc_transaction USING 'ME21'.
      ENDLOOP.
      PERFORM close_group.
                      End of selection event                             *
    END-OF-SELECTION.
      IF session NE 'X'.
    *-----To display the successful records
        WRITE :/10  text-001.          "Sucess records
        WRITE :/10  SY-ULINE(20).
        SKIP.
        IF it_sucess IS INITIAL.
          WRITE :/  text-002.
        ELSE.
          WRITE :/   text-008,          "Total number of Succesful records
                  35 v_ns.
          SKIP.
          WRITE:/   text-003,          "Vendor Number
                 17 text-004,          "Record number
                 30 text-005.          "Message
        ENDIF.
        LOOP AT it_sucess.
          WRITE:/4  it_sucess-lifnr,
                 17 it_sucess-tabix CENTERED,
                 30 it_sucess-sucess_rec.
        ENDLOOP.
        SKIP.
    *-----To display the erroneous records
        WRITE:/10   text-006.          "Error Records
        WRITE:/10   SY-ULINE(17).
        SKIP.
        IF it_error IS INITIAL.
          WRITE:/   text-007.          "No error records
        ELSE.
          WRITE:/   text-009,          "Total number of erroneous records
                 35 v_ne.
          SKIP.
          WRITE:/   text-003,          "Vendor Number
                 17 text-004,          "Record number
                 30 text-005.          "Message
        ENDIF.
        LOOP AT it_error.
          WRITE:/4  it_error-lifnr,
                 17 it_error-tabix CENTERED,
                 30 it_error-error_rec.
        ENDLOOP.
        REFRESH it_sucess.
        REFRESH it_error.
      ENDIF.
    CODE IN INCLUDE.
    Include           ZMM_INCL_PURCHASEORDERKB01
    DATA:   it_BDCDATA LIKE BDCDATA    OCCURS 0 WITH HEADER LINE.
    DATA:   it_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA:   E_GROUP_OPENED.
    *-----Internal table to store sucess records
    DATA:BEGIN OF it_sucess OCCURS 0,
           msgtyp(1)   TYPE c,
           lifnr  LIKE  ekko-lifnr,
           tabix  LIKE  sy-tabix,
           sucess_rec(125),
         END OF it_sucess.
    DATA: g_mess(125) type c.
    *-----Internal table to store error records
    DATA:BEGIN OF it_error OCCURS 0,
           msgtyp(1)   TYPE c,
           lifnr  LIKE  ekko-lifnr,
           tabix  LIKE  sy-tabix,
           error_rec(125),
         END OF it_error.
           Selection screen
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS session RADIOBUTTON GROUP ctu.  "create session
    SELECTION-SCREEN COMMENT 3(20) text-s07 FOR FIELD session.
    SELECTION-SCREEN POSITION 45.
    PARAMETERS ctu RADIOBUTTON GROUP ctu.     "call transaction
    SELECTION-SCREEN COMMENT 48(20) text-s08 FOR FIELD ctu.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 3(20) text-s01 FOR FIELD group.
    SELECTION-SCREEN POSITION 25.
    PARAMETERS group(12).                      "group name of session
    SELECTION-SCREEN COMMENT 48(20) text-s05 FOR FIELD ctumode.
    SELECTION-SCREEN POSITION 70.
    PARAMETERS ctumode LIKE ctu_params-dismode DEFAULT 'N'.
    "A: show all dynpros
    "E: show dynpro on error only
    "N: do not display dynpro
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 48(20) text-s06 FOR FIELD cupdate.
    SELECTION-SCREEN POSITION 70.
    PARAMETERS cupdate LIKE ctu_params-updmode DEFAULT 'L'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 3(20) text-s03 FOR FIELD keep.
    SELECTION-SCREEN POSITION 25.
    PARAMETERS: keep AS CHECKBOX.       "' ' = delete session if finished
    "'X' = keep   session if finished
    SELECTION-SCREEN COMMENT 48(20) text-s09 FOR FIELD e_group.
    SELECTION-SCREEN POSITION 70.
    PARAMETERS e_group(12).             "group name of error-session
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 51(17) text-s03 FOR FIELD e_keep.
    SELECTION-SCREEN POSITION 70.
    PARAMETERS: e_keep AS CHECKBOX.     "' ' = delete session if finished
    "'X' = keep   session if finished
    SELECTION-SCREEN END OF LINE.
    PARAMETERS:p_file LIKE rlgrap-filename.
      at selection screen                                                *
    AT SELECTION-SCREEN.
    group and user must be filled for create session
      IF SESSION = 'X' AND
         GROUP = SPACE. "OR USER = SPACE.
        MESSAGE E613(MS).
      ENDIF.
      create batchinput session                                          *
    FORM OPEN_GROUP.
      IF SESSION = 'X'.
        SKIP.
        WRITE: /(20) 'Create group'(I01), GROUP.
        SKIP.
    *----open batchinput group
        CALL FUNCTION 'BDC_OPEN_GROUP'
          EXPORTING
            CLIENT = SY-MANDT
            GROUP  = GROUP
            USER   = sy-uname.
        WRITE:/(30) 'BDC_OPEN_GROUP'(I02),
                (12) 'returncode:'(I05),
                     SY-SUBRC.
      ENDIF.
    ENDFORM.                    "OPEN_GROUP
      end batchinput session                                             *
    FORM CLOSE_GROUP.
      IF SESSION = 'X'.
    *------close batchinput group
        CALL FUNCTION 'BDC_CLOSE_GROUP'.
        WRITE: /(30) 'BDC_CLOSE_GROUP'(I04),
                (12) 'returncode:'(I05),
                     SY-SUBRC.
      ELSE.
        IF E_GROUP_OPENED = 'X'.
          CALL FUNCTION 'BDC_CLOSE_GROUP'.
          WRITE: /.
          WRITE: /(30) 'Fehlermappe wurde erzeugt'(I06).
        ENDIF.
      ENDIF.
    ENDFORM.                    "CLOSE_GROUP
           Start new transaction according to parameters                 *
    FORM BDC_TRANSACTION USING TCODE TYPE ANY.
      DATA: L_SUBRC LIKE SY-SUBRC.
    *------batch input session
      IF SESSION = 'X'.
        CALL FUNCTION 'BDC_INSERT'
          EXPORTING
            TCODE     = TCODE
          TABLES
            DYNPROTAB = it_BDCDATA.
        WRITE: / 'BDC_INSERT'(I03),
                 TCODE,
                 'returncode:'(I05),
                 SY-SUBRC,
                 'RECORD:',
                 SY-INDEX.
      ELSE.
        REFRESH it_MESSTAB.
        CALL TRANSACTION TCODE USING it_BDCDATA
                         MODE   CTUMODE
                         UPDATE CUPDATE
                         MESSAGES INTO it_MESSTAB.
        L_SUBRC = SY-SUBRC.
        WRITE: / 'CALL_TRANSACTION',
                 TCODE,
                 'returncode:'(I05),
                 L_SUBRC,
                 'RECORD:',
                 SY-INDEX.
      ENDIF.
      Message handling for Call Transaction                              *
      perform subr_mess_hand using g_mess.
    *-----Erzeugen fehlermappe
      IF L_SUBRC <> 0 AND E_GROUP <> SPACE.
        IF E_GROUP_OPENED = ' '.
          CALL FUNCTION 'BDC_OPEN_GROUP'
            EXPORTING
              CLIENT = SY-MANDT
              GROUP  = E_GROUP
              USER   = sy-uname
              KEEP   = E_KEEP.
          E_GROUP_OPENED = 'X'.
        ENDIF.
        CALL FUNCTION 'BDC_INSERT'
          EXPORTING
            TCODE     = TCODE
          TABLES
            DYNPROTAB = it_BDCDATA.
      ENDIF.
      REFRESH it_BDCDATA.
    ENDFORM.                    "BDC_TRANSACTION
         Form  subr_bdc_table                                            *
          text
         -->P_0220   text                                                *
         -->P_0221   text                                                *
         -->P_0222   text                                                *
    FORM subr_bdc_table  USING      VALUE(P_0220) TYPE ANY
                                    VALUE(P_0221) TYPE ANY
                                    VALUE(P_0222) TYPE ANY.
      CLEAR it_bdcdata.
      IF P_0220 = ' '.
        CLEAR it_bdcdata.
        it_bdcdata-fnam     = P_0221.
        it_bdcdata-fval     = P_0222.
        APPEND it_bdcdata.
      ELSE.
        it_bdcdata-dynbegin = P_0220.
        it_bdcdata-program  = P_0221.
        it_bdcdata-dynpro   = P_0222.
        APPEND it_bdcdata.
      ENDIF.
    ENDFORM.                    " subr_bdc_table
         Form  subr_mess_hand                                            *
          text                                                           *
         -->P_G_MESS  text                                               *
    FORM subr_mess_hand USING  P_G_MESS TYPE ANY.
      LOOP AT IT_MESSTAB.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            ID     = it_messtab-msgid
            LANG   = it_messtab-msgspra
            NO     = it_messtab-msgnr
            v1     = it_messtab-msgv1
            v2     = it_messtab-msgv2
          IMPORTING
            MSG    = P_G_MESS
          EXCEPTIONS
            OTHERS = 0.
        CASE it_messtab-msgtyp.
          when 'E'.
            it_error-error_rec   =  P_G_MESS.
            it_error-lifnr       =  it_me21-lifnr.
            it_error-tabix       =  v_count.
            APPEND IT_ERROR.
          when 'S'.
            it_sucess-sucess_rec =  P_G_MESS.
            it_sucess-lifnr      =  it_me21-lifnr.
            it_sucess-tabix      =  v_count.
            APPEND IT_SUCESS.
        endcase.
      ENDLOOP.
      Describe table it_sucess lines v_ns.
      Describe table it_error  lines v_ne.
    ENDFORM.                    " subr_mess_hand
    Also refer
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bdc-table-control-668404
    and
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    Regards,
    srinivas
    <b>*reward for useful answers*</b>

  • HR ABAP How to Write BDC For Infotype 0586

    Hi Experts
    Can Any One tell me how to write BDC for Infotype 0586  and also 585.
    If we enter into the maintaining Screen, the lines in the Screen will dynamically changing depending on the values.
    When I am doing recording , If I press page down after entering values in top lines, the lines are changing and the records are not updating Correctly.
    I need to write BDC to Create Change.
    Can any one please help me in this regard?
    Thanks in Advance.
    Regards
    Avinash.

    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    http://www.google.co.in/search?hl=en&q=SAPBDCtable+control&meta=
    http://www.sap-basis-abap.com/abap/handling-table-control-in-bdc.htm
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    http://www.sap-img.com/abap/question-about-bdc-program.htm

  • Abap-- urgent

    hi all..
            can any one provide me with the links od the site tat provide me with the abap tips on performance tuning in abap,reports, ALV smart forms,IDOC, DDIC objects .. and entire abap..
    thnx

    Hi,
    Go through these link...
    this is the book on ABAP..
    It covers all the basic topics in ABAP..
    http://cma.zdnet.com/book/abap/index.htm
    check these links also...
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm
    for keywords
    very useful link for all
    http://www.sapgenie.com/abap/index.htm
    http://www.sap-img.com/abap.htm
    http://www.sapdevelopment.co.uk/tips/tipshome.htm
    http://help.sap.com/printdocu/core/Print46c/en/Data/Index_en.htm
    http://sap.ittoolbox.com/nav/t.asp?t=322&p=322&h1=322
    http://sap.ittoolbox.com/nav/t.asp?t=448&p=448&h1=448
    http://www.thespot4sap.com/
    http://www.kabai.com/abaps/q.htm
    http://www.geocities.com/mpioud/Abap_programs.html
    http://www.sapgenie.com/abap/tips_and_tricks.htm
    http://www.sapassist.com/code/d.asp?whichpage=1&pagesize=10&i=10&a=c&o=&t=&q=&qt=
    For FAQ
    http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm
    http://www.sapgenie.com/faq/abap.htm
    BAPI-step by step
    http://www.sapgenie.com/abap/bapi/example.htm
    Weblog for receive email and processing it through ABAP
    /people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher
    For Logical database
    http://help.sap.com/saphelp_46c/helpdata/en/9f/db9bed35c111d1829f0000e829fbfe/frameset.htm
    very useful
    http://help.sap.com/saphelp_46c/helpdata/EN/35/2cd77bd7705394e10000009b387c12/frameset.htm
    Useful link to websites
    http://www.hernangn.com.ar/sap.htm
    Useful for background
    http://www.sappoint.com/basis/bckprsng.pdf
    http://help.sap.com/saphelp_nw04/helpdata/en/6f/08703713bf277ee10000009b38f8cf/frameset.htm
    http://publib.boulder.ibm.com/infocenter/wbihelp/index.jsp?topic=/com.ibm.wbix_adapters.doc/doc/mysap4/sap4x41.htm
    Table control in BDC
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    For posting weblog,
    /people/sap.user72/blog/2005/06/28/sdn-weblogs-making-it-easier
    Dynamic Internal table -weblog in sdn
    /people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table
    Smartforms
    http://www.sap-basis-abap.com/sapsf001.htm
    http://www.sap-press.com/downloads/h955_preview.pdf
    http://www.ossincorp.com/Black_Box/Black_Box_2.htm
    http://www.sap-img.com/smartforms/sap-smart-forms.htm
    http://www.sap-img.com/smartforms/smartform-tutorial.htm
    http://www.sapgenie.com/abap/smartforms.htm
    How to trace smartform
    http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
    Workflow
    http://www.sap-img.com/workflow/sap-workflow.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/a5/172437130e0d09e10000009b38f839/frameset.htm
    For examples on WorkFlow...check the below link..
    http://help.sap.com/saphelp_47x200/helpdata/en/3d/6a9b3c874da309e10000000a114027/frameset.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PSWFL/PSWFL.pdf
    http://help.sap.com/saphelp_47x200/helpdata/en/4a/dac507002f11d295340000e82dec10/frameset.htm
    http://www.workflowing.com/id18.htm
    http://www.e-workflow.org/
    http://web.mit.edu/sapr3/dev/newdevstand.html
    ALV
    http://www.geocities.com/mpioud/Abap_programs.html
    Mail
    http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
    http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    Sending mail in background or spool mail
    http://www.sap-basis-abap.com/sapac018.htm
    BOM Explosion
    /people/prakash.singh4/blog/2005/05/15/explode-boms-in-enterprise-portal-using-htmlb-tree--part-1-abap
    BOM
    http://help.sap.com/saphelp_erp2005/helpdata/en/ea/e9b7234c7211d189520000e829fbbd/frameset.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/d1/2e4114a61711d2b423006094b9d648/frameset.htm
    http://www.sap-img.com/sap-sd/sales-bom-implementation.htm
    http://www.sap-basis-abap.com/sappp007.htm
    OLE
    http://www.sapgenie.com/abap/ole.htm
    http://help.sap.com/saphelp_46c/helpdata/en/59/ae3f2e488f11d189490000e829fbbd/frameset.htm
    ALVGRID with refresh
    http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.html
    For language setting and decimal separator
    /people/horst.keller/blog/2004/11/16/abap-geek-7-150-babylonian-confusion
    Oracle queries
    http://sqlzoo.net/
    To format SQL
    http://www.sqlinform.com/
    SCOT settings
    http://www.sap-img.com/basis/basis-faq.htm
    Status Icon [ALV,Table Control,Tab Strip]
    http://www.sapdesignguild.org/resources/MiniSG-old/from_develop/norm_status_icons.htm#positioning_4
    ALV Group Heading
    http://www.sap-img.com/fu037.htm
    For multiMedia
    /people/thomas.jung3/blog/2005/05/11/using-classic-activex-controls-in-the-abap-control-framework
    Uploading LOGO in SAP
    http://www.sap-img.com/ts001.htm
    LSMW
    http://www.sap-img.com/sap-data-migration.htm
    http://www.sapgenie.com/saptech/lsmw.htm
    http://sapabap.iespana.es/sapabap/manuales/pdf/lsmw.pdf
    http://www.sap.info/public/INT/int/glossary/int/glossaryletter/Word-17643ed1d6d658821_glossary/L#Word-17643ed1d6d658821_glossary
    OOPS ALV
    OOPS - Events.
    Editable ALV
    Tree
    TabStrip
    Multigrid
    Check this for basic concepts of OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    Tabstrip
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
    Editable ALV
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
    Tree
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
    General Tutorial for OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
    Function Module
    http://www.geocities.com/victorav15/sapr3/abapfun.html
    Smartforms
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501-0010-ee84-de050a6cc287
    https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
    Table Control
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table%20control%20in%20abap.pdf
    Regards,
    Prasant
    *reward if helpful

  • How to give line items in flatfile while doing BDC for Table control

    Hi all,
    I am writing BDC for Multiple line items and Transaction  is : FSE5N.
    How do i give the data in the flat file. I mean how do we give the multiple line items in flat file , i.e for second line item again we have to header data or not ?
    ex:
    1015;ALL;demo;kr;INR;01;0001;3000172;100
    1015;ALL;demo;kr;INR;01;0001;3000172;200
    for first lineitem  : 3000172;100
    for 2nd line item : 3000172; 200.
    header data : 1015;ALL;demo;kr;INR;01;0001.
    Thanks in advance
    krupali

    Hii ,
    u can give in the same format as u have done in the example.
    A       B    C     D  E    F   G        H          I
    1015;ALL;demo;kr;INR;01;0001;3000172;100
    1015;ALL;demo;kr;INR;01;0001;3000172;200
    and while writing the loop u can give
    loop at it_head.
    loop at it_head where a = it_head-A and b = it_head-B ..........upto G = it_head-G.
      endloop.
    endloop.
    check this
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    Neeraj

  • How to transfer data in table control in bdc

    hi
    how to transfer data in table control in bdc . I need the theory regarding this
    bye

    Hi,
    just check in the forum , there is many threads available to ur questions.
    Table control in BDC
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    You can even refer to these related threads
    bdc table control
    Re: table control in bdc
    table control in BDC
    Reward if helpful.
    Thanks
    Naveen khan

  • In bdc how we handle tabstrips...& tablecontrols

    hi gurus,
                in bdc how we can handle tabstrips and table controls.... pls any one suggest ..
    regards,
    praveen

    Table controls are used to display the data in tabular fashion for better visibility and for easy understanding in Screens as well as in reports.
    syntax:
    CONTROLS <tab_ctrl_name> TYPE TABLEVIEW USING SCREEN <screen_no>.
    chk the demo prog:
    DEMO_DYNPRO_TABCONT_LOOP
    Cursor Position on Table Controls
    At PBO you can set the cursor on a specific field of a specific row of a table control.
    SET CURSOR FIELD <f> LINE <lin> OFFSET <off>.
    Using the optional addition OFFSET, you can enter the offset of the cursor in the field as described under Setting the Cursor Position .
    At PAI you can read the current cursor position.
    GET CURSOR FIELD <f> LINE <lin> ...
    In addition to the information given under Finding Out the Cursor Position , field  contains information on which row of the table control the cursor is currently on. You can also use
    GET CURSOR LINE <lin>.
    if you only want to determine the row of the table control. SY´-SUBRC allows you to check if the cursor is placed in a row of a table control.
    u need to comment the performs of table control fields and write ur own perform statements. And u have to declare the table control fields as separate internal tables.
    Go through this urls.
    www.****************
    www.sap-img.com
    Check the below links.
    just refer to the link below
    http://www.sapmaterial.com/tablecontrol_sap.html
    step by step procedure with screen shots
    http://www.planetsap.com/howdo_a.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbac5135c111d1829f0000e829fbfe/content.htm
    http://sap.niraj.tripod.com/id25.html
    Also you can see the below examples...
    Go to se38 and give demodynpro and press F4.
    YOu will get a list of demo module pool programs.
    One more T-Code is ABAPDOCU.
    YOu can find more examples there.
    See the prgrams:
    DEMO_DYNPRO_TABLE_CONTROL_1 Table Control with LOOP Statement
    DEMO_DYNPRO_TABLE_CONTROL_2 Table Control with LOOP AT ITAB
    http://www.geocities.com/ZSAPcHAT
    http://www.allsaplinks.com/files/using_table_in_screen.pdf
    Check the below link.
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    THis is example to upload the Bank details of the Vendor which has the TC.
    REPORT zprataptable2
    NO STANDARD PAGE HEADING LINE-SIZE 255.
    DATA : BEGIN OF itab OCCURS 0,
    i1 TYPE i,
    lifnr LIKE rf02k-lifnr,
    bukrs LIKE rf02k-bukrs,
    ekorg LIKE rf02k-ekorg,
    ktokk LIKE rf02k-ktokk,
    anred LIKE lfa1-anred,
    name1 LIKE lfa1-name1,
    sortl LIKE lfa1-sortl,
    land1 LIKE lfa1-land1,
    akont LIKE lfb1-akont,
    fdgrv LIKE lfb1-fdgrv,
    waers LIKE lfm1-waers,
    END OF itab.
    DATA : BEGIN OF jtab OCCURS 0,
    j1 TYPE i,
    banks LIKE lfbk-banks,
    bankl LIKE lfbk-bankl,
    bankn LIKE lfbk-bankn,
    END OF jtab.
    DATA : cnt(4) TYPE n.
    DATA : fdt(20) TYPE c.
    DATA : c TYPE i.
    INCLUDE bdcrecx1.
    START-OF-SELECTION.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C: irst1.txt'
    filetype = 'DAT'
    TABLES
    data_tab = itab.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:second.txt'
    filetype = 'DAT'
    TABLES
    data_tab = jtab.
    LOOP AT itab.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-KTOKK'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'RF02K-LIFNR'
    itab-lifnr.
    PERFORM bdc_field USING 'RF02K-BUKRS'
    itab-bukrs.
    PERFORM bdc_field USING 'RF02K-EKORG'
    itab-ekorg.
    PERFORM bdc_field USING 'RF02K-KTOKK'
    itab-ktokk.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-LAND1'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFA1-ANRED'
    itab-anred.
    PERFORM bdc_field USING 'LFA1-NAME1'
    itab-name1.
    PERFORM bdc_field USING 'LFA1-SORTL'
    itab-sortl.
    PERFORM bdc_field USING 'LFA1-LAND1'
    itab-land1.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-KUNNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    cnt = 0.
    LOOP AT jtab WHERE j1 = itab-i1.
    cnt = cnt + 1.
    CONCATENATE 'LFBK-BANKS(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-banks.
    CONCATENATE 'LFBK-BANKL(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankl.
    CONCATENATE 'LFBK-BANKN(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankn.
    IF cnt = 5.
    cnt = 0.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=P+'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(02)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    ENDIF.
    ENDLOOP.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0210'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-FDGRV'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFB1-AKONT'
    itab-akont.
    PERFORM bdc_field USING 'LFB1-FDGRV'
    itab-fdgrv.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0215'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-ZTERM'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0220'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB5-MAHNA'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0310'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFM1-WAERS'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFM1-WAERS'
    itab-waers.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-LIFNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=YES'.
    PERFORM bdc_transaction USING 'XK01'.
    ENDLOOP.
    PERFORM close_group.
    Regards
    Anji
    Through Dialog prog
    You can go through this document...
    http://esnips.com/doc/48bd95e8-facc-4932-b923-465ba59bad24/Table-Control.pdf
    refer this program.....
    TABLES: kna1,knbk.
    DATA: v_kunnr LIKE kna1-kunnr.
    DATA: v_check TYPE c.
    DATA: BEGIN OF it_knbk OCCURS 0,
    banks LIKE knbk-banks,
    bankl LIKE knbk-bankl,
    bankn LIKE knbk-bankn,
    bkont LIKE knbk-bkont,
    koinh LIKE knbk-koinh,
    chk TYPE c,
    END OF it_knbk.
    DATA: v_ucomm TYPE sy-ucomm,
    v_dynnr TYPE sy-dynnr.
    DATA: l_index TYPE sy-index.
    data: count type i.
    CONTROLS: tc1 TYPE TABLEVIEW USING SCREEN 0200.
    *& Module STATUS_0100 OUTPUT
    text
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'ABC'.
    SET TITLEBAR 'xxx'.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    text
    MODULE user_command_0100 INPUT.
    v_ucomm = sy-ucomm.
    CASE v_ucomm.
    WHEN 'DISP' OR 'CHNG'.
    IF v_kunnr space.
    SELECT banks
    bankl
    bankn
    bkont
    koinh
    FROM knbk
    INTO TABLE it_knbk
    WHERE kunnr = v_kunnr.
    LEAVE TO SCREEN '0200'.
    ENDIF.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Module MOD_KUNNR INPUT
    text
    MODULE mod_kunnr INPUT.
    IF NOT v_kunnr IS INITIAL.
    SELECT SINGLE
    kunnr
    FROM kna1
    INTO v_kunnr
    WHERE kunnr = v_kunnr.
    IF sy-subrc 0.
    MESSAGE e000(zz) WITH 'INCORRECT CUSTOMER NUMBER'.
    ENDIF.
    ENDIF.
    IF v_kunnr IS INITIAL.
    MESSAGE e000(zz) WITH 'PLEASE ENTER A VALUE'.
    ENDIF.
    ENDMODULE. " MOD_KUNNR INPUT
    *& Module STATUS_0200 OUTPUT
    text
    MODULE status_0200 OUTPUT.
    SET PF-STATUS 'ABC1'.
    SET TITLEBAR 'xxx'.
    ENDMODULE. " STATUS_0200 OUTPUT
    *& Module SCREENMOD OUTPUT
    text
    MODULE screenmod OUTPUT.
    IF v_ucomm = 'DISP'.
    LOOP AT SCREEN.
    screen-input = 0.
    MODIFY SCREEN.
    ENDLOOP.
    ELSE."if v_UCOMM = 'CHNG'.
    LOOP AT SCREEN.
    IF screen-group1 = 'G1'.
    screen-input = 0.
    ELSE.
    screen-input = 1.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP.
    endif.
    if sy-ucomm = 'INSE'.
    loop at screen.
    IF ( tc1-current_line tc1-lines ).
    screen-input = 0.
    else.
    screen-input = 1.
    modify screen.
    endif.
    endloop.
    endif.
    ENDMODULE. " SCREENMOD OUTPUT
    *& Module EXIT2 INPUT
    text
    MODULE exit2 INPUT.
    LEAVE TO SCREEN 0.
    ENDMODULE. " EXIT2 INPUT
    *& Module modify INPUT
    text
    MODULE modify INPUT.
    IF v_check = 'X'.
    it_knbk-chk = 'X'.
    MODIFY it_knbk index tc1-current_line.
    ELSE.
    CLEAR it_knbk-chk .
    ENDIF.
    ENDMODULE. " modify INPUT
    *& Module USER_COMMAND_0200 INPUT
    text
    MODULE user_command_0200 INPUT.
    v_ucomm = sy-ucomm.
    CASE v_ucomm.
    WHEN 'DELE'.
    DELETE it_knbk where chk eq 'X'.
    DESCRIBE TABLE it_knbk LINES tc1-lines.
    WHEN 'INSE'.
    CLEAR it_knbk.
    APPEND it_knbk.
    DESCRIBE TABLE it_knbk LINES tc1-lines.
    WHEN 'LIST'.
    LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN '0200'.
    WRITE 'Report'.
    WHEN 'BACK'.
    LEAVE TO SCREEN '0100'.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0200 INPUT
    *& Module validate INPUT
    text
    module validate input.
    IF IT_KNBK IS INITIAL.
    MESSAGE E000(ZZ) WITH 'A BLANK LINE CANNOT BE SAVED'.
    ENDIF.
    endmodule. " validate INPUT
    Regards

  • In  BDC how you handled header data and item data

    In  BDC how you handled header data and item data

    Raja,
    Can you be more clear ?
    Usually you load the header data one and then loop at the item data and then load the item data.
    This example should help you.
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • Wanted a code for table controls in bdc

    hi,
    i have written code for uploading data into FB60 transaction but i have a serious problem with that code.
    after entering 10 line items and when i am entering 11th item it is saying that the screen doesnot contain 11th line.
    so please modify my program or if you can please send me a program for handling table controls more line details.
    thanks and i will surely provide ten points to it.
    my code is
    LOOP AT I_PREPARE INTO WA_PREPARE.
    V_VALUE = WA_PREPARE-LINE+0(2).
    CASE V_VALUE.
    WHEN 'A'.
      CLEAR:V_DCNT.
    *UPLOAD THE COMPANY CODE TO FB60.
    *PERFORM.......USING WA_PREPARE-LINE+2(4).
    *? filling header data
    *********to initialize the company code and to get the popup**********
    PERFORM SET_BUKRS.
      PERFORM BDC_DYNPRO      USING 'SAPLACHD' '1000'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'BKPF-BUKRS'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=ENTR'.
      BUKRS = WA_PREPARE-LINE+2(4).
      PERFORM BDC_FIELD       USING 'BKPF-BUKRS'
                                          BUKRS.
      PERFORM BDC_DYNPRO      USING 'SAPMF05A' '1100'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'RF05A-BUSCS'
                                    'R'.
    *UPLOAD THE VENDOR NUMBER TO FB60
    *PERFORM.......USING WA_PREPARE-LINE+45(10).
      ACCNT = WA_PREPARE-LINE+45(10).
      PERFORM BDC_FIELD       USING 'INVFO-ACCNT'
                                           ACCNT.
    *UPLOAD THE DATE TO FB60
    WRITE WA_PREPARE-LINE+34(8) TO V_DATE USING EDIT MASK '  .  .    .'
    *PERFORM.......USING V_DATE.
      PERFORM BDC_FIELD       USING 'INVFO-BLDAT'
                                    '15.09.2004'.
      PERFORM BDC_FIELD       USING 'INVFO-BUDAT'
                                    '15.09.2004'.
    *UPLOAD THE AMOUNT TO FB60
    *PERFORM.......USING WA_PREPARE-LINE+85(15).
      WRBTR = WA_PREPARE-LINE+85(15).
      PERFORM BDC_FIELD       USING 'INVFO-WRBTR'
                                           WRBTR.
    *UPLOAD THE CURRENCY CODE TO FB60
    *PERFORM.......USING WA_PREPARE-LINE+100(3).
      WAERS = WA_PREPARE-LINE+100(3).
      PERFORM BDC_FIELD       USING 'INVFO-WAERS'
                                    WAERS.
    WHEN 'D'.
      V_DCNT = V_DCNT + 1.
    IF V_DCNT GT 04.
       V_DCNT = 04.
    ENDIF.
    *UPLOAD THE G/L ACC. TO FB60.
    *PERFORM.......USING WA_PREPARE-LINE+51(20).
    *? filling item data
      CONCATENATE 'ACGL_ITEM-WRBTR(' V_DCNT ')' INTO FNAM.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    FNAM.
      CONCATENATE 'ACGL_ITEM-HKONT(' V_DCNT ')' INTO FNAM.
      HKONT = WA_PREPARE-LINE+51(20).
      PERFORM BDC_FIELD       USING FNAM
                                    HKONT.
    *UPLOAD THE AMOUNT TO FB60(ACGL_ITEM-WRBTR)
    *PERFORM........USING WA_PREPARE-LINE+121(15).
      CONCATENATE 'ACGL_ITEM-WRBTR(' V_DCNT ')' INTO FNAM.
      WRBTR = WA_PREPARE-LINE+75(15).
      PERFORM BDC_FIELD       USING FNAM
                                    WRBTR.
      PERFORM BDC_DYNPRO      USING 'SAPMF05A' '1100'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                '=0006'.
      PERFORM BDC_FIELD       USING 'RF05A-BUSCS'
                                    'R'.
    ENDCASE.

    hi,
    check this example:
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    REPORT  ZSR_BDC_TBCTRL
            NO STANDARD PAGE HEADING LINE-SIZE 255.
    TABLES : RF02K,LFA1,LFBK.
    DATA : BEGIN OF IT_VEN OCCURS 0,
          LIFNR LIKE RF02K-LIFNR,
          KTOKK LIKE RF02K-KTOKK,
          NAME1 LIKE LFA1-NAME1,
          SORTL LIKE LFA1-SORTL,
          LAND1 LIKE LFA1-LAND1,
          SPRAS LIKE LFA1-SPRAS,
          BANKS(6) TYPE C,
          BANKL(17) TYPE C,
          BANKN(19) TYPE C,
          END OF IT_VEN.
    DATA : BEGIN OF BANKS OCCURS 0,
           BANKS LIKE LFBK-BANKS,
           END OF BANKS,
           BEGIN OF BANKL OCCURS 0,
           BANKL LIKE LFBK-BANKL,
           END OF BANKL,
           BEGIN OF BANKN OCCURS 0,
           BANKN LIKE LFBK-BANKN,
           END OF BANKN.
    DATA : FLD(20) TYPE C,
           CNT(2) TYPE N.
    DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    INCLUDE BDCRECX1.
    START-OF-SELECTION.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'Z:\sr.TXT'
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = IT_VEN
    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
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    PERFORM OPEN_GROUP.
    LOOP AT IT_VEN.
        REFRESH BDCDATA.
        REFRESH : BANKS,BANKL,BANKN..
        SPLIT IT_VEN-BANKS AT ',' INTO TABLE BANKS.
        SPLIT IT_VEN-BANKL AT ',' INTO TABLE BANKL.
        SPLIT IT_VEN-BANKN AT ',' INTO TABLE BANKN.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0100'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RF02K-KTOKK'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'RF02K-LIFNR'
                                  IT_VEN-LIFNR.
    PERFORM BDC_FIELD       USING 'RF02K-KTOKK'
                                  IT_VEN-KTOKK.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0110'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFA1-SPRAS'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'LFA1-NAME1'
                                  IT_VEN-NAME1.
    PERFORM BDC_FIELD       USING 'LFA1-SORTL'
                                  IT_VEN-SORTL.
    PERFORM BDC_FIELD       USING 'LFA1-LAND1'
                                  IT_VEN-LAND1.
    PERFORM BDC_FIELD       USING 'LFA1-SPRAS'
                                  IT_VEN-SPRAS.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0120'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFA1-KUNNR'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0130'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFBK-BANKN(02)'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=ENTR'.
    *perform bdc_field       using 'LFBK-BANKS(01)'
                                 'DE'.
    *perform bdc_field       using 'LFBK-BANKS(02)'
                                 'DE'.
    *perform bdc_field       using 'LFBK-BANKL(01)'
                                 '10020030'.
    *perform bdc_field       using 'LFBK-BANKL(02)'
                                 '67270003'.
    *perform bdc_field       using 'LFBK-BANKN(01)'
                                 '12345'.
    *perform bdc_field       using 'LFBK-BANKN(02)'
                                 '66666'.
    MOVE 1 TO CNT.
        LOOP AT BANKS.
          CONCATENATE 'LFBK-BANKS(' CNT ') ' INTO FLD.
          PERFORM BDC_FIELD USING FLD BANKS-BANKS.
          CNT = CNT + 1.
        ENDLOOP.
        MOVE 1 TO CNT.
        LOOP AT BANKL.
          CONCATENATE 'LFBK-BANKL(' CNT ') ' INTO FLD.
          PERFORM BDC_FIELD USING FLD BANKL-BANKL.
          CNT = CNT + 1.
        ENDLOOP.
        MOVE 1 TO CNT.
        LOOP AT BANKN.
          CONCATENATE 'LFBK-BANKN(' CNT ') ' INTO FLD.
          PERFORM BDC_FIELD USING FLD BANKN-BANKN.
          CNT = CNT + 1.
        ENDLOOP.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0130'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFBK-BANKS(01)'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=ENTR'.
    PERFORM BDC_DYNPRO      USING 'SAPLSPO1' '0300'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=YES'.
    PERFORM BDC_TRANSACTION USING 'XK01'.
    ENDLOOP.
    PERFORM CLOSE_GROUP.

  • How  to handle table controls in BDC

    Hi All,
    Can u please help me out in my BDC program which involves header data and the item data which is to be filled in a Table Control of a particular transaction .If anyone can send me already existing code it would be of great help..
    Thanks in Advance
    Kishore

    Hi Kishore
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    regards
    SAmeer

  • How to handle table control in BDC while uploading item details for anorder

    How to handle table control in BDC while uploading item details for an order?
    What is the use of CTU_PARAMS structure in BDC?
    In Finance I have done some changes to the layout set by coping to a zscript(duning letter) and how can assign the print program?
    What is the process to test the finance script?
    How can I see the print preview whether it is coming correctly or not?
    Thanks in advance.
    Regards.
    Abhilash.

    hi,
    for the bdc control refer the following link:
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    ctu_params:
    refer to the link
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/dataTransfers-LSMW%2CALE%2C+BDC
    reward if useful,
    thanks and regards

Maybe you are looking for