Skip to Content
author's profile photo
Former Member

records

hi,

how to display error n success records

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 05:31 AM

    hi sivaranjhani..

    i cant get ur question properly... but if i m getting u right than,

    u can sheck sy-subrc's value after any operation to check wether is there any error occured or not?

    and u can put your message to display that error...

    reward if useful..

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 06:31 AM

    Here is a solution for ur requirement....

    See the code for reference....

    data: itab like table of ZTABLE with header line,

    Success type i,

    Error type i,

    total type i.

    ***Your code to upload file

    ***make sure ITAb has same structure as ZTABLE

    loop at itab.

    insert into ZTABLE values itab.

    if sy-subrc eq 0.

    write:/ 'Success',ITAB.

    Success = Success + 1.

    else.

    write:/ 'Error',ITAB.

    error = error + 1.

    endif.

    endloop.

    total = success + error.

    write:/ 'Total No of records:',total.

    write:/ 'No of records successfully inserted:',success.

    write:/ 'No of records with Error:',Error.

    Reward points if useful, get back in case of query...

    Cheers!!!

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 06:34 AM

    Variant 1

    INSERT INTO dbtab VALUES wa. or

    INSERT INTO (dbtabname) VALUES wa. or

    INSERT dbtab FROM wa. or

    INSERT (dbtabname) FROM wa.

    Extras:

    1. ... CLIENT SPECIFIED

    2. ... CONNECTION con

    Effect

    Inserts one line into a database table. The line to be inserted is taken from the work area wa and the data read from left to right according to the line structure of the database table dbtab. Here, the structure of wa is not taken into account. For this reason, the work area wa must be at least as wide (see DATA) as the line structure of dbtab, and the alignment of the work area wa must correspond to the alignment of the line structure. Otherwise, a runtime error occurs.

    If the database table dbtab or the work area wa contain strings, wa must be compatible with the line structure of dbtab.

    When the command has been executed, the system field SY-DBCNT contains the number of inserted lines (0 or 1).

    The Return Code is set as follows:

    SY-SUBRC = 0:

    Line was successfully inserted.

    SY-SUBRC = 4:

    Line could not be inserted since a line with the same key already exists.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 06:43 AM

    Hi

    for that you need declare the message class in the prigram like this

    REPORT ZREPNAME [NO STANDARD PAGE HEADING] [LINE-SIZE col] [LINE-COUNT n(m)] <b>[MESSAGE-ID mid].</b>

    <b>The MESSAGE Statement</b>

    <b>Using a Global Message Class</b>

    If the introductory statement of a program contains the addition

    ... MESSAGE-ID <id>.

    and a message class <id> contained in table T100, you can use the MESSAGE statement as follows:

    MESSAGE <t><num> [WITH <f1> ... <f 4>] [RAISING <exc>].

    where <t> is the single-character message type and <nnn> the three-digit message number.

    <b>Specifying the Message Statically</b>

    To specify the message class, message number, and message type statically,

    use the following form of the MESSAGE statement:

    MESSAGE <t><nnn>(<id>) [WITH <f1> ... <f4>] [RAISING <exc>].

    <b>

    Specifying the Message Dynamically</b>

    To specify the message class, message number, and message type dynamically,

    use the following form of the MESSAGE statement:

    MESSAGE ID <id> TYPE <t> NUMBER <n> [WITH <f1> ... <f4>] [RAISING <exc>].

    where <id>, <t>, and <n> are fields containing the message class, message number,

    and message type respectively.

    <b>Messages and Exceptions</b>

    Within function modules and methods, you can use the RAISING addition

    in the MESSAGE statement to trigger exception:

    MESSAGE..... RAISING <exc>.

    If the calling program does not handle the exception <exc> itself, the message is displayed,

    and the program continues processing in the manner appropriate to the message type

    and context

    <b>Message Types</b>

    A Termination The message appears in a dialog box, and the program terminates. When the user has confirmed the message, control returns to the next-highest area menu.

    E Error Depending on the program context, an error dialog appears or the program terminates.

    I Information The message appears in a dialog box. Once the user has confirmed the message, the program continues immediately after the MESSAGE statement.

    S Status The program continues normally after the MESSAGE statement, and the message is displayed in the status bar of the next screen.

    W Warning Depending on the program context, an error dialog appears or the program terminates.

    X Exit No message is displayed, and the program terminates with a short dump. Program terminations with a short dump normally only occur when a runtime error occurs. Message type X allows you to force a program termination. The short dump contains the message ID.

    <b>Reward if useful</b>

    Add comment
    10|10000 characters needed characters exceeded