How to convert raw data to original data

Hi,
I'm using db10g.
I have stored the blob of a word doc into the database using dbms_lob package.
Now during retrieval, i'm getting the raw data using the code
dbms_lob.read( l_lob, l_amt, l_off, l_raw );
l_raw is of type raw.
I want to convert the raw data to original string.
Please Help
Thanks

Divya wrote:
I think I have clearly told that i have blobs of different files in my database.
The files are of different type, I have blob of pdf,doc,html,xml,gif etc...
and in the procedure i have posted(get_file_contents), it is a database procedure and i'm calling it from the forms.
So i'm passing the file_name and file_id to the procedure(file_name and file_id are the columns in the table.
Table 'Blob_Details' have 4 columns file_id,file_name,file_type,theblob) and a varchar variable final_data.
final_data varchar(32000)
and in the procedure i'm taking the blob from database, reading it using dbms_lob.read in a loop and casting it to varchar and storing the contents in the variable final_data.
So coming out of the loop, the variable final_data will have the contents of the given file.BLOB data (such as word or excel documents and PDFs containing images etc.) are Binary data, not Character data. Converting that raw binary data to VARCHAR will cause issues.
If you have loaded a binary file and stored it on the database as a BLOB (Binary data) and you now want to create the original file from that BLOB, you will simply need to read the BLOB data from the database into BLOB variable and process it in chunks, using UTL_FILE to write out, in Binary mode, that data to a file with the appropriate filename. The actual process is quite simple...
As sys user:
CREATE OR REPLACE DIRECTORY MY_FILES AS 'c:\myfiles';
GRANT READ,WRITE ON DIRECTORY MY_FILES TO myuser;As myuser:
DECLARE
   -- Data Variables
   v_blob             BLOB;
   v_data_length      NUMBER;
   -- Loop Control Variables
   v_offset           NUMBER := 1;
   v_chunk   CONSTANT NUMBER := 32767; -- maximum chunk size
   -- UTL_FILE variables
   fh                 UTL_FILE.file_type;
BEGIN
   v_blob := ... populate the blob variable here
   v_data_length := DBMS_LOB.getlength (v_blob);
   -- Open the file
   fh := UTL_FILE.fopen ('MY_FILES', 'myfile.dat', 'wb', v_chunk);
   LOOP
      -- Exit when our file offset is bigger than our file
      EXIT WHEN v_offset > v_data_length;
      -- Write the output chunk by chunk
      UTL_FILE.put_raw (fh, DBMS_LOB.SUBSTR (v_blob, v_chunk, v_offset), TRUE);
      -- Increment the offset by the amount written
      v_offset := v_offset + v_chunk;
   END LOOP;
   -- Close the file
   UTL_FILE.fclose (fh);
END;

Similar Messages

  • Date Time Original & Date Time Digitized bug

    I have noticed that in Lightroom (1.1 or 1.2, doesn't matter) my photographs display WRONG Date Time Original & Date Time Digitized in the Metadata section. Both are exactly 30 minutes behind the actual time the photos were shot - eg., if I have shot a photo at 7:00pm, it will be shown as though it was shot at 6:30pm. Bridge correctly displays both this info. Any suggestions on how to rectify this info in Lightroom? Thanks,

    If you are shooting RAW, take care with "Edit capture time". There is
    evidence that it causes a rewrite of the RAW file by LR. This
    kind of a rewrite is dangerous, sometimes causing corruption. See
    this thread for a discussion:
    http://www.adobeforums.com/webx/.3c0331a6
    --Milt--

  • HOW TO CONVERT RAW FILES TO JPEG RGB 8 BIT in iphoto

    Can someone please tell me how to convert RAW files to jpeg RGB 8 bit in iphoto on an iMac?

    How are you trying to "export to Mypics"? The only way to get a Raw out of iPhoto is to export with the Kind set to Original.
    Regards
    TD

  • How to convert raw files from new fujifilm x-t1 ?

    how to convert raw files from new fujifilm x-t1 ?

    The work around of converting the CR2 to dng either with the dng converter or ACR 6.7 will allow working in LR and CS5 but not with the latest raw conversion engine from Adobe i.e PV 2012.
    Remember to keep a copy of the CR2 files if you wish to utilize the Canon software.

  • How to convert raw data to wav files??

    Hi AnyOne,
    Can anyone know how to do convert raw data in hex format into wav file format??
    Please show some guideline.
    Thank You.

    Hi Craig,
    Thanks for the reply.
    I do follow according the the wav creation standard and save it as wav file. However, i still fail to read back the wav file.
    I using LV8.2. Attach with my testvi and data. Please guide if i make any mistake in my testvi
    Thx and Regards,
    Simon76     
    Attachments:
    data.txt ‏7 KB
    testvi.JPG ‏39 KB
    header.txt ‏1 KB

  • Organize raw images keeping original date

    I want to organize my photos using AND KEEPING the original date & time.
    If I use Canon Digital Phote Professional v. 3.13.20.0 this is changed. Now I have big problems in windows explorer to get them chronological. I don't care about WHEN I edit the photos, I want the original dates, these are important to me!
    How do I do that??

    Thanks for your reply, it has taken me some time and courage to pick it up again...
    In DPP, sort by "Shooting Date/Time".
    .....Yes, this works, but for some older original files the date has now been changed somehow, so the chronological order is now wrong. And my computer is soooo slow to respond, and DPP keeps hanging. A new computer is necessary.
    Files edited in any way are given a new date of the time of editing.
    Note also that the Rename Tool allows you to incorporate the shooting date and/or time into the file name.
    ... Yes, but now I use the date in a format not available, so I add it in a textformat.
    I am not sure wether the date on the renamed files will change or not while doing that, it was some weeks ago I did it.
    If I rename and make a copy, the date the copy was created is used, NOT the original time and date the photo was taken. In Irfanview I can set this feature, new files keep the original date and time, but then .CR2 files are not recognized and shown by Irfanview (at least in my situation, maybe my Irfanview version is too old), so only half of the photos are renamed (only the .JPG ones, not the RAW photos).  
    And in Windows 8 (and I think also in Windows 7) , WE lets you make the shooting date one of the visible columns and sort on it
    ... correct, but it is not standard, you have to open it specifically, and then it is so slow to respond. And .CR2 files are not supplied with shooting date in WE, so only the .JPG photos are sorted.
    In DPP, e..g. if I give 1-5 star rating to a file I have to save it, and then in Windows explorer the save date is shown, not the original date which I like to keep, whatever I do with the file and when, because that is not important to me.   
    I will have to work out a system to rename it before I edit anything, so it remains in chronological order, and later I can rate them, edit them etc. But I would like to check them and reject/delete the bad photos before giving the good ones a logical name. What should I eat first, the egg or the chicken ...

  • When I open up "originals" in my iPhoto library, the dates are not there or are incorrect.  I see date created and date modified, not the original date the picture was taken.  How can I find the accurate original dates?

    I have had a lot of issues with my iPhoto program. After many trips to the Genius Bar and numerous hours with phone techs, I am now rebuilding my library, starting with a backup of it from before the corruption. When I "get info" of a picture, I notice the original date the picture was taken (most important for me), is not there or is wrong.  When I check package contents of my iPhoto library, the originals show up, but most (not all) of the dates are wrong.  Can anyone tell me how or where I might find the original dates?

    I did post to the iPhoto forum and am hoping for an answer soon. I don't want to continue rebuilding my iphoto library if I can do it using originals. My library has 45,000 pictures...a huge job!

  • How to convert a string value to date

    Dear All,
    I am new to powershell script, i was trying to store a Ad user password set date to a variable add, add a number of days to get the expire date.
    but when i try to convert the variable to date value, I am getting the error as below.
    Please help me......
    PS C:\script> $passwordSetDate = (get-aduser user1 -properties * | select PasswordLastSet)
    PS C:\script> $passwordSetDate
    PasswordLastSet
    7/15/2014 8:17:24 PM
    PS C:\script> $a = [datetime]::ParseExact($passwordSetDate,"MM/dd/yyyy HH:MM:SS", $null)
    Cannot find an overload for "ParseExact" and the argument count: "3".
    At line:1 char:1
    + $a = [datetime]::ParseExact($passwordSetDate,"MM/dd/yyyy HH:MM:SS", $null)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodException
        + FullyQualifiedErrorId : MethodCountCouldNotFindBest
    PS C:\script> $a = [datetime]::ParseExact($passwordSetDate,"MM/dd/yyyy HH:MM:SS", $null)

    Dear All,
    I am new to powershell script, i was trying to store a Ad user password set date to a variable add, add a number of days to get the expire date.
    but when i try to convert the variable to date value, I am getting the error as below.
    Please help me......
    PS C:\script> $passwordSetDate = (get-aduser user1 -properties * | select PasswordLastSet)
    PS C:\script> $passwordSetDate
    PasswordLastSet
    7/15/2014 8:17:24 PM
    PS C:\script> $a = [datetime]::ParseExact($passwordSetDate,"MM/dd/yyyy HH:MM:SS", $null)
    Cannot find an overload for "ParseExact" and the argument count: "3".
    At line:1 char:1
    + $a = [datetime]::ParseExact($passwordSetDate,"MM/dd/yyyy HH:MM:SS", $null)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodException
        + FullyQualifiedErrorId : MethodCountCouldNotFindBest
    PS C:\script> $a = [datetime]::ParseExact($passwordSetDate,"MM/dd/yyyy HH:MM:SS", $null)
    In your post you ask how to convert a string value to a date.  The value returned from the Get-AdUser is already a date.  It does not need to be converted.
    Bill has sshown one way to convert a date to a string and there are other methods.  You need to clarify your question.
    If you are really trying ot convert strings to dates then you can start with this:
    [datetime]'01/21/1965 13:33:23'
    Most date strings aer autodetected by the class.
    ¯\_(ツ)_/¯

  • How to convert object type to only Date type ?

    Hii everyone,
    I have a table in database and their is column called as date and its data type is DateTime
    In my UI part i have taken a Datepeacker and what ever user selected that date i am storing in my Date properties which has the same data type DateTime and at the Insertion time the date inserting successfully but at the time of updating data i am getting
    error that the Date is not correct format because in date property it having the value 23:12:2014 00:00:00 which is crate problem at the time of update. So how to solve this ?
    Note : I am using VS2008 and using Datagrid inside datgrid what ever changes user make tat one i required to update ,below are my update code which done through datatable i.e
      first i have done datatable dt=new datatable();
                                  dt = EmpBusinessLayer.SelectManager(dd.Eno)
    then my update logic is :
        for (int i= 0; i < dt.Rows.Count; i++)
                    ee.Ename = dt.Rows[i][0].ToString();
                    ee.Job = dt.Rows[i][1].ToString();
                    ee.Dept = dt.Rows[i][2].ToString();
                    ee.Gender = dt.Rows[i][3].ToString();
                    ee.Status =Convert.ToInt32(dt.Rows[i][4]);
                    ee.Dates = Convert.ToDateTime(dt.Rows[i][6]);// Hear i am getting value like 23.8.2104 00:00:00
                    ee.Eno = Convert.ToInt32(dt.Rows[i][9]);
                    cmd = new SqlCommand("update Employee set sEname='"+ee.Ename+"', sEJob='"+ee.Job+"', sEDept='"+ee.Dept+"',
    sGender='"+ee.Gender+"', bStatus="+ee.Status+", dDates="+ee.Dates+" where iEmpNo="+ee.Eno, con);       // Hear Getting Error tat incorrect syntax 00
                    if (con.State != ConnectionState.Open)
                        con.Open();
                    if (cmd.ExecuteNonQuery() > 0)
                        return 1;
    S.K Nayak

    You could use the yyyy-MM-dd format by calling the ToString method on the DateTime object:
    cmd = new SqlCommand("update Employee set sEname='"+ee.Ename+"', sEJob='"+ee.Job+"', sEDept='"+ee.Dept+"', sGender='"+ee.Gender+"', bStatus="+ee.Status+", dDates=" + ee.Dates.ToString("yyyy-MM-dd") +" where iEmpNo="+ee.Eno, con);
    Note that you should use parameters when create a command like this though:
    https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlparametercollection.addwithvalue(v=vs.110).aspx
    But that's another story for another thread in another forum.
    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question.

  • How do I save emails with original dates to a cd

    I am trying to save a sizable group of emails to a CD and have tried to create a folder and simply drag and drop each one.  This is both time comsuming and it leaves me with all the dates reflecting today instead of the original email dates.  Is there a way to copy a groupo of email "with original dates" to a CD.  Please advise - urgent

    Hello
    into mail , make a new mail box (plus button left angle of mail )
    move messages to archive into it ,
    then archive the new mail box ( right click option to archive )
    then burn into cd the "mbox" file in this way no risk to lose date
    Pierre

  • How to convert raw to number in oracle 8

    Does anyone know how to convert a raw data to number format ???
    If i do: select dump(50,16) from dual, it will return bytes c1 33.
    With this bytes in a raw variable, how can i convert it to a number variable in Oracle 8.
    PS: Oracle 8 doesn't have utl_raw.cast_to_number function...
    Thanx.

    Thanx for help... But...
    This examples are very usefull, but only converts a value in HEX to number.
    In my case, i need a routine that convert the bytes of value 50 (i.e. 2 bytes -> C1 33) into a number variable. If i only use hex to number, will return wrong value. I need to convert this bytes (C1 33) into original number, i mean, value 50.
    Using dump function for 50, will return C1 33...
    How can i make to convert C1 33 back to value 50??
    I think that is the same of the utl_raw.cast_to_number, but i'm using Oracle 8, and this function is in Oracle 9...
    Anyone have idea ??

  • How to convert RAW files to JPEG?

    I have a bunch of raw files and I am not sure how to convert them to JPEG.  I sure would appreciate some help with this.  Thank you

    As you are posting on the Canon forum, I will assume you are using a Canon camera.  Your camera came with the software you need.  It's called Digital Photo Professional.  It will also have the user manual for the software.

  • How to convert RAW images to JPG in Imagebrowser EX 1.4.0.5

    I installed ImagBrowser EX so I can view my raw images.  It works fine for viewing but I can't find how to convert them to raw images.  The manual and help file says to go to Edit > Process RAW Images but when I go to the edit menu, there is no such option.  There is only Correct red-eye, auto correct, adjust color and brightness, increase sharpness, crop imae, insert text, edit movies and extract multiple images from movie
    Help?

    You need to install Canon Digital Photo Professional from the camera-supplied CD.
    John Hoffman
    Conway, NH
    1D Mark IV, Rebel T5i, Pixma PRO-100, MX472

  • How to convert raw data into pdf ?

    Hi everyone,
    I have a requirement where I have to print the document present in application server.
    I used below code to do this
    * Open the file in binary mode
       OPEN DATASET gv_filepath FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
       DO.
         TRY.
    * Since the file is opened in Binary mode, the entire contents of the
    * file is read in one go!
             READ DATASET gv_filepath INTO gv_filedata.
             IF sy-subrc <> 0.
               EXIT.
             ENDIF.
           CATCH cx_sy_conversion_codepage.
         ENDTRY.
         APPEND gv_filedata TO gt_file_table.
         CLEAR gv_filedata.
       ENDDO.
       CLOSE DATASET gv_filepath.
    DESCRIBE TABLE gt_file_table LINES lv_lines.
      lv_pages = lv_lines.
      lv_dest = 'LP01'.
      lv_spoolname = 'LOCW'.
      CALL FUNCTION 'RSPO_SX_OUTPUT_TEXTDATA'
        EXPORTING
    *     NAME           = lv_spoolname
          DEST           = lv_dest
          ROWS           = lv_lines
          STARTROW       = 1
          PAGES          = 99
          RQTITLE        = 'Print Spool'
          RQCOPIES       = 1
          RQOWNER        = sy-uname
          IMMEDIATELY    = ' '
        IMPORTING
          RQID           = lv_spoolid
        TABLES
          TEXT_DATA      = gt_file_table
        EXCEPTIONS
          NAME_MISSING   = 1
          NAME_TWICE     = 2
          NOT_FOUND      = 3
          ILLEGAL_LAYOUT = 4
          INTERNAL_ERROR = 5
          SIZE_MISMATCH  = 6
          OTHERS         = 7.
      IF SY-SUBRC <> 0.
    * Implement suitable error handling here
      ENDIF.
    Passed the spool id generated to below FM but it is not converting into pdf
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          SRC_SPOOLID                    = lv_spoolid
         NO_DIALOG                      = ' '
         DST_DEVICE                     = 'LOCW'
         PDF_DESTINATION                = 'X'
    *     NO_BACKGROUND                  =
    *     GET_SIZE_FROM_FORMAT           =
    *     USE_CASCADING                  = ' '
    *   IMPORTING
    *     PDF_BYTECOUNT                  = lv_bytecount
    *     PDF_SPOOLID                    = lv_pdf1
    *     LIST_PAGECOUNT                 =
    *     BTC_JOBNAME                    =
    *     BTC_JOBCOUNT                   =
    *     BIN_FILE                       = lv_pdf
       TABLES
         PDF                            = lt_pdf
       EXCEPTIONS
         ERR_NO_ABAP_SPOOLJOB           = 1
         ERR_NO_SPOOLJOB                = 2
         ERR_NO_PERMISSION              = 3
         ERR_CONV_NOT_POSSIBLE          = 4
         ERR_BAD_DESTDEVICE             = 5
         USER_CANCELLED                 = 6
         ERR_SPOOLERROR                 = 7
         ERR_TEMSEERROR                 = 8
         ERR_BTCJOB_OPEN_FAILED         = 9
         ERR_BTCJOB_SUBMIT_FAILED       = 10
         ERR_BTCJOB_CLOSE_FAILED        = 11
         OTHERS                         = 12
      IF SY-SUBRC <> 0.
    * Implement suitable error handling here
      ENDIF.
    When I go to SP01 and check the spool generated it is in raw document type.
    How can I convert this raw document to pdf type ??
    Please help me to resolve this.
    Regards,
    Krishna

    Ok, since I can't edit the post anymore, here the new version of code, without the use of SCMS_XSTRING_TO_BINARY for intermediate table. Reasons: effectively doubles the memory use and I don't want to check if the kernel is cutting off the hexdecimal nulls when the last spool line is written, or to relay of that behaviour.
    Matthew Billingham, and other mods: it would be really nice if you could hide the old version please (this post here). The number of google results for that FM is scary and I really don't want to contribute to promoting its use...
    REPORT zjbtst2.
    PARAMETERS: p_file TYPE string
       LOWER CASE
       DEFAULT '/usr/sap/....'
       OBLIGATORY.
    PARAMETERS: p_dest TYPE rspopname
      DEFAULT 'LP01'
      OBLIGATORY .
    PERFORM main USING p_file p_dest.
    *&      Form  main
    FORM main
      USING
        i_file TYPE string
        i_dest TYPE  rspopname.
      DATA: lo_handle TYPE REF TO cl_rspo_spool_handle .
      DATA: l_spoolid TYPE rspoid.
      DATA: l_content TYPE xstring .
      DATA: l_message_text TYPE string .
      PERFORM get_file USING i_file CHANGING l_content .
      PERFORM new_spool USING i_dest CHANGING lo_handle l_spoolid.
      PERFORM write_spool USING lo_handle l_spoolid l_content .
      l_message_text = |Spool { l_spoolid } created| .
      MESSAGE l_message_text TYPE 'I' .
    ENDFORM .                  "main
    *&      Form  get_file
    FORM get_file
       USING i_file TYPE string
       CHANGING c_content TYPE xstring.
      DATA: l_message_text TYPE string .
      CLEAR c_content .
      OPEN DATASET i_file FOR INPUT IN BINARY MODE
        MESSAGE l_message_text.
      IF sy-subrc NE 0 .
        MESSAGE l_message_text TYPE 'E' .
      ELSE.
        READ DATASET i_file INTO c_content .
        CLOSE DATASET i_file.
      ENDIF .
    ENDFORM .                   "get_file
    *&      Form  new_spool
    FORM new_spool
       USING
         i_destination TYPE rspopname
       CHANGING
         co_handle TYPE REF TO cl_rspo_spool_handle
         c_spoolid TYPE rspoid .
      cl_rspo_spool_handle=>open(
        EXPORTING
          dest           = i_destination
          name           = 'Test'
          layout         = 'G_RAW'
          doctype        = 'BIN'
        IMPORTING
          ref            = co_handle
          spoolid        = c_spoolid
        EXCEPTIONS
          device_missing = 1
          name_twice     = 2
          no_such_device = 3
          operation_failed = 4
          OTHERS         = 5
      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 .                    "new_spool
    *&      Form  WRITE_SPOOL
    FORM write_spool
      USING
        io_handle TYPE REF TO cl_rspo_spool_handle
        i_spoolid TYPE rspoid
        i_content TYPE xstring .
      DATA: l_buffer(128) TYPE x ."Hmm, 128 does work, 4096 doesn't...
      DATA: l_buffer_length TYPE i .
      DATA: l_full_buffers_count TYPE i .
      DATA: l_part_buffer_length TYPE i .
      DATA: l_offset TYPE i .
      DATA: l_length TYPE i .
      l_buffer_length = xstrlen( l_buffer ) .
      l_full_buffers_count = xstrlen( i_content ) DIV l_buffer_length .
      l_part_buffer_length = xstrlen( i_content ) MOD l_buffer_length .
      DO l_full_buffers_count + 1 TIMES .
        IF sy-index LE l_full_buffers_count .
          l_length = l_buffer_length .
        ELSEIF l_part_buffer_length GT 0 .
          l_length = l_part_buffer_length .
        ELSE.
          EXIT .
        ENDIF .
        l_buffer = i_content+l_offset(l_length) .
        ADD l_length TO l_offset .
        io_handle->write_binary(
          EXPORTING
            data           = l_buffer
            length         = l_length
          EXCEPTIONS
            not_open       = 1
            operation_failed = 2
            OTHERS         = 3
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDDO .
      io_handle->close(
        EXPORTING
          final          = 'X'
        EXCEPTIONS
          operation_failed = 1
          already_closed = 2
          OTHERS         = 3
      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 .                    "write_spool

  • How to convert raw 1024 data to Excel data

    Hi,
    I am having requirement to send email as attachment in CRM, by  using cl_crmcmp_c_mailcuco_impl  class for sending mail.
    i am able to send PDF documents but for excel it is not working
    i am getting data into the table of type crmt_isx_inv_docdetail_raw_t  ( RAW 1024) .
    How can we convert data into the EXCEL type .

    Hi Arpita,
    Try this sample code::
    Send mail
    maildata-obj_name = 'TEST'.
    maildata-obj_descr = 'Test Subject'.
    loop at htmllines.
    mailtxt = htmllines.
    append mailtxt.
    endloop.
    mailrec-receiver = 'your receiver mail id'.
    mailrec-rec_type = 'U'.
    append mailrec.
    call function 'SO_NEW_DOCUMENT_SEND_API1'
    exporting
    document_data = maildata
    document_type = 'EXL'
    put_in_outbox = 'X'
    tables
    object_header = mailtxt
    object_content = mailtxt
    receivers = mailrec
    exceptions
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    others = 8.
    if sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Hope it will help you.
    Regards,
    NIkita

Maybe you are looking for