Error in BDC for VK-11

Hi All,
I have created a BDC for T-Code VK11. When I am loading the data then my BDC is throwing an error becoz for some materials Unit of Measurement(UOM) sceen is coming which I have not captured in BDC. This UOM is coming only for few materials and this screen is not coming when I m entering these materials manually.
Can anybody plz help me out in solving this.
Warm Regards,
Nishu

Do a recording with a material which is throwing u the UOM screen .
IF ur flat file is not having Uom pick the values for the materials from MARA/ MARM table into a variable and submit it to the screen of UOM.
See a recording will be done considering the fact that all the possible scenarios are handled . So If the screen is popping up with a UOM screen then it has to be handled .
You have to capture this in ur BDC recording .
Cause even it throws the UOM screen for one material u need to handle that .
There is one more screen for UOM jsut do a select and pass the UOM for the material in the code
if u r not intending to maintain the same in ur flat file.
Regards,
vijay

Similar Messages

  • Error in BDC for tcode fbcj

    Hello Everyone,
    I am working on bdc for tcode fbcj.
    I have done recording through shdb only till saving of a row and not posting of document as per requirement.
    Now the Problem I am facing is that through BDC I am able to enter transaction , do the data entry and then the regular message saying vendor 10000001 is subject to withholding tax. After getting this message The whole record row gets disappered. So I am not able to do the data entry through BDC.
    Please I request you all to help me in this regard.
    Thanks,
    Pranil Shinde.

    hi,
          First of all go to FK03 and give the vendor name and company code and tick mark
    Withholding Tax and then enter.
    Here you need to maintain the withholding tax information. To do that take the help of FI Consultant. and then execute FBCJ transaction. I hope you can resolve your issue.
    Regards,
    Kasuladevi

  • Error in BDC for Infotype 0589

    Hi friends,
                     I have developed a BDC program for Infotype 0589.  After executing the program to upload data from file, I am getting error message: Field Q0589-ANZHL(7) input value is longer than screen field
    Here I am adding my  Sample code also.
    REPORT  ZTEST_0589.
    PARAMETERS :
      p_file TYPE rlgrap-filename.         " Accepts File Name
    *" Type declarations...................................................
    TYPES :
      BEGIN OF type_s_it0589,
        pernr   TYPE rp50g-pernr,          " Personnel Number
        inftyp  TYPE rp50g-choic,          " Infotype
        begda   TYPE p0589-begda,          " Begin Date
        endda   TYPE p0589-endda,          " End Date                                   
        lga01   TYPE q0589-lgart,           
        betrg01 TYPE q0589-betrg,         
        anzhl01 TYPE q0589-anzhl,         
        lga02   TYPE q0589-lgart,           
        betrg02 TYPE q0589-betrg,         
        anzhl02 TYPE q0589-anzhl,         
        lga03   TYPE q0589-lgart,           
        betrg03 TYPE q0589-betrg,         
        anzhl03 TYPE q0589-anzhl,         
        lga04   TYPE q0589-lgart,           
        betrg04 TYPE q0589-betrg,         
        anzhl04 TYPE q0589-anzhl,         
        lga05   TYPE q0589-lgart,           
        betrg05 TYPE q0589-betrg,         
        anzhl05 TYPE q0589-anzhl,        
        lga06   TYPE q0589-lgart,           
        betrg06 TYPE q0589-betrg,         
        anzhl06 TYPE q0589-anzhl,         
        lga07   TYPE q0589-lgart,           
        betrg07 TYPE q0589-betrg,         
        anzhl07 TYPE q0589-anzhl,         
        lga08   TYPE q0589-lgart,           
        betrg08 TYPE q0589-betrg,         
        anzhl08 TYPE q0589-anzhl,          
      END OF type_s_it0589.
    Work variables                                                   
    DATA:
      w_file      TYPE string,             " File Name
      w_betrg(50) TYPE c,                  " Proposed Contribution
      w_anzhl(50) TYPE c,                  " Actual Contribution
      w_count(2)  TYPE n,                  " Counter
      w_year(4)   TYPE n,                  " Year
      w_month(2)  TYPE n,                  " Month
      w_day(2)    TYPE n,                  " Day
      w_date(10)  TYPE c,                  " Date
      w_wage(50)   TYPE c,                  " wage
      w_waget(50)   TYPE c,                 " wage type
      w_curr(12)  TYPE c,                  " Currency
      w_tabrows LIKE sy-srows VALUE 7,     " Table Control rows
      w_update TYPE i,                     " Number of Updated Records
      w_failed TYPE i,                     " Number of Failed Records
      w_0589_lines TYPE i,                 " Number of Records in File
      w_text TYPE string.                  " CheckBox for considering
    " Actual Contributions
    Structure to hold File Data                                         *
    DATA :
      fs_it0589 TYPE type_s_it0589.
    Structure to hold Batch input: New table field structure            *
    DATA :
    fs_bdcdata TYPE bdcdata.
    Structure to hold Messages in the SAP System                        *
    DATA :
      fs_messages TYPE bdcmsgcoll.
    Structure to hold Personnel Number, Message Type & Message Text     *
    DATA:
      BEGIN OF fs_log,
        pernr   TYPE rp50g-pernr,
        msgtxt(200) TYPE c,
        msgtyp TYPE c,
      END OF fs_log.
    Structure to hold Parameter string for runtime of CALL TRANSACTION  *
    DATA :
      fs_opt TYPE ctu_params.
    Internal Table to hold File Data                                    *
    DATA :
      t_it0589 LIKE
      STANDARD TABLE
            OF fs_it0589.
    Internal Table to hold Batch input: New table field structure       *
    DATA :
      t_bdcdata TYPE
       STANDARD TABLE
             OF bdcdata.
    Internal Table to hold Messages in the SAP System                   *
    DATA:
      t_messages TYPE TABLE OF bdcmsgcoll.
    Internal Table to hold Personnel Number, Message Type & Message Text*
    DATA:
       t_log LIKE
    STANDARD TABLE
          OF fs_log.
    FORM validate .
      IF p_file IS INITIAL.
        MESSAGE e005(zvalid).
      ENDIF.                               " IF P_FILE IS INITIAL.
      MOVE p_file TO w_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = w_file
          filetype                = 'ASC'
          has_field_separator     = 'X'
          dat_mode                = 'X'
        TABLES
          data_tab                = t_it0589
        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 NE 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      IF t_it0589 IS INITIAL.
        MESSAGE e006(zvalid).
      ENDIF.                               " IF T_IT0589 IS INITIAL
    ENDFORM.                               " FORM VALIDATE
    FORM f4_help .
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          file_name = p_file.
    ENDFORM.                               " FORM F4_HELP
    *&      Form  FILL_BDCDATA
    FORM fill_bdcdata .
      DESCRIBE TABLE t_it0589 LINES w_0589_lines.
      LOOP AT t_it0589 INTO fs_it0589.
        REFRESH t_bdcdata.
        REFRESH t_messages.
        PERFORM bdc_dynpro USING 'SAPMP50A' '1000'.
        PERFORM bdc_field USING 'RP50G-PERNR'
                                fs_it0589-pernr.
        w_year = fs_it0589-begda+0(4).
        w_month = fs_it0589-begda+4(2).
        w_day = fs_it0589-begda+6(2).
        CONCATENATE w_day w_month w_year INTO w_date
                                 SEPARATED BY '.'.
        PERFORM bdc_field USING 'RP50G-BEGDA'
                                w_date.
        w_year = fs_it0589-endda+0(4).
        w_month = fs_it0589-endda+4(2).
        w_day = fs_it0589-endda+6(2).
        CONCATENATE w_day w_month w_year INTO w_date
                                 SEPARATED BY '.'.
        PERFORM bdc_field USING 'RP50G-ENDDA'
                                w_date.
        PERFORM bdc_field USING 'RP50G-CHOIC'
                                fs_it0589-inftyp.
        PERFORM bdc_field USING 'BDC_OKCODE'
                                '/00'.
        PERFORM bdc_dynpro USING 'SAPMP50A' '1000'.
        PERFORM bdc_field USING 'BDC_OKCODE'
                                '=INS'.
        PERFORM bdc_dynpro USING 'MP058900' '2000'.
    1st Row...............................................................
        ADD 1 TO w_count.
        MOVE fs_it0589-lga01 TO w_wage.
        PERFORM bdc_field USING 'Q0589-LGART(01)'
                                w_wage.
        MOVE fs_it0589-betrg01 TO w_curr.
        PERFORM bdc_field USING 'Q0589-BETRG(01)'
                                w_curr.
        MOVE fs_it0589-anzhl01 TO w_curr.
        PERFORM bdc_field USING 'Q0589-ANZHL(01)'
                                w_curr.
    2nd Row...............................................................
    3rd Row...............................................................
    4th Row...............................................................
    5th Row...............................................................
    6th Row...............................................................
        ADD 1 TO w_count.
        IF w_count > w_tabrows .
          w_count = 1.
          PERFORM bdc_field USING 'BDC_OKCODE'
                                  'P+' .
          PERFORM bdc_dynpro USING 'MP058900' '2000'.
        ENDIF.                             " IF W_COUNT > W_TABROWS
        MOVE fs_it0589-lga06 TO w_curr.
        CONCATENATE 'Q0589-LGART(' w_count ')' INTO w_wage.
        PERFORM bdc_field USING w_wage
                                w_curr.
        MOVE fs_it0589-betrg06 TO w_curr.
        CONCATENATE 'Q0589-BETRG(' w_count ')' INTO w_betrg.
        PERFORM bdc_field USING w_betrg
                                w_curr.
        MOVE fs_it0589-anzhl06 TO w_curr.
        CONCATENATE 'Q0589-ANZHL(' w_count ')' INTO w_anzhl.
        PERFORM bdc_field USING w_anzhl
                                w_curr.
    7th Row...............................................................
        ADD 1 TO w_count.
        IF w_count > w_tabrows .
          w_count = 1.
          PERFORM bdc_field USING 'BDC_OKCODE'
                                  'P+' .
          PERFORM bdc_dynpro USING 'MP058900' '2000'.
        ENDIF.                             " IF W_COUNT > W_TABROWS
        MOVE fs_it0589-lga07 TO w_curr.
        CONCATENATE 'Q0589-LGART(' w_count ')' INTO w_wage.
        PERFORM bdc_field USING w_wage
                                w_curr.
        MOVE fs_it0589-betrg07 TO w_curr.
        CONCATENATE 'Q0589-BETRG(' w_count ')' INTO w_betrg.
        PERFORM bdc_field USING w_betrg
                                w_curr.
        MOVE fs_it0589-anzhl07 TO w_curr.
        CONCATENATE 'Q0589-ANZHL(' w_count ')' INTO w_anzhl.
        PERFORM bdc_field USING w_anzhl
                                w_curr.
    *- -- Same upto 15 rows.......
    Save..................................................................
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                       '=UPD'.
    Back..................................................................
        PERFORM bdc_dynpro USING 'MP058900' '2000'.
        PERFORM bdc_field  USING 'BDC_OKCODE'
                                 '/EBCK'.
        w_count = 0.
        CALL TRANSACTION 'PA30'  USING t_bdcdata
                               OPTIONS FROM fs_opt
                              MESSAGES INTO t_messages.
        LOOP AT t_messages INTO fs_messages.
          CALL FUNCTION 'FORMAT_MESSAGE'
            EXPORTING
              id        = fs_messages-msgid
              lang      = sy-langu
              no        = fs_messages-msgnr
              v1        = fs_messages-msgv1
              v2        = fs_messages-msgv2
              v3        = fs_messages-msgv3
              v4        = fs_messages-msgv4
            IMPORTING
              msg       = fs_log-msgtxt
            EXCEPTIONS
              not_found = 1
              OTHERS    = 2.
          IF sy-subrc NE 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.                           " IF SY-SUBRC NE 0
          MOVE fs_it0589-pernr TO fs_log-pernr.
          MOVE fs_messages-msgtyp TO fs_log-msgtyp.
          APPEND fs_log TO t_log.
          CLEAR fs_log.
          IF fs_messages-msgtyp EQ 'S'
         AND fs_messages-msgnr  EQ '102'.
            ADD 1 TO w_update.
          ELSEIF fs_messages-msgtyp EQ 'S'
             AND fs_messages-msgnr  EQ '015'
              OR fs_messages-msgtyp EQ 'E'.
            ADD 1 TO w_failed.
          ENDIF.                           " IF FS_MESSAGES-MSGTYP EQ 'S'
        ENDLOOP.                           " LOOP AT T_MESSAGES
      ENDLOOP.                             " LOOP AT T_IT0585
      WRITE :/ 'Number of Records Fetched from file'(001),
             50   w_0589_lines COLOR 1,
             / 'Number of Records Updated into the database'(002),
             50    w_update COLOR 1,
             / 'Number of Records Failed to update into database'(003),
             50   w_failed COLOR 6 .
      SKIP 3.
      WRITE :/ 'Detailed Log.....'(004).
      SKIP 1.
      LOOP AT t_log INTO fs_log.
        AT NEW pernr.
          WRITE :/  fs_log-pernr COLOR 1.
        ENDAT.                             " AT NEW PERNR
        IF fs_log-msgtyp = 'E'.
          WRITE :15  fs_log-msgtxt COLOR 6 INVERSE ON.
        ELSE.
          WRITE :15  fs_log-msgtxt.
        ENDIF.                             " IF FS_LOG-MSGTYP = 'E'
      ENDLOOP.                             " LOOP AT T_LOG INTO FS_LOG
    ENDFORM.                               " FORM FILL_BDCDATA
    *&      Form  BDC_DYNPRO
    This subroutine starts new screen                                    *
    There are no interface parameters to be passed to this subroutine.  *
    FORM bdc_dynpro USING program dynpro.
      CLEAR fs_bdcdata.
      fs_bdcdata-program  = program.
      fs_bdcdata-dynpro   = dynpro.
      fs_bdcdata-dynbegin = 'X'.
      APPEND fs_bdcdata TO t_bdcdata.
    ENDFORM.                               " FORM BDC_DYNPRO
    *&      Form  BDC_FIELD
    This subroutine inserts field                                        *
    There are no interface parameters to be passed to this subroutine.  *
    FORM bdc_field USING fnam fval.
      CLEAR fs_bdcdata.
      fs_bdcdata-fnam = fnam.
      fs_bdcdata-fval = fval.
      APPEND fs_bdcdata TO t_bdcdata.
    ENDFORM.                               " FORM BDC_FIELD
    Thanks,
    Ziad khan

    Hi Amit,
               Thaks for reply. Amit, I am new to ABAP-HR so i dont know how to use FM "HR_MAINTAIN_MASTERDATA".
    Can u please explain in detail.
    Thanks
    Ziad

  • Error in BDC for Tcode IB02

    Hi all
    I have written the code for deleting Line item and re-inserting that line item (for particulat Material) for IB02 using BDC.
    i am able to delete that line item but it is giving error while re-inserting that line item.It is giving error as " Field RC29-POSTP(3) does not exits on the screenSAPLCSDI 0140".If i commected that line it is giving error for another field. I tried so many times, but no use Plz Plz help me out
    LOOP AT equn_itab INTO w_equn_itab.
    CLEAR count.
    PERFORM bdc_dynpro      USING 'SAPLCSDI' '0200'.
    PERFORM bdc_field       USING 'RC29N-EQUNR' w_equn_itab-equnr.
    PERFORM bdc_field       USING 'RC29N-WERKS' w_equn_itab-werks.
    PERFORM bdc_field       USING 'RC29N-STLAN' w_equn_itab-stlan
    PERFORM bdc_field       USING 'BDC_OKCODE' '/00'.
    PERFORM bdc_dynpro      USING 'SAPLCSDI' '0150'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
    LOOP AT stpo_itab INTO w_stpo_itab WHERE stlnr = w_equn_itab-stlnr.
    count = count + 1.
    READ TABLE mara_itab INTO W_MARA_ITAB WITH KEY matnr = w_stpo_itab-idnrk
    IF SY-SUBRC EQ 0.
    CONCATENATE 'RC29P-AUSKZ(' count ')' INTO v_string.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                         v_string.
    PERFORM bdc_field      USING v_string 'X'.
    CLEAR v_string.
    ENDIF.
    ENDLOOP.
    clear v_string.
    PERFORM bdc_dynpro      USING 'SAPLCSDI' '0150'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=FCDL'.
    PERFORM bdc_dynpro      USING 'SAPLCSDI' '0150'.
    PERFORM bdc_field      USING 'BDC_OKCODE' '=FCNP'.
    PERFORM bdc_dynpro     USING 'SAPLCSDI' '0140'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
    LOOP AT stpo2_itab INTO w_stpo2_itab WHERE stlnr = w_equn_itab-stlnr.
    READ TABLE mara_itab INTO W_MARA_ITAB WITH KEY matnr = w_stpo_itab-idnrk
    concatenate 'RC29-IDNRK(' C ')' INTO V_STRING.
    perform bdc_field       using 'BDC_CURSOR'
                                   V_STRING.
    perform bdc_field       using V_STRING
                                  '1688'.
    CLEAR v_string.
    concatenate 'RC29-MENGE(' C ')' INTO V_STRING.
    perform bdc_field       using V_STRING
                                  W_STPO2_ITAB-MENGE.
    CLEAR v_string.
    concatenate 'RC29-MEINS(' C ')' INTO V_STRING.
    perform bdc_field       using V_STRING
                                  W_STPO2_ITAB-MEINS.
    CLEAR v_string.
    READ TABLE MARC_ITAB INTO W_MARC_ITAB WITH KEY MATNR =
    W_STPO2_ITAB-IDNRK.
    READ TABLE zmrp_bom_itab INTO W_zmrp_bom_itab WITH KEY DISPO =
    W_MARC_ITAB-DISPO.
    CONCATENATE 'RC29-POSTP(' C ')' INTO V_STRING.
    perform bdc_field       using V_STRING
                                  W_zmrp_bom_itab-POSTP.
    C = C + 1.
    ENDLOOP.
    CLEAR C.
    PERFORM bdc_dynpro      USING 'SAPLCSDI' '0140'.
    PERFORM bdc_field      USING  'BDC_OKCODE' '=FCBU'.
    PERFORM bdc_dynpro      USING 'SAPLCSDI' '0150'.
    PERFORM bdc_field      USING  'BDC_OKCODE' '=FCBU'.
    PERFORM bdc_dynpro     USING  'SAPLCSDI' '0130'.
    PERFORM bdc_field      USING  'BDC_OKCODE' '=FCBU'.
    PERFORM bdc_dynpro     USING  'SAPLCSDI' '0130'.
    PERFORM bdc_field      USING  'BDC_OKCODE' '/EENDE'.
    PERFORM bdc_calltransaction USING c_ib02.
    Thanks in advance
    Regards
    Rao

    Hi,
    CONCATENATE 'RC29-POSTP(0' C ')' INTO V_STRING.
    Value would be 03 & not 3.
    Best regards,
    Prashant

  • Error in bdc for cs01

    Hi Guys,
    With your help i wrote my first bdc program for transaction cs01(bom creation), and its working fine for 18 lines.However if my file contains more than 18 records the program gives an error "Field RC29P-POSTP (2) is not an input field" and doesnt upload even single line. I know it has something to do with tablecontrol, Kindly guide me on the same.
    Bye

    Hi
    Can we have your code here? And please put them in codes...It will look more legible.
    Regards,
    Vishwa.

  • Error in bdc for mc88

    hi,
       i am facing a problem at the time of bdc recording in MC88 , when i capturing the  inactive version button it generates ok_code "/00" but when it put down in z report it does not work.  if any one knows about dis prob. den  tell me.
    Thanks & Regards.
    Kshitiz Goyal.

    Do a recording with a material which is throwing u the UOM screen .
    IF ur flat file is not having Uom pick the values for the materials from MARA/ MARM table into a variable and submit it to the screen of UOM.
    See a recording will be done considering the fact that all the possible scenarios are handled . So If the screen is popping up with a UOM screen then it has to be handled .
    You have to capture this in ur BDC recording .
    Cause even it throws the UOM screen for one material u need to handle that .
    There is one more screen for UOM jsut do a select and pass the UOM for the material in the code
    if u r not intending to maintain the same in ur flat file.
    Regards,
    vijay

  • 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

  • Error when creating a bdc for asset master upload

    I am getting a warning message (AA186), when changing the depreciation start date to capitalization date. It says,
    "Different Order Dep. start date in depreciation area 01. Check"
    This error is a problem in creating the BDC for asset master upload. We have only one depreciaton area 01 (book dep).
    Please help.

    This is normal message you get when you try to change depn start date. I think this should not be a problem for BDC posting. This message can always be bypassed.

  • BDC for multiple line items (VA01)

    Hi Experts,
      I create a BDC for VA01 transaction for single line item in that now i want to upload multiple line items also with  o/p of total no. of records uploaded, no. of records posted and the no. of error records...
    Can any body explain with sample code...

    Hi,
    if the flat file is containing header and item records...
    first split those records tooo two internal tables header and item..
    Loop at header ...
      process of recording steps for header....
    Loop at item...
    here create a varialbe with char 2 .. for index value....
      process of item recording steps..
      increment the index value by 1....
      here u have to pass  'p+'  OK_CODE..
    Endloop ..(item)
    Endloop...(header)
    for more info goo through this link...
    http://www.sap-img.com/bdc.htm
    hope helpful
    Raghunath.S

  • BDC for MIGO for GR OutBound Delivery( A01 & R05 ) from Movement Type 107 to 109

    Hi,
    I am stuck with a very typical situation need all your expertise and advices for a solution.
    We are basically trying to create change the movement type from 107 to 109 through MIGO.
    I have made a BDC recording for MIGO ( because we would like to track each delivery specifically under shipment , I know that there is a BAPI which is there to do this but it works fine if we do the shipment with Purchase Order as input which dont want in that manner )
    Process:
    1. Creating Production Order
    2. Creating Purchase Order
    3. Creating STO
    4. Deliveries
    5. PGI for Deliveries
    6. Shipment for group of outbound Deliveries
    I have created a z program where i am passing shipment number in the selection screen.
    Then it would take all the deliveries for that shipment and pass each delivery to MIGO and process it and change the status from 107 to 109.
    Interesting part here is, the code works absolutely perfect only from my ID. But when I test from other ID it is not executing, so to check where is the problem I have added mess_tab to the CALL TRANSACTION to capture what message is been populated for my ID comparing with others
    Message Captured on Others ID's:
    MSGID: 00
    MSGNR: 344
    MSGV1: SAPLMIGO
    MSGV2: 1300
    Message Captured on MY ID:
    MSGID: MIGO
    MSGNR: 012
    MSGV1: 5000005802
    MSGV2: (empty)
    This is the problem this program is executing only on MY ID, rest all ID's it is not processing.
    We have cross verified with security and basis regarding any authorization issues but nothing came up.
    Please help me what could be the issue ( WHY it is processing successfully for my and WHY NOT for other ID's)
    Below is the main code :
    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'                     " Converting Date format to DD/MM/YYYY
         EXPORTING
           DATE_INTERNAL            = sy-datum
         IMPORTING
           DATE_EXTERNAL            = lv_date_external
         EXCEPTIONS
           DATE_INTERNAL_IS_INVALID = 1
           OTHERS                   = 2.
           IF SY-SUBRC <> 0.                                     "#EC NEEDED
    * Implement suitable error handling here
           ENDIF.
    *   Validating input shipment number with database table VTTP
           SELECT VTTP~TKNUM
                  VTTP~TPNUM
                  VTTP~VBELN
             FROM VTTP INNER JOIN VTTK
             ON VTTP~TKNUM = VTTK~TKNUM
             INTO TABLE IT_VTTP
             WHERE VTTK~TKNUM = P_TKNUM
               AND VTTK~STDIS = 'X'.
           IF sy-subrc = 0.
    *   Validating all deliveries having same Delivery type or not
             SELECT * FROM likp INTO TABLE it_likp FOR ALL ENTRIES IN it_vttp WHERE vbeln = it_vttp-vbeln
                                                                                AND vbtyp = 'J'.
             IF sy-subrc = 0.
               CLEAR lv_lines.
               LOOP AT it_likp INTO wa_likp.
                 REFRESH:it_vbfa,BDCDATA.
    *   Validating if Delivery Type = 109 (GR already done), or Delivery Type = 107 (must process for GR )
                 SELECT * FROM vbfa INTO TABLE it_vbfa WHERE vbelv = wa_likp-vbeln
    *                                                AND vbtyp_v = 'J'
                                                         AND bwart = '109'.
                 IF sy-subrc = 0.
                   lv_flag1 = 'X'.
                 ELSE.
                   SELECT * FROM vbfa INTO TABLE it_vbfa WHERE vbelv = wa_likp-vbeln
    *                                                  AND vbtyp_v = 'J'
                                                           AND bwart = '107'.
                   IF sy-subrc NE 0.
                     MESSAGE 'No Deliveries with Movement Type "107" ' TYPE 'I'.
                   ELSE.
                     lv_flag2 = 'X'.
                     lv_lines = lv_lines + 1.
    **  BDC for MIGO
                     perform bdc_dynpro      using 'SAPLMIGO' '0001'.
                     perform bdc_field       using 'BDC_OKCODE'
                                                   '=OK_GO'.
                     perform bdc_field       using 'GODYNPRO-ACTION'
                                                   'A01'.
                     perform bdc_field       using 'GODYNPRO-REFDOC'
                                                   'R05'.
                     perform bdc_field       using 'GODEFAULT_TV-BWART'
                                                   '109'.
                     perform bdc_field       using 'BDC_CURSOR'
                                                   'GODYNPRO-OUTBOUND_DELIVERY'.
                     perform bdc_field       using 'GODYNPRO-OUTBOUND_DELIVERY'
                                                   wa_likp-vbeln. "'80019574'.
                     perform bdc_field       using 'GOHEAD-BLDAT'
                                                   lv_date_external. "'04/29/2015'.
                     perform bdc_field       using 'GOHEAD-BUDAT'
                                                   lv_date_external. "'04/29/2015'.
                     perform bdc_field       using 'GOHEAD-WEVER'
                                                   '1'.
                     perform bdc_dynpro      using 'SAPLMIGO' '0001'.
                     perform bdc_field       using 'BDC_OKCODE'
                                                   '=OK_POST1'.
                     perform bdc_field       using 'GODEFAULT_TV-BWART'
                                                   '109'.
                     perform bdc_field       using 'GOHEAD-BLDAT'
                                                   lv_date_external. "'04/29/2015'.
                     perform bdc_field       using 'GOHEAD-LFSNR'
                                                   wa_likp-vbeln. "'0080019574'.
                     perform bdc_field       using 'GOHEAD-BUDAT'
                                                   lv_date_external. "'04/29/2015'.
                     perform bdc_field       using 'GOHEAD-WEVER'
                                                   '1'.
                     perform bdc_field       using 'GODYNPRO-DETAIL_ZEILE'
                                                   '   1'.
                     perform bdc_field       using 'GOITEM-ERFME'
                                                   'EA'.
                     perform bdc_field       using 'GOITEM-ERFMG'
                                                   '1'.
                     perform bdc_field       using 'GOITEM-LSMNG'
                                                   '1'.
                     perform bdc_field       using 'GOITEM-LSMEH'
                                                   'EA'.
                     perform bdc_field       using 'GOITEM-MIGO_ELIKZ'
                                                   '1'.
                     perform bdc_field       using 'GOITEM-BWART'
                                                   '109'.
                     perform bdc_field       using 'GOITEM-LGOBE'
                                                   'RX Cross-docking'.
                     perform bdc_field       using 'BDC_CURSOR'
                                                   'GODYNPRO-DETAIL_TAKE'.
                     perform bdc_field       using 'GODYNPRO-DETAIL_TAKE'
                                                   'X'.
                     PERFORM bdc_dynpro      USING 'SAPLMIGO' '1300'.
                     PERFORM bdc_field       USING 'BDC_CURSOR'
                                                   'G_TIP_DONT_SHOW_AGAIN'.
                     PERFORM bdc_field       USING 'BDC_OKCODE'
                                                   '=OK_TIP_GO'.
                     PERFORM bdc_field       USING 'G_TIP_DONT_SHOW_AGAIN'
                                                   'X'.
    *& Avoid unncessary screens to populate while processing background.
                     LV_OPTIONS-DISMODE = 'N'.
                     LV_OPTIONS-UPDMODE = 'S'.
                     LV_OPTIONS-NOBINPT = 'X'.
                     CALL TRANSACTION 'MIGO' USING BDCDATA  OPTIONS FROM LV_OPTIONS MESSAGES INTO IT_MESSTAB1 .
                     WAIT UP TO 1 SECONDS.
                     DELETE IT_MESSTAB1 WHERE MSGTYP NE 'E'.
                     IF IT_MESSTAB1[] IS NOT INITIAL.
                       APPEND LINES OF IT_MESSTAB1 TO IT_MESSTAB.
                     ENDIF.
                   ENDIF.
                 ENDIF.
               ENDLOOP.
             ENDIF.
           ELSE.
             MESSAGE 'Shipment Number does not exists Or not Planned' TYPE 'E'.
           ENDIF.
         ELSE.
           MESSAGE 'Please insert Shipment Number' TYPE 'E'.
         ENDIF.
         IF lv_flag1 = 'X' AND lv_flag2 = 'X'.
           MESSAGE 'This shipment is processed with an inconsistent goods receipt' TYPE 'I'.
         ELSEIF lv_flag1 = 'X'.
           MESSAGE 'Shipment already been processed for these deliveries' TYPE 'I'.
         ELSEIF lv_flag2 = 'X'.
           lv_lines1 = lv_lines.
           CONDENSE lv_lines1 NO-GAPS .
           CONCATENATE lv_lines1 'Goods Receipt are posted for the shipment '
                  INTO lv_message SEPARATED BY space.
           MESSAGE  lv_message TYPE 'I'.
         ENDIF.
    * Display Messages from Message TAB.
         DELETE ADJACENT DUPLICATES FROM IT_MESSTAB.
         DATA:lv_msg TYPE string.
         LOOP AT IT_MESSTAB INTO WA_MESSTAB.
           CALL FUNCTION 'FORMAT_MESSAGE'
             EXPORTING
               ID        = WA_MESSTAB-MSGID
               NO        = WA_MESSTAB-MSGNR
               V1        = WA_MESSTAB-MSGV1
               V2        = WA_MESSTAB-MSGV2
               V3        = WA_MESSTAB-MSGV3
               V4        = WA_MESSTAB-MSGV4
             IMPORTING
               MSG       = lv_msg
             EXCEPTIONS
               NOT_FOUND = 1
               OTHERS    = 2.
           IF sy-subrc <> 0.
    * Implement suitable error handling here
           ENDIF.
           WRITE:/ lv_msg.
         ENDLOOP.
    *        Start new screen                                              *
       FORM BDC_DYNPRO USING PROGRAM DYNPRO.                 "#EC PF_NO_TYPE
         CLEAR BDCDATA.
         BDCDATA-PROGRAM  = PROGRAM.
         BDCDATA-DYNPRO   = DYNPRO.
         BDCDATA-DYNBEGIN = 'X'.
         APPEND BDCDATA.
       ENDFORM.
    *        Insert field                                                  *
       FORM BDC_FIELD USING FNAM FVAL.                       "#EC PF_NO_TYPE
         CLEAR BDCDATA.
         BDCDATA-FNAM = FNAM.
         BDCDATA-FVAL = FVAL.
         APPEND BDCDATA.
       ENDFORM.
    Thanks,
    Srini

    Hi Rob,
    Thanks for quick reply.
    I have checked the NOTE : 304122
    But there in the NOTE it says ( " BAPI, BAPI_GOODSMVT_CANCEL, BAPI_GOODSMVT_CREATE, CNTL_ERROR" )
    These BAPI's work perfectly for (purchase order as input type), but here out type is ( A01 & R05 ) we are giving DELIVERY NUMBER as input to MIGO.
    So for this scenario we cannot use those BAPI's mentioned in the NOTE.
    Also as stated earlier in the message interesting part is
    "The code works absolutely perfect only from my ID. But when I test from other ID it is not executing. Code is working exactly as expected ONLY to my ID. When i try to execute the same code from another's ID it is not working"
    So what do you think might be the issue?

  • Problem in doing BDC for XK01

    Hi all,
    i am doing BDC for XK01 with Line Item for Bank Details(Table Control..)
    With 3 Internal table
    IT_dummy to get the flat file
    IT_vend  for Header details
    IT_bank  for Item Details
    in this there is a Nested loop
    Loop at it_vend.
    perform bdc
    loop at it_bank.
    concatenate................
    endloop.
    endloop.
    because of the above nested loops..it's bit slow..
    & i am trying to do with a single internal table..
    The problem is..
    with the header data it's not picking all the item data(it's picking only one..)..help me in resolving the problem..
    Below the code..
    REPORT  ZMM_BDCTC1 NO STANDARD PAGE HEADING LINE-SIZE 255.
    PARAMETER:P_FILE TYPE RLGRAP-FILENAME.
    DATA BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF IT_DUMMY OCCURS 0,
          TYP,
          DES(255) TYPE C,
          END OF IT_DUMMY.
    DATA:DELIMITER VALUE ',',
         cnt(4) TYPE N,
         L_FNAM(30) TYPE C,
         FILENAME TYPE STRING.
    TYPES:BEGIN OF TY_FINAL,
          N(4) TYPE C,
          LIFNR TYPE RF02K-LIFNR,
          BUKRS TYPE RF02K-BUKRS,
          EKORG TYPE RF02K-EKORG,
          KTOKK TYPE RF02K-KTOKK,
          NAME1 TYPE LFA1-NAME1,
          SORTL TYPE LFA1-SORTL,
          LAND1 TYPE LFA1-LAND1,
          AKONT TYPE LFB1-AKONT,
          FDGRV TYPE LFB1-FDGRV,
          WAERS LIKE LFM1-WAERS,
          M(4) TYPE C,
          BANKS TYPE LFBK-BANKS,
          BANKL TYPE LFBK-BANKL,
          BANKN TYPE LFBK-BANKN,
          KOINH TYPE LFBK-KOINH,
          END OF TY_FINAL.
    DATA: IT_FINAL TYPE TABLE OF TY_FINAL,
          WA_FINAL TYPE TY_FINAL.
    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.
         FILENAME = P_FILE.
         CALL FUNCTION 'GUI_UPLOAD'
           EXPORTING
             filename                      = FILENAME
            FILETYPE                      = 'ASC'
           tables
             data_tab                      = IT_DUMMY.
    START-OF-SELECTION.
    LOOP AT it_dummy.
        IF it_dummy-typ = 'H'.
          SPLIT  it_dummy-des AT delimiter INTO WA_FINAL-lifnr "Populating Header Table
                                                WA_FINAL-bukrs
                                                WA_FINAL-ekorg
                                                WA_FINAL-ktokk
                                                WA_FINAL-name1
                                                WA_FINAL-sortl
                                                WA_FINAL-land1
                                                WA_FINAL-akont
                                                WA_FINAL-fdgrv
                                                WA_FINAL-waers.
          WA_FINAL-N = WA_FINAL-N + 1.
          WA_FINAL-M = WA_FINAL-M + 1.
        ELSEIF it_dummy-typ = 'I'.
          SPLIT it_dummy-des AT delimiter INTO WA_FINAL-BANKS
                                               WA_FINAL-BANKL
                                               WA_FINAL-BANKN
                                               WA_FINAL-KOINH.
          APPEND WA_FINAL TO IT_FINAL.
        ENDIF.
      ENDLOOP.
    LOOP AT IT_FINAL INTO WA_FINAL.
    WRITE:/ WA_FINAL-N,
            WA_FINAL-LIFNR,
            WA_FINAL-BUKRS,
            WA_FINAL-EKORG,
            WA_FINAL-KTOKK,
            WA_FINAL-NAME1,
            WA_FINAL-SORTL,
            WA_FINAL-LAND1,
            WA_FINAL-AKONT,
            WA_FINAL-FDGRV,
            WA_FINAL-WAERS,
            WA_FINAL-M,
            WA_FINAL-BANKS,
            WA_FINAL-BANKL,
            WA_FINAL-BANKN,
            WA_FINAL-KOINH.
    ENDLOOP.
    data: WA_FINAL1 like line of IT_FINAL.
    clear WA_FINAL1.
    ******************BDC STARTS***********************
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
    CLIENT      = SY-MANDT
    GROUP       = 'ZMM_BDCTAB'
    KEEP        = 'X'
    USER        = SY-UNAME.
    Clear wa_final.
    LOOP AT IT_FINAL INTO WA_FINAL.
    WA_FINAL1 = WA_FINAL.
    CLEAR BDCDATA[].
    AT NEW N.
    cnt = 1.
    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'
                                  WA_FINAL1-LIFNR.
    perform bdc_field       using 'RF02K-BUKRS'
                                  WA_FINAL1-BUKRS.
    perform bdc_field       using 'RF02K-EKORG'
                                  WA_FINAL1-EKORG.
    perform bdc_field       using 'RF02K-KTOKK'
                                  WA_FINAL1-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-NAME1'
                                  WA_FINAL1-NAME1.
    perform bdc_field       using 'LFA1-SORTL'
                                  WA_FINAL1-SORTL.
    perform bdc_field       using 'LFA1-LAND1'
                                  WA_FINAL1-LAND1.
    perform bdc_dynpro      using 'SAPMF02K' '0120'. "ERROR CLEARED
    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-KOINH(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    ENDAT.
    *ENDON.
    IF WA_FINAL1-N = WA_FINAL1-M.
    CONCATENATE  'LFBK-BANKS(' cnt ')'  INTO L_FNAM.
    perform bdc_field       using L_FNAM
                                  WA_FINAL1-BANKS.
    CONCATENATE  'LFBK-BANKL(' cnt ')'  INTO L_FNAM.
    perform bdc_field       using L_FNAM
                                  WA_FINAL1-BANKL.
    CONCATENATE  'LFBK-BANKN(' cnt ')'  INTO L_FNAM.
    perform bdc_field       using L_FNAM
                                  WA_FINAL1-BANKN.
    CONCATENATE  'LFBK-KOINH(' cnt ')'  INTO L_FNAM.
    perform bdc_field       using L_FNAM
                                  WA_FINAL1-KOINH.
    *ENDDO.
    cnt = cnt + 1.
    ENDIF.
    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'.
    *AT NEW LIFNR.
    perform bdc_field       using 'LFB1-AKONT'
                                  WA_FINAL1-AKONT.
    perform bdc_field       using 'LFB1-FDGRV'
                                  WA_FINAL1-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'
                                  WA_FINAL1-WAERS.
    perform bdc_dynpro      using 'SAPMF02K' '0320'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-LIFNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    AT END OF M.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    TCODE     = 'XK01'
    TABLES
    DYNPROTAB = BDCDATA.
    ENDAT.
    CLEAR WA_FINAL1.
    CLEAR WA_FINAL.
    ENDLOOP.
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    *********************BDC ENDS***********************
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
    IF FVAL <> NODATA.
        CLEAR BDCDATA.
        BDCDATA-FNAM = FNAM.
        BDCDATA-FVAL = FVAL.
        APPEND BDCDATA.
    ENDIF.
    ENDFORM.
    Flat File is..
    HAAA45,1000,1000,0002,NAME45,N,IN,31000,A1,USD
    IIN,1000,1021,Name45
    IIN,1000,1022,Name45
    HAAA50,1000,1000,0002,NAME50,N,IN,31000,A1,USD
    IIN,1000,1023,Name50
    IIN,1000,1024,Name50

    Regarding avoiding the loop I have a suggestion, though I have not tried this .
    SAP help says " Using the internal table bdc_tab, you can provide any number of screens of the called transaction with input and user actions. " .
    Above implies you can load all records in the itab bdc_tab when doing call transaction. Say, your bdc_tabl has 30 records for 1 pass of the transaction. You need to update 10 vendor records. You simply load up all 300 records into bdc_tab. After every 30 record loads, you simulate a 'SAVE' press in your program but do not leave the transaction. Rather you simulate the keystroke that takes you to the first screen of XK01 after the save if not aready there, and start loading up the next transaction.

  • BDC for FB50L...URGENT

    Hi,
    I am doing the BDC for FB50L but the code doesn't seem to execute...it is giving errors...
    I am attaching the code...Please review it and help me....its really urgent...
    Your help will be really appreciated...
    REPORT  ZTEST_BDC_PARK_ACC_GL.
    DATA:
    t_document_line_item_main LIKE bapiacgl09 OCCURS 100,
    t_document_line_item_enhn LIKE bapiacextc OCCURS 100,
    t_document_line_item_amnt LIKE bapiaccr09 OCCURS 100,
    t_return LIKE bapiret2 OCCURS 100,
    wa_document_header LIKE  bapiache09,
    wa_document_line_item_main LIKE bapiacgl09,
    wa_document_line_item_enhn LIKE bapiacextc,
    wa_document_line_item_amnt LIKE bapiaccr09,
    wa_return LIKE bapiret2.
    DATA: it_bdcdata TYPE TABLE OF bdcdata,
          it_messages TYPE TABLE OF bdcmsgcoll,
          wa_messages TYPE bdcmsgcoll,
          options TYPE ctu_params.
    DATA:  idx TYPE i,
           ch3(5) TYPE c,
           fname(40) TYPE c.
    DATA: indate TYPE d,
          intdate TYPE D.
    CLEAR wa_document_header.
    wa_document_header-obj_type = space.                        "
    wa_document_header-obj_key = space.
    wa_document_header-obj_sys = space.
    wa_document_header-bus_act = 'RFBU'.
    wa_document_header-username = 'INFAUSRTEST'.
    wa_document_header-header_txt = 'BAPI__POST'.
    wa_document_header-comp_code = '1001'.
    wa_document_header-doc_date = '20070814'.
    wa_document_header-pstng_date = '20070814'.
    CLEAR wa_document_header-trans_date.
    CLEAR wa_document_header-fisc_year.
    CLEAR wa_document_header-fis_period.
    wa_document_header-doc_type = 'SY'.
    wa_document_header-ref_doc_no = 'REQUIRED'.
    wa_document_header-ac_doc_no = space.
    wa_document_header-obj_key_r = space.
    wa_document_header-reason_rev = space.
    wa_document_header-compo_acc = space.
    wa_document_header-ref_doc_no_long = space.
    wa_document_header-acc_principle = 'LGAP'.
    wa_document_header-neg_postng = space.
    wa_document_header-obj_key_inv = space.
    wa_document_header-bill_category = space.
    Fill Line Item #1
    CLEAR: wa_document_line_item_main, wa_document_line_item_enhn, wa_document_line_item_amnt.
    Fill Main Portion Of Accounting Line Item
    wa_document_line_item_main-itemno_acc = '1'.         "Accounting Document Line Item Number
    wa_document_line_item_main-gl_account = '2412001067'."HKONT - Account
    wa_document_line_item_main-item_text = 'Test BAPI'.  "SGTXT - Item Text
    wa_document_line_item_main-doc_type = space.         "BLART - Document Type
    wa_document_line_item_main-comp_code = space.        "BUKRS - Company Code
    wa_document_line_item_main-pstng_date = '20070814'.  "BUDAT - Posting Date
    wa_document_line_item_main-alloc_nmbr = space.       "ZUONR - Allocation Number
    wa_document_line_item_main-costcenter = space.       "KOSTL - Cost Center
    wa_document_line_item_main-profit_ctr = space.       "PRCTR - Profit Center
    wa_document_line_item_main-de_cre_ind = 'D'.        "NEWBS - Posting Key / Debit Credit Indicator
    wa_document_line_item_main-trade_id = space.         "RASSC - Company ID Of Trading Partner
    Fill Amount Portion Of Accounting Line Item
    wa_document_line_item_amnt-itemno_acc = '1'.          "Accounting Document Line Item Number
    wa_document_line_item_amnt-curr_type = '00'.          "Currency Type
    wa_document_line_item_amnt-currency = 'USD'.          "WAERS - Currency Key
    wa_document_line_item_amnt-amt_doccur = '239959'.      "WRBTR - Amount In Document Currency Type
    APPEND: wa_document_line_item_main TO t_document_line_item_main,
            wa_document_line_item_amnt TO t_document_line_item_amnt.
    Fill Next Line Item #2
    CLEAR: wa_document_line_item_main, wa_document_line_item_enhn, wa_document_line_item_amnt.
    Fill Main Portion Of Accounting Line Item
    wa_document_line_item_main-itemno_acc = '2'.         "Accounting Document Line Item Number
    wa_document_line_item_main-gl_account = '2412001067'."HKONT - Account
    wa_document_line_item_main-item_text = 'Test BAPI'.  "SGTXT - Item Text
    wa_document_line_item_main-doc_type = space.         "BLART - Document Type
    wa_document_line_item_main-comp_code = space.        "BUKRS - Company Code
    wa_document_line_item_main-pstng_date = '20070814'.  "BUDAT - Posting Date
    wa_document_line_item_main-alloc_nmbr = space.       "ZUONR - Allocation Number
    wa_document_line_item_main-costcenter = space.       "KOSTL - Cost Center
    wa_document_line_item_main-profit_ctr = space.       "PRCTR - Profit Center
    wa_document_line_item_main-de_cre_ind = 'C'.        "NEWBS - Posting Key / Debit Credit Indicator
    wa_document_line_item_main-trade_id = space.         "RASSC - Company ID Of Trading Partner
    Fill Enhancement Portion Of Accounting Line Item
    Fill Amount Portion Of Accounting Line Item
    wa_document_line_item_amnt-itemno_acc = '2'.          "Accounting Document Line Item Number
    wa_document_line_item_amnt-curr_type = '00'.          "Currency Type
    wa_document_line_item_amnt-currency = 'USD'.          "WAERS - Currency Key
    wa_document_line_item_amnt-amt_doccur = '-239959'.     "WRBTR - Amount In Document Currency Type
    APPEND: wa_document_line_item_main TO t_document_line_item_main,
            wa_document_line_item_amnt TO t_document_line_item_amnt.
    *************************BDC PROGRAM**************************************************************
    PERFORM bdc_dynpro TABLES it_bdcdata USING 'SAPMF05A' wa_document_header-comp_code .
    PERFORM bdc_field TABLES it_bdcdata USING 'BDC_OKCODE'
    '=BP'.
      MOVE  wa_document_header-doc_date TO indate.
      CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
      EXPORTING
      date_external = indate
      IMPORTING
      date_internal = intdate.
      PERFORM bdc_field TABLES it_bdcdata USING 'ACGL_HEAD-BLDAT'
      INTDATE.
      perform bdc_field TABLES it_bdcdata USING 'ACGL_HEAD-WAERS'
      wa_document_line_item_amnt-currency.
      MOVE  wa_document_header-pstng_date TO indate.
      CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
      EXPORTING
      date_external = indate
      IMPORTING
      date_internal = intdate.
      PERFORM bdc_field TABLES it_bdcdata USING 'ACGL_HEAD-BUDAT'
      INTDATE.
      perform bdc_field TABLES it_bdcdata USING 'ACGL_HEAD-XBLNR'
      wa_document_header-ref_doc_no.
      PERFORM bdc_field TABLES it_bdcdata USING 'ACGL_HEAD-BKTXT'
      wa_document_header-header_txt.
      LOOP AT t_document_line_item_main INTO wa_document_line_item_main.
        idx = idx + 1.
        ch3 = idx.
        CONCATENATE 'ACGL_ITEM-HKONT(' ch3 ')' INTO fname.
        CONDENSE fname.
        PERFORM bdc_field TABLES it_bdcdata USING fname
        wa_document_line_item_main-gl_account.
        CONCATENATE 'ACGL_ITEM-SHKZG(' ch3 ')' INTO fname.
        CONDENSE fname.
        PERFORM bdc_field TABLES it_bdcdata USING fname
        wa_document_line_item_main-de_cre_ind.
        CONCATENATE 'ACGL_ITEM-WRBTR(' ch3 ')' INTO fname.
        CONDENSE fname.
        PERFORM bdc_field TABLES it_bdcdata USING fname
        wa_document_line_item_amnt-amt_doccur.
        CONCATENATE 'ACGL_ITEM-SGTXT(' ch3 ')' INTO fname.
        CONDENSE fname.
        PERFORM bdc_field TABLES it_bdcdata USING fname
        wa_document_line_item_main-item_text .
      ENDLOOP.
      options-dismode = 'A'.
      options-nobinpt = 'X'.
      CALL TRANSACTION 'FB50' USING it_bdcdata MESSAGES INTO
      it_messages OPTIONS FROM options.
    Start new screen
    FORM bdc_dynpro TABLES it_bdcdata STRUCTURE bdcdata USING program
    dynpro
      DATA: wa_bdcdata TYPE bdcdata.
      wa_bdcdata-program = program.
      wa_bdcdata-dynpro = dynpro.
      wa_bdcdata-dynbegin = 'X'.
      APPEND wa_bdcdata TO it_bdcdata.
    ENDFORM. "BDC_DYNPRO
    Insert field
    FORM bdc_field TABLES it_bdcdata STRUCTURE bdcdata USING fnam fval.
      DATA: wa_bdcdata TYPE bdcdata.
      IF fval <> space.
        CLEAR wa_bdcdata.
        wa_bdcdata-fnam = fnam.
        wa_bdcdata-fval = fval.
        APPEND wa_bdcdata TO it_bdcdata.
      ENDIF.
    ENDFORM.                    "BDC_FIELD
    Please suggest....
    Thanks

    data : amount(16).
    This below statement is not passing value wa_document_line_item_amnt-amt_doccur into it_bdcdata-fval. So try to move it to a character field and then use the perform statement.
    PERFORM bdc_field TABLES it_bdcdata USING fname
    wa_document_line_item_amnt-amt_doccur.
    change it to:
    WRITE wa_document_line_item_amnt-amt_doccur TO AMOUNT.
    PERFORM bdc_field TABLES it_bdcdata USING fname AMOUNT.
    -Kriss

  • BDC FOR PO CREATE USING ME21

    Iam Creating BDC Program bu using ME21 for Uploading PO.
    Iam getting error at Income term2 in the Second Screen of ME21. Iam Passing this value through Excel Sheet But event then it is not picking. When i check in debugging the value of income term2 is populating.
    Let me know what are the mandotory fields for creating PO using Me21.
    Here iam also attaching the code, Please help us because it is very urgent.
    report ZPOUPLOADME21
    no standard page heading line-size 255.
    *include bdcrecx1.
    INCLUDE YMM_BDCRECX1.
    •     Internal Table T_BDCDATA to store BDC data
    •     Batchinputdata of single transaction
    DATA: T_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    •     Internal Table T_BDC_MSG to store BDC messages
    DATA: T_BDC_MSG LIKE STANDARD TABLE OF BDCMSGCOLL INITIAL
    SIZE 0 WITH HEADER LINE.
    DATA: V_FILE LIKE RLGRAP-FILENAME ,
    V_COUNT(5) TYPE C,
    V_MESSAGE_CNT(5) TYPE C .
    DATA : BEGIN OF IT_DATA OCCURS 0,
    LIFNR LIKE EKKO-LIFNR, " Vendor
    BSART LIKE RM06E-BSART, " Order Type
    BEDAT(10) TYPE C, " Date
    EKORG LIKE EKKO-EKORG, " Purchasing Organization
    EKGRP LIKE EKKO-EKGRP, " Purchasing Group
    WERKS LIKE RM06E-WERKS, " Plant
    INCO2 LIKE EKKO-INCO2, " Inco Terms
    KNTTP LIKE EKPO-KNTTP, " A/C Assignment Category
    EMATN LIKE EKPO-EMATN, " Material Number
    MENGE LIKE EKPO-MENGE, " Purchase Order Quantity
    NETPR LIKE EKPO-NETPR, " Net Price
    MWSKZ LIKE EKPO-MWSKZ, " Tax Code
    NPLNR LIKE MSEG-NPLNR, " Network
    VORNR LIKE PSORDER-VORNR, " Operation
    END OF IT_DATA.
    START-OF-SELECTION.
    PERFORM OPEN_GROUP.
    PERFORM DATA_UPLOAD.
    PERFORM CALL_TRANSACTION.
    PERFORM CLOSE_GROUP.
    PERFORM WRITE_ERROR.
    *& Form DATA_UPLOAD
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM DATA_UPLOAD.
    *call function ws_upload to retrieve data from a flat file in the
    *presentation server into an internal table
    CALL FUNCTION 'UPLOAD'
    EXPORTING
    FILENAME = V_FILE
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = IT_DATA
    EXCEPTIONS
    CONVERSION_ERROR = 1
    INVALID_TABLE_WIDTH = 2
    INVALID_TYPE = 3
    NO_BATCH = 4
    UNKNOWN_ERROR = 5
    GUI_REFUSE_FILETRANSFER = 6
    OTHERS = 7.
    •     if ws_upload fails then display appropriate message
    IF SY-SUBRC 0.
    •     MESSAGE E000 WITH 'Data not Uploaded into internal table'.
    ENDIF.
    ENDFORM. " DATA_UPLOAD
    *& Form CALL_TRANSACTION
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM CALL_TRANSACTION.
    DATA : V_IVDAT(10) TYPE C,
    V_AKTIV(10) TYPE C,
    V_MESSAGE(404) TYPE C.
    REFRESH T_BDCDATA.
    CLEAR T_BDCDATA.
    V_COUNT = 0.
    V_MESSAGE_CNT = 0.
    LOOP AT IT_DATA .
    V_COUNT = V_COUNT + 1.
    *perform open_group.
    perform bdc_dynpro using 'SAPMM06E' '0100'.
    perform bdc_field using 'BDC_CURSOR'
    'RM06E-WERKS'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'EKKO-LIFNR'
    IT_DATA-LIFNR.
    perform bdc_field using 'RM06E-BSART'
    IT_DATA-BSART.
    *perform bdc_field using 'RM06E-BEDAT'
    •     '24.01.2008'.
    perform bdc_field using 'RM06E-BEDAT'
    IT_DATA-BEDAT.
    perform bdc_field using 'EKKO-EKORG'
    IT_DATA-EKORG.
    perform bdc_field using 'EKKO-EKGRP'
    IT_DATA-EKGRP.
    *perform bdc_field using 'RM06E-LPEIN'
    •     'T'.
    perform bdc_field using 'RM06E-WERKS'
    IT_DATA-WERKS.
    perform bdc_dynpro using 'SAPMM06E' '0101'.
    perform bdc_field using 'BDC_CURSOR'
    'EKKO-INCO2'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EKKO-EKGRP'
    •     IT_DATA-EKGRP1. "'SP3'.
    *perform bdc_field using 'EKKO-PINCR'
    •     IT_DATA-PINCR. "'10'.
    *perform bdc_field using 'EKKO-SPRAS'
    •     IT_DATA-SPRAS. "'EN'.
    *perform bdc_field using 'EKKO-UPINC'
    •     IT_DATA-UPINC. "'1'.
    *perform bdc_field using 'EKKO-ZTERM'
    •     IT_DATA-ZTERM.
    *perform bdc_field using 'EKKO-WAERS'
    •     IT_DATA-WAERS. "'INR'.
    *perform bdc_field using 'EKKO-ZBD1T'
    •     IT_DATA-ZBD1T. "'44'.
    *perform bdc_field using 'EKKO-WKURS'
    •     IT_DATA-WKURS. "' 1.00000'.
    *perform bdc_field using 'EKKO-INCO1'
    •     IT_DATA-INCO1.
    perform bdc_field using 'EKKO-INCO2'
    IT_DATA-INCO2.
    perform bdc_dynpro using 'SAPMM06E' '0120'.
    perform bdc_field using 'BDC_CURSOR'
    'EKPO-NETPR(01)'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EKPO-KNTTP(01)'
    •     'N'.
    perform bdc_field using 'EKPO-KNTTP(01)'
    IT_DATA-KNTTP.
    perform bdc_field using 'EKPO-EMATN(01)'
    IT_DATA-EMATN.
    perform bdc_field using 'EKPO-MENGE(01)'
    IT_DATA-MENGE.
    perform bdc_field using 'EKPO-NETPR(01)'
    IT_DATA-NETPR.
    perform bdc_dynpro using 'SAPMM06E' '0111'.
    perform bdc_field using 'BDC_CURSOR'
    'EKPO-MWSKZ'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EKPO-KNTTP'
    •     'N'.
    *perform bdc_field using 'EKPO-TXZ01'
    •     'Clamps & Connector'.
    *perform bdc_field using 'EKPO-MENGE'
    •     '4'.
    *perform bdc_field using 'EKPO-SPINF'
    •     'A'.
    *perform bdc_field using 'EKPO-NETPR'
    •     '100.00'.
    *perform bdc_field using 'EKPO-PEINH'
    •     '1'.
    *perform bdc_field using 'EKPO-BPRME'
    •     'NO'.
    *perform bdc_field using 'EKPO-BPUMN'
    •     '1'.
    *perform bdc_field using 'EKPO-BPUMZ'
    •     '1'.
    *perform bdc_field using 'EKPO-PRSDR'
    •     'X'.
    *perform bdc_field using 'RM06E-EEIND'
    •     '24.01.2008'.
    *perform bdc_field using 'RM06E-LPEIN'
    •     'D'.
    *perform bdc_field using 'EKPO-WEPOS'
    •     'X'.
    perform bdc_field using 'EKPO-MWSKZ'
    IT_DATA-MWSKZ.
    *perform bdc_field using 'EKPO-REPOS'
    •     'X'.
    perform bdc_dynpro using 'SAPMM06E' '0511'.
    perform bdc_field using 'BDC_CURSOR'
    'EKKN-SAKTO'.
    perform bdc_field using 'BDC_OKCODE'
    '=ENTE'.
    *perform bdc_field using 'EKKN-SAKTO'
    •     '6034025'.
    *perform bdc_field using 'DKACB-FMORE'
    •     'X'.
    perform bdc_dynpro using 'SAPLKACB' '0002'.
    *perform bdc_field using 'BDC_CURSOR'
    •     'COBL-VORNR'.
    perform bdc_field using 'BDC_OKCODE'
    '=ENTE'.
    perform bdc_field using 'COBL-NPLNR'
    IT_DATA-NPLNR.
    perform bdc_field using 'COBL-VORNR'
    IT_DATA-VORNR.
    perform bdc_dynpro using 'SAPMM06E' '0111'.
    perform bdc_dynpro using 'SAPMM06E' '0120'.
    perform bdc_field using 'BDC_CURSOR'
    'RM06E-EBELP'.
    perform bdc_field using 'BDC_OKCODE'
    '=BU'.
    *perform bdc_field using 'RM06E-EBELP'
    •     '10'.
    perform bdc_dynpro using 'SAPLSPO1' '0300'.
    perform bdc_field using 'BDC_OKCODE'
    '=YES'.
    perform bdc_transaction using 'ME21'.
    perform close_group.
    LOOP AT T_MESSTAB WHERE REC_NO IS INITIAL.
    AT FIRST.
    V_MESSAGE_CNT = V_MESSAGE_CNT + 1.
    T_MESSTAB-REC_NO = V_COUNT.
    ENDAT.
    MODIFY T_MESSTAB TRANSPORTING REC_NO.
    ENDLOOP.
    REFRESH T_BDCDATA.
    CLEAR T_BDCDATA.
    ENDLOOP.
    SKIP.
    WRITE : /10 'Record Number ', 30 'Error Message'.
    SKIP.
    endform.
    *& Form WRITE_ERROR
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM WRITE_ERROR.
    LOOP AT T_MESSTAB.
    WRITE : /10 T_MESSTAB-REC_NO , 30 T_MESSTAB-MESSAGE.
    ENDLOOP.
    ULINE /10(100).
    WRITE : /10 'No of Records : ' , V_COUNT.
    WRITE : /10 'No of Erroneous Records : ' , V_MESSAGE_CNT.
    ULINE /10(100).
    ENDFORM. " WRITE_ERROR
    *& Form CHECK_BDC
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM CHECK_BDC.
    DATA: L_CHECK LIKE YMMT_CHECK_BDC-YCHECK.
    SELECT SINGLE YCHECK INTO L_CHECK FROM YMMT_CHECK_BDC
    WHERE PROGRAMM EQ SY-REPID
    AND YCHECK EQ 'X'.
    IF SY-SUBRC NE 0.
    MESSAGE S000(YM) WITH 'Execution not possible'.
    STOP.
    ENDIF.
    ENDFORM. " CHECK_BDC
    Your Help will be highly appreciated.
    If any bapi code you have please send me.
    Thanks
    Rahul

    Hi.
    ckeck this.
    *Code used to create BDC
    *& Report ZBDC_EXAMPLE *
    *& Example BDC program, which updates net price of item 00010 of a *
    *& particular Purchase order(EBELN). *
    REPORT ZBDC_EXAMPLE NO STANDARD PAGE HEADING
    LINE-SIZE 132.
    Data declaration
    TABLES: ekko, ekpo.
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekko-ebeln,
    waers TYPE ekko-waers,
    netpr TYPE ekpo-netpr,
    err_msg(73) TYPE c,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko,
    it_error TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_error TYPE t_ekko,
    it_success TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_success TYPE t_ekko.
    DATA: w_textout LIKE t100-text.
    DATA: gd_update TYPE i,
    gd_lines TYPE i.
    *Used to store BDC data
    DATA: BEGIN OF bdc_tab OCCURS 0.
    INCLUDE STRUCTURE bdcdata.
    DATA: END OF bdc_tab.
    *Used to stores error information from CALL TRANSACTION Function Module
    DATA: BEGIN OF messtab OCCURS 0.
    INCLUDE STRUCTURE bdcmsgcoll.
    DATA: END OF messtab.
    *Screen declaration
    SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME
    TITLE text-001. "Purchase order Num
    SELECT-OPTIONS: so_ebeln FOR ekko-ebeln OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK block1.
    SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME
    TITLE text-002. "New NETPR value
    PARAMETERS: p_newpr(14) TYPE c obligatory. "LIKE ekpo-netpr.
    SELECTION-SCREEN END OF BLOCK block2.
    *START-OF-SELECTION
    START-OF-SELECTION.
    Retrieve data from Purchase order table(EKKO)
    SELECT ekkoebeln ekkowaers ekpo~netpr
    INTO TABLE it_ekko
    FROM ekko AS ekko INNER JOIN ekpo AS ekpo
    ON ekpoebeln EQ ekkoebeln
    WHERE ekko~ebeln IN so_ebeln AND
    ekpo~ebelp EQ '10'.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Check data has been retrieved ready for processing
    DESCRIBE TABLE it_ekko LINES gd_lines.
    IF gd_lines LE 0.
    Display message if no data has been retrieved
    MESSAGE i003(zp) WITH 'No Records Found'(001).
    LEAVE TO SCREEN 0.
    ELSE.
    Update Customer master data (instalment text)
    LOOP AT it_ekko INTO wa_ekko.
    PERFORM bdc_update.
    ENDLOOP.
    Display message confirming number of records updated
    IF gd_update GT 1.
    MESSAGE i003(zp) WITH gd_update 'Records updated'(002).
    ELSE.
    MESSAGE i003(zp) WITH gd_update 'Record updated'(003).
    ENDIF.
    Display Success Report
    Check Success table
    DESCRIBE TABLE it_success LINES gd_lines.
    IF gd_lines GT 0.
    Display result report column headings
    PERFORM display_column_headings.
    Display result report
    PERFORM display_report.
    ENDIF.
    Display Error Report
    Check errors table
    DESCRIBE TABLE it_error LINES gd_lines.
    If errors exist then display errors report
    IF gd_lines GT 0.
    Display errors report
    PERFORM display_error_headings.
    PERFORM display_error_report.
    ENDIF.
    ENDIF.
    *& Form DISPLAY_COLUMN_HEADINGS
    Display column headings
    FORM display_column_headings.
    WRITE:2 ' Success Report '(014) COLOR COL_POSITIVE.
    SKIP.
    WRITE:2 'The following records updated successfully:'(013).
    WRITE:/ sy-uline(42).
    FORMAT COLOR COL_HEADING.
    WRITE:/ sy-vline,
    (10) 'Purchase Order'(004), sy-vline,
    (11) 'Old Netpr'(005), sy-vline,
    (11) 'New Netpr'(006), sy-vline.
    WRITE:/ sy-uline(42).
    ENDFORM. " DISPLAY_COLUMN_HEADINGS
    *& Form BDC_UPDATE
    Populate BDC table and call transaction ME22
    FORM bdc_update.
    PERFORM dynpro USING:
    'X' 'SAPMM06E' '0105',
    ' ' 'BDC_CURSOR' 'RM06E-BSTNR',
    ' ' 'RM06E-BSTNR' wa_ekko-ebeln,
    ' ' 'BDC_OKCODE' '/00', "OK code
    'X' 'SAPMM06E' '0120',
    ' ' 'BDC_CURSOR' 'EKPO-NETPR(01)',
    ' ' 'EKPO-NETPR(01)' p_newpr,
    ' ' 'BDC_OKCODE' '=BU'. "OK code
    Call transaction to update customer instalment text
    CALL TRANSACTION 'ME22' USING bdc_tab MODE 'N' UPDATE 'S'
    MESSAGES INTO messtab.
    Check if update was succesful
    IF sy-subrc EQ 0.
    ADD 1 TO gd_update.
    APPEND wa_ekko TO it_success.
    ELSE.
    Retrieve error messages displayed during BDC update
    LOOP AT messtab WHERE msgtyp = 'E'.
    Builds actual message based on info returned from Call transaction
    CALL FUNCTION 'MESSAGE_TEXT_BUILD'
    EXPORTING
    msgid = messtab-msgid
    msgnr = messtab-msgnr
    msgv1 = messtab-msgv1
    msgv2 = messtab-msgv2
    msgv3 = messtab-msgv3
    msgv4 = messtab-msgv4
    IMPORTING
    message_text_output = w_textout.
    ENDLOOP.
    Build error table ready for output
    wa_error = wa_ekko.
    wa_error-err_msg = w_textout.
    APPEND wa_error TO it_error.
    CLEAR: wa_error.
    ENDIF.
    Clear bdc date table
    CLEAR: bdc_tab.
    REFRESH: bdc_tab.
    ENDFORM. " BDC_UPDATE
    FORM DYNPRO *
    stores values to bdc table *
    --> DYNBEGIN *
    --> NAME *
    --> VALUE *
    FORM dynpro USING dynbegin name value.
    IF dynbegin = 'X'.
    CLEAR bdc_tab.
    MOVE: name TO bdc_tab-program,
    value TO bdc_tab-dynpro,
    'X' TO bdc_tab-dynbegin.
    APPEND bdc_tab.
    ELSE.
    CLEAR bdc_tab.
    MOVE: name TO bdc_tab-fnam,
    value TO bdc_tab-fval.
    APPEND bdc_tab.
    ENDIF.
    ENDFORM. " DYNPRO
    *& Form DISPLAY_REPORT
    Display Report
    FORM display_report.
    FORMAT COLOR COL_NORMAL.
    Loop at data table
    LOOP AT it_success INTO wa_success.
    WRITE:/ sy-vline,
    (10) wa_success-ebeln, sy-vline,
    (11) wa_success-netpr CURRENCY wa_success-waers, sy-vline,
    (11) p_newpr, sy-vline.
    CLEAR: wa_success.
    ENDLOOP.
    WRITE:/ sy-uline(42).
    REFRESH: it_success.
    FORMAT COLOR COL_BACKGROUND.
    ENDFORM. " DISPLAY_REPORT
    *& Form DISPLAY_ERROR_REPORT
    Display error report data
    FORM display_error_report.
    LOOP AT it_error INTO wa_error.
    WRITE:/ sy-vline,
    (10) wa_error-ebeln, sy-vline,
    (11) wa_error-netpr CURRENCY wa_error-waers, sy-vline,
    (73) wa_error-err_msg, sy-vline.
    ENDLOOP.
    WRITE:/ sy-uline(104).
    REFRESH: it_error.
    ENDFORM. " DISPLAY_ERROR_REPORT
    *& Form DISPLAY_ERROR_HEADINGS
    Display error report headings
    FORM display_error_headings.
    SKIP.
    WRITE:2 ' Error Report '(007) COLOR COL_NEGATIVE.
    SKIP.
    WRITE:2 'The following records failed during update:'(008).
    WRITE:/ sy-uline(104).
    FORMAT COLOR COL_HEADING.
    WRITE:/ sy-vline,
    (10) 'Purchase Order'(009), sy-vline,
    (11) 'Netpr'(010), sy-vline,
    (73) 'Error Message'(012), sy-vline.
    WRITE:/ sy-uline(104).
    FORMAT COLOR COL_NORMAL.
    ENDFORM. " DISPLAY_ERROR_HEADINGS
    regards.
    sowjanya.b.

  • BDC for MM02 - MRP area

    Hello everyone!
    I have developed a BDC program to batch input data into MM02 / MRP area.
    It's working perfectly fine when I use mode 'A' in CALL TRANSACTION statement, but when I change it to 'N', so I can give this for the customer to test, it stops working, giving me an error in one of the screens, saying the "MRP area  is not assigned to plant CH01" (when running with mode "E" it also gives me the error).
    Here's my coding:
    REPORT  zload_mrp_areas.
    Data and variables definition
    DATA:  bdcdata    LIKE bdcdata OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF t_header OCCURS 0,
            link      LIKE mara-matnr,
            matnr     LIKE mara-matnr,
            werks     LIKE marc-werks,
            mstae(2)  TYPE c,
            perkz(2)  TYPE c,
          END OF t_header.
    DATA: BEGIN OF t_details OCCURS 0,
            muvbr(5)  TYPE c,
            unvbr(5)  TYPE c,
            matnr     LIKE mara-matnr,
            priod(6)  TYPE c,
            gsvbr(5)  TYPE c,
          END OF t_details.
    DATA: v_count(3)  TYPE n,
          v_week      LIKE scal-week,
          v_week1(6)  TYPE n,
          v_week2(6)  TYPE n,
          v_page(5)   TYPE p DECIMALS 2,
          v_index(3)  TYPE n,
          v_field(19) TYPE c,
          v_mode      TYPE c,
          v_date1     LIKE sy-datum,
          v_date2     LIKE sy-datum,
          v_date3     TYPE i.
    Screen definition
    SELECTION-SCREEN  BEGIN OF BLOCK 1 WITH FRAME TITLE text-001.
    PARAMETERS: headfile     LIKE rfpdo1-febauszf OBLIGATORY,
                detsfile     LIKE rfpdo1-febauszf OBLIGATORY.
    SELECTION-SCREEN  END OF BLOCK 1.
    File selection
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR headfile.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          mask      = ',Multicash,*.txt'
          static    = 'X'
        CHANGING
          file_name = headfile.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR detsfile.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          mask      = ',Multicash,*.txt'
          static    = 'X'
        CHANGING
          file_name = detsfile.
    START-OF-SELECTION                                           *
    START-OF-SELECTION.
    Load files
      PERFORM load_files.
      PERFORM process_file.
    *&      Form  LOAD_FILES
          Load files from network to SAP
    FORM load_files .
    File upload
      DATA: l_filename TYPE string.
      l_filename = headfile.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename            = l_filename
          filetype            = 'ASC'
        TABLES
          data_tab            = t_header.
      IF sy-subrc <> 0.
      ENDIF.
      l_filename = detsfile.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename            = l_filename
          filetype            = 'ASC'
        TABLES
          data_tab            = t_details.
      IF sy-subrc <> 0.
      ENDIF.
    ENDFORM.                    " LOAD_FILES
    *&      Form  process_file
          Load files into Material Master
    FORM process_file .
      LOOP AT t_header.
        REFRESH bdcdata.
        PERFORM bdc_dynpro  USING 'SAPLMGMM'        '0060'.
        PERFORM bdc_field   USING 'RMMG1-MATNR'     t_header-matnr.
        PERFORM bdc_field   USING 'BDC_OKCODE'      '/00'.
        PERFORM bdc_dynpro  USING 'SAPLMGMM'        '0070'.
        PERFORM bdc_field   USING 'BDC_OKCODE'       '=SELA'.
        PERFORM bdc_dynpro  USING 'SAPLMGMM'        '0070'.
        PERFORM bdc_field   USING 'BDC_OKCODE'       '=ENTR'.
        PERFORM bdc_dynpro  USING 'SAPLMGMM'        '0080'.
        PERFORM bdc_field   USING 'RMMG1-WERKS'     t_header-werks.
        PERFORM bdc_field   USING 'BDC_OKCODE'      '=ENTR'.
        PERFORM bdc_dynpro  USING 'SAPLMGMM'        '4004'.
        PERFORM bdc_field   USING 'BDC_OKCODE'      '=SP12'.
        PERFORM bdc_dynpro  USING 'SAPLMGMM'        '4000'.
        PERFORM bdc_field   USING 'BDC_OKCODE'      '=PB42'.
        PERFORM bdc_dynpro  USING 'SAPLMD_MGD1'     '0010'.
       PERFORM bdc_field   USING 'SMDMA-BERID(01)' 'X'.
        PERFORM bdc_field   USING 'BDC_OKCODE'      '=AEND'.
        PERFORM bdc_dynpro  USING 'SAPLMD_MGD1'     '0020'.
        PERFORM bdc_field   USING 'BDC_OKCODE'      '=SP04'.
        CLEAR v_week.
        CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
          EXPORTING
            date = sy-datum
          IMPORTING
            week = v_week.
        CALL FUNCTION 'WEEK_GET_FIRST_DAY'
          EXPORTING
            week = v_week
          IMPORTING
            date = v_date1.
        LOOP AT t_details WHERE matnr = t_header-matnr.
          CLEAR: v_week1, v_week2.
          v_week1 = v_week.
          v_week  = t_details-priod.
          CALL FUNCTION 'WEEK_GET_FIRST_DAY'
            EXPORTING
              week = v_week
            IMPORTING
              date = v_date2.
          v_date3 = v_date1 - v_date2.
          v_page  = v_date3 / 7.
          IF v_page > 11.
            v_index = v_page MOD 11.
            v_page  = v_page / 11.
            COMPUTE v_count = TRUNC( v_page ).
          ELSE.
            v_index = v_page.
          ENDIF.
          IF v_index IS INITIAL.
            v_index = 11.
            v_count = v_count - 1.
          ELSE.
            v_index = v_index + 1.
          ENDIF.
    Paging
          IF v_count NE 0.
            v_count = v_count + 1.
            DO v_count TIMES.
              PERFORM bdc_dynpro  USING 'SAPLMD_MGD1'     '0020'.
              PERFORM bdc_field   USING 'BDC_OKCODE'      '=P-'.
            ENDDO.
            PERFORM bdc_dynpro  USING 'SAPLMD_MGD1'     '0020'.
            PERFORM bdc_field   USING 'BDC_OKCODE'      '=P++'.
            v_count = v_count - 1.
            DO v_count TIMES.
              PERFORM bdc_dynpro  USING 'SAPLMD_MGD1'     '0020'.
              PERFORM bdc_field   USING 'BDC_OKCODE'      '=P-'.
            ENDDO.
          ENDIF.
          PERFORM bdc_dynpro  USING 'SAPLMD_MGD1'     '0020'.
          v_field = 'RM03M_DB-KOVBW(*)'.
          REPLACE '*' WITH v_index INTO v_field.
          PERFORM bdc_field   USING v_field     t_details-muvbr.
          v_field = 'RM03M_DB-VBWRT(*)'.
          REPLACE '*' WITH v_index INTO v_field.
          PERFORM bdc_field   USING v_field     t_details-unvbr.
         PERFORM bdc_dynpro  USING 'SAPLMD_MGD1'     '0020'.
          PERFORM bdc_field   USING 'BDC_OKCODE'      '=WEIT'.
          PERFORM bdc_dynpro  USING 'SAPLMD_MGD1'     '0020'.
          PERFORM bdc_field   USING 'BDC_OKCODE'      '/00'.
          PERFORM bdc_dynpro  USING 'SAPLMD_MGD1'     '0020'.
          PERFORM bdc_field   USING 'BDC_OKCODE'      '=P++'.
        ENDLOOP.
        PERFORM bdc_dynpro  USING 'SAPLMD_MGD1'     '0020'.
        PERFORM bdc_field   USING 'BDC_OKCODE'      '=UEBE'.
        PERFORM bdc_dynpro  USING 'SAPLMD_MGD1'     '0010'.
        PERFORM bdc_field   USING 'BDC_OKCODE'      '=UEBE'.
        PERFORM bdc_dynpro  USING 'SAPLMGMM'        '4000'.
        PERFORM bdc_field   USING 'BDC_OKCODE'      '=BU'.
        DATA: ITAB TYPE TABLE OF BDCMSGCOLL.
        v_mode = 'N'.
        CALL TRANSACTION 'MM02' USING bdcdata
                       MODE   v_mode
                       UPDATE 'S'
                       MESSAGES INTO ITAB.
        if sy-subrc is initial.
        endif.
      ENDLOOP.
    ENDFORM.                    " process_file
    *&      Form  BDC_DYNPRO
          text
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.                    "BDC_DYNPRO
    *&      Form  BDC_FIELD
    FORM bdc_field USING fnam fval.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.                    "BDC_FIELD
    Can anyone help? Please!
    Thanks and regards,
    Fernanda

    You are trying to access one of the MRP area which is not yet assigned to CH01 plant. You need to make sure wheather the MRP view was already created for that material for CH01 plant.
    So, first check your data against the MARC for material and plant. If you don't fine any material for that plant than don't run BDC for that plant.
    Regards,
    Naimesh Patel

  • Validation error in BDC

    Hi friends,
    I am doing a BDC for F-03 and everything is working fine except when the the BDC is executed at background mode i.e N.
    It is working good at A and E but it gives a custom validation error at background processing.
    I am searching SDN since yesterday and found this is caused by S and W messages but i have diffused then but then too the error is encountered.
    No idea why my PROFIT CENTER value is not populated at BACKGROUND mode.
    Any ideas?
    Please help.
    Thanks much.

    Hi Park,
    If you have GUI objects like pop-up screens, etc it will not work. Check out these links for more information.
    Re: Docking container could not be created - while running batch job
    Re: Multiple OO ALV Container - Background Execution
    Thanks and Best Regards,
    Dinesh.

Maybe you are looking for