In call transaction how can we handle error records.

hai..tellme how can we handle error records in call transaction..we can get error records into one flatfile ok...then we have to execute the same bdc program with dat flat file (error records) once again...is it wright ..

Hi,
check this program u will get idea
seee this prog. its will help u .
copy and run this prog.
TYPES : BEGIN OF t_disp ,
vendorno(9),
compcc(13),
purchorg(14),
accgroup(15),
title(7),
name(5),
country(8),
ordcurr(14),
END OF t_disp.
TYPES : BEGIN OF t_err,
msgtyp LIKE bdcmsgcoll-msgtyp,
l_mstring(250),
END OF t_err.
DATA: i_disp TYPE STANDARD TABLE OF t_disp,
wa_disp TYPE t_disp,
i_err TYPE STANDARD TABLE OF t_err,
wa_err TYPE t_err.
data definition
Batchinputdata of single transaction
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
messages of call transaction
DATA: messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
error session opened (' ' or 'X')
DATA: e_group_opened.
message texts
TABLES: t100.
PARAMETER : p_file1 LIKE ibipparms-path,
p_cmode LIKE ctu_params-dismode DEFAULT 'N'.
"A: show all dynpros
"E: show dynpro on error only
"N: do not display dynpro
*selction screen.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file1.
AT SELECTION-SCREEN ON p_file1.
IF p_file1 IS INITIAL.
MESSAGE 'FILE IS NOT FOUND' TYPE 'E'.
ENDIF.
START-OF-SELECTION.
PERFORM f_disp_file1.
END-OF-SELECTION.
PERFORM f_disp_errs.
*& Form F_DISP_FILE1
text
--> p1 text
<-- p2 text
FORM f_disp_file1 .
DATA: l_filename1 TYPE string.
MOVE p_file1 TO l_filename1.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_filename1
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = i_disp
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.
*? prepare BDC data
DELETE i_disp INDEX 1.
LOOP AT i_disp INTO wa_disp .
PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF02K-LIFNR'
wa_disp-vendorno.
'ztest_1'.
PERFORM bdc_field USING 'RF02K-BUKRS'
wa_disp-compcc.
'0001'.
PERFORM bdc_field USING 'RF02K-EKORG'
wa_disp-purchorg.
'0001'.
PERFORM bdc_field USING 'RF02K-KTOKK'
wa_disp-accgroup.
'0001'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFA1-SPRAS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_field USING 'LFA1-ANRED'
wa_disp-title.
'Mr.'.
PERFORM bdc_field USING 'LFA1-NAME1'
wa_disp-name.
'test name'.
PERFORM bdc_field USING 'LFA1-SORTL'
'TEST NAME'.
PERFORM bdc_field USING 'LFA1-LAND1'
wa_disp-country.
'in'.
PERFORM bdc_field USING 'LFA1-SPRAS'
'en'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFA1-KUNNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0210'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFB1-AKONT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0215'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFB1-ZTERM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0220'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFB5-MAHNA'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0310'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFM1-WAERS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=UPDA'.
PERFORM bdc_field USING 'LFM1-WAERS'
wa_disp-ordcurr.
'inr'.
PERFORM bdc_transaction USING 'XK01'.
WRITE:/ WA_DISP-VendorNo,
WA_DISP-COMPCC,
WA_DISP-PURCHORG,
WA_DISP-ACCGROUP,
WA_DISP-title,
WA_DISP-name,
WA_DISP-country,
WA_DISP-ORDCURR.
CLEAR: wa_disp.
REFRESH bdcdata.
ENDLOOP.
ENDFORM. " F_DISP_FILE1
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
IF FVAL NODATA.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDIF.
ENDFORM. "BDC_FIELD
*& Form bdc_transaction
text
-->P_0322 text
FORM bdc_transaction USING tcode.
DATA: l_mstring(480),
l_subrc LIKE sy-subrc.
REFRESH messtab.
CALL TRANSACTION tcode USING bdcdata
MODE p_cmode
UPDATE 'L'
MESSAGES INTO messtab.
l_subrc = sy-subrc.
IF SMALLLOG 'X'.
WRITE: / 'CALL_TRANSACTION',
TCODE,
'returncode:'(I05),
L_SUBRC,
'RECORD:',
SY-INDEX.
LOOP AT messtab.
SELECT SINGLE * FROM t100 WHERE sprsl = messtab-msgspra
AND arbgb = messtab-msgid
AND msgnr = messtab-msgnr.
IF sy-subrc = 0.
l_mstring = t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH messtab-msgv1 INTO l_mstring.
REPLACE '&2' WITH messtab-msgv2 INTO l_mstring.
REPLACE '&3' WITH messtab-msgv3 INTO l_mstring.
REPLACE '&4' WITH messtab-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH messtab-msgv1 INTO l_mstring.
REPLACE '&' WITH messtab-msgv2 INTO l_mstring.
REPLACE '&' WITH messtab-msgv3 INTO l_mstring.
REPLACE '&' WITH messtab-msgv4 INTO l_mstring.
ENDIF.
CONDENSE l_mstring.
WRITE: / messtab-msgtyp, l_mstring(250).
*? Send this errors to err internal table
wa_err-msgtyp = messtab-msgtyp.
wa_err-l_mstring = l_mstring.
APPEND wa_err TO i_err.
ELSE.
WRITE: / messtab.
ENDIF.
CLEAR: messtab, wa_err.
ENDLOOP.
SKIP.
ENDIF.
ENDFORM. " bdc_transaction
*& Form f_disp_errs
text
--> p1 text
<-- p2 text
FORM f_disp_errs .
SORT i_err BY msgtyp.
LOOP AT i_err INTO wa_err.
AT FIRST.
WRITE : / text-002.
ULINE.
ENDAT.
AT NEW msgtyp.
IF wa_err-msgtyp = 'S'.
WRITE : / text-003.
ULINE.
ELSEIF wa_err-msgtyp = 'E'.
WRITE : / text-001.
ULINE.
ENDIF.
ENDAT.
WRITE : / wa_err-msgtyp, wa_err-l_mstring.
CLEAR wa_err.
ENDLOOP.
ENDFORM. " f_disp_errs
Regards

Similar Messages

  • How can i handle error in my apex form

    Hi experts,
    I have designed a form where i record values.I have a create button and when i press it without entering any values i have the following error. How can i handle tat error so that if i dont enter any values i have an error message being displaying prompting the user to enter values
    ORA-01400: cannot insert NULL into ("LOTTO_BI"."HOURLY_SALES"."ACT_AMT")
         Error      Unable to process row of table HOURLY_SALES.

    As far as I understand your problem you just have to add a validation to your page processing.
    In the third step when creating a validation you can choose "Item not null".

  • How can i handle error 500 ?

    i want to implement simple error handling by using the erro-page construction in web.xml. so i create the following code:
    <error-page>
    <error-code>400</error-code>
    <location>/fehler400.html</location>
    </error-page>
    when i produce error 400 the server goes to page fehler400.html.
    when i use the same construction for error 500 (internal server error):
    <error-page>
    <error-code>500</error-code>
    <location>/fehler500.html</location>
    </error-page>
    and i produce such an error it don't work correctly. The server goes into a endless loop. All time the server wanted to use the startpage of my application.
    What can i do ?

    when logout from application and than query a page inside the applicationen the server produces an error an whant to open the login site with event = init.
    therewith this work i defined a default event on my login page.
    <event name="*">
    <null/>
    </event>
    now when i query a page inside the application without login the server brings automatically up the login page.

  • Errors in flat file records? how can i handle them?

    Hi All,
    I am new for BDC. I am uploading customer(XD01) records using BDC caltransaction method.my problem is when i am running the program, some times my program is not updating the records because of my flat file errors. after i correcting the error records and if i run the same program already updated records not processing. my program not running. what i need to do? how can i handle the flat file for reprocessing the error records?
    i have around 50,000 records in my flat file.

    your program accepts a flat file say the structure of it is structure_load and you create another structure similar to structure_load and name it structure_error.
    loop at itab_load.
    call transactions...
    if success..
    commit work and wait X sec.
    else.
    move-corresponding field to structure_error
    append structure_error.
    endif.
    endloop.
    write the file stru_error to PC or app server and make the changes  to the data and use the str_error as input to your code again..

  • Can any one tell me How can I handle internal error in smartforn

    Hi,
    How can I handle internal error in smartforn, what type of problem can be.
    Regards
    chandra

    Look at [SAP Smart Forms (BC-SRV-SCR)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRSF/BCSRVSCRSF.pdf]
    Runtime Errors
    Each Smart Form can trigger a number of exceptions during its execution. To limit this number of exceptions, you can bundle the occurring errors in error classes and store them in an error log in the composer. For each error, you store an internal error number and (if possible) a message from table T100 (work area, message number, message text and parameters) in addition to the error class. To each error class, you assign an exception, which means that if the recognized error teminates the form processing, the system triggers exactly this exception. When an exception occurs, the caller of the Smart Form can use predefined function modules to read the error log and then decide which reaction is appropriate in the respective error context.
    Possible exceptions for the generated function module are:
    - FORMATTING_ERROR
    - INTERNAL_ ERROR
    - SEND_ERROR
    - USER_CANCELED
    In addition, you can define your own exceptions.
    If an error (or a warning) occurs, the system internally fills an error table. The application can now read this table as soon as the function module for the form is processed to the end. To read the table that contains all errors and warnings that occurred, call function module SSF_READ_ERRORS. The table has structure SSFERROR. The fields in the table are the number of the document within the job, the form name, an error number, a message class, a message type, a message number and four additional message variables. If processing is terminated, the application can dynamically display a message. The error numbers are defined in the include SSF_ERROR.
    If you want to trigger your own exception in the free coding of the Smart Form, you can use one of the following methods:
    - Use the macro user_exception <exception>, which triggers the exception <exception> and fills the above tables. After the termination additional system variables for the error (symsgno, sy-msgtyp, and so on) do not contain the values required for your own exception.
    - If you want to access the system variables sy-msgno, sy-msgtyp, and so on for your exception directly, proceed as follows: Call function module SSF_MESSAGE and trigger your exception yourself using the RAISE statement.
    The system field &SFSY-EXCEPTION& contains the name of the triggered exception.
    Then debug your program.
    Regards

  • How can I handle runtime errors in Java

    Please some one tell me what are runtime errors and How can I handle them using java code
    This is important
    Thanks in Advance
    Chowdary AK

    The java equivalent of function pointers is the one-instance class, as used to pass handlers to swing components, for example. Often an anonymous class is used.
    Put your function signature in an interface, and pass an object that implements that interface:
    public Class1 {
      public interface CallBack {
        void myMethod(String arg1);
      CallBack callb;
      public Class1(CallBack callb) {
       this.callb = callb;
      callb.myMethod("A string");
    class2 {
       first = new Class1(new Class1.CallBack() {
         public void myMethod(String arg1) {
           ... do something ...

  • I made a website and the domainname is tschantré with that special é (egue). but it gives me an error, how can i handle that?

    how can i handle that i can gibe the domainname with é - any code? or something else?

    Could you please confirm the error message you are getting and whether it is while adding domain in File > Export as HTML or File > Upload to FTP host option or if there is a different location you are referring to?
    I checked and both the Export and Upload to FTP options both accept the accented characters in domain name field.
    Cheers,
    Vikas

  • How can we handle multiple applications in session method

    how can we handle multiple applications in .. session method.
    can any body reply me.
    thanks

    Hari,
    hi Check out this sample code to use session method
    REPORT  ztest_report
    NO STANDARD PAGE HEADING
                            LINE-SIZE 255
                            MESSAGE-ID ZRASH.
                    Internal Table Declarations                          *
    *--Internal Table for Data Uploading.
    DATA : BEGIN OF IT_FFCUST OCCURS 0,
             KUNNR(10),
             BUKRS(4),
             KTOKD(4),
             ANRED(15),
             NAME1(35),
             SORTL(10),
             STRAS(35),
             ORT01(35),
             PSTLZ(10),
             LAND1(3),
             SPRAS(2),
             AKONT(10),
           END OF IT_FFCUST.
    *--Internal Table to Store Error Records.
    DATA : BEGIN OF IT_ERRCUST OCCURS 0,
             KUNNR(10),
             EMSG(255),
           END OF IT_ERRCUST.
    *--Internal Table to Store Successful Records.
    DATA : BEGIN OF IT_SUCCUST OCCURS 0,
             KUNNR(10),
             SMSG(255),
           END OF IT_SUCCUST.
    *--Internal Table for Storing the BDC data.
    DATA : IT_CUSTBDC LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    *--Internal Table for storing the messages.
    DATA : IT_CUSTMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA : V_FLAG1(1) VALUE ' ',
    "Flag used for opening session.
           V_TLINES LIKE SY-TABIX,
           "For storing total records processed.
           V_ELINES LIKE SY-TABIX,
           "For storing the no of error records.
           V_SLINES LIKE SY-TABIX.
           "For storing the no of success records.
             Selection screen                                            *
    SELECTION-SCREEN BEGIN OF BLOCK B1.
    PARAMETERS : V_FNAME LIKE RLGRAP-FILENAME,
                 V_SESNAM  LIKE RLGRAP-FILENAME.
    SELECTION-SCREEN END OF BLOCK B1.
             Start-of-selection                                          *
    START-OF-SELECTION.
    *-- Form to upload flatfile data into the internal table.
      PERFORM FORM_UPLOADFF.
           TOP-OF-PAGE                                                   *
    TOP-OF-PAGE.
      WRITE:/ 'Details of the error and success records for the transaction'
      ULINE.
      SKIP.
             End of Selection                                            *
    END-OF-SELECTION.
    *-- Form to Generate a BDC from the Uploaded Internal table
      PERFORM FORM_BDCGENERATE.
    *--To write the totals and the session name.
      PERFORM FORM_WRITEOP.
    *&      Form  form_uploadff
        Form to upload flatfile data into the internal table.
    FORM FORM_UPLOADFF .
    *--Variable to change the type of the parameter file name.
      DATA : LV_FILE TYPE STRING.
      LV_FILE = V_FNAME.
    *--Function to upload the flat file to the internal table.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                      =  LV_FILE
        FILETYPE                      = 'ASC'
          HAS_FIELD_SEPARATOR           = 'X'
        HEADER_LENGTH                 = 0
        READ_BY_LINE                  = 'X'
        DAT_MODE                      = ' '
      IMPORTING
        FILELENGTH                    =
        HEADER                        =
        TABLES
          DATA_TAB                      = IT_FFCUST
        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.
    *--Deleting the headings from the internal table.
        DELETE IT_FFCUST INDEX 1.
    *--Getting the total number of records uploaded.
        DESCRIBE TABLE IT_FFCUST LINES V_TLINES.
      ENDIF.
    ENDFORM.                    " form_uploadff
    *&      Form  Form_bdcgenerate
        Form to Generate a BDC from the Uploaded Internal table
    FORM FORM_BDCGENERATE .
    *--Generating the BDC table for the fields of the internal table.
      LOOP AT IT_FFCUST.
        PERFORM POPULATEBDC USING :
                                    'X' 'SAPMF02D' '0105',
                                    ' ' 'BDC_OKCODE'  '/00' ,
                                    ' ' 'RF02D-KUNNR' IT_FFCUST-KUNNR,
                                    ' ' 'RF02D-BUKRS' IT_FFCUST-BUKRS,
                                    ' ' 'RF02D-KTOKD' IT_FFCUST-KTOKD,
                                    'X' 'SAPMF02D' '0110' ,
                                    ' ' 'BDC_OKCODE'  '/00',
                                    ' ' 'KNA1-ANRED'  IT_FFCUST-ANRED,
                                    ' ' 'KNA1-NAME1' IT_FFCUST-NAME1,
                                    ' ' 'KNA1-SORTL'  IT_FFCUST-SORTL,
                                    ' ' 'KNA1-STRAS' IT_FFCUST-STRAS,
                                    ' ' 'KNA1-ORT01' IT_FFCUST-ORT01,
                                    ' ' 'KNA1-PSTLZ' IT_FFCUST-PSTLZ,
                                    ' ' 'KNA1-LAND1' IT_FFCUST-LAND1,
                                    ' ' 'KNA1-SPRAS' IT_FFCUST-SPRAS,
                                    'X' 'SAPMFO2D' '0120',     
                                    ' ' 'BDC_OKCODE'  '/00',
                                    'X' 'SAPMF02D' '0125',     
                                    ' ' 'BDC_OKCODE'  '/00',
                                    'X' 'SAPMF02D' '0130',     
                                    ' ' 'BDC_OKCODE'  '=ENTR',
                                    'X' 'SAPMF02D' '0340',     
                                    ' ' 'BDC_OKCODE'  '=ENTR',
                                    'X' 'SAPMF02D' '0360',
                                    ' ' 'BDC_OKCODE'  '=ENTR',
                                    'X' 'SAPMF02D' '0210',     
                                    ' ' 'KNB1-AKONT'  IT_FFCUST-AKONT,
                                    ' ' 'BDC_OKCODE'  '/00',
                                    'X' 'SAPMF02D' '0215',
                                    ' ' 'BDC_OKCODE'  '/00',
                                    'X' 'SAPMF02D' '0220',     
                                    ' ' 'BDC_OKCODE'  '/00',
                                    'X' 'SAPMF02D' '0230',     
                                    ' ' 'BDC_OKCODE'  '=UPDA'.
    *--Calling the transaction 'fd01'.
        CALL TRANSACTION 'FD01' USING IT_CUSTBDC MODE 'N' UPDATE 'S'
        MESSAGES INTO IT_CUSTMSG.
        IF SY-SUBRC <> 0.
    *--Populating the error records internal table.
          IT_ERRCUST-KUNNR = IT_FFCUST-KUNNR.
          APPEND IT_ERRCUST.
          CLEAR IT_ERRCUST.
    *--Opening a session if there is an error record.
          IF V_FLAG1 = ' '.
            PERFORM FORM_OPENSESSION.
            V_FLAG1 = 'X'.
          ENDIF.
    *--Inserting the error records into already open session.
          IF V_FLAG1 = 'X'.
            PERFORM FORM_INSERT.
          ENDIF.
    *--Populating the Success records internal table.
        ELSE.
          IT_SUCCUST-KUNNR = IT_FFCUST-KUNNR.
          APPEND IT_SUCCUST.
          CLEAR IT_SUCCUST.
        ENDIF.
    *--Displaying the messages.
        IF NOT IT_CUSTMSG[] IS INITIAL.
          PERFORM FORM_FORMATMSG.
        ENDIF.
    *--Clearing the message and bdc tables.
        CLEAR : IT_CUSTBDC[],IT_CUSTMSG[].
      ENDLOOP.
    *--Getting the total no of error records.
      DESCRIBE TABLE IT_ERRCUST LINES V_ELINES.
    *--Getting the total no of successful records.
      DESCRIBE TABLE IT_SUCCUST LINES V_SLINES.
    *--Closing the session only if it is open.
      IF V_FLAG1 = 'X'.
        PERFORM FORM_CLOSESESS.
      ENDIF.
    ENDFORM.                    " Form_bdcgenerate
    *&      Form  populatebdc
          FOrm to Populate the BDC table.
    FORM POPULATEBDC  USING    VALUE(P_0178)
                               VALUE(P_0179)
                               VALUE(P_0180).
      IF P_0178 = 'X'.
        IT_CUSTBDC-PROGRAM = P_0179.
        IT_CUSTBDC-DYNPRO = P_0180.
        IT_CUSTBDC-DYNBEGIN = 'X'.
      ELSE.
        IT_CUSTBDC-FNAM = P_0179.
        IT_CUSTBDC-FVAL = P_0180.
      ENDIF.
      APPEND IT_CUSTBDC.
      CLEAR IT_CUSTBDC.
    ENDFORM.                    " populatebdc
    *&      Form  FORM_OPENSESSION
          Form to Open a session.
    FORM FORM_OPENSESSION .
    *--Variable to convert the given session name into reqd type.
      DATA : LV_SESNAM(12).
      LV_SESNAM = V_SESNAM.
    *--Opening a session.
      CALL FUNCTION 'BDC_OPEN_GROUP'
       EXPORTING
         CLIENT                    = SY-MANDT
         GROUP                     = LV_SESNAM
         HOLDDATE                  = '20040805'
         KEEP                      = 'X'
         USER                      = SY-UNAME
         PROG                      = SY-CPROG
    IMPORTING
       QID                       =
       EXCEPTIONS
         CLIENT_INVALID            = 1
         DESTINATION_INVALID       = 2
         GROUP_INVALID             = 3
         GROUP_IS_LOCKED           = 4
         HOLDDATE_INVALID          = 5
         INTERNAL_ERROR            = 6
         QUEUE_ERROR               = 7
         RUNNING                   = 8
         SYSTEM_LOCK_ERROR         = 9
         USER_INVALID              = 10
         OTHERS                    = 11
      IF SY-SUBRC <> 0.
        WRITE :/ 'Session not open'.
      ENDIF.
    ENDFORM.                    " FORM_OPENSESSION
    *&      Form  FORM_INSERT
          fORM TO INSERT ERROR RECOED INTO A SESSION.
    FORM FORM_INSERT .
    *--Inserting the record into session.
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          TCODE                  = 'FD01'
        POST_LOCAL             = NOVBLOCAL
        PRINTING               = NOPRINT
        SIMUBATCH              = ' '
        CTUPARAMS              = ' '
        TABLES
          DYNPROTAB              = IT_CUSTBDC
        EXCEPTIONS
          INTERNAL_ERROR         = 1
          NOT_OPEN               = 2
          QUEUE_ERROR            = 3
          TCODE_INVALID          = 4
          PRINTING_INVALID       = 5
          POSTING_INVALID        = 6
          OTHERS                 = 7
      IF SY-SUBRC <> 0.
        WRITE :/ 'Unable to insert the record'.
      ENDIF.
    ENDFORM.                    " FORM_INSERT
    *&      Form  FORM_CLOSESESS
          Form to Close the Open Session.
    FORM FORM_CLOSESESS .
      CALL FUNCTION 'BDC_CLOSE_GROUP'
        EXCEPTIONS
          NOT_OPEN    = 1
          QUEUE_ERROR = 2
          OTHERS      = 3.
      IF SY-SUBRC <> 0.
      ENDIF.
    ENDFORM.                    " FORM_CLOSESESS
    *&      Form  FORM_FORMATMSG
          Form to format messages.
    FORM FORM_FORMATMSG .
    *--Var to store the formatted msg.
      DATA : LV_MSG(255).
      CALL FUNCTION 'FORMAT_MESSAGE'
        EXPORTING
          ID        = SY-MSGID
          LANG      = SY-LANGU
          NO        = SY-MSGNO
          V1        = SY-MSGV1
          V2        = SY-MSGV2
          V3        = SY-MSGV3
          V4        = SY-MSGV4
        IMPORTING
          MSG       = LV_MSG
        EXCEPTIONS
          NOT_FOUND = 1
          OTHERS    = 2.
      IF SY-SUBRC = 0.
        WRITE :/ LV_MSG.
      ENDIF.
      ULINE.
    ENDFORM.                    " FORM_FORMATMSG
    *&      Form  form_writeop
          To write the totals and the session name.
    FORM FORM_WRITEOP .
      WRITE :/ 'Total Records Uploaded :',V_TLINES,
               / 'No of Error Records :',V_ELINES,
               / 'No of Success Records :',V_SLINES,
               / 'Name of the Session :',V_SESNAM.
      ULINE.
    ENDFORM.                    " form_writeop
    Don't forget to reward if useful..

  • How can I handel errors in .ksh file

    Hi All
    I am writing a .ksh file which will create FTP a file to the ftp location ..
    My file looks like this :-
    cd ${RUNTIME}
    NOW=$(date +"%y%m%d%H%M%S")
    ftp -i -n -v ${TEST_TP_SERVER} <<END
    user $TEST_TP_USER_ID $TEST_TP_USER_PWD
    lcd ${OUTDIR}
    put "TEST.txt" "$NOW.ABC"
    quit
    END
    My question is how can I handel errors here in this file . If something happens after cd ${RUNTIME} line then I can write like this :
    if [ "$?" -ne "0" ]; then echo "Can not connect , wrong user name / password " exit 1 fi 
    But after ftp -i -n -v ${TEST_TP_SERVER} <<END line I cant write the same . So can anyone please tell me how can I write error handling part after FTP command ?

    Moreover, I need to send that page as a whole by email, so even if the white spaces between parts of picture
    could be removed during printing, it wouldn't be a solution =(
    You can email the new PDF document.

  • How can I handle exception? - to give user more friendly notification

    Hi!
    User gets an error:
    'Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process. current checksum =...'
    How can I handle this exception (when two users want to modify the same set of data at the same time)? I would like to hide the above error message and give user more friendly notification.
    Thanks in advance,
    Tom

    Thanks Vikas for your answer.
    These workarounds are really creative and I want to use one of them. BUT my problem is to 'catch' the exception/error when two users want to modify the same set of data at the same time.
    Those solutions which we can read about in this link you gave me describe handling exceptions in pl/sql processes. How can I catch the error I am talking about in pl/sql code?
    Code would be like this:
    DECLARE
    two_users EXCEPTION;
    BEGIN
    IF --catch the error
    THEN RAISE two_users;
    END IF;
    EXCEPTION WHEN two_users
    THEN :HIDDEN_ITEM := 'Error Message';
    END;
    What should I put in a place where there is '--catch the error' ??
    Thanks in advance,
    Tom

  • How can we handle table control parameter in lsmw

    hi guru,
    please tell me  how can we handle table control parameter in lsmw.
    thanks & regards
    subhasis.

    Hi,
    we  create table control program (module pool) this program use in LSMW,
    we mention the transaction code ,write ur  table control program name.
    This is use full for u
    Reguards,
    lakshmi

  • How can we handle in flex application if the server is down?

    how can we handle in flex application if the server is down?

    You and me both. 
    As ambiguous as the original question was, I think he was just asking how to handle a server exception and I would suggest generally just using a Alert.show("your specific message (eg.  The server is currently unavailable)") in the place where you handle the fault return from your service or http call.  I'm sure there are more complicated messaging frameworks or approaches, but that seems to be enough for my apps.

  • How can we handle table control in BDC?

    Hi,
    How can we handle table control in BDC?
    regards
    eswar

    hi,
    check this example:
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    ex:
    *& Report  ZSR_BDC_TBCTRL
    REPORT  ZSR_BDC_TBCTRL
            NO STANDARD PAGE HEADING LINE-SIZE 255.
    TABLES : RF02K,LFA1,LFBK.
    DATA : BEGIN OF IT_VEN OCCURS 0,
          LIFNR LIKE RF02K-LIFNR,
          KTOKK LIKE RF02K-KTOKK,
          NAME1 LIKE LFA1-NAME1,
          SORTL LIKE LFA1-SORTL,
          LAND1 LIKE LFA1-LAND1,
          SPRAS LIKE LFA1-SPRAS,
          BANKS(6) TYPE C,
          BANKL(17) TYPE C,
          BANKN(19) TYPE C,
          END OF IT_VEN.
    DATA : BEGIN OF BANKS OCCURS 0,
           BANKS LIKE LFBK-BANKS,
           END OF BANKS,
           BEGIN OF BANKL OCCURS 0,
           BANKL LIKE LFBK-BANKL,
           END OF BANKL,
           BEGIN OF BANKN OCCURS 0,
           BANKN LIKE LFBK-BANKN,
           END OF BANKN.
    DATA : FLD(20) TYPE C,
           CNT(2) TYPE N.
    DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    INCLUDE BDCRECX1.
    START-OF-SELECTION.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'Z:\sr.TXT'
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = IT_VEN
    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.
    PERFORM OPEN_GROUP.
    LOOP AT IT_VEN.
        REFRESH BDCDATA.
        REFRESH : BANKS,BANKL,BANKN..
        SPLIT IT_VEN-BANKS AT ',' INTO TABLE BANKS.
        SPLIT IT_VEN-BANKL AT ',' INTO TABLE BANKL.
        SPLIT IT_VEN-BANKN AT ',' INTO TABLE BANKN.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0100'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RF02K-KTOKK'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'RF02K-LIFNR'
                                  IT_VEN-LIFNR.
    PERFORM BDC_FIELD       USING 'RF02K-KTOKK'
                                  IT_VEN-KTOKK.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0110'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFA1-SPRAS'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'LFA1-NAME1'
                                  IT_VEN-NAME1.
    PERFORM BDC_FIELD       USING 'LFA1-SORTL'
                                  IT_VEN-SORTL.
    PERFORM BDC_FIELD       USING 'LFA1-LAND1'
                                  IT_VEN-LAND1.
    PERFORM BDC_FIELD       USING 'LFA1-SPRAS'
                                  IT_VEN-SPRAS.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0120'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFA1-KUNNR'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0130'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFBK-BANKN(02)'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=ENTR'.
    *perform bdc_field       using 'LFBK-BANKS(01)'
                                 'DE'.
    *perform bdc_field       using 'LFBK-BANKS(02)'
                                 'DE'.
    *perform bdc_field       using 'LFBK-BANKL(01)'
                                 '10020030'.
    *perform bdc_field       using 'LFBK-BANKL(02)'
                                 '67270003'.
    *perform bdc_field       using 'LFBK-BANKN(01)'
                                 '12345'.
    *perform bdc_field       using 'LFBK-BANKN(02)'
                                 '66666'.
    MOVE 1 TO CNT.
        LOOP AT BANKS.
          CONCATENATE 'LFBK-BANKS(' CNT ') ' INTO FLD.
          PERFORM BDC_FIELD USING FLD BANKS-BANKS.
          CNT = CNT + 1.
        ENDLOOP.
        MOVE 1 TO CNT.
        LOOP AT BANKL.
          CONCATENATE 'LFBK-BANKL(' CNT ') ' INTO FLD.
          PERFORM BDC_FIELD USING FLD BANKL-BANKL.
          CNT = CNT + 1.
        ENDLOOP.
        MOVE 1 TO CNT.
        LOOP AT BANKN.
          CONCATENATE 'LFBK-BANKN(' CNT ') ' INTO FLD.
          PERFORM BDC_FIELD USING FLD BANKN-BANKN.
          CNT = CNT + 1.
        ENDLOOP.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0130'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFBK-BANKS(01)'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=ENTR'.
    PERFORM BDC_DYNPRO      USING 'SAPLSPO1' '0300'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=YES'.
    PERFORM BDC_TRANSACTION USING 'XK01'.
    ENDLOOP.
    PERFORM CLOSE_GROUP.

  • How can we transfer error report

    Hi!
    experts,
    how can we transfer error report from a BAPI to the application server? as i am collecting the error report from the BAPI ?

    You can use the following code in your program for your ref:
    REPORT ZEX_DATATOFILE .
    *& ABAPLOVERS: Data Transfer
    Parameters to enter the path
    PARAMETERS FILENAME(128) DEFAULT '/usr/tmp/testfile.dat'
                             LOWER CASE.
    Table Declaration
    DATA: it_return type table of  BAPIRET2.
    Data Declaration
    DATA D_MSG_TEXT(50).
    populate DOCUMENTHEADER and pass to BAPI
    *You can call your Bapi here *
    CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
      EXPORTING
        documentheader       = <header>
    IMPORTING
      OBJ_TYPE             =
      OBJ_KEY              =
      OBJ_SYS              =
      tables
        accountgl            =
        currencyamount       =
        return               = it_return
      EXTENSION1           =
    collect all the logs in one internal table
    ENDLOOP.
    Opening the File
    OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE
                          MESSAGE D_MSG_TEXT.
    IF SY-SUBRC NE 0.
      WRITE: 'File cannot be opened. Reason:', D_MSG_TEXT.
      EXIT.
    ENDIF.
    Transferring Data
    LOOP AT  it_return to wa_return .
      TRANSFER wa_return  TO FILENAME.
    ENDLOOP.
    Closing the File
    CLOSE DATASET FILENAME.
    Regards
    Dhirendra
    Edited by: dhirendra pandit on Jul 7, 2009 1:55 PM

  • How can i handle BLOB.

    How can i handle BLOB data.

    Thank you for the input, but it wasn't so usefull. I found a soluten to get the get a blob from the database.
    <snip>
    MimeBodyPart mbp = new MimeBodyPart();
    // Create the Multipart to be added the parts to
         Multipart mp = new MimeMultipart();
    while( rs.next()) {
    BLOB Attachment     = rs.getBLOB("att");
    String FileName     = rs.getString("nam");
    String FileType     = rs.getString("ext");
    // Create and fill the second message part (Attachements)     
         MimeBodyPart mbp1 = new MimeBodyPart();
         String type = (FileType != null ? FileType : dftMime);
         String fileName = (FileName != null ? FileName : dftName);
         mbp1.setDisposition(Part.ATTACHMENT);
         mbp1.setFileName(fileName);
         mbp1.setDataHandler(new
         DataHandler(new BLOBDataSource(Attachment, type)));
         mbp1.setHeader( "Content-Transfer-Encoding", "base64" );
         mp.addBodyPart(mbp1);
    Now i get the following stacktrace:
    A send error is occured. Exit program.null
    javax.mail.internet.ParseException
    at javax.mail.internet.ContentType.<init>(ContentType.java:89)
    at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1249)
    at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1001)
    at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:333)
    at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1255)
    at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2012)
    at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1980)
    at javax.mail.Transport.send(Transport.java:97)
    at miag.app.mail.SendMail.send(SendMail.java:150)
    at miag.app.mail.SendMail.main(SendMail.java:37)
    The email will not be sent.
    Thank you
    Rene

Maybe you are looking for