BDC with lots of validations and conversions

hi to all experts,
                       i need a sample  bdc program with lots of validations and conversion.
thanks

Hi,
REPORT  ZMMFTS01A_MAINTAIN_SOURCE_LIST NO STANDARD PAGE HEADING
        LINE-SIZE 250.
TABLES eord.
***Types Declaration
**Type of Upload File
TYPES : BEGIN OF ty_final,
         matnr(018),       "Material No
         werks(004),       "Plant
         vdatu(010),       "valid From
         bdatu(010),       "valid To
         lifnr(010),       "Vendor
         ekorg(004),       "Purchase Org
         reswk(004),       "Plant from which material is procured
         ebeln(010),       "Agreement
         ebelp(005),       "Item
         feskz(003),       "Fix
         notkz(003),       "Blk
         autet(003),       "MRP
        END OF ty_final.
**Type for Error Records
TYPES : BEGIN OF ty_errmsg,
         matnr(018),
         werks(004),
         vdatu(010),
         bdatu(010),
         lifnr(010),
         ekorg(004),
         reswk(004),
         ebeln(010),
         ebelp(005),
         feskz(003),
         notkz(003),
         autet(003),
         messg(200),
        END OF ty_errmsg.
**Type to get the existing no of records before comparison
TYPES : BEGIN OF ty_eord,
         matnr LIKE eord-matnr,
         werks LIKE eord-werks,
         erdat LIKE eord-erdat,
         vdatu LIKE eord-vdatu,
         bdatu LIKE eord-bdatu,
         lifnr LIKE eord-lifnr,
         flifn LIKE eord-flifn,
         ebeln LIKE eord-ebeln,
         ebelp LIKE eord-ebelp,
         febel LIKE eord-febel,
         reswk LIKE eord-reswk,
         notkz LIKE eord-notkz,
         ekorg LIKE eord-ekorg,
         autet LIKE eord-autet,
        END OF ty_eord.
**Type to get the no of records in the Database after comparison
TYPES : BEGIN OF ty_eord1,
         vdatu LIKE eord-vdatu,
         bdatu LIKE eord-bdatu,
        END OF ty_eord1.
***Data Declarations
DATA : v_repid    LIKE sy-repid,
       v_datfm    LIKE usr01-datfm,
       v_message(200),
       v_err_rec  TYPE i,
       v_errors   TYPE i,
       v_updated  TYPE i,
       v_matnr    TYPE matnr,
       v_lines    TYPE i,
       v_eord_row TYPE i,
       s_count(2) TYPE n,
       v_fnam(20) TYPE c,
       v_tabix(2) TYPE n,
       v_vdatu(10),
       v_bdatu LIKE eord-bdatu,
       v_datum(10),
       f_option type ctu_params.
****Begin of Changes by Pavan  Ticket 648507            "D13K948908
DATA : s_vdatu  TYPE sy-datum,
       s_bdatu  TYPE sy-datum.
****End of Changes By Pavan    Ticket 648507            "D13K948908
***Internal Tables Declaration
DATA : it_eord       TYPE STANDARD TABLE OF ty_eord    WITH HEADER LINE,    "Internal Table for Appending all the Rows of DB Table EORD
       it_bdcdata    TYPE STANDARD TABLE OF bdcdata    WITH HEADER LINE,   
       it_final      TYPE STANDARD TABLE OF ty_final   WITH HEADER LINE,   
       it_err_rec    TYPE STANDARD TABLE OF ty_final   WITH HEADER LINE,  
       it_messtab    TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE, 
       it_errmsg     TYPE STANDARD TABLE OF ty_errmsg  WITH HEADER LINE,   
       it_eord1      TYPE STANDARD TABLE OF ty_eord1   WITH HEADER LINE,   
       it_ctu_params TYPE STANDARD TABLE OF ctu_params WITH HEADER LINE.
DATA : wa_final LIKE LINE OF it_final.
***Constants
CONSTANTS : c_1  TYPE i VALUE '1',
            c_12 TYPE i VALUE '12',
            c_x         VALUE 'X'.
***Selection Screen
SELECTION-SCREEN : BEGIN OF BLOCK header WITH FRAME TITLE text-002.
SELECTION-SCREEN SKIP.
PARAMETERS  P_FNAME LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK header.
                 I N I L I T I A L I Z A T I O N                          *
INITIALIZATION.
  it_ctu_params-updmode = 'S'.
  it_ctu_params-defsize = 'X'.
  it_ctu_params-dismode = 'N'.
  APPEND it_ctu_params.
               A T   S E L E C T I O N   S C R E E N                      *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
  PERFORM file_get.
                S T A R T   O F   S E L E C T I O N                       *
START-OF-SELECTION.
  PERFORM upload_xcel.
  IF NOT it_final[] IS INITIAL.
    SORT it_final BY matnr werks lifnr ekorg reswk ebeln ebelp.
    DESCRIBE TABLE it_final LINES v_lines.
  ENDIF.
**To Know the Date Format for the user name in user master record
  SELECT SINGLE datfm FROM usr01
                      INTO v_datfm
                      WHERE bname = sy-uname.
**Updating the Database based on the Combinations of Vendor/PPL/Porg and Agreement/Item
  LOOP AT it_final.
*****Begin of Changes By Pavan   Ticket 648507            "D13K948908
    CLEAR : s_vdatu, s_bdatu.
    CONCATENATE it_final-vdatu6(4) it_final-vdatu0(2) it_final-vdatu+3(2) INTO s_vdatu.
    CONCATENATE it_final-bdatu6(4) it_final-bdatu0(2) it_final-bdatu+3(2) INTO s_bdatu.
    PERFORM plant_conversion USING it_final-werks.
*****End of Changes By Pavan     Ticket 648507            "D13K948908
    REFRESH it_eord[].
    v_matnr = it_final-matnr.
**Adding preceeding Zeroes to the Material No
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT  = v_matnr
      IMPORTING
        OUTPUT = v_matnr.
**Adding preceeding Zeroes to the Vendor
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT  = it_final-lifnr
      IMPORTING
        OUTPUT = it_final-lifnr.
**Adding preceeding Zeroes to the Item
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT  = it_final-ebelp
      IMPORTING
        OUTPUT = it_final-ebelp.
    TRANSLATE it_final-feskz TO UPPER CASE.
    TRANSLATE it_final-notkz TO UPPER CASE.
Select the Existing Records from EORD for the Combination of Material and Plant of New Record
    SELECT matnr
           werks
           erdat
           vdatu
           bdatu
           lifnr
           flifn
           ebeln
           ebelp
           febel
           reswk
           notkz
           ekorg
           autet FROM eord INTO corresponding fields of TABLE it_eord
                  WHERE matnr EQ v_matnr
                    AND werks EQ it_final-werks.
    SORT it_eord BY matnr werks vdatu bdatu erdat lifnr ekorg reswk ebeln ebelp.
    IF sy-subrc EQ 0.
      LOOP AT it_eord.
If the Combination of Old Records Vendor/PPL/Porg is same and Agreement/Item
is also same then delete the Old Record and Upload the New Record
        IF it_eord-MATNR = V_MATNR        AND
           it_eord-WERKS = IT_FINAL-WERKS AND
           it_eord-LIFNR = IT_FINAL-LIFNR AND
           it_eord-EKORG = IT_FINAL-EKORG AND
           it_eord-RESWK = IT_FINAL-RESWK AND
           it_eord-EBELN = IT_FINAL-EBELN AND
           it_eord-EBELP = IT_FINAL-EBELP.
*****Begin of Changes By Pavan   Ticket 648507            "D13K948908
          IF s_vdatu GT it_eord-bdatu OR s_bdatu LT it_eord-vdatu.
          ELSE.
*****End of Changes By Pavan     Ticket 648507            "D13K948908
            v_tabix = sy-tabix.
            PERFORM bdc_dynpro USING  'SAPLMEOR' '0200'.
            PERFORM bdc_field USING : 'EORD-MATNR' it_final-matnr,
                                      'EORD-WERKS' it_final-WERKS,
                                      'BDC_OKCODE' '/00'.
            PERFORM bdc_dynpro USING  'SAPLMEOR' '0205'.
            CONCATENATE 'RM06W-SELKZ(' v_tabix ')'  INTO v_fnam.
            PERFORM bdc_field USING : v_fnam 'X'.
            PERFORM bdc_field  USING 'BDC_OKCODE' '=LOES'.
            PERFORM bdc_dynpro USING 'SAPLSPO1'   '0200'.
            PERFORM bdc_field  USING 'BDC_OKCODE' '=YES'.
            PERFORM bdc_dynpro USING  'SAPLMEOR' '0205'.
            PERFORM bdc_field  USING 'BDC_OKCODE' '=BU'.
          ENDIF.
        ELSE.
If the Combination of Old Records Vendor/PPL/Porg is same and Agreement/Item
is different, if the FIX of the Existing one is X and also the FIX of the New one
is X then deselect the FIX of the Old one, if the MRP of the Old one is 1 and also
the MRP of the New one is 1 then delete the MRP of the Old one, if the FIX and MRP
of the Old one is X,1 and if it is same for the new one also, then delete the FIX
and MRP of the Old one and insert the new one also
          IF it_eord-lifnr = it_final-lifnr AND
             it_eord-ekorg = it_final-ekorg AND
             it_eord-reswk = it_final-reswk AND
             it_eord-ebeln NE '' AND it_final-ebeln NE ''.
            IF it_eord-ebeln NE it_final-ebeln OR it_eord-ebelp NE it_final-ebelp.
              IF it_eord-febel EQ 'X' OR it_eord-autet EQ '1'.
                v_tabix = sy-tabix.
                IF it_final-feskz = 'X' AND it_final-autet = '1'.
               it_eord-febel = ''.
               it_eord-autet = ''.
*****Begin of Changes By Pavan   Ticket 648507            "D13K948908
                  IF s_vdatu GT it_eord-bdatu OR s_bdatu LT it_eord-vdatu.
                  ELSE.
*****End of Changes By Pavan     Ticket 648507            "D13K948908
                    PERFORM bdc_dynpro USING  'SAPLMEOR' '0200'.
                    PERFORM bdc_field USING : 'EORD-MATNR' it_final-matnr,
                                     'EORD-WERKS' it_final-WERKS,
                                     'BDC_OKCODE' '/00'.
                    PERFORM bdc_dynpro USING  'SAPLMEOR' '0205'.
                    CONCATENATE 'RM06W-FESKZ(' v_tabix ')'  INTO v_fnam.
                    PERFORM bdc_field1 USING : v_fnam SPACE.
                    CONCATENATE 'EORD-AUTET(' v_tabix ')'  INTO v_fnam.
                    PERFORM bdc_field1 USING : v_fnam SPACE.
                    PERFORM bdc_field  USING 'BDC_OKCODE' '=BU'.
                  ENDIF.
                ELSEIF
                 it_final-feskz = 'X'.
               it_eord-febel = ''.
*****Begin of Changes By Pavan   Ticket 648507            "D13K948908
                  IF s_vdatu GT it_eord-bdatu OR  s_bdatu LT it_eord-vdatu.
                  ELSE.
*****End of Changes By Pavan     Ticket 648507            "D13K948908
                    PERFORM bdc_dynpro USING  'SAPLMEOR' '0200'.
                    PERFORM bdc_field USING : 'EORD-MATNR' it_final-matnr,
                                     'EORD-WERKS' it_final-WERKS,
                                     'BDC_OKCODE' '/00'.
                    PERFORM bdc_dynpro USING  'SAPLMEOR' '0205'.
                    CONCATENATE 'RM06W-FESKZ(' v_tabix ')'  INTO v_fnam.
                    PERFORM bdc_field1 USING : v_fnam SPACE.
                    PERFORM bdc_field  USING 'BDC_OKCODE' '=BU'.
                  ENDIF.
                ELSEIF
                 it_final-autet = '1'.
               it_eord-autet  = ''.
*****Begin of Changes By Pavan   Ticket 648507            "D13K948908
                  IF s_vdatu GT it_eord-bdatu OR  s_bdatu LT it_eord-vdatu.
                  ELSE.
*****End of Changes By Pavan     Ticket 648507            "D13K948908
                    PERFORM bdc_dynpro USING  'SAPLMEOR' '0200'.
                    PERFORM bdc_field USING : 'EORD-MATNR' it_final-matnr,
                                     'EORD-WERKS' it_final-WERKS,
                                     'BDC_OKCODE' '/00'.
                    PERFORM bdc_dynpro USING  'SAPLMEOR' '0205'.
                    CONCATENATE 'EORD-AUTET(' v_tabix ')'  INTO v_fnam.
                    PERFORM bdc_field1 USING : v_fnam SPACE.
                    PERFORM bdc_field  USING 'BDC_OKCODE' '=BU'.
                  ENDIF.
                ENDIF.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
        CLEAR it_eord.
        IF NOT it_bdcdata[] IS INITIAL.
          CALL TRANSACTION 'ME01' USING it_bdcdata
                                  OPTIONS FROM it_ctu_params.
          REFRESH it_bdcdata[].
          EXIT.
        ENDIF.
      ENDLOOP.
    ENDIF.
      ENDIF.
    CLEAR : v_matnr, it_final.
  ENDLOOP.
  REFRESH : it_eord[].
  FREE it_eord.
**Updating the Records of Upload File into ME01
  LOOP AT it_final INTO wa_final.
    it_final = wa_final.
    CLEAR v_matnr.
    TRANSLATE it_final-feskz TO UPPER CASE.
    TRANSLATE it_final-notkz TO UPPER CASE.
*****Begin of Changes By Pavan   Ticket 648507            "D13K948908
    PERFORM plant_conversion USING wa_final-werks.
*****End of Changes By Pavan     Ticket 648507            "D13K948908
**To convert the Valid From and Valid To into User's Format
    CASE v_datfm.
      WHEN 1.
        CONCATENATE it_final-vdatu3(2) '.' it_final-vdatu0(2) '.' it_final-vdatu+6(4) INTO it_final-vdatu.
        CONCATENATE it_final-bdatu3(2) '.' it_final-bdatu0(2) '.' it_final-bdatu+6(4) INTO it_final-bdatu.
      WHEN 2.
        CONCATENATE it_final-vdatu0(2) '/' it_final-vdatu3(2) '/' it_final-vdatu+6(4) INTO it_final-vdatu.
        CONCATENATE it_final-bdatu0(2) '/' it_final-bdatu3(2) '/' it_final-bdatu+6(4) INTO it_final-bdatu.
      WHEN 3.
        CONCATENATE it_final-vdatu0(2) '-' it_final-vdatu3(2) '-' it_final-vdatu+6(4) INTO it_final-vdatu.
        CONCATENATE it_final-bdatu0(2) '-' it_final-bdatu3(2) '-' it_final-bdatu+6(4) INTO it_final-bdatu.
      WHEN 4.
        CONCATENATE it_final-vdatu6(4) '.' it_final-vdatu0(2) '.' it_final-vdatu+3(2) INTO it_final-vdatu.
        CONCATENATE it_final-bdatu6(4) '.' it_final-bdatu0(2) '.' it_final-bdatu+3(2) INTO it_final-bdatu.
      WHEN 5.
        CONCATENATE it_final-vdatu6(4) '/' it_final-vdatu0(2) '/' it_final-vdatu+3(2) INTO it_final-vdatu.
        CONCATENATE it_final-bdatu6(4) '/' it_final-bdatu0(2) '/' it_final-bdatu+3(2) INTO it_final-bdatu.
      WHEN 6.
        CONCATENATE it_final-vdatu6(4) '-' it_final-vdatu0(2) '-' it_final-vdatu+3(2) INTO it_final-vdatu.
        CONCATENATE it_final-bdatu6(4) '-' it_final-bdatu0(2) '-' it_final-bdatu+3(2) INTO it_final-bdatu.
***End of Changes by Pavan                       "D13K945062
      WHEN 'A'.
        CONCATENATE it_final-vdatu6(4) '/' it_final-vdatu3(2) '/' it_final-vdatu+0(2) INTO it_final-vdatu.
        CONCATENATE it_final-bdatu6(4) '.' it_final-bdatu3(2) '.' it_final-bdatu+0(2) INTO it_final-bdatu.
      WHEN 'B'.
        CONCATENATE it_final-vdatu6(4) '/' it_final-vdatu3(2) '/' it_final-vdatu+0(2) INTO it_final-vdatu.
        CONCATENATE it_final-bdatu6(4) '.' it_final-bdatu3(2) '.' it_final-bdatu+0(2) INTO it_final-bdatu.
      WHEN 'C'.
        CONCATENATE it_final-vdatu6(4) '/' it_final-vdatu3(2) '/' it_final-vdatu+0(2) INTO it_final-vdatu.
        CONCATENATE it_final-bdatu6(4) '.' it_final-bdatu3(2) '.' it_final-bdatu+0(2) INTO it_final-bdatu.
    ENDCASE.
      AT NEW werks.
    CLEAR s_count.
    REFRESH : it_bdcdata[], it_eord1[].
    PERFORM bdc_dynpro USING  'SAPLMEOR' '0200'.
    PERFORM bdc_field USING : 'EORD-MATNR' it_final-matnr,
                              'EORD-WERKS' it_final-WERKS,
                              'BDC_OKCODE' '/00'.
    PERFORM bdc_dynpro USING  'SAPLMEOR' '0205'.
**Adding preceeding Zeroes to the Material No
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT  = it_final-matnr
      IMPORTING
        OUTPUT = v_matnr.
**To know the Number of records in EORD after Updating with new records
    SELECT vdatu
           bdatu FROM EORD
                 INTO TABLE it_eord1
                 WHERE matnr = v_matnr
                   AND werks = it_final-werks.
    DESCRIBE TABLE it_eord1 LINES v_eord_row.
    s_count = v_eord_row + 1.
      ENDAT.
    CONCATENATE 'EORD-VDATU(' s_count ')'  INTO v_fnam.
    PERFORM bdc_field USING : v_fnam it_final-VDATU.
    CONCATENATE 'EORD-BDATU(' s_count ')'  INTO v_fnam.
    PERFORM bdc_field USING : v_fnam it_final-BDATU.
    CONCATENATE 'EORD-EKORG(' s_count ')'  INTO v_fnam.
    PERFORM bdc_field USING : v_fnam  it_final-EKORG.
    CONCATENATE 'EORD-LIFNR(' s_count ')'  INTO v_fnam.
    PERFORM bdc_field USING : v_fnam it_final-LIFNR.
    CONCATENATE 'EORD-RESWK(' s_count ')'  INTO v_fnam.
    PERFORM bdc_field USING : v_fnam it_final-RESWK.
    CONCATENATE 'EORD-EBELN(' s_count ')'  INTO v_fnam.
    PERFORM bdc_field USING : v_fnam it_final-EBELN.
    CONCATENATE 'EORD-EBELP(' s_count ')'  INTO v_fnam.
    PERFORM bdc_field USING : v_fnam it_final-EBELP.
    CONCATENATE 'RM06W-FESKZ(' s_count ')' INTO v_fnam.
    PERFORM bdc_field USING : v_fnam it_final-FESKZ.
    CONCATENATE 'EORD-NOTKZ(' s_count ')'  INTO v_fnam.
    PERFORM bdc_field USING : v_fnam it_final-NOTKZ.
    CONCATENATE 'EORD-AUTET(' s_count ')'  INTO v_fnam.
    PERFORM bdc_field USING : v_fnam it_final-AUTET.
     AT END OF werks.
    PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.
    REFRESH it_messtab[].
    CALL TRANSACTION 'ME01' USING it_bdcdata
                            OPTIONS FROM it_ctu_params
                                MODE 'A'
                              UPDATE 'L'
                         MESSAGES INTO it_messtab.
    IF SY-SUBRC NE 0.
      it_err_rec-matnr = it_final-matnr.
      it_err_rec-werks = it_final-werks.
      it_err_rec-vdatu = it_final-vdatu.
      it_err_rec-bdatu = it_final-bdatu.
      it_err_rec-lifnr = it_final-lifnr.
      it_err_rec-ekorg = it_final-ekorg.
      it_err_rec-reswk = it_final-reswk.
      it_err_rec-ebeln = it_final-ebeln.
      it_err_rec-ebelp = it_final-ebelp.
      it_err_rec-feskz = it_final-feskz.
      it_err_rec-notkz = it_final-notkz.
      it_err_rec-autet = it_final-autet.
      APPEND it_err_rec.
      CLEAR it_err_rec.
      PERFORM format_message.
    ENDIF.
     ENDAT.
  ENDLOOP.
**To Upload the Error Records into another Excel File
  IF NOT it_err_rec[] IS INITIAL.
    PERFORM errors_file.
    DESCRIBE TABLE it_err_rec LINES v_err_rec.
    v_errors = v_err_rec - 1.
  ELSE.
    v_errors = 0.
  ENDIF.
  v_updated = v_lines - v_errors.
  WRITE : /2 'RUN DATE    :' color COL_NORMAL, 20 sy-datum,
          /2 'RUN TIME    :' color COL_NORMAL, 20 sy-uzeit.
  SKIP 2.
  WRITE : /2 'FILE PATH   :' color COL_NORMAL, 20 p_fname.
  SKIP 2.
  WRITE : /2 'RESULTS' color COL_NORMAL.
  SKIP.
  WRITE : /2 'Number of Rows in the Upload File  :' color COL_NORMAL, v_lines,
          /2 'Number of Rows Updated             :' color COL_NORMAL, v_updated,
          /2 'Number of Error Records            :' color COL_NORMAL, v_errors.
  IF it_errmsg[] IS NOT INITIAL.
    SKIP 2.
    WRITE : /2 'Details of the Error Records' color COL_NORMAL.
    SKIP.
    ULINE.
    FORMAT COLOR COL_NORMAL.
    WRITE : /2 'Material',
            22 'Plant',
            28 'Valid From',
            40 'Valid To',
            52 'Vendor',
            64 'Porg',
            70 'PPL',
            76 'Agreement',
            88 'Item',
            94 'Fix',
            98 'Blk',
            102 'MRP',
            106 'Err. Description'.
    FORMAT COLOR OFF.
    ULINE.
    LOOP AT it_errmsg.
      AT NEW autet.
        WRITE : /2 it_errmsg-matnr,
                22 it_errmsg-werks,
                28 it_errmsg-vdatu,
                40 it_errmsg-bdatu,
                52 it_errmsg-lifnr,
                64 it_errmsg-ekorg,
                70 it_errmsg-reswk,
                76 it_errmsg-ebeln,
                88 it_errmsg-ebelp,
                94 it_errmsg-feskz,
                98 it_errmsg-notkz,
                102 it_errmsg-autet.
      ENDAT.
      WRITE    106 it_errmsg-messg.
    ENDLOOP.
  ENDIF.
                 E N D   O F   S E L E C T I O N                     *
END-OF-SELECTION.
*&      Form  file_get
      Selects the File Name and Path
FORM file_get .
  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      PROGRAM_NAME  = v_repid
      DYNPRO_NUMBER = SYST-DYNNR
      FIELD_NAME    = p_fname
    CHANGING
      FILE_NAME     = p_fname
    EXCEPTIONS
      MASK_TOO_LONG = 1
      OTHERS        = 2.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " file_get
*&      Form  upload_xcel
      Uploading data to an Internal Table
FORM upload_xcel .
  DATA: BEGIN OF it_intern OCCURS 0.
          INCLUDE STRUCTURE ALSMEX_TABLINE. " Rows for Table with Excel Data
  DATA: END OF it_intern.
  DATA v_no_rows  TYPE i VALUE 9999.
  FIELD-SYMBOLS : <fs1>.
  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      FILENAME                = P_FNAME
      I_BEGIN_COL             = c_1
      I_BEGIN_ROW             = c_1
      I_END_COL               = c_12
      I_END_ROW               = v_no_rows
    TABLES
      INTERN                  = it_intern
    EXCEPTIONS
      INCONSISTENT_PARAMETERS = 1
      UPLOAD_OLE              = 2
      OTHERS                  = 3.
  IF SY-SUBRC NE 0.
    MESSAGE text-016 TYPE 'I'.
  ENDIF.
  LOOP AT it_intern.
    ASSIGN COMPONENT it_intern-col OF STRUCTURE
    it_final TO <fs1>.
    IF sy-subrc NE 0.
      EXIT.
    ENDIF.
    <fs1> = it_intern-value.
    AT END OF row.
      APPEND it_final.
      CLEAR  it_final.
    ENDAT.
  Endloop.
  FREE it_intern.
***To Delete the Headings from the Internal Table.
  DELETE it_final WHERE matnr CA 'MATmat'.
ENDFORM.                    " upload_xcel
*&      Form  bdc_dynpro
      Populate Screen Name
FORM bdc_dynpro  USING    PROGRAM
                          DYNPRO.
  CLEAR it_bdcdata.
  it_bdcdata-PROGRAM  = PROGRAM.
  it_bdcdata-DYNPRO   = DYNPRO.
  it_bdcdata-DYNBEGIN = 'X'.
  APPEND it_bdcdata.
ENDFORM.                    " bdc_dynpro
*&      Form  bdc_field
     Populate Screen Field
FORM bdc_field  USING    FNAM
                         FVAL.
  IF FVAL <> SPACE.
    CLEAR it_bdcdata.
    it_bdcdata-FNAM = FNAM.
    it_bdcdata-FVAL = FVAL.
    APPEND it_bdcdata.
  ENDIF.
ENDFORM.                    " bdc_field
*&      Form  bdc_field
     Populate Screen Field
FORM bdc_field1   USING   FNAM
                         FVAL.
  CLEAR it_bdcdata.
  it_bdcdata-FNAM = FNAM.
  it_bdcdata-FVAL = FVAL.
  APPEND it_bdcdata.
ENDFORM.                    " bdc_field
*&      Form  errors_file
      Downloads the Error Records
FORM errors_file .
  DATA : l_fname  TYPE string,
         l_var1   TYPE string,
         l_var2   TYPE string.
  l_fname = p_fname.
  SPLIT l_fname at '.' into l_var1 l_var2.
  CONCATENATE l_var1 '_error.' l_var2 INTO l_fname.
**To Write the Headings in the Excel File
  it_err_rec-matnr = text-003.
  it_err_rec-werks = text-004.
  it_err_rec-vdatu = text-005.
  it_err_rec-bdatu = text-006.
  it_err_rec-lifnr = text-007.
  it_err_rec-ekorg = text-008.
  it_err_rec-reswk = text-009.
  it_err_rec-ebeln = text-010.
  it_err_rec-ebelp = text-011.
  it_err_rec-feskz = text-012.
  it_err_rec-notkz = text-013.
  it_err_rec-autet = text-014.
  INSERT it_err_rec INDEX 1.
  CLEAR it_err_rec.
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      FILENAME                = l_fname
      FILETYPE                = 'DAT'
     APPEND                  = ' '
     CONFIRM_OVERWRITE       = ' '
    TABLES
      DATA_TAB                = it_err_rec
    EXCEPTIONS
      FILE_WRITE_ERROR        = 1
      NO_BATCH                = 2
      GUI_REFUSE_FILETRANSFER = 3
      INVALID_TYPE            = 4
      NO_AUTHORITY            = 5
      UNKNOWN_ERROR           = 6
      HEADER_NOT_ALLOWED      = 7
      SEPARATOR_NOT_ALLOWED   = 8
      FILESIZE_NOT_ALLOWED    = 9
      HEADER_TOO_LONG         = 10
      DP_ERROR_CREATE         = 11
      DP_ERROR_SEND           = 12
      DP_ERROR_WRITE          = 13
      UNKNOWN_DP_ERROR        = 14
      ACCESS_DENIED           = 15
      DP_OUT_OF_MEMORY        = 16
      DISK_FULL               = 17
      DP_TIMEOUT              = 18
      FILE_NOT_FOUND          = 19
      DATAPROVIDER_EXCEPTION  = 20
      CONTROL_FLUSH_ERROR     = 21
      OTHERS                  = 22.
  IF SY-SUBRC EQ 0.
    MESSAGE text-015 TYPE 'S'.
  ENDIF.
ENDFORM.                    " errors_file
*&      Form  format_message
      To Write the Error Records
FORM format_message .
  IF NOT it_messtab[] IS INITIAl.
    LOOP AT it_messtab.
      IF it_messtab-msgtyp = 'E'.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            ID        = it_messtab-msgid
            LANG      = sy-langu
            NO        = it_messtab-msgnr
            V1        = it_messtab-msgv1
            V2        = it_messtab-msgv2
            V3        = it_messtab-msgv3
            V4        = it_messtab-msgv4
          IMPORTING
            MSG       = v_message
          EXCEPTIONS
            NOT_FOUND = 1
            OTHERS    = 2.
        IF SY-SUBRC EQ 0.
          it_errmsg-matnr = it_final-matnr.
          it_errmsg-werks = it_final-werks.
          it_errmsg-vdatu = it_final-vdatu.
          it_errmsg-bdatu = it_final-bdatu.
          it_errmsg-ekorg = it_final-ekorg.
          it_errmsg-lifnr = it_final-lifnr.
          it_errmsg-reswk = it_final-reswk.
          it_errmsg-ebeln = it_final-ebeln.
          it_errmsg-ebelp = it_final-ebelp.
          it_errmsg-feskz = it_final-feskz.
          it_errmsg-notkz = it_final-notkz.
          it_errmsg-autet = it_final-autet.
          it_errmsg-messg = v_message.
          APPEND it_errmsg.
          CLEAR : it_errmsg, v_message.
        ENDIF.
      ENDIF.
    ENDLOOP.
  ENDIF.
ENDFORM.                    " format_message
*&      Form  plant_conversion
     Adding preceeding Zeroes
     -->P_IT_FINAL_WERKS  text
FORM plant_conversion  USING    P_VAR.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT  = P_VAR
      IMPORTING
        OUTPUT = P_VAR.
ENDFORM.                    " plant_conversion
Hope it helps!!!
Regards,
Pavan

Similar Messages

  • My iPad colors are fuzzy with lots of reds and purples.  Did this once before and cleared up.  This time it won't clear up.  Any suggestion?

    My iPad colors are fuzzy with lots of reds and purples.  Looks like my digital camera when it needs to be recharged if that helps describe the issue.  Can anyone help?

    Next step is to back up and restore via iTunes. If the problem continues, restore as a new device and test. If the problem is solved, there is some kind of corruption in your backup file. If it continues, take it to an Apple store for evaluation of a possible hardware problem.

  • I submitted my podcast and I got an email saying error, I checked with the feed validator and got this message: This feed does not validate. line 40, column 6: Undefined item element: itunes:order, how do sort this out, someone help me please.

    I submitted my podcast and I got an email saying error, I checked with the feed validator and got this message: This feed does not validate. line 40, column 6: Undefined item element: itunes:order, how do sort this out, someone help me please.

    Ignore it. 'itunes:order' is a recent addition which FeedValidator doesn't know about. If your podcast is rejected that is unlikely to be the reason. Of course as you haven't posted the feed URL nor the text of the error message I can't make any further comment.

  • FCPX editing on internal or external drive for small media files with lots of layers and compositing ?

    I am upgrading my mid 2012 MBP with an internal SSD. I have16 RAM. OS is Mavericks.
    I edit videos using a mix of photos (imported layers via photoshop), short animations, short video clips. I do some very basic stop animation also. So each media file is not heavy (photos, pics, short videos), but I do a lot of layering and compositing in FCPX.  I had a lot of delays and freezes with 5400 rpm HDD… so I decided to upgrade to SSD.
    Some people have told me to edit it all on my internal SSD as the media files are not big..
    Everywhere else on the web I read that all media / libraries should be on an external while I edit them. But most of these contributors are using huge video files, HD, which is not my case.
    So – with small media files but lots of editing and effects  / animation, should I spend the extra money on a good external 7200 rpm USB3 to edit from ? Or just use external drive for storage and not editing.
    Not going for TB as I read there would not be a difference between USB3 and TB on a 7200 rpm external drive (difference is felt when using RAID, r SSD external)
    Thanks!

    I uses external SSD Thunderbolt for my all my editing stuff. I make small projects and only keeps one library at a time on my external drive. When finished I backup the library to another big external. I would strongly recommend external SSD Thunderbolt such as LaCie Rugged 256 GB or 128 GB. I use this setup with my Mac Pro late 2013. I never edit from internal. You could also go for RAID with 4 disks but that might be an overkill.

  • Add any Video with a Video import and conversion system with choose skin

    Would be great to have a drag and drop video system where Muse takes care of the required formats and resolution conversions for HTML5 and redundancy player for old browsers.
    The current embedding system has massive downsides because lots of large blue chip companies block most video hosting sites like vimeo and Your Tube.
    Also these sorts of embedded players can distract viewers off your page when they finnish with links to other videos.

    You might want to try MPEG Streamclip (it's free) to convert the video; it is available here:
    http://www.squared5.com/svideo/mpeg-streamclip-mac.html
    I can't comment on your 1.83 GHz/iMovie 09 dilemma except to guess it may work but would be excruciatingly slow (my 2.16 GHz is slow!).

  • Rqmt to create a PG with lots of fixed and some variable text, not a report

    Hi, I have a requirement where I have to create a custom page which has lots of long lines of text(fixed) in paragraphs, with in between some data which needs to be populated from database tables. It is not a report but a custom page that is needed. I am new to OA Framework, so I was having trouble identifying which region styles or items to use, and how to proceed with it. Could anyone please help me out.

    user645399 wrote:
    Thank You so much for the valuable feedback.
    My agency requires some reports to be generated at a certain interval, after a certain type of batch load. A few different types of reports will be generated and usually we have scripts which we run to generate the necessary tables and extract the reports from there. We retain the tables for verification purpose as it stores some valuable status of some customers and so on, which we will not be able to generate again easily. The table will have around 50,000 - 100,000 records averagely. Sometimes more.
    I am automating the process now as per client's request.
    So, I thought of using the same script to automate it in the web. For table name we usually changed them manually.
    Now, when the user runs, he or she have to give them table name/ report name.
    I thought of concatinating the sysdate and report name but what if there is a problem and the user runs it for a second time?
    Unless I have a separate part of the coding to take care of this issue.
    Please advice if there is an alternative.
    Thank You Very Much.
    Cheers!
    NithyaSo why is it necessary to create a table just to create a report?
    You really, really need to rethink this entire process from the beginning, not just try to shoehorn in something from a current, astoundingly bad, design.

  • We just bought our boys iPad minis.  We have a "family ipad" now with lots of music and apps the boys love.  Will syncing them to icloud cause a nightmare with calendars, music, and emails etc being shared?

    We just bought our children 2 ipad minis.  We have a "family ipad" now that contains lots of their apps, music, books etc.  I am afraid to connect the minis to icloud for fear they will also sync our calendars, email, etc.  Does anyone have experience with a family using icloud and do you recommend starting over with everyone having their own account or merging the family?

    Welcome to the Apple Community.
    To begin with, I would like to try to explain Apple's confusing nomenclature in regard to iCloud.
    Apple have called the whole cloud thing iCloud, there are a number of features under the iCloud umbrella, some of which require their own login. iTunes is one of these, another is what Apple have unfortunately also called iCloud too.
    You can use the same Apple ID (account) to login to both iCloud and iTunes, but you don't need to and often users will login to each service using a different ID.
    The part that you need to remember is that the services available when you log into iCloud are completely different and unrelated to those when you log in to iTunes. Your iCloud login enables mail, contacts, calendars, find my phone, Back to My Mac, Documents & Data sharing and photostream, it does not affect any of your iTunes services.

  • MSI P965 + C2D E6400 - New PC with lots of Errors and Restart Randomly

    My System:
    CPU:      Intel C2D E6400
    MOBO:   MSI P965 NEO-F
    BIOS Ver:   1.5
    RAM:      TWINMOS 5300/667 DDR2 – 2x 512MB
    HD:      Seagate 160GB SATA II
    VIDEO:   ASUS EN7600GT
    PSU:      ACBEL I-Power 550w with Active PFC
    OS:      Win XP Pro SP2
    NO OVER-CLOCKING!
    My Problem
    Immediately after installation, my will have lots of citrical errors and many times, the monitor just went blank and PC restart.
    What I have done:
    Updated BIOS to 1.6. THE SAME PROBLEM.
    I suspect that it was the RAM, so using only 1x 512MB RAM, that system was Stable. (For Both my RAM – thus, RAM was good)
    That makes me suspect that the MOBO. So I place Both the RAM from DIMM Slot 1 & 3 to Slot 2 & 4. The System was Stable.
    Back to Slot 1 & 3, THE SAME PROBLEM.
    To me, confirmed MOBO faulty and went to change the MOBO.
    With the NEW MOBO (same model), THE SAME PROBLEM.
    Now I am running my System with RAM in Slot 2 & 4 for 1 week and the System is Stable.
    Can someone advise me what the problem? What if in the future I need to add more RAM?
    Thanks

    Quote from: Blazer on 29-December-06, 09:50:59
    increase your ddr voltage, run memtest86+ and correct all memory errors.
    list your power supply specs from label on psu.
    Active PFC   550 Watts
    Voltage      Min      Max
    +5V         1.0A      30.0A
    +3.3V         0.5A      28.0A
    +12V1         1.0A      12.0A
    +12V2         1.0A      22.0A
    +12V3         1.0A      14.0A
    -12V         0.0A      1.0A
    +5Vs         0.05A      2.0A

  • BAPI,BADI ,BDC,ALE ,IDOC,USER EXIT,VALIDATION AND SMART FORMS.

    Dear Experts,
    I am pretty new in BAPI,BADI ,BDC,ALE ,IDOC,USER EXIT,VALIDATION AND SMART FORMS.
    Pls let me know for these topics shall i put the question in this community or should i put in any other form. Pl suggest me .
    Regards
    Shivas

    Plz SEARCH in SCN before posting ,you will get lot of posts .
    Don't use all caps in the subject line

  • I've recently been given a macbook pro from uni, with lots of adobe software on. I want to pair it with my iMac which has music etc and is it possible to get the software to the imac and the files to the macbook?Giving me the best of both :-)

    I've recently been given a macbook pro from uni, with lots of adobe software on. I want to pair it with my iMac which has music etc and is it possible to get the software to the imac and the files to the macbook?Giving me the best of both :-)

    You would need the original installation disks or files for the Adobe software to get it onto your iMac, and having it on two computers may not be allowed by your university's licensing. Talk to whoever issued the MacBook.
    As to the music, just copy it over to the MacBook, either via Home Sharing, file sharing, or an external storage medium (hard drive, USB flash drive, etc.).
    Regards.

  • Apple changed my Apple ID to the email address associated with my iTunes account. I now can no longer access my account because the old user name is no longer valid and has no password. I have been on the phone with tech support for hours trying to fix.

    Apple changed my Apple ID to the email address associated with my iTunes account. I now can no longer access my account because the old user name is no longer valid and has no password. I have been on the phone with tech support for hours trying to fix this. I can not update any of the apps associated with that user name.

    Is this itunes on the iPad or on my computer? Thank you for the reply.

  • Hello i can  not  i use my account on the applewill   store , i hope that yu help  me with a lot of thanks and wait reply to this massege

    hello i can not i use my account  on the apple store  , i hope  that yu will  help me  with  a  lot  of thanks and wait  reply to this message

    Go through the below link.
    http://support.apple.com/kb/ts2446
    If the above link doesn't helps then contact APple support and they will help you Enable your Apple Id from their End : http://support.apple.com/kb/he57

  • IPad 1 Safari Crashes Constantly and getting worse day by day.  Has Apple come up with a solution?  Now I am hearing its alos happening on the newer models.  My company is about to buy a lot of tablets and I will not recommend Apple anything til they fix.

    iPad 1 Safari Crashes Constantly and getting worse day by day.  Has Apple come up with a solution?  Now I am hearing its also happening on the newer models.  My company is about to buy a lot of tablets and I will not recommend Apple anything until they fix the problem.  Granted 30 or 40 iPads is not a huge impact but i promise once the outside world hears about this BS things will change.  There are plenty of other tablets out there that do not have this problem.  At the very least we should have the option of rolling back to a stable IOS...

    I have already tried all the things mentioned above as well as other things such as other browsers etc.  Its is obviously a problem with the hardware.  I also borrowed a brand new 4th gen iPad and it does the same thing.  Even after upgrading it to 6.01.  An occasional crash is one thing and can easily be waved off but this is clearly systemic and the problem appears to be related to graphical images and videos.  Both iPads are the 64gb versions, the only difference other than model is the iPad 1 has ATT cellular.  The new version is clean i.e no other APPs loaded other than what came with it.  I have 7 more coming but im seriously considering sending them back in favor of an Android tablet or the MS Surface.

  • I'm trying to install iCloud on my PC running Windows Vista with Service Pack 2 and I get a message that the set up program is not a valid win32 file.

    I'm trying to install iCloud on my PC running Windows Vista with Service Pack 2 and I get a message that the set up program is not a valid win32 file. Can anyone help me with this?

    What is the exact error message?

  • TS1587 Hello, I downloaded an ntfs systemfile from tuxera and used it to convert a usb stick, my imac froze a while after so I turned it off the on and now I have blue vertical lines on boot up and the a white screen with lots of tine blue symbols, need h

    Hello, I downloaded an ntfs systemfile from tuxera and used it to convert a usb stick so I could put more than the fat32 4gb on, my Imac froze a while after so I turned it off the on and now I have blue vertical lines on boot up and the a white screen with lots of tine blue symbols after, mouse pointer moves but thats about it.
    Have used R and cmd to get a menu up but once I choose one of the four options my mouse is rendered useless and I cant get any further, have downloaded, to another usb stick recovery disk assisstant and am trying to use that in conjunction with the lion option on the previously mentioned screen, computer was responding really slowly and has now frozen on the terms of software license agreement (maybe the last hurdle!) can anyone pleeeeeease help!!!!!??????

    It's likely that the boot drive is failing, or that there's some other hardware fault. Run the Apple Hardware Test.
    Intel-based Macs: Using Apple Hardware Test
    Even if the test is negative, you should make a "Genius" appointment at an Apple Store to have the machine tested more thoroughly.

Maybe you are looking for

  • Adobe Media Encoder CS5 crashes at a certain point while rendering

    Adobe Media Encoder CS5 crashes at a certain point while rendering, I have also tried to render directly from Premiere Pro but this only makes PremPro crash instead. The clip I am trying to render right now is 20 mins long, 1600x900 and is a .avi fil

  • Terms of payment: 85 days. 10 & 25

    Dear all, I need to create a new terms of payment for Spain: "85 days. 10 & 25". No problem to create it, but with days 6 and/or 7 of each month it doesn't work propertly. Depending on the days of each month. I created it in the following way: Day li

  • HP Photosmart C4380 [8A36CB] communicat​ion error with MacBook OS 10.7.5 over wireless

    Hi, I keep getting the message 'communication error' when trying to print wireless to a Photosmart C4380 from my MacBook (OS 10.7.5) through a TimeCapsule 2Gb router. The message also says: "/usr/libexec/cups/backend/dnssd failed" but I don't know wh

  • Not currently available in the U.S. Store - only on Wi-fi connection?

    Hi All, I have an issue with access to iTunes and App Store when connected via wi-fi. The error that says "The item you have requested is not currently available in the U.S. Store". The strange thing is that if I switch off wi-fi and connect via 3G i

  • How to raise IP profile and improve BB speed?

    Hello, my BB speed is much slower than I would like; i ran the tests and found the following: Download speedachieved during the test was - 3.82 Mbps  For your connection, the acceptable range of speeds is 0.6 Mbps-7.15 Mbps.  Additional Information: