Regarding BDC for CO02

Hi All,
Iam facing a peculiar problem in BDC for CO02  for Collective orders. While recording, I have captured the ok_code for the Push button 'Read Order' . But while processing it , it stops exactly after displaying the list. Here I need to click manually on 'Read Order' to continue the processing. I think the problem comes because the list displayed is a ALV tree.Can anybody please suggest a solution if they faced it earlier.
Please let me know if you need any details. Points will be rewarded to the useful answers.
Thanks,
Manjula.S

HI Manjula
I am facing a similar kind of issue to process the BDC for tree sture
Please advice

Similar Messages

  • BDC for CO02 , How to check conditions

    Hi,
    i m trying a BDC of CO02- Change Production Order, i have recorded the transaction by changing the date field in the first screen and then by pressing "Operation Overview" button to change the "WorkCenter".
    The Workcenter screen holds the value in the table control.
    After recording , when i pass value from TXT file, the BDC Program should identify the table control row which is having AFVGD-KTSCH's Value as 'SEWING', so that the value from the TXT file should replace the another field AFVGD-ARBPL based on the stdtext-'SEWING'.
    can any body help me in this.

    dear prabhu,
    see the below code, suggest me where to do the checking,
    see the BOLD part of the mail for more info.
    pls help in this, i m new to BDC.
    regs,
    raja
    data: str type c length 1,
    var type c length 30,
    cntr type i.
    data: begin of record,
      AUFNR(012),
      FLG_OVIEW(001),
      GLTRP(010),
      GSTRP(010),
      ARBPL(008),
      KTSCH(020),
    end of record.
    DATA: itab LIKE record OCCURS 1000 WITH HEADER LINE.
    PARAMETERS textfile LIKE rlgrap-filename DEFAULT
    'c:\prdord.txt'.
    End generated data section ***
    START-OF-SELECTION.
      CALL FUNCTION 'WS_UPLOAD'
        EXPORTING
          filename            = textfile
          filetype            = 'DAT'
        TABLES
          data_tab            = itab
        EXCEPTIONS
          conversion_error    = 1
          file_open_error     = 2
          file_read_error     = 3
          invalid_type        = 4
          no_batch            = 5
          unknown_error       = 6
          invalid_table_width = 7
          OTHERS              = 8.
      IF sy-subrc <> 0.
        WRITE:/ 'Upload From',textfile,'to itab is not successful'.
        EXIT.
      ENDIF.
      LOOP AT itab.
    IF sy-subrc <> 0. EXIT. ENDIF.
    perform bdc_dynpro      using 'SAPLCOKO1' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CAUFVD-AUFNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'CAUFVD-AUFNR'
                                  itab-AUFNR.
    perform bdc_field       using 'R62CLORD-FLG_OVIEW'
                                  itab-FLG_OVIEW.
    perform bdc_dynpro      using 'SAPLCOKO1' '0115'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TERM'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CAUFVD-GSTRP'.
    perform bdc_field       using 'CAUFVD-GLTRP'
                                  itab-GLTRP.
    perform bdc_field       using 'CAUFVD-GSTRP'
                                  itab-GSTRP.
    perform bdc_dynpro      using 'SAPLCOKO1' '0115'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=VGUE'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CAUFVD-GAMNG'.
    perform bdc_field       using 'CAUFVD-GSTRP'
                                  itab-GSTRP.
    perform bdc_dynpro      using 'SAPLCOVG' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'AFVGD-KTSCH'.
    <b>Here is where i need to check whether the 'AFVGD-KTSCH'containing value 'SEWING' then the itab value should be placed in the below  screen-field.</b>
      perform bdc_field       using 'BDC_CURSOR'
                                  'AFVGD-ARBPL(02)'.
      perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
      perform bdc_field       using 'AFVGD-ARBPL(02)'
                                  itab-ARBPL.
      perform bdc_dynpro      using 'SAPLCOVG' '0100'.
      perform bdc_field       using 'BDC_OKCODE'
                                  '=FREI'.
      perform bdc_field       using 'BDC_CURSOR'
                                  'PSFC_DISP-AUFNR'.
    perform bdc_dynpro      using 'SAPLSPO2' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=OPT1'.
    perform bdc_dynpro      using 'SAPLCOVG' '0100'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'PSFC_DISP-AUFNR'.
    CALL TRANSACTION 'CO02' USING bdcdata MODE 'A'.
    if sy-subrc eq 1001.
    write:/ ITAB-aufnr,ITAB-arbpl, ITAB-gstrp.
    write 'Not Updated'.
    else.
    write:/ ITAB-aufnr,ITAB-arbpl, ITAB-gstrp.
    write 'Updated Successfully'.
    endif.
    REFRESH bdcdata.
    *else.
    write 'Improper Text File Format'.
    *endif.
    endloop.

  • Regarding BDC for MB31

    Hi,
    Can anybody help me for  BDC CODE for MB31(Goods Receipt for Production Order).
    This is 1st time i am using BDC for MB31. I don't know how to do recording of MB31.
    How many fields are mandatory? Or Anyother way to create Good Receipt.(Like FM or BAPI)
    Thanks And Regards,
    Amit

    Hi Amit,
    Use following function module to create Goods receipt:
    MB_CREATE_GOODS_MOVEMENT
    The function module provides a general interface for posting goods movements.
    Hope this helps.
    Regards,
    Abhijeet

  • Regarding BDC for CO01

    Hi Friends,
    Can anybody help me for BDC CODE for CO01(Create production order).
    This is 1st time i am using BDC for CO01. I don't know how to do recording of CO01.
    How many fields are mandatory? Or Anyother way to Create production orde.(Like FM or BAPI)
    Thanks And Regards,
    Amit

    Amit,
    Here is a trick (you can treat it as method) to know mandatory fields for BDC method.
    1. Go to your transaction code, I guess you are working 'co01'.
    2. Press 'Enter' on the screen, you would be asked to enter value for a field-enter correct value and then press enter, next you may be asked to enter value for another field....continue until you don't get any error/warning.
    3. You will be taken to next/second screen if you were successful entering correct values in the first screen.
    4. Mean while, note down those fields that you have filled.
    5. Follow above steps until you are done with all screens.
    6. Next you can start recording from T.Code 'SHDB'.
    Reply to the post if you have any question in the explanation.

  • Urgent,need for code in bdc for co02

    hi all,
    im in urgent need of code for developing bdc tcode co02.
    Thanks for your help..

    1. Please record the transaction which you need to change the data in Co02 (Shop Order/Prod. Order)
    2. Create BDC program as normally you do it for normal BDC programs..
    Smaple Code with Recording.
    clear: bdcdata,messtab.
      perform bdc_dynpro using: 'SAPLCOKO1' '0110'.
      perform bdc_field using: 'CAUFVD-AUFNR' t_aufk-aufnr.
      perform bdc_field using: 'R62CLORD-FLG_OVIEW' 'X'.
      perform bdc_field using: 'BDC_OKCODE' '/00'.
      perform bdc_dynpro using: 'SAPLCOKO1' '0115'.
      perform bdc_field using: 'BDC_SUBSCR' 'SAPLCOKO1'.
      perform bdc_field using: 'BDC_OKCODE' '=KOWE'.
      perform bdc_dynpro using: 'SAPLCOKO1' '0115'.
      perform bdc_field using: 'BDC_SUBSCR' 'SAPLCOKO1'.
      perform bdc_field using: 'BDC_CURSOR' 'AFPOD-INSMK'.
       perform bdc_field using: 'AFPOD-INSMK' 'S'.
      perform bdc_field using: 'BDC_OKCODE' '=BU'.
      call transaction 'CO02' using bdcdata mode 'A'
                                            update 'S'
                                            messages into messtab.
    Thanks,

  • Regarding bdc for automatic run

    hi experts,
                    i have developed a bdc for hr in which the data is uploading from the excel sheet,what my user wants that this report will run automatically at 11 pm every day so for this send me the steps for this i know i have to exceute it in the background but how plz help me ...
    ***plz dnt send me the url come up with your own answer....
    thnx in advance.....

    Hi RAVI,
    if u've created the BDC in call transaction method, then create a variant for the selection screen with the relevant data. and create a scheduled job from SM36.
    in case of session: u need to schedule the two programs in SM36.
    1st the bdc program to create the session and next the program RSBDCSUB with variants. in case of scheduling RSBDCSUB session name & other details should be saved in the variants.
    Reward if useful
    Regards
    ANUPAM

  • Regarding BDC for QA01 ( inspection lot creation )

    I am creating an inspection lot in qa01.
    I am getting a model dialog box in between.
    The dialog box contains 3 group counter values ( say 5
                                                          6
                                                          7 )
    I need to Pick only only one group counter value.
    The value that needs to be picked is contained in a
    variable ( wl_gpcntr).
    Also, i have an internal table with all the group counters.
    So, i can get the index of the group counter which i
    need to filled in the inspection lot.
    Then i concatenated the field name with the index.
      ( PLKO-PLNAL(index of the group counter) ) into the
       screen field wl_grp_cntr and passed to the BDC_field
       subroutine.
    In the BDC steps, i have given
      PERFORM bdc_dynpro     USING 'SAPLCPSE' '2110'.
      PERFORM bdc_field :    USING 'BDC_CURSOR'
                                                wl_grp_cntr,
                             USING 'BDC_OKCODE' '=PICK'.
       Now, the Problem is
        In ALL SCREEN mode it is working perfectly,
        but in NO SCREEN mode it is creating an inspection
        lot but with blank group counter.
        kindly need suggestion.

    Hi,
    If you have activated two inspection types (eg 01, 0101) of same inspection lot origin (01), in material master you should  have a preferred indicator set for the inspection type for which you want to be selected when you perform goods receipt.
    This check box is available in the inspection type set up in the Material master.
    Also check whether the post to inspection stock indicator is set for the material (in the inspection type), then only material will be posted to inspection stock.
    Please confirm, what happens to the stock after making MIGO. check in MMBE and confirm
    Go through the link and maintain the necessary settings. I think default settings for 01 type should work.
    http://help.sap.com/saphelp_470/helpdata/en/2d/350e4d448c11d189420000e829fbbd/content.htm
    Regards
    Hari

  • Issue regarding bdc for capturing error records

    Hi All,
            My requirement is to capture the error record and download the error record to a flat file .
    I have done recording for MM01 transaction .
    I am getting a problem like no error records are downloaded into the flat file .It is downloading only the empty records.
    Pls see the below code which i developed & modify it for any changes .Its an urgent .Pls provide me the solution ASAP.
    My Flat file
    M     FERT     X     MATL105     KG     
    X     FERT     X     MATL106     KG
    In the above flat file 'X' is an Industry sector which doesnot exists which is an error record that has to be captured and download it into the flat file .
    Source code :
    report Z_MM01_MSG_F MESSAGE-ID MSG1
           no standard page heading line-size 255.
    include bdcrecx1.
    parameters: dataset(132) lower case.
    ***    DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
    *   If it is nessesary to change the data section use the rules:
    *   1.) Each definition of a field exists of two lines
    *   2.) The first line shows exactly the comment
    *       '* data element: ' followed with the data element
    *       which describes the field.
    *       If you don't have a data element use the
    *       comment without a data element name
    *   3.) The second line shows the fieldname of the
    *       structure, the fieldname must consist of
    *       a fieldname and optional the character '_' and
    *       three numbers and the field length in brackets
    *   4.) Each field must be type C.
    *** Generated data section with specific formatting - DO NOT CHANGE  ***
    data: begin of record occurs 0,
    * data element: MBRSH
            MBRSH_001(001),
    * data element: MTART
            MTART_002(004),
    * data element: XFELD
            KZSEL_01_003(001),
    * data element: MAKTX
            MAKTX_004(040),
    * data element: MEINS
            MEINS_005(003),
    * data element: MTPOS_MARA
            MTPOS_MARA_006(004),
          end of record.
    *DECLARATION OF BDCDATA STRUCTURE
    DATA: IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE .
    *declaration to store the message
    DATA: IT_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE .
    *DECLARATION TO STORE THE MESSAGE
    DATA: BEGIN OF IT_STORE_MSG OCCURS 0,
          STORE(1000),
          END OF IT_STORE_MSG.
    *declaration SUCCESS MESG
    DATA: BEGIN OF IT_SUCCESS OCCURS 0,
          SUCCESS_REC(10),
          MBRSH(10),
          TABIX LIKE SY-TABIX,
          END OF IT_SUCCESS.
    *declaration ERROR MESSAGE
    DATA: BEGIN OF IT_ERROR  OCCURS  0,
          ERROR_REC(10),
          MBRSH(10),
             TABIX LIKE SY-TABIX,
          END OF IT_ERROR.
    DATA:TABIX LIKE SY-TABIX.
    *validating Material type(mtart) field data with table T134
    data : v_type like T134-mtart.
    DATA: V_INDSECT LIKE MARA-MBRSH.
    *** End generated data section ***
    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                      = 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.
    *perform open_dataset using dataset.
    perform open_group.
    LOOP AT RECORD.
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    *- Validating industry sector(MBRSH) from the master table(MARA)
    select single MBRSH from T137  into V_INDSECT where MBRSH eq
    record-MBRSH_001.
    IF SY-SUBRC EQ 0.
    perform bdc_field       using 'RMMG1-MBRSH'
                                  record-MBRSH_001.
    *endif.
    perform bdc_field       using 'RMMG1-MTART'
                                  record-MTART_002.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                                  record-KZSEL_01_003.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_004.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MEINS'.
    perform bdc_field       using 'MARA-MEINS'
                                  record-MEINS_005.
    perform bdc_field       using 'MARA-MTPOS_MARA'
                                  record-MTPOS_MARA_006.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    perform bdc_transaction using 'MM01'.
    *ELSE.
    *message  E000 WITH 'Industry sector does not Exist' .
    *endif.
    LOOP AT MESSTAB.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
       ID              = MESSTAB-MSGID
       LANG            = MESSTAB-MSGSPRA
       NO              = MESSTAB-MSGNR
       V1              = MESSTAB-MSGV1
       V2              = MESSTAB-MSGV2
    *   V3              = SY-MSGV3
    *   V4              = SY-MSGV4
    IMPORTING
       MSG             = IT_STORE_MSG-STORE
       EXCEPTIONS
    *   NOT_FOUND       = 1
       OTHERS          = 0.
    IF MESSTAB-MSGTYP = 'S'.
       IT_SUCCESS-SUCCESS_REC = IT_STORE_MSG-STORE.
       IT_SUCCESS-MBRSH = record-MBRSH_001.
       IT_SUCCESS-TABIX = TABIX.
       APPEND IT_SUCCESS.
       ELSEIF  MESSTAB-MSGTYP = 'E'.
       IT_ERROR-ERROR_REC = IT_STORE_MSG-STORE.
       IT_ERROR-MBRSH = record-MBRSH_001.
       IT_ERROR-TABIX = TABIX.
      APPEND IT_ERROR.
    ENDIF.
    endloop.
    endif.
    ENDLOOP.
    CALL FUNCTION 'DOWNLOAD'
      TABLES
        DATA_TAB                      = IT_error
    *   FIELDNAMES                    =
    * EXCEPTIONS
    *   INVALID_FILESIZE              = 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.
    perform close_group.
    *perform close_dataset using dataset.
    Code Formatted by: Alvaro Tejada Galindo on Apr 9, 2008 5:05 PM

    Hi,
    DATA: IT_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE .
    CALL FUNCTION 'DOWNLOAD'
    TABLES
    DATA_TAB = IT_error
    FIELDNAMES =
    EXCEPTIONS
    INVALID_FILESIZE = 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.
    instead of using IT_error ion tables use IT_MESSTAB.
    <REMOVED BY MODERATOR>
    Code Formatted by: Alvaro Tejada Galindo on Apr 9, 2008 5:07 PM

  • Hi All,Issue regarding bdc for capturing error records,its urgent

    Hi All,
            My requirement is to capture the error record and download the error record to a flat file .
    I have done recording for MM01 transaction .
    I am getting a problem like no error records are downloaded into the flat file .It is downloading only the empty records.
    Pls see the below code which i developed & modify it for any changes .Its an urgent .Pls provide me the solution ASAP.
    My Flat file
    M     FERT     X     MATL105     KG     
    X     FERT     X     MATL106     KG
    In the above flat file 'X' is an Industry sector which doesnot exists which is an error record that has to be captured and download it into the flat file .
    Source code :
    report Z_MM01_MSG_F MESSAGE-ID MSG1
           no standard page heading line-size 255.
    include bdcrecx1.
    parameters: dataset(132) lower case.
       DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
      If it is nessesary to change the data section use the rules:
      1.) Each definition of a field exists of two lines
      2.) The first line shows exactly the comment
          '* data element: ' followed with the data element
          which describes the field.
          If you don't have a data element use the
          comment without a data element name
      3.) The second line shows the fieldname of the
          structure, the fieldname must consist of
          a fieldname and optional the character '_' and
          three numbers and the field length in brackets
      4.) Each field must be type C.
    Generated data section with specific formatting - DO NOT CHANGE  ***
    data: begin of record occurs 0,
    data element: MBRSH
            MBRSH_001(001),
    data element: MTART
            MTART_002(004),
    data element: XFELD
            KZSEL_01_003(001),
    data element: MAKTX
            MAKTX_004(040),
    data element: MEINS
            MEINS_005(003),
    data element: MTPOS_MARA
            MTPOS_MARA_006(004),
          end of record.
    *DECLARATION OF BDCDATA STRUCTURE
    DATA: IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE .
    *declaration to store the message
    DATA: IT_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE .
    *DECLARATION TO STORE THE MESSAGE
    DATA: BEGIN OF IT_STORE_MSG OCCURS 0,
          STORE(1000),
          END OF IT_STORE_MSG.
    *declaration SUCCESS MESG
    DATA: BEGIN OF IT_SUCCESS OCCURS 0,
          SUCCESS_REC(10),
          MBRSH(10),
          TABIX LIKE SY-TABIX,
          END OF IT_SUCCESS.
    *declaration ERROR MESSAGE
    DATA: BEGIN OF IT_ERROR  OCCURS  0,
          ERROR_REC(10),
          MBRSH(10),
             TABIX LIKE SY-TABIX,
          END OF IT_ERROR.
    DATA:TABIX LIKE SY-TABIX.
    *validating Material type(mtart) field data with table T134
    data : v_type like T134-mtart.
    DATA: V_INDSECT LIKE MARA-MBRSH.
    End generated data section ***
    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                      = 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.
    *perform open_dataset using dataset.
    perform open_group.
    LOOP AT RECORD.
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    *- Validating industry sector(MBRSH) from the master table(MARA)
    select single MBRSH from T137  into V_INDSECT where MBRSH eq
    record-MBRSH_001.
    IF SY-SUBRC EQ 0.
    perform bdc_field       using 'RMMG1-MBRSH'
                                  record-MBRSH_001.
    *endif.
    perform bdc_field       using 'RMMG1-MTART'
                                  record-MTART_002.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                                  record-KZSEL_01_003.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_004.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MEINS'.
    perform bdc_field       using 'MARA-MEINS'
                                  record-MEINS_005.
    perform bdc_field       using 'MARA-MTPOS_MARA'
                                  record-MTPOS_MARA_006.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    perform bdc_transaction using 'MM01'.
    *ELSE.
    *message  E000 WITH 'Industry sector does not Exist' .
    *endif.
    LOOP AT MESSTAB.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
       ID              = MESSTAB-MSGID
       LANG            = MESSTAB-MSGSPRA
       NO              = MESSTAB-MSGNR
       V1              = MESSTAB-MSGV1
       V2              = MESSTAB-MSGV2
      V3              = SY-MSGV3
      V4              = SY-MSGV4
    IMPORTING
       MSG             = IT_STORE_MSG-STORE
       EXCEPTIONS
      NOT_FOUND       = 1
       OTHERS          = 0.
    IF MESSTAB-MSGTYP = 'S'.
       IT_SUCCESS-SUCCESS_REC = IT_STORE_MSG-STORE.
       IT_SUCCESS-MBRSH = record-MBRSH_001.
       IT_SUCCESS-TABIX = TABIX.
       APPEND IT_SUCCESS.
       ELSEIF  MESSTAB-MSGTYP = 'E'.
       IT_ERROR-ERROR_REC = IT_STORE_MSG-STORE.
       IT_ERROR-MBRSH = record-MBRSH_001.
       IT_ERROR-TABIX = TABIX.
      APPEND IT_ERROR.
    ENDIF.
    endloop.
    endif.
    ENDLOOP.
    CALL FUNCTION 'DOWNLOAD'
      TABLES
        DATA_TAB                      = IT_error
      FIELDNAMES                    =
    EXCEPTIONS
      INVALID_FILESIZE              = 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.
    perform close_group.
    *perform close_dataset using dataset.

    Hi,
    DATA: IT_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE .
    CALL FUNCTION 'DOWNLOAD'
    TABLES
    DATA_TAB = IT_error
    FIELDNAMES =
    EXCEPTIONS
    INVALID_FILESIZE = 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.
    instead of using IT_error ion tables use IT_MESSTAB.
    <REMOVED BY MODERATOR>
    Code Formatted by: Alvaro Tejada Galindo on Apr 9, 2008 5:07 PM

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

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

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

  • Problem in creation of BDC for transaction phap_create

    Hello Friends,
    I am trying to create BDC for PHAP_CREATE.
    When you run a transaction a pop up window appears to select the template id.
    And in BDC it is selected by cursor position. So once selected, the value of template id cannot be changed.
    I want this as a parameter.So that each time I run a BDC I will be able to create different types of Appraisal documents i.e with different template ids.
    How to go about it???
    Regards,
    Bhushan

    Hi,
    For selecting the id, while doing recording,
    record with
    CTRL + F ( Where u can give ur id) and proceed further.

  • BDC for TCODE F150

    Hi Friends,
    I am facing problem while developing BDC for tcode F150. The last action i.e. scheduling for particular dunning date is not getting executed in my BDC.
    I am also pasting the end part of my BDC recording. Please review it and advise.
    PERFORM bdc_dynpro      USING 'SAPLF150_JOBS' '1000'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'F150V-STRZT'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=JOBS'.
      PERFORM bdc_field       USING 'F150V-STRDT'
                                    rdate.
      PERFORM bdc_field       USING 'F150V-XSTRF'
                                    'X'.
        select single SPLD into p_out from USR01 where bname = sy-uname.
      perform bdc_field       using 'ITCPO-TDDEST'
                                     p_out.
      CALL TRANSACTION 'F150'
    Thank you,
    Swapnil
    Edited by: Swapnil Tawade on Sep 22, 2008 3:15 PM

    Hi,
       If u want it for  some specific plants then before populating data  to bdcdata internal table  check the conditions for which the plant fields required values to be passed  and if the condition is satisfied then pass the plant field to bdcdata table . If the condition is not satisfied then dont pass that plant field to bdcdata table bcoz  if  u r not passing any field to bdcdata table then that field is going have default values.
    Regards,
    Shafi

  • 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

  • To Record  J1IS BDC  For Multiple Line Items

    Hi,
      Iam trying to record BDC for J1IS transaction.
    while  recording  material document which contains more than  8 line items , Only 8 line items get saved and the rest of the items doesn't get saved ,
        But when I  do this manually then  all the line items get saved,
        Can anyone give the remedy for this Problem (to record J1IS for multiple line items).
      Thanks in Advance.
    Regards,
    S.Janani.

    Hi Janani / Leo
    The problem might be that the scroll down functionality after 8 line items is not recorded in your recording.
    In order to overcome the issue, you need to check OK__CODE whicle page down and add it in recording after Number of line items are greater than 8.
    Please check below link for details:
    http://scn.sap.com/thread/1106677
    http://scn.sap.com/thread/797827
    http://scn.sap.com/thread/2037271
    Best Regards,
    Sachin

  • "BDC for multiple line items of PO"

    I am using this code to move data for multiple line items of a PO. But only one is getting transferred. I am using BDC for this.
    FORM transaction_bdc .
      DATA :
      v_cnt(2) TYPE n,
      v_bst(2) TYPE n,
      v_bn TYPE i,
      v_bstpo(25),
      v_ebtyp(25),
      v_menge(25),
      v_eeind(25),
      v_xblnr(25),
      v_xblnr1(25),
      v_ebelp(2) TYPE n,
      v_ebelpt(2),
      v_menge1(11),
      v_ebt TYPE i,
      v_vebtyp LIKE ekes-ebtyp,
      v_eb(2) TYPE n,
      v_tcselflag(40),
      v_tem(2) TYPE n,
      v_correct TYPE i,
      v_file TYPE string.
      DATA: ls_outtab TYPE tb_struc.
      DATA: l_valid TYPE c,
            l_locked TYPE c.
      CALL METHOD g_grid->check_changed_data
        IMPORTING
          e_valid = l_valid.
      IF l_valid EQ 'X'.
        LOOP AT tb_output WHERE check EQ 'X' .
          MOVE-CORRESPONDING tb_output TO itab_output.
          APPEND itab_output.
          CLEAR itab_output.
        ENDLOOP.
        IF tb_output-check <> 'X'.
          MESSAGE e003 WITH text-004.
        ENDIF.
      ENDIF.
      IF itab_output[] IS NOT INITIAL.
        PERFORM open_group.
    ***looping at purchase order level.
        LOOP AT itab_output where ebelp is not initial .
          CLEAR v_bn.
          CLEAR v_ebt.
          PERFORM bdc_dynpro USING 'SAPMM06E' '0105'.
          PERFORM bdc_field USING 'BDC_CURSOR'
          'RM06E-BSTNR'.
          PERFORM bdc_field USING 'BDC_OKCODE'
          '/00'.
          PERFORM bdc_field USING 'RM06E-BSTNR'
          itab_output-ebeln.
    ***Changing alphanumeric fields and quantity fields to character type**
    *v_ebelp = tB_OUTPUT-ebelp.
    *clear v_ebelpt.
    *v_menge1 = tB_OUTPUT-menge.
    *v_ebelpt = v_ebelp.
    ***End Of Changing**
    *Checking for the exact number of the item**
          LOOP AT tb_output where ebeln = itab_output-ebeln.
            READ TABLE itab_output INDEX 1.
            IF tb_output-ebelp = itab_output-ebelp.
              exit.
            ELSE.
              v_bn = v_bn + 1.
            ENDIF.
          ENDLOOP.
    v_bst = v_bn + 1.
    *End Of Checking**
    **Mapping items**
            v_tem = 1.
            CONCATENATE 'RM06E-BSTPO(' v_bst ')' INTO v_bstpo.
            CONCATENATE 'RM06E-TCSELFLAG(' v_tem ')' INTO v_tcselflag.
            PERFORM bdc_dynpro USING 'SAPMM06E' '0120'.
            PERFORM bdc_field USING 'BDC_CURSOR'
            v_bstpo.
            PERFORM bdc_field USING 'BDC_OKCODE'
            '=DETA'.
            PERFORM bdc_field USING 'RM06E-EBELP'
            v_ebelpt.
            PERFORM bdc_dynpro USING 'SAPMM06E' '0111'.
            PERFORM bdc_field USING 'BDC_CURSOR'
            'EKPO-BSTAE'.
            PERFORM bdc_field USING 'BDC_OKCODE'
            '/00'.
            PERFORM bdc_dynpro USING 'SAPMM06E' '0120'.
            PERFORM bdc_field USING 'BDC_CURSOR'
            v_bstpo.
            PERFORM bdc_field USING 'BDC_OKCODE'
            '=BSTA'.
            PERFORM bdc_field USING 'RM06E-EBELP'
            v_ebelpt.
            PERFORM bdc_field USING v_tcselflag
            'X'.
    **Checking weather Confirmation category already exists**
            SELECT ebtyp FROM ekes INTO v_vebtyp WHERE ebelp =
            itab_output-ebelp AND ebeln = itab_output-ebeln.
            ENDSELECT.
            IF sy-dbcnt > 0.
              v_ebt = sy-dbcnt.
            ENDIF.
            v_eb = v_ebt + 1.
    **End Of Checking**
    **For Line items**
            CONCATENATE 'EKES-EBTYP(' v_eb ')' INTO v_ebtyp.
            CONCATENATE 'EKES-MENGE(' v_eb ')' INTO v_menge.
            CONCATENATE 'RM06E-EEIND(' v_eb ')' INTO v_eeind.
            CONCATENATE 'EKES-XBLNR(' v_eb ')' INTO v_xblnr.
    **End**
            PERFORM bdc_dynpro USING 'SAPLEINB' '0200'.
            PERFORM bdc_field USING 'BDC_CURSOR'
            v_xblnr.
            PERFORM bdc_field USING 'BDC_OKCODE'
            '=BU'.
            PERFORM bdc_field USING v_ebtyp
            itab_output-ebtyp.
            PERFORM bdc_field USING v_eeind
            itab_output-eindt.
            PERFORM bdc_field USING v_menge
            v_menge1.
            PERFORM bdc_field USING v_xblnr
            itab_output-xblnr.
    **End Of Mappings**
    *loop at itab_output.
            MOVE-CORRESPONDING itab_output TO ekes.
            modify ekes.
           MOVE-CORRESPONDING itab_output TO eket.
           MODIFY eket.
           MOVE-CORRESPONDING tb_output TO ekpo.
           MODIFY ekpo.
         ENDLOOP.
          CALL TRANSACTION 'ME22N'
          USING itbdc
          MODE   'E'.
          commit work.
    perform bdc_transaction using 'ME22N'.
    **End Of Purchase Order Loop**
        PERFORM close_group.
        endloop.
         endif.

    Hi Asha,
    check the below code once...
    LOOP AT tb_output where ebeln = itab_output-ebeln.
    READ TABLE itab_output INDEX 1.
    IF tb_output-ebelp = itab_output-ebelp.
    exit.
    ELSE.
    v_bn = v_bn + 1.
    ENDIF.
    ENDLOOP.
    Here you are reading the table itab_output with index 1, it means you alway reading the first record of that internal table.
    Regards,
    Satya.

Maybe you are looking for

  • My website background image color is not correct in Safari????

    On my website my background jpg image that appears in bottom left corner is not correct in Safari. In ALL other web browsers (Firefox 3.1, IE, Opera, etc) my website looks fine! So it must be a setting or error in Safari. The jpg image in question ha

  • How to turn off touchpad soft click in win7

    How can I turn off touchpad soft click in win7. Thx

  • Shared User folder "Ticket"

    I have just discovered a folder: {hd}/Users/Shared/Ticket that I can't identify. It was created on September 24, 2010, and has not been modified since. It appears to be empty. There is a user group named "wheel" which has read/write privileges. The o

  • Calibrate the laser power

    Hi All When i go to burn a CD or DVD I get the following message: 'The attempt to burn a disc failed. The device failed to calibrate the laser power level for this media.' I'm using an 17" iMac 2 GHz Intel Core 2 Duo with 1 GB 677 MHz DDR2 SDRAM runn

  • Brand new 7th gen Nano

    Hi all, just brought a brand new iPod nano, synced all of my songs onto it  however when I press play on the iPod I hear no sound nor songs even though the play button has been hit and in action. Any help and comments on this is appreciated.