Upload into Database

Hi, I'm trying to find out how the PL/SQL "procedure upload" actually uploads a file from a users hard disk into a remote database. I presume this doesn't use ftp, but some other mechanism. Can anyone shed any light on this please?
TIA - Julian.

Check http://download-west.oracle.com/docs/cd/A91202_01/901_doc/appdev.901/a88879/toc.htm
I believe PL/SQL is using a C level I/O operation on each respective platform.

Similar Messages

  • Uploading into database table from text file using tab (GUI_UPLOAD)

    i have small doubt
    i have 3 fiels in text file using tab as separator
    i need to update into database table 'ZABPSP_01'
    from 's.txt' located in local disk.
    My code is below.
    Please let me know the correction.
    Awaiting for ur response.
    Thanks in advance
    REPORT  ZABPSPPRG_02.
    TABLES: LFA1,MARA,KNA1,ZABPSP_01.
    DATA:  begin of itab occurs 0,
    IKUNNR type zabpsp_01-kunnr,
    IMATNR type zabpsp_01-matnr,
    IADRNR type zabpsp_01-adrnr.
    DATA:END OF ITAB.
    DATA: FILENAME1 TYPE STRING.
    FILENAME1 = 'C:/s.txt'.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = FILENAME1
      FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                     = itab.
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF sy-subrc EQ 0.
    zabpsp_01-kunnr = ITAB-IKUNNR.
    zabpsp_01-matnr = ITAB-IMATNR.
    zabpsp_01-adrnr = ITAB-IADRNR.
    WRITE : / ' UPLOAD SUCCESS ' .
    ENDIF.
    \[subject changed, don't write everything in upper case!\]
    Edited by: Jan Stallkamp on Aug 6, 2008 2:39 PM

    Hi,
    After upload modify the code like below. Also change the file name as some one suggested already. If u are still facing problems then check in debug mode what is happening after FM call.
    CALL GUI_UPLOAD FM.
    IF sy-subrc EQ 0
    IF NOT itab[] IS INITIAL.
    MODIFY ZABPSP_01 FROM TABLE itab.
    WRITE : / ' UPLOAD SUCCESS ' .
    ELSE.
    WRITE 'No data in file'.
    ENDIF.
    ELSE.
    WRITE 'Upload failure'.
    ENDIF.
    Thanks,
    Vinod.

  • Report with link to file uploaded into database

    I have created a form that allows me to upload files into a database table with a blob column.
    Is it possible to create a report that will have a link to the files / database blob column, so when a user clicks on it, it displays the file.

    Hiya,
    You can create a simple report that list all the file IDs and their name. Then create a link on the ID or filename, which calls a procedure (DISPLAY_BLOB) passing it the id.
    you can view the content of the procedure in the document ference below:
    http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=FOR&p_id=336842.995
    Hope this helps.

  • Problem in getting data into database with standard direct input program

    HI All,
    I am having problem which is not updating the records in MM01 or MM02 with standard direct input program. i have data in internal table. from that table i am trying to upload into database by using background job MRP_MATERIAL_MASTER_DATA_LOAD.
    when i execute my program it is showing message job is started. then i go into sm37 and seethe job status by executing. there also i am seeing job completed succesfully.
    but if i go to mm03 and find the materials are updated or created there i couldn't find the material numbers which are from internal table.
    So if ny one help me it wil be great.
    Thanks in Advance
    Venkat N

    Hi Anil,
    Thanks for your answer, but i am facing problem is i have material no and denominator and Actual UOM and nominator field values in the flat file.....
    by using RMDATIND direct input program with MRP_MATERIAL_UPLOAD as job name for background job while uploading data into database.
    here i am not getting data in to database, but when i execute the job in sm37 it is showing that message job processing successfully completed...this is my status..
    if u can help me in this it will be gr8ful..
    Thanks,
    Venkat N

  • Upload data from excel into database through pl/sql

    Hi All,
    I have excel which contains data lets say employee details,
    I have one upload button ,which is used to upload excel and then i want to map the cell of excel to the database column and through plsql code i want to upload the excel data into database.
    In short ,i want to upload the data from excel into database using plsql code,
    or suggest me any other way to do this.(except the data load method present in apex)
    Thanks,
    Jitendra

    if you use APEX 4 you can define you own table
    the code below is for APEX 3
    PROCEDURE pro_carga_planilla_prosp( p_archivo VARCHAR2) IS
    v_blob_data BLOB;
    v_blob_len NUMBER;
    v_position NUMBER;
    v_raw_chunk RAW(10000);
    v_char CHAR(1);
    c_chunk_len number := 1;
    v_line VARCHAR2 (32767) := NULL;
    v_data_array wwv_flow_global.vc_arr2;
    v_rows number;
    v_sr_no number := 1;
    v_ok boolean := true;
    v_local_ok BOOLEAN := TRUE;
    v_reg_ok NUMBER := 0;
    v_reg_ko NUMBER := 0;
    v_localidad_id NUMBER;
    v_departamento_id NUMBER;
    v_cargo_id NUMBER;
    v_prospecto_id NUMBER;
    v_asesor_id NUMBER;
    V_REG prospectos%rowtype;
    BEGIN
    -- Read data from wwv_flow_files</span>
    select blob_content into v_blob_data
    from wwv_flow_files
    where name= p_archivo;
    v_blob_len := dbms_lob.getlength(v_blob_data);
    v_position := 1;
    -- Read and convert binary to char</span>
    WHILE ( v_position <= v_blob_len ) LOOP
    v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
    v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
    v_line := v_line || v_char;
    -- pro_log('linea '||v_line);
    v_position := v_position + c_chunk_len;
    -- When a whole line is retrieved </span>
    IF v_char = CHR(10) THEN
    -- Convert comma to : to use wwv_flow_utilities </span>
    v_line := replace(REPLACE (v_line, ',', ':'), ';',':');
    v_line := replace(replace(v_line, chr(10)),chr(13));
    if substr(v_line,1,1)= ':' then
    v_line := '0'||v_line;
    end if;
    if instr(v_line,':',1,21) = 0 then
    if instr(v_line,':',1,20) = 0 then
    v_line:=v_line||':';
    end if;
    v_line:=v_line||':';
    end if;
    -- pro_log(v_line);
    -- Convert each column separated by : into array of data </span>
    v_data_array := wwv_flow_utilities.string_to_table (v_line);
    -- Insert data into target table </span>
    IF v_data_array(1) IS NOT NULL AND
    v_sr_no <> 1 THEN
    V_REG.NOMBRE:=ltrim(rtrim(v_data_array(2)));
    V_REG.RAZON_SOCIAL:=v_data_array(3);
    V_REG.DIRECCION := v_data_array(4)||' '||v_data_array(5);
    -- PRO_LOG('PROSP 1 ' ||v_sr_no);
    v_localidad_id := pack_empresas.get_localidad(v_data_array(6));
    -- PRO_LOG('PROSP 1.1 '||v_sr_no);
    V_REG.LOCALIDAD_ID:=v_localidad_id;
    -- PRO_LOG('PROSP 1.2 '||v_sr_no);
    V_REG.CODIGO_POSTAL:=LTRIM(RTRIM(v_data_array(7)) );
    -- PRO_LOG('PROSP 1.3 '||v_sr_no);
    -- PRO_LOG('PROSP 1.1 '||v_sr_no);
    v_departamento_id := pack_empresas.get_departamento(v_data_array(8));
    -- PRO_LOG('PROSP 1.4 '||v_sr_no);
    V_REG.DEPARTAMENTO_ID:=v_departamento_id;
    -- PRO_LOG('PROSP 1.5 '||v_sr_no);
    V_REG.TELEFONO:=v_data_array(9);
    --PRO_LOG('PROSP 1.6 '||v_sr_no);
    V_REG.TELEFONO2:=v_data_array(10);
    -- PRO_LOG('PROSP 1.7 '||v_sr_no);
    V_REG.RUBRO:=v_data_array(11);
    -- PRO_LOG('PROSP 1.8 '||v_sr_no);
    V_REG.RUC:=ltrim(rtrim(v_data_array(12)));
    -- PRO_LOG('PROSP 1.9 '||v_sr_no);
    -- pro_log(v_data_array(1));
    -- pro_log(v_data_array(2));
    V_REG.CANTIDAD_EMPLEADOS:=RTRIM(LTRIM(v_data_array(13)));
    -- PRO_LOG('PROSP 1.10 '||v_sr_no);
    -- pro_log(v_data_array(14));
    V_REG.CANTIDAD_BENEFICIARIOS:=RTRIM(LTRIM(v_data_array(14)));
    --PRO_LOG('PROSP 1.11 '||v_sr_no);
    V_REG.MAIL:=v_data_array(19);
    -- pro_log(V_REG.MAIL);
    -- PRO_LOG('PROSP 1.12 '||v_sr_no);
    -- v_data_array(20):= replace(replace(v_data_array(20),chr(10)),chr(13));
    if not v_data_array.exists(20) then
    -- pro_log('existe');
    -- pro_log(ltrim(rtrim(replace(replace(v_data_array(20),chr(10)),chr(13)))));
    V_REG.Proveedor:= ltrim(rtrim(replace(replace(v_data_array(20),chr(10)),chr(13))));
    else
    v_data_array(20):=null;
    end if;
    -- V_REG.PROVEEDOR:=v_data_array(20);
    -- PRO_LOG('PROSP 1.13 '||v_sr_no);
    if not v_data_array.exists(21) then
    V_REG.OBSERVACIONES:=v_data_array(21);
    else
    v_data_array(21):=null;
    end if;
    -- PRO_LOG('PROSP 1.14 '||v_sr_no);
    -- PRO_LOG('PROSP 1.2 '||v_sr_no);
    insert into prospectos (nombre,razon_social, direccion,localidad_id,codigo_postal,
    departamento_id, telefono, telefono2, rubro,ruc,cantidad_empleados,
    cantidad_beneficiarios,mail,proveedor,observaciones)
    values (nvl(ltrim(rtrim(v_data_array(2))),v_data_array(3)), v_data_array(3),
    v_data_array(4)||' '||v_data_array(5),
    v_localidad_id, LTRIM(RTRIM(v_data_array(7))),v_departamento_id, v_data_array(9),
    v_data_array(10),v_data_array(11), ltrim(rtrim(v_data_array(12))), RTRIM(LTRIM(v_data_array(13))),
    RTRIM(LTRIM(v_data_array(14))),v_data_array(19),v_data_array(20), v_data_array(21))
    returning prospecto_id INTO v_prospecto_id;
    -- PRO_LOG('PROSP 2');
    v_cargo_id := pack_empresas.get_cargo(v_data_array(17));
    -- PRO_LOG('PROSP 3');
    insert into prospecto_contactos (prospecto_id,nombre,apellido,cargo_id,
    telefono,mail)
    values (v_prospecto_id, nvl(v_data_array(15),'S/N'), nvl(v_data_array(16),'S/A'),
    v_cargo_id, v_data_array(18), v_data_array(19));
    -- PRO_LOG('PROSP 4');
    v_asesor_id := pack_empresas.get_asesor(v_data_array(1));
    -- PRO_LOG('PROSP 5');
    insert into asignaciones (prospecto_id,asesor_id,fecha_asignacion)
    values (v_prospecto_id, v_asesor_id, trunc(sysdate));
    -- PRO_LOG('PROSP 6');
    END IF;
    -- Clear out
    v_line := NULL;
    v_sr_no := v_sr_no + 1;
    END IF;
    END LOOP;
    delete wwv_flow_files
    where name= p_archivo;
    END pro_carga_planilla_prosp;
    function hex_to_decimal
    --this function is based on one by Connor McDonald
    --http://www.jlcomp.demon.co.uk/faq/base_convert.html
    ( p_hex_str in varchar2 ) return number
    is
    v_dec number;
    v_hex varchar2(16) := '0123456789ABCDEF';
    begin
    v_dec := 0;
    for indx in 1 .. length(p_hex_str)
    loop
    v_dec := v_dec * 16 + instr(v_hex,upper(substr(p_hex_str,indx,1)))-1;
    end loop;
    return v_dec;
    end hex_to_decimal;

  • Problem with direct input program while uploading data into database

    TABLES:  BGR00,                        " Mappensatz
             BMM00,                        " MM01/MM02  BTCI-Kopfdaten
             BMMH1,                        " MM01/MM02 Hauptdaten
             BMMH2,                        " Länderdaten (Steuern)
             BMMH3,                        " Prognosewerte
             BMMH4,                        " Verbrauchswerte
             BMMH5,                        " Kurztexte
             BMMH6,                        " Mengeneinheiten
             BMMH7,                        " Langtexte
             BMMH8.                        " Referentielle EAN's
           Satztypen
    DATA:    MAPPENSATZ  LIKE BMM00-STYPE VALUE '0',
             KOPFSATZ    LIKE BMM00-STYPE VALUE '1',
             HAUPTSATZ   LIKE BMM00-STYPE VALUE '2',
             KUN_SATZ    LIKE BMM00-STYPE VALUE 'Z',
             LANDSATZ    LIKE BMM00-STYPE VALUE '3',
             PROGSATZ    LIKE BMM00-STYPE VALUE '4',
             VERBSATZ    LIKE BMM00-STYPE VALUE '5',
             KTEXTSATZ   LIKE BMM00-STYPE VALUE '6',
             MESATZ      LIKE BMM00-STYPE VALUE '7',
             TEXTSATZ    LIKE BMM00-STYPE VALUE '8',
             EANSATZ     LIKE BMM00-STYPE VALUE '9'.
    Common Data Bereich fuer die extern aufgerufenen Routinen
           Initialstrukturen
    DATA:  BEGIN OF COMMON PART RMMMBIMY.
    DATA:    BEGIN OF I_BMM00.
               INCLUDE STRUCTURE BMM00.    " Kopfdaten
    DATA:    END OF I_BMM00.
    DATA:    BEGIN OF I_BMMH1.
               INCLUDE STRUCTURE BMMH1.    " Haupdaten
    DATA:    END OF I_BMMH1.
    DATA:    BEGIN OF I_BMMH2.
               INCLUDE STRUCTURE BMMH2.    " Länderdaten
    DATA:    END OF I_BMMH2.
    DATA:    BEGIN OF I_BMMH3.
               INCLUDE STRUCTURE BMMH3.    " Prognosewerte
    DATA:    END OF I_BMMH3.
    DATA:    BEGIN OF I_BMMH4.
               INCLUDE STRUCTURE BMMH4.    " Verbrauchswerte
    DATA:    END OF I_BMMH4.
    DATA:    BEGIN OF I_BMMH5.
               INCLUDE STRUCTURE BMMH5.    " Kurztexte
    DATA:    END OF I_BMMH5.
    DATA:    BEGIN OF I_BMMH6.
               INCLUDE STRUCTURE BMMH6.    " Mengeneinheiten
    DATA:    END OF I_BMMH6.
    DATA:    BEGIN OF I_BMMH7.
               INCLUDE STRUCTURE BMMH7.    " Textzeilen
    DATA:    END OF I_BMMH7.
    DATA:    BEGIN OF I_BMMH8.
               INCLUDE STRUCTURE BMMH8.    " Referentielle EAN's
    DATA:    END OF I_BMMH8.
    DATA:  END OF COMMON PART.
    DATA: WA LIKE TEDATA-DATA.
           Einzelfelder
    DATA:    GROUP_COUNT(6) TYPE C,    " Anzahl Mappen
             TRANS_COUNT(6) TYPE C,    " alte Definition für rmmmbim0
             SATZ_COUNT  LIKE MUEB_REST-TRANC, " Trans.zähler neu
             H_IND_COUNT LIKE MUEB_REST-D_IND, " Index welches Feld zurücks.
             SATZ2_COUNT(6) TYPE C.    " Anz. Sätze je Trans. ohne Kopfsatz
    DATA:    XEOF(1)          TYPE C,  " X=End of File erreicht
             XHAUPTSATZ_EXIST TYPE C,  " X=Hauptsatz zum Kopf exi.
             NODATA(1)        TYPE C.  " kein BI für dieses Feld
    mk/15.08.94:
    DATA:    GROUP_OPEN(1)  TYPE C.             " X=Mappe schon geöffnet
    *eject
           Konstanten
    DATA:    C_NODATA(1)    TYPE C VALUE '/'.   " Default für NODATA
    DATA:    MATNR_ERW     LIKE MARA-MATNR  VALUE '0                 '.
    DATA:    MATNR_ERW_INT LIKE MARA-MATNR.  "internal sight of '0      '
    DATA:    MATNR_LAST    LIKE MARA-MATNR.  "Material number
    mk/11.08.94 2.1H:
    If this flag is initial, the database updates will be done directly
    during background maintenance instead of using a separate update
    task. (no usage of this flag in dialogue mode!)
    DATA: DBUPDATE_VB(1) VALUE ' '.       "note 306628
    data: matsync type mat_sync. "wk/99a no update in dialog if called
    ***INCLUDE ZMUSD070.
    TABLES: MARA,                          "Material Master: General Data
            MARC,                          "Material Master: C Segment
            MARD,                          "Material Master: St Loc/Batch
            MBEW,                          "Material Valuation
            MVKE,                          "Material Master: Sales Data
            MLGN,                          "Material Data per Whse Number
            MLAN,                          "Tax Classification: Material
            T001W,                         "Plants/Branches
            TBICU.
    DATA: BEGIN OF VALUTAB OCCURS 0.
            INCLUDE STRUCTURE RSPARAMS.
    DATA: END OF VALUTAB.
    DATA: BEGIN OF VARTECH.
            INCLUDE STRUCTURE VARID.
    DATA: END OF VARTECH.
    DATA: PARMS LIKE ZXXDCONV.
    DATA: REC_COUNT      TYPE  I,
          REC_COUNT_BAD  TYPE  I,
          ZJOBID         LIKE  TBIZU-JOBID,
          ZJOBCOUNT      LIKE  TBIZU-JOBCOUNT,
          ZMATNR         LIKE  MARA-MATNR,
          ZTEXT(80)      TYPE  C.
    CONSTANTS: LIT_ZERO(18)  TYPE  C            VALUE '000000000000000000',
               LIT_CHAR      TYPE  C            VALUE '_',
               LIT_CREATE    LIKE  BMM00-TCODE  VALUE 'MM01',
               LIT_CHANGE    LIKE  BMM00-TCODE  VALUE 'MM02',
               LIT_CHECK(1)  TYPE  C            VALUE 'X'.
    DATA:  BEGIN OF INP_DATA OCCURS 0,
             MATNR(18)  TYPE C,            " Material code
             UMREN(6)   TYPE C,            " Denominator
             MEINH(3)   TYPE C,            " Alternate UOM
             UMREZ(6)   TYPE C,            " Numerator
           END OF INP_DATA.
    *eject
    SELECTION-SCREEN BEGIN OF BLOCK INOUT WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT (13) TEXT-004.
    PARAMETERS:     P_PC        RADIOBUTTON GROUP SRC DEFAULT 'X'.
    SELECTION-SCREEN COMMENT (6) TEXT-005.
    PARAMETERS:     P_UNIX      RADIOBUTTON GROUP SRC.
    SELECTION-SCREEN COMMENT (6) TEXT-006.
    PARAMETERS:     P_DS_TYP    LIKE     ZXXDCONV-DS_TYP
                                   DEFAULT 'ASC'.
    SELECTION-SCREEN END OF LINE.
    *SELECT-OPTIONS: S_PATH      FOR      PARMS-PATH
                                  NO INTERVALS
                                  LOWER CASE.
    PARAMETERS:  P_PATH TYPE RLGRAP-FILENAME.
    PARAMETERS:     P_HDRLIN   LIKE     ZXXDCONV-HDR_LINES
                                   DEFAULT 0,
                    P_JOBNAM   LIKE     TBICU_S-JOBNAME
                                   MEMORY ID BM1,
                    P_DI_EXE    AS       CHECKBOX
                                   DEFAULT  LIT_CHECK,
                    P_MAPPE     LIKE     BGR00-GROUP
                                   DEFAULT  'MRP_UOM_LOAD'
                                   NO-DISPLAY.
    SELECTION-SCREEN END OF BLOCK INOUT.
    *eject
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PATH.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                PROGRAM_NAME  = SYST-REPID
                DYNPRO_NUMBER = SYST-DYNNR
                FIELD_NAME    = 'P_PATH'
           CHANGING
               FILE_NAME     = S_PATH-LOW
                FILE_NAME     = P_PATH
           EXCEPTIONS
                MASK_TOO_LONG = 1
                OTHERS        = 2.
    AT SELECTION-SCREEN.
    Set up parameter record
      PARMS-UNIX      = P_UNIX.
      PARMS-PC        = P_PC.
      PARMS-DS_TYP    = P_DS_TYP.
      PARMS-JOBNAME   = P_JOBNAM.
      PARMS-MAPPE     = P_MAPPE.
      PARMS-HDR_LINES = P_HDRLIN.
    *eject
           Main Processing Routine                                       *
    START-OF-SELECTION.
    Initialization
      PERFORM 0000_HOUSEKEEPING.
    Initialize transaction data in I_BM00
    PERFORM 0500_INIT_BMM00.
    Process input files
    SORT S_PATH BY SIGN OPTION LOW.
         MOVE S_PATH-LOW TO PARMS-PATH.
          MOVE P_PATH TO PARMS-PATH.
    LOOP AT S_PATH.
       AT NEW LOW.
          CLEAR   INP_DATA.
         REFRESH INP_DATA.
    Read source data into internal table
          PERFORM 1000_GET_SOURCE_DATA TABLES INP_DATA.
    Processs each record in internal table
          ZTEXT    = TEXT-007.
          ZTEXT+13 = PARMS-DS_NAME.
          PERFORM 4000_PROGRESS_INDICATOR USING ZTEXT.
    Initialize transaction data in I_BM00
      PERFORM 0500_INIT_BMM00.
          LOOP AT INP_DATA.
    Reset tables for each record
            BMM00              = I_BMM00.
            BMMH1              = I_BMMH1.
            BMMH6              = I_BMMH6.
    Load structures with data
            MOVE-CORRESPONDING INP_DATA TO BMM00.
            PERFORM 2000_WRITE_OUTPUT USING BMM00.
            MOVE-CORRESPONDING INP_DATA TO BMMH1.
            PERFORM 2000_WRITE_OUTPUT USING BMMH1.
            MOVE-CORRESPONDING INP_DATA TO BMMH6.
            PERFORM 2000_WRITE_OUTPUT USING BMMH6.
            REC_COUNT = REC_COUNT + 1.
          ENDLOOP.
       ENDAT.
    ENDLOOP.
      IF  REC_COUNT GT 0
      AND P_DI_EXE  EQ LIT_CHECK.
        PERFORM 3000_START_DI_JOB.
      ENDIF.
    WRITE: / TEXT-008,
               REC_COUNT.
      PERFORM 9000_END_OF_JOB.
    *eject
    Include containing common routines used by direct input programs
      INCLUDE ZMUSD071.
    *eject
          FORM 0500_INIT_BMM00                                          *
          Initialize I_BMM00 with transaction code and views selected   *
    FORM 0500_INIT_BMM00.
    ***this changes done by samson**
    if not inp_data[] is initial.
    select single matnr from mara INTO ZMATNR where matnr = inp_data-matnr.
    if sy-subrc = 0.
      I_BMM00-TCODE = LIT_CHANGE.
    Basic data
      I_BMM00-XEIK1  = LIT_CHECK.
    else.
      I_BMM00-TCODE = LIT_CREATE.
    Basic data
      I_BMM00-XEIK1 = LIT_CHECK.
    endif.
    endif.
    **this changes above done by samson**
    Transaction code
    I_BMM00-TCODE = LIT_CHANGE.
    Basic data
    I_BMM00-XEIK1  = LIT_CHECK.
    ENDFORM.
    INCLUDE ZMUSD069.
    *eject
          FORM 0000_HOUSEKEEPING                                        *
          Initialization routines                                       *
    FORM 0000_HOUSEKEEPING.
      PERFORM 0010_LDS_NAME.
      PERFORM 0020_DS_NAME.
      PERFORM 0030_OPEN_FILE.
      PERFORM 0040_INIT_STRUCTS.
    ENDFORM.
    *eject
          FORM 0010_LDS_NAME                                            *
          Obtain logical file name from DI job details                  *
    FORM 0010_LDS_NAME.
    Check valid job name
      SELECT SINGLE * FROM  TBICU
                      WHERE JOBNAME EQ PARMS-JOBNAME.
      IF SY-SUBRC EQ 0.
        CALL FUNCTION 'RS_VARIANT_VALUES_TECH_DATA'
             EXPORTING
                  REPORT               = TBICU-REPNAME
                  VARIANT              = TBICU-VARIANT
             IMPORTING
                  TECHN_DATA           = VARTECH
             TABLES
                  VARIANT_VALUES       = VALUTAB
             EXCEPTIONS
                  VARIANT_NON_EXISTENT = 1
                  VARIANT_OBSOLETE     = 2
                  OTHERS               = 3.
        IF SY-SUBRC EQ 0.
          READ TABLE VALUTAB WITH KEY 'LDS_NAME'.
          MOVE VALUTAB-LOW TO PARMS-LDS_NAME.
        ELSE.
          MESSAGE I001 WITH PARMS-JOBNAME.
          MESSAGE A099.
        ENDIF.
      ELSE.
        MESSAGE I000 WITH PARMS-JOBNAME.
        MESSAGE A099.
      ENDIF.
    ENDFORM.
    *eject
          FORM 0040_INIT_STRUCTS                                        *
          Initialize structures for direct input records                *
    FORM 0040_INIT_STRUCTS.
    Start of standard SAP initialization from example program RMMMBIME
    *------- Write session record -
      CLEAR BGR00.
      BGR00-STYPE  = MAPPENSATZ.
      BGR00-GROUP  = PARMS-MAPPE.
      BGR00-NODATA = C_NODATA.
      BGR00-MANDT  = SY-MANDT.
      BGR00-USNAM  = SY-UNAME.
      BGR00-START  = BGR00-NODATA.
      BGR00-XKEEP  = BGR00-NODATA.
      PERFORM 2000_WRITE_OUTPUT USING BGR00.
    *----- Initialize structures -
      NODATA = BGR00-NODATA.
      PERFORM INIT_STRUKTUREN_ERZEUGEN(RMMMBIMI) USING NODATA.
    End of standard SAP initialization from example program RMMMBIME
    ENDFORM.
    *eject.
          FORM 3000_START_DI_JOB                                        *
          Start direct input job                                        *
    FORM 3000_START_DI_JOB.
      ZTEXT = 'Starting '(021).
      ZTEXT+9 = TBICU-JOBNAME.
      PERFORM 4000_PROGRESS_INDICATOR USING ZTEXT.
      CALL FUNCTION 'BI_START_JOB'
           EXPORTING
                JOBID                 = ' '
                JOBTEXT               = TBICU-JOBNAME
                REPNAME               = TBICU-REPNAME
                SERVER                = TBICU-EXECSERVER
                VARIANT               = TBICU-VARIANT
                NEW_JOB               = 'X'
                CONTINUE_JOB          = ' '
                START_IMMEDIATE       = 'X'
                DO_NOT_PRINT          = 'X'
                USERNAME              = SY-UNAME
           IMPORTING
                JOBID                 = ZJOBID
                JOBCOUNT              = ZJOBCOUNT
           EXCEPTIONS
                JOB_OPEN_FAILED       = 1
                JOB_CLOSE_FAILED      = 2
                JOB_SUBMIT_FAILED     = 3
                WRONG_PARAMETERS      = 4
                JOB_DOES_NOT_EXIST    = 5
                WRONG_STARTTIME_GIVEN = 6
                JOB_NOT_RELEASED      = 7
                WRONG_VARIANT         = 8
                NO_AUTHORITY          = 9
                DIALOG_CANCELLED      = 10
                JOB_ALREADY_EXISTS    = 11
                PERIODIC_NOT_ALLOWED  = 12
                ERROR_NUMBER_GET_NEXT = 13
                OTHERS                = 14.
      IF SY-SUBRC EQ 0.
        WRITE: / 'Direct input job'(022), TBICU-JOBNAME, 'started'.
      ELSE.
        WRITE: / 'Direct input failed with return code'(023), SY-SUBRC.
      ENDIF.
    FORM 0020_DS_NAME.
      CALL FUNCTION 'FILE_GET_NAME'
           EXPORTING
                CLIENT           = SY-MANDT
                LOGICAL_FILENAME = PARMS-LDS_NAME
                OPERATING_SYSTEM = SY-OPSYS
           IMPORTING
                FILE_NAME        = PARMS-DS_NAME
           EXCEPTIONS
                FILE_NOT_FOUND   = 1
                OTHERS           = 2.
      IF SY-SUBRC NE 0.
        MESSAGE E002 WITH PARMS-LDS_NAME.
        MESSAGE A099.
      ENDIF.
    ENDFORM.
    *eject
          FORM 0030_OPEN_FILE                                           *
          Open physical file for output                                 *
    FORM 0030_OPEN_FILE.
    OPEN DATASET PARMS-DS_NAME FOR OUTPUT IN TEXT MODE. "thg191105
      OPEN DATASET PARMS-DS_NAME FOR OUTPUT IN TEXT MODE
                                     encoding default. "thg191105
      IF SY-SUBRC NE 0.
        MESSAGE E003 WITH PARMS-DS_NAME.
        MESSAGE A099.
      ENDIF.
    ENDFORM.
    *eject
          FORM 1000_GET_SOURCE_DATA                                     *
          Read source data into internal table                          *
    -->  INP_DATA   " Name of internal table passed as parameter       *
    FORM 1000_GET_SOURCE_DATA TABLES INP_DATA.
      CALL FUNCTION 'Z_FILE_UPLOAD'
           EXPORTING
                UNIX                = PARMS-UNIX
                PC                  = PARMS-PC
                FILETYPE            = PARMS-DS_TYP
                FILENAME            = PARMS-PATH
                HDR_LINES           = PARMS-HDR_LINES
           TABLES
                DATA_TAB            = INP_DATA
           EXCEPTIONS
                CONVERSION_ERROR    = 1
                FILE_OPEN_ERROR     = 2
                FILE_READ_ERROR     = 3
                INVALID_TABLE_WIDTH = 4
                INVALID_TYPE        = 5
                NO_BATCH            = 6
                UNKNOWN_ERROR       = 7
                INVALID_SOURCE      = 8
                OTHERS              = 9.
    ENDFORM.
    *eject
          FORM 2000_WRITE_OUTPUT                                        *
          Write record in standard SAP structure to UNIX file           *
    -->  I_STRUCT   " Name of record passed as parameter               *
    *FORM 2000_WRITE_OUTPUT USING I_STRUCT."SRY28NOV05
    FORM 2000_WRITE_OUTPUT USING I_STRUCT TYPE ANY.      "SRY28NOV05
       TRANSFER I_STRUCT TO PARMS-DS_NAME.
      IF SY-SUBRC NE 0.
        MESSAGE E004 WITH PARMS-DS_NAME.
        MESSAGE A099.
      ENDIF.
    ENDFORM.
    *eject
    *&      Form  2100_WS_DOWNLOAD
          text                                                           *
    -->  p1        text
    <--  p2        text
    FORM 2100_WS_DOWNLOAD TABLES INP_DATA.
    DATA: FILENAME LIKE RLGRAP-FILENAME.   "SRY28NOV05
      DATA: W_FILENAME TYPE STRING.             "SRY28NOV05
      DATA: W_FTYP(10) TYPE C VALUE 'DAT'.      "SRY28NOV05
    MOVE PARMS-DS_NAME TO FILENAME.       "SRY28NOV05
      MOVE PARMS-DS_NAME TO W_FILENAME.      "SRY28NOV05
    *BEGIN OF BLOCK COMMENT BY SRY28NOV05
    CALL FUNCTION 'WS_DOWNLOAD'
          EXPORTING
            BIN_FILESIZE        = ' '
            CODEPAGE            = ' '
               FILENAME            = FILENAME
               FILETYPE            = 'DAT'
            MODE                = ' '
            WK1_N_FORMAT        = ' '
            WK1_N_SIZE          = ' '
            WK1_T_FORMAT        = ' '
            WK1_T_SIZE          = ' '
            COL_SELECT          = ' '
            COL_SELECTMASK      = ' '
       importing
            filelength          =
          TABLES
               DATA_TAB            = INP_DATA
            FIELDNAMES          =
          EXCEPTIONS
               FILE_OPEN_ERROR     = 1
               FILE_WRITE_ERROR    = 2
               INVALID_FILESIZE    = 3
               INVALID_TABLE_WIDTH = 4
               INVALID_TYPE        = 5
               NO_BATCH            = 6
               UNKNOWN_ERROR       = 7
               OTHERS              = 8.
    *END OF BLOCK COMMENT BY SRY28NOV05
    *BEGIN OF BLOCK ADDED BY SRY28NOV05
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                        = W_FILENAME
          FILETYPE                        = W_FTYP
        TABLES
          DATA_TAB                        = INP_DATA
       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 NE 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *END OF BLOCK ADDED BY SRY28NOV05
    ENDFORM.                               " 2100_WS_DOWNLOAD
    *eject
          FORM 4000_PROGRESS_INDICATOR                                  *
          Write progress text to status bar                             *
    -->  TEXT   " Text passed as parameter                             *
    FORM 4000_PROGRESS_INDICATOR USING TEXT.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
           EXPORTING
                PERCENTAGE = 0
                TEXT       = TEXT
           EXCEPTIONS
                OTHERS     = 1.
    ENDFORM.
    *eject.
          FORM 9000_END_OF_JOB                                          *
          Close files on UNIX                                           *
    FORM 9000_END_OF_JOB.
      CLOSE DATASET PARMS-DS_NAME.
    ENDFORM.
    FORM 1000_GET_SOURCE_DATA TABLES INP_DATA.
      CALL FUNCTION 'Z_FILE_UPLOAD'
           EXPORTING
                UNIX                = PARMS-UNIX
                PC                  = PARMS-PC
                FILETYPE            = PARMS-DS_TYP
                FILENAME            = PARMS-PATH
                HDR_LINES           = PARMS-HDR_LINES
           TABLES
                DATA_TAB            = INP_DATA
           EXCEPTIONS
                CONVERSION_ERROR    = 1
                FILE_OPEN_ERROR     = 2
                FILE_READ_ERROR     = 3
                INVALID_TABLE_WIDTH = 4
                INVALID_TYPE        = 5
                NO_BATCH            = 6
                UNKNOWN_ERROR       = 7
                INVALID_SOURCE      = 8
                OTHERS              = 9.
    ENDFORM.
    *eject
          FORM 2000_WRITE_OUTPUT                                        *
          Write record in standard SAP structure to UNIX file           *
    -->  I_STRUCT   " Name of record passed as parameter               *
    *FORM 2000_WRITE_OUTPUT USING I_STRUCT."SRY28NOV05
    FORM 2000_WRITE_OUTPUT USING I_STRUCT TYPE ANY.      "SRY28NOV05
       TRANSFER I_STRUCT TO PARMS-DS_NAME.
      IF SY-SUBRC NE 0.
        MESSAGE E004 WITH PARMS-DS_NAME.
        MESSAGE A099.
      ENDIF.
    ENDFORM.
    *eject
    *&      Form  2100_WS_DOWNLOAD
          text                                                           *
    -->  p1        text
    <--  p2        text
    FORM 2100_WS_DOWNLOAD TABLES INP_DATA.

    Hi,
    Thnaks for your reply, This is my requirement.
    Here my problem is i am trying to upload the data from flatfile which contain materil number, denominator, Actual UOM, Nominator field values.
    Which is the data i need to upload into MM02 and MM01, if material number is new then it has to create the material, if material is already existing it has to update the UOM values.
    here i am getting data into my internal table INP_DATA, from that i am trying to upload the data to database by using job name MRP_MATERIAL_MASTER_DATA_UPLOAD with direct input program RMDATIND.
    when i execute my program i am getting success message all the records writtin from flatfile to application server. and job started message.
    then if i go into sm37 screen there i execute the job it is also giving active message. if i refresh it it is showing job completed message.
    then i look at job log status. there i found that for existing material it is expecting material type, for new material it is giving some gravity error.
    So could u help me in this it will be gr8.
    Thanks & Regards,
    RamNV

  • Bulk upload into an existing email newsletter database

    Hi,
    I would like to do a bulk upload into an existing email newsletter database.
    When I export the database that I want to update, the file format is:
    Full Name | Email Address | Opt-in Status | Subscribe date
    However, the file format of the entities basic import file is:
    Email Address
    Title
    First Name
    Last Name
    Company Name
    Custom Date
    Which one should I use?
    Thanks for your help.

    Hi Christina,
    You need to use the file format of the import file, always.
    Otherwise you'll end up with customers that have email addresses as name and names as email addresses.
    Let me know if you run into any issues.
    Thanks and regards,
    Florin

  • Upload .txt file into Database Table

    Hi,
    I was wondering if someone could please point me in the right direction. I've been looking around the forum but can't find anything to help me achieve the following.
    I would like to be able to upload a .txt file using a webpage. Then store the information inside this file into database tables.
    eg. contents of mytextfile.txt:
    richard
    10 anywhere street, anytown, somewhere
    111 222 333 444
    joe
    9 somestreet, elsewhere
    999 888 777 666
    peter
    214 nearby lane, overhere
    555 555 555 555
    I would like to insert this data into a table.
    eg. table name = CONTACTS
    userid = primary key (using sequence)
    username = (line 1 - richard, joe, peter)
    address = (line 2)
    phone_no = (line 3)
    As you can see the records will appear 1 at a time and will have a blank line between records. Is there anyway for me to upload a file like this and have it placed into tables?
    I have seen http://otn.oracle.com/products/database/htmldb/howtos/howto_file_upload.html but this seems to be for uploading a whole file and downloading the same file, rather than extracting data from the file.
    I hope I have managed to explain my problem.
    Many thanks,
    Richard.

    Richard,
    HTML DB allows you to upload CSV files via the Data Workshop. That data would then be parsed and inserted into a specific table. Alternatively, if you have your data in an Excel spreadsheet, and it is less than 32k, you can copy & paste the data directly into HTML DB's Data Workshop, which will then parse and import it into the Oracle database.
    The one obstacle you may have to overcome is converting your data from the format you outlined to CSV format. Specifically, you would have to make this:
    richard
    10 anywhere street, anytown, somewhere
    111 222 333 444
    Look something like this:
    "richard","10 anywhere street, anytown, somewhere","111 222 333 444"
    Hope this helps,
    - Scott -

  • How can i load file into database from client-side to server-side

    i want to upload file from client-side to server-side, i use the following code to load blob into database.
    if the file is in the server-side, it can work, but if it in the client-side, it said that the system cannot find the file. i think it only will search the file is in the server-side or not, it will not search the client-side.
    how can i solve it without upload the file to the server first, then load it into database??
    try
    ResultSet rset = null;
    PreparedStatement pstmt =
    conn.prepareStatement ("insert into docs values (? , EMPTY_BLOB())");
    pstmt.setInt (1, docId);
    pstmt.execute ();
    // Open the destination blob:
    pstmt.setInt (1, docId);
    rset = pstmt.executeQuery (
    "SELECT content FROM docs WHERE id = ? FOR UPDATE");
    BLOB dest_lob = null;
    if (rset.next()) {
    dest_lob = ((OracleResultSet)rset).getBLOB (1);
    // Declare a file handler for the input file
    File binaryFile = new File (fileName);
    FileInputStream istream = new FileInputStream (binaryFile);
    // Create an OutputStram object to write the BLOB as a stream
    OutputStream ostream = dest_lob.getBinaryOutputStream();
    // Create a tempory buffer
    byte[] buffer = new byte[1024];
    int length = 0;
    // Use the read() method to read the file to the byte
    // array buffer, then use the write() method to write it to
    // the BLOB.
    while ((length = istream.read(buffer)) != -1)
    ostream.write(buffer, 0, length);
    pstmt.close();
    // Close all streams and file handles:
    istream.close();
    ostream.flush();
    ostream.close();
    //dest_lob.close();
    // Commit the transaction:
    conn.commit();
    conn.close();
    } catch (SQLException e) {

    Hi,
    Without some more details of the configuration, its difficult to know
    what's happening here. For example, what do you mean by client side
    and server side, and where are you running the upload Java application?
    If you always run the application on the database server system, but can't
    open the file on a different machine, then it sounds like a file protection
    problem that isn't really connected with the database at all. That is to
    say, if the new FileInputStream (binaryFile) statement fails, then its not
    really a database problem, but a file protection issue. On the other hand,
    I can't explain what's happening if you run the program on the same machine
    as the document file (client machine), but you can't write the data to the
    server, assuming the JDBC connection string is set correctly to connect to
    the appropriate database server.
    If you can provide some more information, we'll try to help.
    Simon
    null

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code.
    1. Excel File is on My PC.
    2. And I want to write a Stored Procedure or Package to do that.
    3. DataBase is on Other Server. Client-Server Environment.
    4. I am Using Toad or PlSql developer tool.

    If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
    1. Get your DBA to create directory object in oracle using the following command:
    create directory TEST_DIR as ‘directory_path’;
    Note: This directory is on the server.
    2. Grant read,write on directory directory_object_name to username;
    You can find out the directory_object_name value from dba_directories view if you are using the system user account.
    3. Logon as the user as mentioned above.
    Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
    function getData(p_filename in varchar2,
    p_filepath in varchar2
    ) RETURN VARCHAR2 is
    input_file utl_file.file_type;
    --declare a buffer to read text data
    input_buffer varchar2(4000);
    begin
    --using the UTL_FILE in built package
    input_file := utl_file.fopen(p_filepath, p_filename, 'R');
    utl_file.get_line(input_file, input_buffer);
    --debug
    --dbms_output.put_line(input_buffer);
    utl_file.fclose(input_file);
    --return data
    return input_buffer;
    end;
    Hope this helps.

  • Inserting blob data into database

    Hello everybody,
    I need insert blob data into database. that data i need to get from form
    can i use request.getParameter(""); for getting that file.
    Plz help how to get data from form to servlet and through callablestatement i need to insert into database.
    regards,
    Anil

    Hi,
    1) first create a form with file element
    first.jsp
    <form action="GetData" enctype="multipart/form-data" method="post">
    <input type="file" name="datafile" size="40">
    <input type="submit" value="Send">
    <input type="reset" name="Reset" value="Cancel">
    </form>
    GetData.java
    // servlet file
    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    res.setContentType("text/html");
    PrintWriter out = response.getWriter();
    try {
    System.setProperty( "jdbc.drivers", "com.microsoft.jdbc.sqlserver.SQLServerDriver" );
    Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver" );
    con = DriverManager.getConnection( "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=JAVATEAM;SelectMethod=cursor;User=sa;Password=urpassword" );
    PreparedStatement pst = con.prepareStatement("insert into uploads(binaryfile) values(?)");
    FileInputStream fis=new FileInputStream(request.getParameter ( "datafile" ) );
    byte[] b= new byte[fis.available()+1];
    fis.read(b);
    pst.setBytes(1,b);
    pst.executeUpdate();
    pst.close();
    con.close();
    catch(SQLException e)
    out.println ( e);
    catch (ClassNotFoundException e)
    out.println( e );
    }Here in doPost(), i create preparedstatement,
    now you to create one procedure for insert
    and by using callable statement you just call that procedure and pass this byte b as arguments,
    now its in your hands
    my idea is over.

  • This is my Jsp code for image upload in database:

    This is my Jsp code for image upload in database:
    -----------Upload.jsp----------------
    <html>
    <head>
    </head>
    <body bgproperties="fixed" bgcolor="#CCFFFF">
    <form method="POST" action="UploadPicture.jsp" enctype="multiform/form-data">
    <%! int update=0; %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.text.*" %>
    <%@ page import="java.sql.Date" %>
    <%@ page import="java.io.*"%>
    <%@ page language = "java" %>
    <%
    try
    String ct="3";
    String path;
    File image=new File(request.getParameter("upload"));
    path=request.getParameter("upload");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:itPlusElectronics","","");
    PreparedStatement pstmt=con.prepareStatement("insert into graphics values(?,?,?)");
    pstmt.setString(2,path);
    pstmt.setString(3,ct);
    InputStream is=new FileInputStream(path);
    pstmt.setBinaryStream(1, is, (int)(image.length()));
    int s=pstmt.executeUpdate();
    if(s>0)
    out.println("Uploaded");
    else
    %>
    unsucessfull
    <%}
    is.close();
    pstmt.close();
    catch(Exception e)
    }%>
    </p>
    <p><br>
    <img src="UploadedPicture.jsp">image</img>
    <p></p>
    </form>
    </body>
    </html>
    My database name is itPlusElectronics and the table name is "graphics".
    I have seen as a result of the above code that the image is stored in database as "Long binary data". and database table is look like as follows-------
    picture path id
    Long binary data D:\AMRIT\1-1-Picture.jpg 3
    To retrive and display i use this JSP code as--
    ------------------------UploadedPicture.jsp------------------------------
    <html>
    <head>
    </head>
    <body bgproperties="fixed" bgcolor="#CCFFFF">
    <%! int update=0; %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.text.*" %>
    <%@ page import="java.io.*"%>
    <%@ page language = "java" %>
    <%@page import="javax.servlet.ServletOutputStream"%>
    <%
    try
    String path;
    path=request.getParameter("upload1");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:itPlusElectronics","","");
    PreparedStatement pst = con.prepareStatement("SELECT * FROM graphics WHERE id ='3'");
    // pst.setString(3, id);
    ResultSet rs = pst.executeQuery();
    path=rs.getString("path");
    if(rs.next()) {
    byte[] bytearray = new byte[4096];
    int size=0;
    InputStream sImage;
    sImage = rs.getBinaryStream(1);
    response.reset();
    response.setContentType("image/jpeg");
    response.addHeader("Content-Disposition","filename=path");
    while((size=sImage.read(bytearray))!= -1 )
    response.getOutputStream().write(bytearray,0,size) ;
    response.flushBuffer();
    sImage.close();
    rs.close();
    catch(Exception e)
    %>
    </body>
    </html>
    Now after browsing a jpg image file from client side and pressing submit button ;
    I am unable display the image in the Upload.jsp file.Though I use
    <img src="UploadedPicture.jsp">image</img> HTML code in Upload.jsp
    file .
    Now I am unable to find out the mistakes which is needed for displaying the picture in the Upload.jsp page..
    If any one can help with the proper jsp code to retrive and display the image ,please please help me !!!!!!!!!!!!!!!!!!!!!!!!!!

    dketcham wrote:
    cotton.m wrote:
    >
    2) I'm looking at how you called stuff, and you're trying to call the jsp file as an image? That jsp isn't the source of the image, just a page linking to an image. I think if you really want to do things that way you're going to need to just include that jsp within the jsp you're calling it from (or you can do it the easy way, and if you have the information to get the path of the image you want, you could simply call the image from the first jsp you posted)This is incorrect.
    There are two JSPs. The second when called will (if it worked) return the source of an image as stored in the database.even when called with <img src=xx.jsp>??
    Yes.
    If any of what I say next seems obvious or otherwise negative I apologize, just trying to explain and I don't know what you know vs what you don't.
    The link in the src is just a URL not a filetype. So just because it ends with JSP does not mean it has to return HTML. The content type is determined by the browser using the Content-Type header returned by the server in the HTTP response. In this case the header is set to be a jpeg so that's what the browser will attempt to interpret the content part of the response as.
    So in fact one is not limited to just HTML or images but whatever content type you would like to return (that the browser can understand anyway). This could be HTML or it could be an image of some type or it could be a PDF or it could be an Excel spreadsheet. All you have to do in the JSP is set the header appropriately and then send content that is actually in that format.
    This does not just apply to JSP by the way but all other web programming languages. You can do similar things to produce the same results in PHP, Perl, ASP etc.
    The only JSP/Servlet complication is whether or not doing this in a JSP is a "good" idea but I am not an expert enough at that to make a definitive statement. Mostly though JDBC in a JSP is a no-no.

  • Download smart style and upload into ecc

    Hi,
    I want one smart style to be uploaded into ECC6.0, I have upload option. Prior to that I need to download the styles in 4.6C system where there is no download option. Can any one help me.
    Venkat.

    Hi
    IN 4.6c did you check in smartforms tcode....Utilities-->Download Style?? You have to select the radio button and check.
    Actually, just did some research and found out that there is no option to download in 4.6c. However, this code can help you do that:
    REPORT zi_load_smartforms_and_styles LINE-SIZE 150
           NO STANDARD PAGE HEADING.
    *Program : ZSMART_FORM_UPLOAD_DOWNLOAD *
    *Description : This utility/tool can download or upload smartform and *
    * smartstyles. *
    *======================================================================*
    *&===== TABLES =====
    TABLES: stxfadm,
            stxsadm.
    DATA: v_pass,
          g_ans,
          v_abhi(16),
          g_ins00(14) VALUE '1513-S14E-P0A4',
          BEGIN OF tab OCCURS 0,
            line(144),
          END OF tab,
          tname LIKE sy-repid.
    *&===== SELCTION SCREEN =====
    SELECTION-SCREEN BEGIN OF BLOCK smart1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 4(20) text-101.
    PARAMETERS: p_fname LIKE stxfadm-formname DEFAULT 'ZTEST2'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 4(20) text-102.
    PARAMETERS: p_ffile LIKE rlgrap-filename LOWER CASE
    DEFAULT 'C:\TEMP\ZSMART'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF BLOCK ind1 WITH FRAME TITLE text-002.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 4(20) text-103.
    PARAMETERS: p_ft RADIOBUTTON GROUP abh1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 4(20) text-104.
    PARAMETERS: p_fu RADIOBUTTON GROUP abh1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 4(20) text-105.
    PARAMETERS: p_fd RADIOBUTTON GROUP abh1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK ind1.
    SELECTION-SCREEN END OF BLOCK smart1.
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN BEGIN OF BLOCK smart2 WITH FRAME TITLE text-003.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 4(20) text-106.
    PARAMETERS: p_sname LIKE stxfadm-formname DEFAULT 'ZTEST2'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 4(20) text-102.
    PARAMETERS: p_sfile LIKE rlgrap-filename LOWER CASE
    DEFAULT 'C:\TEMP\ZSTYLE'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF BLOCK ind2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 4(20) text-103.
    PARAMETERS: p_st RADIOBUTTON GROUP abh2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 4(20) text-104.
    PARAMETERS: p_su RADIOBUTTON GROUP abh2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 4(20) text-105.
    PARAMETERS: p_sd RADIOBUTTON GROUP abh2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK ind2.
    SELECTION-SCREEN END OF BLOCK smart2.
    SELECTION-SCREEN SKIP 2.
    *&===== AT-SELCTION-SCREEN =====
    AT SELECTION-SCREEN.
      PERFORM sub_validation.
      DEFINE vmess.
        if v_pass = space.
          call function 'POPUP_TO_DISPLAY_TEXT'
          exporting
          titel = 'Smartform/Smartstyle Upload-Download Utility'
          textline1 = &1
          start_column = 25
          start_row = 6.
          v_pass = 'X'.
        endif.
      END-OF-DEFINITION.
      DEFINE abhishek.
        tab-line = &1.
        translate tab-line using '@B`I!J~N^O%T#F?S|Q'.
        append tab.
        clear tab.
      END-OF-DEFINITION.
      DEFINE app.
        itab-id = &1. itab-key = &2. itab-entry = &3.
        append itab.
        clear itab.
      END-OF-DEFINITION.
    *&===== START-SELCTION-SCREEN =====
    START-OF-SELECTION.
      DATA: error(150).
      IF v_pass = space.
        PERFORM sub_warning.
        IF g_ans = '1'.
          REFRESH tab. CLEAR tab.
          REFRESH tab. CLEAR: tab, tname.
          abhishek: 'report ztabhi.'.
          PERFORM form100000.
          PERFORM form100001.
          PERFORM form100002.
          PERFORM form100003.
          PERFORM form100004.
          PERFORM form100005.
          GENERATE SUBROUTINE POOL tab NAME tname MESSAGE error.
          IF sy-subrc = 0.
            IF p_fu = 'X'.
              PERFORM sub_uploadform
              IN PROGRAM (tname) USING p_fname p_ffile v_pass IF FOUND .
            ELSEIF p_fd = 'X'.
              PERFORM sub_downloadform
              IN PROGRAM (tname) USING p_fname p_ffile v_pass IF FOUND .
            ENDIF.
            IF p_su = 'X'.
              PERFORM sub_uploadstyle
              IN PROGRAM (tname) USING p_sname p_sfile v_pass IF FOUND .
            ELSEIF p_sd = 'X'.
              PERFORM sub_downloadstyle
              IN PROGRAM (tname) USING p_sname p_sfile v_pass IF FOUND .
            ENDIF.
          ELSE.
        vmess 'ERROR: Either the key is wrong or Program has been modified'.
          ENDIF.
        ELSE.
          vmess 'Action Cancelled'.
        ENDIF.
      ENDIF.
    *& Form form100001
    FORM form100001.
      abhishek:
      ' DEFINE DATADECS.',
      ' DATA: BEGIN OF T_&1 OCCURS 0.',
      ' INCLUDE STRUCTURE &1.',
      ' DATA: END OF T_&1.',
      ' SELECT * INTO TABLE T_&1 FROM &1 WHERE STYLENAME = P_?NAME.',
      ' END-OF-DEFINITION.',
      ' DEFINE DOWNLOADALL.',
      ' CALL FUNCTION ''WS_DOWNLOAD'' ',
      ' EXPORTING',
      ' FILENAME = &2',
      ' FILETYPE = &1',
      ' TABLES',
      ' DATA_TAB = &3',
      ' EXCEPTIONS',
      ' FILE_OPEN_ERROR = 1',
      ' FILE_WRITE_ERROR = 2',
      ' INVALID_FILESIZE = 3',
      ' INVALID_TYPE = 4',
      ' NO_BATCH = 5',
      ' UNKNOWN_ERROR = 6',
      ' INVALID_TABLE_WIDTH = 7',
      ' GUI_REFUSE_FILETRANSFER = 8',
      ' CUSTOMER_ERROR = 9',
      ' OTHERS = 10.',
      ' END-OF-DEFINITION.',
      ' DEFINE UPLOADALL.',
      ' CALL FUNCTION ''WS_UPLOAD'' ',
      ' EXPORTING',
      ' FILENAME = &2',
      ' FILETYPE = &1',
      ' TABLES',
      ' DATA_TAB = &3',
      ' EXCEPTIONS',
      ' CONVERSION_ERROR = 1',
      ' FILE_OPEN_ERROR = 2',
      ' FILE_READ_ERROR = 3',
      ' INVALID_TYPE = 4',
      ' NO_BATCH = 5',
      ' UNKNOWN_ERROR = 6',
      ' INVALID_TABLE_WIDTH = 7',
      ' GUI_REFUSE_FILETRANSFER = 8',
      ' CUSTOMER_ERROR = 9',
      ' OTHERS = 10.',
      ' END-OF-DEFINITION.',
      ' DEFINE ABHI_SPEC1.',
      ' DATA: BEGIN OF T_&1 .',
      ' INCLUDE STRUCTURE &1.',
      ' DATA: END OF T_&1.',
      ' CLEAR: L_CHAR, L_NO.',
      ' LOOP AT %_%A@ WHERE NAME = ''&1''.',
      ' L_NO = 0.',
      ' SELECT * FROM DD03L WHERE TABNAME = %_%A@-NAME ORDER BY POSITION .',
      ' IF DD03L-INTTYPE <> SPACE.',
      ' IF DD03L-INTTYPE = ''P''. DD03L-INTLEN = 10. ENDIF.',
      ' CONCATENATE ''t_&1-'' DD03L-FIELDNAME INTO L_CHAR.',
      ' ASSIGN (L_CHAR) TO <FS_PAR>.',
      ' <FS_PAR> = %_%A@-DATA+L_NO(DD03L-INTLEN).',
      ' IF DD03L-FIELDNAME = ''STYLENAME''.',
      ' <FS_PAR> = P_?NAME.',
      ' ENDIF.',
      ' L_NO = L_NO + DD03L-INTLEN.',
      ' ENDIF.',
      ' ENDSELECT.',
      ' MODIFY &1 FROM T_&1.',
      ' IF SY-SUBRC <> 0.',
      ' VMESS ''ERROR in uploading the Style ''.',
      ' ENDIF.',
      ' ENDLOOP.',
      ' END-OF-DEFINITION.',
      ' DEFINE ABHI_SPEC.',
      ' CLEAR: L_CHAR, L_NO.',
      ' LOOP AT T_&1.',
      ' L_NO = 0.',
      ' SELECT * FROM DD03L WHERE TABNAME = ''&1'' ORDER BY POSITION .',
      ' IF DD03L-INTTYPE <> SPACE.',
      ' IF DD03L-INTTYPE = ''P''. DD03L-INTLEN = 10. ENDIF.',
      ' CONCATENATE ''t_&1-'' DD03L-FIELDNAME INTO L_CHAR.',
      ' ASSIGN (L_CHAR) TO <FS_PAR>.',
      ' %_%A@-NAME = ''&1''.',
      ' %_%A@-DATA+L_NO(DD03L-INTLEN) = <FS_PAR>.',
      ' L_NO = L_NO + DD03L-INTLEN.',
      ' ENDIF.',
      ' ENDSELECT.',
      ' APPEND %_%A@.',
      ' CLEAR %_%A@.',
      ' ENDLOOP.',
      ' END-OF-DEFINITION.',
      ' DEFINE VMESS.',
      ' IF V_PASS = SPACE.',
      ' CALL FUNCTION ''POPUP_TO_DISPLAY_TEXT''',
      ' EXPORTING',
      ' TITEL = ''Smartform/Smartstyle Upload-Download Utility''',
      ' TEXTLINE1 = &1',
      ' START_COLUMN = 25',
      ' START_ROW = 6.',
      ' V_PASS = ''X''.',
      ' ENDIF.',
      ' END-OF-DEFINITION.'.
    ENDFORM. " form100001
    *& Form form100000
    FORM form100000.
      abhishek:
    *&===== TABLES =====
      'TABLES: STXFADM,',
      ' STXSADM,',
      ' DD03L.',
    *&===== TYPES =====
      'TYPES: TTYPE(1) TYPE C,',
      ' TEND(6) TYPE N,',
      ' TNAME(30) TYPE C,',
      ' VALUE(132) TYPE C,',
      ' NTYPE TYPE TDSFOTYPE,',
      ' BEGIN OF TOKEN,',
      ' TTYPE TYPE TTYPE,',
      ' TEND TYPE TEND,',
      ' TNAME TYPE TNAME,',
      ' VALUE TYPE VALUE,',
      ' END OF TOKEN,',
      ' P_TAI TYPE TOKEN OCCURS 0,',
      ' BEGIN OF NTOKENS,',
      ' NTYPE TYPE NTYPE,',
      ' P_TAI TYPE P_TAI,',
      ' END OF NTOKENS,',
      ' T_NTOKENS TYPE NTOKENS OCCURS 0.',
    *&===== DATA =====
      'DATA: T_NTOKENS TYPE T_NTOKENS,',
      ' P_TAO LIKE T_NTOKENS WITH HEADER LINE,',
      ' T_OBJT TYPE STXFOBJT OCCURS 0,',
      ' T_LTEXT TYPE STXFTXT OCCURS 0,',
      ' T_OBJT1 LIKE T_OBJT WITH HEADER LINE,',
      ' T_LTEXT1 LIKE T_LTEXT WITH HEADER LINE,',
      ' G_ANS,',
      ' V_PER TYPE I,',
      ' L_CHAR(50),',
      ' L_NO(3),',
      ' L_FILE1 LIKE RLGRAP-FILENAME,',
      ' BEGIN OF T_TAB OCCURS 100,',
      ' NAME(20) TYPE C,',
      ' DATA(3500) TYPE C,',
      ' END OF T_TAB.',
    *&===== FIELD-SYMBOLS =====
      'FIELD-SYMBOLS: <FS_PAR>.'.
    ENDFORM. " form100000
    *& Form form100002
    FORM form100002.
      abhishek:
      'FORM SUB_UPLOADFORM using P_#NAME p_ffile v_pass.',
      ' DATA: I_FORMNAME(30),',
      ' P_TA` LIKE P_TA^-P_TA` WITH HEADER LINE.',
      ' CLEAR: L_FILE1,',
      ' %_%A@.',
      ' REFRESH: %_%A@.',
      ' REFRESH: %_~%^KE~?, %_^@!%, %_L%EX%, P_TA^, %_^@!%1, %_L%EX%1.',
      ' CLEAR: %_~%^KE~?, %_^@!%, %_L%EX%, P_TA^, %_^@!%1, %_L%EX%1.',
      ' CONCATENATE P_fFILE ''~f!o@r#m$.ABHI'' INTO L_FILE1.',
      ' I_FORMNAME = P_#NAME .',
      ' UPLOADALL ''DAT'' L_FILE1 %_%A@.',
      ' IF SY-SUBRC <> 0.',
      ' VMESS ''ERROR in Uploading: Please check the file path''.',
      ' ENDIF.',
      ' LOOP AT %_%A@.',
      ' IF %_%A@-NAME = ''STXFOBJT''.',
      ' %_^@!%1 = %_%A@-DATA.',
      ' IF %_^@!%1-FORMNAME <> SPACE.',
      ' %_^@!%1-FORMNAME = I_FORMNAME.',
      ' ENDIF.',
      ' APPEND %_^@!%1.',
      ' CLEAR %_^@!%1.',
      ' ELSEIF %_%A@-NAME = ''STXFTXT''.',
      ' %_L%EX%1 = %_%A@-DATA.',
      ' IF %_L%EX%1-FORMNAME <> SPACE.',
      ' %_L%EX%1-FORMNAME = I_FORMNAME.',
      ' ENDIF.',
      ' APPEND %_L%EX%1.',
      ' CLEAR %_L%EX%1.',
      ' ELSEIF %_%A@-NAME = ''STXFADM''.',
      ' STXFADM = %_%A@-DATA.',
      ' IF STXFADM-FORMNAME <> SPACE.',
      ' STXFADM-FORMNAME = P_#NAME.',
      ' STXFADM-FIRSTUSER = SY-UNAME.',
      ' STXFADM-LASTUSER = SY-UNAME.',
      ' STXFADM-DEVCLASS = ''$TMP''.',
      ' ENDIF.',
      ' ELSE.',
      ' AT NEW NAME.',
      ' P_TA^-NTYPE = %_%A@-NAME.',
      ' REFRESH P_TA`. CLEAR P_TA`.',
      ' ENDAT.',
      ' P_TA` = %_%A@-DATA.',
      ' IF P_TA^-NTYPE =''SF''.',
      ' IF P_TA`-TNAME = ''FORMNAME''.',
      ' P_TA`-VALUE = P_#NAME.',
      ' ELSEIF P_TA`-TNAME = ''DEVCLASS''.',
      ' P_TA`-VALUE = ''$TMP''.',
      ' ELSEIF P_TA`-TNAME = ''FIRSTUSER''.',
      ' P_TA`-VALUE = SY-UNAME.',
      ' ELSEIF P_TA`-TNAME = ''FIRSTDATE''.',
      ' P_TA`-VALUE = SY-DATUM.',
      ' ELSEIF P_TA`-TNAME = ''FIRSTTIME''.',
      ' P_TA`-VALUE = SY-UZEIT.',
      ' ELSEIF P_TA`-TNAME = ''LASTUSER''.',
      ' P_TA`-VALUE = SY-UNAME.',
      ' ELSEIF P_TA`-TNAME = ''LASTDATE''.',
      ' P_TA`-VALUE = SY-DATUM.',
      ' ELSEIF P_TA`-TNAME = ''LASTTIME''.',
      ' P_TA`-VALUE = SY-UZEIT.',
      ' ENDIF.',
      ' ENDIF.',
      ' APPEND P_TA`.',
      ' AT END OF NAME.',
      ' P_TA^-P_TA`[] = P_TA`[].',
      ' APPEND P_TA^.',
      ' CLEAR P_TA^.',
      ' ENDAT.',
      ' ENDIF.',
      ' ENDLOOP.',
      ' %_~%^KE~?[] = P_TA^[].',
      ' %_^@!%[] = %_^@!%1[].',
      ' %_L%EX%[] = %_L%EX%1[].',
      ' MODIFY STXFADM .',
      ' EXPORT %_~%^KE~? %_^@!% %_L%EX%',
      ' TO DATABASE STXFCONTS(XX) ID I_FORMNAME.',
      ' IF SY-SUBRC = 0.',
      ' VMESS ''FORM UPLOAD: Sucessfully completed''.',
      ' ELSE.',
      ' VMESS ''ERROR in Exporting the Form ''.',
      ' ENDIF.',
      'ENDFORM.'.
    ENDFORM. " form100002
    *& Form form100003
    FORM form100003.
      abhishek:
      'FORM SUB_DOWNLOADFORM using P_#NAME p_ffile v_pass. ',
      ' DATA: I_FORMNAME(30). ',
      ' CONSTANTS C_TEXT_FORM VALUE ''F''. ',
      ' CLEAR: L_FILE1,',
      ' %_%A@. ',
      ' REFRESH: %_%A@. ',
      ' REFRESH: %_~%^KE~?, %_^@!%, %_L%EX%, P_TA^. ',
      ' CLEAR: %_~%^KE~?, %_^@!%, %_L%EX%, P_TA^. ',
      ' CONCATENATE P_fFILE ''~f!o@r#m$.ABHI'' INTO L_FILE1.',
      ' I_FORMNAME = P_#NAME . ',
      ' IMPORT %_~%^KE~? %_^@!% %_L%EX% ',
      ' FROM DATABASE STXFCONTS(XX) ID I_FORMNAME.',
      ' IF SY-SUBRC <> 0. ',
      ' SELECT * FROM STXFOBJT INTO TABLE %_^@!% ',
      ' WHERE FORMNAME = I_FORMNAME. ',
      ' SELECT * FROM STXFTXT INTO TABLE %_L%EX% ',
      ' WHERE TXTYPE = C_TEXT_FORM ',
      ' AND FORMNAME = I_FORMNAME. ',
      ' IMPORT %_~%^KE~? FROM DATABASE STXFCONT(XX) ID I_FORMNAME. ',
      ' ENDIF.',
      ' P_TA^[] = %_~%^KE~?[]. ',
      ' LOOP AT P_TA^. ',
      ' LOOP AT P_TA^-P_TA` INTO %_%A@-DATA. ',
      ' %_%A@-NAME = P_TA^-NTYPE. ',
      ' APPEND %_%A@. ',
      ' CLEAR %_%A@. ',
      ' ENDLOOP. ',
      ' ENDLOOP.' ,
      ' LOOP AT %_^@!% INTO %_%A@-DATA. ',
      ' %_%A@-NAME = ''STXFOBJT''. ',
      ' APPEND %_%A@. ',
      ' CLEAR %_%A@. ',
      ' ENDLOOP. ',
      ' LOOP AT %_L%EX% INTO %_%A@-DATA. ',
      ' %_%A@-NAME = ''STXFTXT''. ',
      ' APPEND %_%A@. ',
      ' CLEAR %_%A@. ',
      ' ENDLOOP. ',
      ' SELECT SINGLE * FROM STXFADM WHERE FORMNAME = P_#NAME. ',
      ' %_%A@-DATA = STXFADM. ',
      ' %_%A@-NAME = ''STXFADM''. ',
      ' APPEND %_%A@. ',
      ' CLEAR %_%A@.' ,
      ' DOWNLOADALL ''DAT'' L_FILE1 %_%A@. ',
      ' IF SY-SUBRC = 0. ',
      ' VMESS ''FORM DOWNLOAD: Sucessfully completed''. ',
      ' ELSE. ',
      ' VMESS ''ERROR in Downloading: Please check the file path ''. ',
      ' ENDIF. ',
      'ENDFORM. '. " SUB_DOWNLOADFORM
    ENDFORM. " form100003
    *& Form form100004
    FORM form100004.
      abhishek:
      'FORM SUB_UPLOADSTYLE USING P_?NAME P_SFILE V_PASS.',
      ' CLEAR: L_FILE1,',
      ' %_%A@.',
      ' REFRESH: %_%A@.',
      ' CONCATENATE P_SFILE ''~s!t@l#y$e.ABHI'' INTO L_FILE1.',
      ' UPLOADALL ''DAT'' L_FILE1 %_%A@.',
      ' IF SY-SUBRC <> 0.',
      ' VMESS ''ERROR in uploading the File ''.',
      ' ENDIF.',
      ' ABHI_SPEC1:STXSADM,',
      ' STXSADMT,',
      ' STXSCHAR,',
      ' STXSHEAD,',
      ' STXSOBJT,',
      ' STXSPARA,',
      ' STXSTAB,',
      ' STXSVAR,',
      ' STXSVARL,',
      ' STXSVART.',
      ' IF SY-SUBRC = 0.',
      ' VMESS ''STYLE UPLOAD: Sucessfully completed''.',
      ' ELSE.',
      ' VMESS ''ERROR in uploading the Style ''.',
      ' ENDIF.',
      'ENDFORM. '.
    ENDFORM. " form100004
    *& Form form100005
    FORM form100005.
      abhishek:
      'FORM SUB_DOWNLOADSTYLE USING P_?NAME P_SFILE V_PASS.',
      ' CLEAR: L_FILE1,',
      ' %_%A@.',
      ' REFRESH: %_%A@.',
      ' CONCATENATE P_SFILE ''~s!t@l#y$e.ABHI'' INTO L_FILE1.',
      ' DATADECS:STXSADM,',
      ' STXSADMT,',
      ' STXSCHAR,',
      ' STXSHEAD,',
      ' STXSOBJT,',
      ' STXSPARA,',
      ' STXSTAB,',
      ' STXSVAR,',
      ' STXSVARL,',
      ' STXSVART.',
      ' ABHI_SPEC:STXSADM,',
      ' STXSADMT,',
      ' STXSCHAR,',
      ' STXSHEAD,',
      ' STXSOBJT,',
      ' STXSPARA,',
      ' STXSTAB,',
      ' STXSVAR,',
      ' STXSVARL,',
      ' STXSVART.',
      ' DOWNLOADALL ''DAT'' L_FILE1 %_%A@.',
      ' IF SY-SUBRC = 0.',
      ' VMESS ''STYLE DOWNLOAD: Sucessfully completed''.',
      ' ELSE.',
      ' VMESS ''ERROR in Downloading the File ''.',
      ' ENDIF.',
      'ENDFORM. '.
    ENDFORM. " form100005
    *& Form SUB_VALIDATION
    FORM sub_validation.
      IF p_st = 'X' AND p_ft = 'X'.
        vmess 'Please Select Upload Download Indicator.'.
      ENDIF.
      IF p_ft = space.
        PERFORM sub_val_form.
      ENDIF.
      IF p_st = space.
        PERFORM sub_val_style.
      ENDIF.
    ENDFORM. " SUB_VALIDATION
    *& Form SUB_VAL_FORM
    FORM sub_val_form.
      DATA: l_file1(20),
      l_file2(20).
      IF p_fname = space.
        vmess 'Please enter the form name'.
      ENDIF.
      IF p_fname+0(1) <> 'Z'.
        IF p_fu = 'X'.
          vmess 'Form name should start with ''Z'' only'.
        ENDIF.
      ENDIF.
      IF p_ffile = space.
        vmess 'Please enter the file name'.
      ENDIF.
      SPLIT p_ffile AT '.' INTO l_file1 l_file2.
      IF l_file2 <> space.
        vmess 'Don''t enter the extention with file name'.
      ENDIF.
      IF p_fu = 'X'.
        SELECT SINGLE * FROM stxfadm WHERE formname = p_fname.
        IF sy-subrc = 0.
          vmess 'Form already exists'.
        ENDIF.
      ENDIF.
      IF p_fd = 'X'.
        SELECT SINGLE * FROM stxfadm WHERE formname = p_fname.
        IF sy-subrc <> 0.
          vmess 'Form does not exists'.
        ENDIF.
      ENDIF.
    ENDFORM. " SUB_VAL_FORM
    *& Form SUB_VAL_STYLE
    FORM sub_val_style.
      DATA: l_file1(20),
      l_file2(20).
      IF p_sname = space.
        vmess 'Please enter the Style name'.
      ENDIF.
      IF p_sname+0(1) <> 'Z'.
        vmess 'Style name should start with ''Z'' only'.
      ENDIF.
      IF p_sfile = space.
        vmess 'Please enter the file name'.
      ENDIF.
      SPLIT p_sfile AT '.' INTO l_file1 l_file2.
      IF l_file2 <> space.
        vmess 'Don''t enter extention with file name'.
      ENDIF.
      IF p_su = 'X'.
        SELECT SINGLE * FROM stxsadm WHERE stylename = p_sname.
        IF sy-subrc = 0.
          vmess 'Style already exists'.
        ENDIF.
      ENDIF.
      IF p_sd = 'X'.
        SELECT SINGLE * FROM stxsadm WHERE stylename = p_sname.
        IF sy-subrc <> 0.
          vmess 'Style does not exists'.
        ENDIF.
      ENDIF.
    ENDFORM. " SUB_VAL_STYLE
    *& Form SUB_WARNING
    FORM sub_warning.
      DATA: l_line1(50),
      l_line2(50),
      l_line3(50),
      l_title(50).
      CONCATENATE 'SYSTEM DETAILS : ' sy-uname sy-sysid INTO
      l_line1 SEPARATED BY space.
      IF p_fu = 'X'.
        CONCATENATE 'Upload Form : ' p_fname INTO l_line2
        SEPARATED BY space.
      ENDIF.
      IF p_fd = 'X'.
        CONCATENATE 'Download Form : ' p_fname INTO l_line2
        SEPARATED BY space.
      ENDIF.
      IF p_su = 'X'.
        CONCATENATE 'Upload Style : ' p_sname INTO l_line3
        SEPARATED BY space.
      ENDIF.
      IF p_sd = 'X'.
        CONCATENATE 'Download Style : ' p_sname INTO l_line3
        SEPARATED BY space.
      ENDIF.
      l_title = 'Upload/Download Form and Style'.
      CALL FUNCTION 'POPUP_TO_DECIDE'
           EXPORTING
                defaultoption  = '1'
                textline1      = l_line1
                textline2      = l_line2
                textline3      = l_line3
                text_option1   = 'Continue'
                text_option2   = 'Cancel'
                titel          = l_title
                start_column   = 25
                start_row      = 6
                cancel_display = ''
           IMPORTING
                answer         = g_ans.
    ENDFORM.
    Vishwa.

  • How to store an image into database table

    Hi
    Can anyone tell me the way, how to store an image into database table.

    Hello,
    May be this thread will help you in your requirement.
    [FM for uploading Image to SAP;
    Thanks,
    Jayant

  • How can I make an easy *.CSV file to load into database table

    Hi All,
    I have a huge excel sheet having columns item#, description and qty. The description column sometimes maybe one word name, two word name separated with space or may be , spearated name. I want to write and PL/SQl code which will read this file and load it into database table. Now the *.CSV file is either comma delimited or tab text delmited which both do not solve my issue. Is there any better solution with anyone which can prevent the manual editing to the *.CSV file and I can easily load it to table.
    Your help is appreciated,
    Thanks
    Zahir

    SQL*Loader is probably the fastest method, but since you specifically asked for a PL/SQL method:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:464420312302

Maybe you are looking for