How to find out duplicate record contained in a flat file

Hi Experts,
For my project I have written a program for flat file upload.
Requirement 1
In the flat file there may be some duplicate record like:
Field1   Field2
11        test1
11        test2
12        test3
13        test4
Field1 is primary key.
Can you please let me know how I can find out the duplicate record.
Requirement 2
The flat file contains the header row as shown above
Field1   Field2
How our program can skip this record and start reading / inserting records from row no 2 ie
11        test1
onwards.
Thanks
S
FORM upload1.
DATA : wf_title TYPE string,
lt_filetab TYPE filetable,
l_separator TYPE char01,
l_action TYPE i,
l_count TYPE i,
ls_filetab TYPE file_table,
wf_delemt TYPE rollname,
wa_fieldcat TYPE lvc_s_fcat,
tb_fieldcat TYPE lvc_t_fcat,
rows_read TYPE i,
p_error TYPE char01,
l_file TYPE string.
DATA: wf_object(30) TYPE c,
wf_tablnm TYPE rsdchkview.
wf_object = 'myprogram'.
DATA i TYPE i.
DATA:
lr_mdmt TYPE REF TO cl_rsdmd_mdmt,
lr_mdmtr TYPE REF TO cl_rsdmd_mdmtr,
lt_idocstate TYPE rsarr_t_idocstate,
lv_subrc TYPE sysubrc.
TYPES : BEGIN OF test_struc,
/bic/myprogram TYPE /bic/oimyprogram,
txtmd TYPE rstxtmd,
END OF test_struc.
DATA : tb_assum TYPE TABLE OF /bic/pmyprogram.
DATA: wa_ztext TYPE /bic/tmyprogram,
myprogram_temp TYPE ziott_assum,
wa_myprogram TYPE /bic/pmyprogram.
DATA : test_upload TYPE STANDARD TABLE OF test_struc,
wa2 TYPE test_struc.
DATA : wa_test_upload TYPE test_struc,
ztable_data TYPE TABLE OF /bic/pmyprogram,
ztable_text TYPE TABLE OF /bic/tmyprogram,
wa_upld_text TYPE /bic/tmyprogram,
wa_upld_data TYPE /bic/pmyprogram,
t_assum TYPE ziott_assum.
DATA : wa1 LIKE test_upload.
wf_title = text-026.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = wf_title
default_extension = 'txt'
file_filter = 'Tab delimited Text Files (*.txt)'
CHANGING
file_table = lt_filetab
rc = l_count
user_action = l_action
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
OTHERS = 3. "#EC NOTEXT
IF sy-subrc 0.
EXIT.
ENDIF.
LOOP AT lt_filetab INTO ls_filetab.
l_file = ls_filetab.
ENDLOOP.
CHECK l_action = 0.
IF l_file IS INITIAL.
EXIT.
ENDIF.
l_separator = 'X'.
wa_fieldcat-fieldname = 'test'.
wa_fieldcat-dd_roll = wf_delemt.
APPEND wa_fieldcat TO tb_fieldcat.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
CLEAR wa_test_upload.
Upload file from front-end (PC)
File format is tab-delimited ASCII
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
has_field_separator = l_separator
TABLES
data_tab = i_mara
data_tab = test_upload
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.
EXIT.
ELSE.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
IF test_upload IS NOT INITIAL.
DESCRIBE TABLE test_upload LINES rows_read.
CLEAR : wa_test_upload,wa_upld_data.
LOOP AT test_upload INTO wa_test_upload.
CLEAR : p_error.
rows_read = sy-tabix.
IF wa_test_upload-/bic/myprogram IS INITIAL.
p_error = 'X'.
MESSAGE s153 WITH wa_test_upload-/bic/myprogram sy-tabix.
CONTINUE.
ELSE.
TRANSLATE wa_test_upload-/bic/myprogram TO UPPER CASE.
wa_upld_text-txtmd = wa_test_upload-txtmd.
wa_upld_text-txtsh = wa_test_upload-txtmd.
wa_upld_text-langu = sy-langu.
wa_upld_data-chrt_accts = 'xyz1'.
wa_upld_data-co_area = '12'.
wa_upld_data-/bic/zxyzbcsg = 'Iy'.
wa_upld_data-objvers = 'A'.
wa_upld_data-changed = 'I'.
wa_upld_data-/bic/zass_mdl = 'rrr'.
wa_upld_data-/bic/zass_typ = 'I'.
wa_upld_data-/bic/zdriver = 'yyy'.
wa_upld_text-langu = sy-langu.
MOVE-CORRESPONDING wa_test_upload TO wa_upld_data.
MOVE-CORRESPONDING wa_test_upload TO wa_upld_text.
APPEND wa_upld_data TO ztable_data.
APPEND wa_upld_text TO ztable_text.
ENDIF.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM ztable_data.
DELETE ADJACENT DUPLICATES FROM ztable_text.
IF ztable_data IS NOT INITIAL.
CALL METHOD cl_rsdmd_mdmt=>factory
EXPORTING
i_chabasnm = 'myprogram'
IMPORTING
e_r_mdmt = lr_mdmt
EXCEPTIONS
invalid_iobjnm = 1
OTHERS = 2.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
**Lock the Infoobject to update
CALL FUNCTION 'RSDG_IOBJ_ENQUEUE'
EXPORTING
i_objnm = wf_object
i_scope = '1'
i_msgty = rs_c_error
EXCEPTIONS
foreign_lock = 1
sys_failure = 2.
IF sy-subrc = 1.
MESSAGE i107(zddd_rr) WITH wf_object sy-msgv2.
EXIT.
ELSEIF sy-subrc = 2.
MESSAGE i108(zddd_rr) WITH wf_object.
EXIT.
ENDIF.
*****Update Master Table
IF ztable_data IS NOT INITIAL.
CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
EXPORTING
i_iobjnm = 'myprogram'
i_tabclass = 'M'
I_T_ATTR = lt_attr
TABLES
i_t_table = ztable_data
EXCEPTIONS
attribute_name_error = 1
iobj_not_found = 2
generate_program_error = 3
OTHERS = 4.
IF sy-subrc 0.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'zddd_rr'
msgty = 'E'
txtnr = '054'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
MESSAGE e054(zddd_rr) WITH 'myprogram'.
ELSE.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'zddd_rr'
msgty = 'S'
txtnr = '053'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
ENDIF.
*endif.
*****update Text Table
IF ztable_text IS NOT INITIAL.
CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
EXPORTING
i_iobjnm = 'myprogram'
i_tabclass = 'T'
TABLES
i_t_table = ztable_text
EXCEPTIONS
attribute_name_error = 1
iobj_not_found = 2
generate_program_error = 3
OTHERS = 4.
IF sy-subrc 0.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'zddd_rr'
msgty = 'E'
txtnr = '055'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
ENDIF.
ENDIF.
ELSE.
MESSAGE s178(zddd_rr).
ENDIF.
ENDIF.
COMMIT WORK.
CALL FUNCTION 'RSD_CHKTAB_GET_FOR_CHA_BAS'
EXPORTING
i_chabasnm = 'myprogram'
IMPORTING
e_chktab = wf_tablnm
EXCEPTIONS
name_error = 1.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
****Release locks on Infoobject
CALL FUNCTION 'RSDG_IOBJ_DEQUEUE'
EXPORTING
i_objnm = 'myprogram'
i_scope = '1'.
ENDIF.
ENDIF.
PERFORM data_selection .
PERFORM update_alv_grid_display.
CALL FUNCTION 'MESSAGES_SHOW'.
ENDFORM.

Can you please let me know how I can find out the duplicate record.
you need to split the records from flat file structure into your internal table ans use a delete ADJACENT duplicates comparing fields
split flat_str into wa_f1 wa_f2 wa_f2 at tab_space.

Similar Messages

  • How to find out the textframe contains "stroke color" (or) "fillcolor"?

    How to find out the textframe contains "stroke color" (or) "fillcolor" via javascript. Kindly advise me with sample.

    I know, this post is quite a while ago, but: This simply does not work for me. Neither for simple PathItems, nor for the characters of a TextFrame.
    Working on: Illustrator CS5.5, Mac OS, Javascript
    Simple example:
    var numSelectedObjects = app.activeDocument.selection.length;
    // If any objects selected: Get fill and stroke color of the first one
    if(numSelectedObjects > 0){
    alert("Fill Color: " + app.activeDocument.selection[0].fillColor + " / Stroke Color: " + app.activeDocument.selection[0].fillColor);
    This returns always CMYKColor, RGBColor or GrayColor, even if there is no Color assigned to the objects stroke or fill!!
    For PathItems there is the attribute ".filled" or ".stroked", which returns "true" or "false" and is reliable.
    if(app.activeDocument.selection[i].filled){ // works fine with PathItems!
    Is there anything similar for Characters? I tried this one, but it does not work (because I think it does not exist):
    if(app.activeDocument.selection[i].textRange.filled){ // does not work!
    I just need to find out, if the characters in a textfield have got a fill or stroke color. Reliable.
    It would be very nice to get help from anybody!
    Thanks a lot in advance!

  • How to find out which page contains a specific ITextFrame

    Hi all,<br /><br />I would like to ask if it is possible to find out which page contains a specific text frame?<br /><br />I used the following code to find the ITextFrame that contains the caret<br />ISelectionManager* mgr = activeContext->GetContextSelection();<br />InterfacePtr<ITextEditSuite> esuite(mgr, UseDefaultIID());<br />InterfacePtr<ITextTrackerAccess> tracker(esuite, UseDefaultIID());<br />ITextFocus* focus = tracker->QueryTextFocus();<br />ITextModel* model = focus->QueryTextModel();<br />IFrameList* flist = model->QueryFrameList();<br />RangeData range = textFocus->GetCurrentRange();<br />TextIndex cposition = range.Start(0);<br />int32 fidx;<br />ITextFrame* frm = flist->QueryFrameContaining(cposition, &fidx);<br />UIDRef frmUIDRef = ::GetUIDRef(frm);<br /><br />However, when I use the following code to iterate through the pages, I cannot find any UID that matches the ITextFrame<br />for (int32 sIdx = 0; sIdx < spreadList->GetSpreadCount(); sIdx++) {<br />  UIDRef spreadUIDRef(database, spreadList->GetNthSpreadUID(sIdx));<br />  InterfacePtr<ISpread> spread(spreadUIDRef, UseDefaultIID());<br />  for (int32 pIdx = 0; pIdx < spread->GetNumPages(); pIdx++) {<br />    spread->GetItemsOnPage(pageIndex, &uidList);<br />    if (uidList.Contains(frmUIDRef.GetUID()) == kTrue) {<br />      ...<br />    }<br />  }<br />}<br /><br />Any help is appreciate. Thank you.<br /><br />Ikki

    I think your frmUIDRef is too far down the hierarchy to show up in GetItemsOnPage(). Try getting the IHierarchy interface from frmUIDRef and calling QueryParent(). That should get you from the kFrameItemBoss to the kMultiColumnItemBoss. Do the same again and you'll get to the kSplineItemBoss, which should appear in GetItemsOnPage().
    If you're running the debug version of InDesign, you can use the Test menu to run the Diagnostics > Document Structure > Trace Content Hierarchy command, which will print out the UIDs of all the items on a page and let you see what's happening.
    Charles

  • How to find out what was imported from a dump file

    Hi.
    I got the dump file from a group and they told me to import it. Import job went successfully without errors as following:
    Import: Release 9.2.0.6.0 - Production on Mon Oct 16 20:53:12 2006
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.6.0 - Production
    Export file created by EXPORT:V09.02.00 via conventional path
    Warning: the objects were exported by OPS$ORACLETS, not by you
    import done in US7ASCII character set and UTF8 NCHAR character set
    import server uses WE8ISO8859P1 character set (possible charset conversion)
    export server uses AL16UTF16 NCHAR character set (possible ncharset conversion)
    . importing OPS$ORACLETS's objects into SYS
    . importing BDS_APP's objects into BDS_APP
    Import terminated successfully without warnings.
    How do i find out what was imported from a dump file?

    another way would be to just list the contents of the dump file
    imp user/pass file=dumpfile show=Y

  • How to find out the Correct Controlfile script Trace .trc file in /bdump

    Hi Guys
    This is the most childish queries in this forum ..
    I wanna know how to Find out the correct trace file when we Issue alter database backup controlfile to trace at sqlprompt for Creating controlfile script.
    As i find it a bit confusing to go through the same Date & almost same time .trc files out of hundreds of trace file in /bdump directory to find the correct one.
    if we 've to find the Alert log file in /bdump directory $ ls -l al* & we get the alert log file .... if there is any similar way to find out the controlfile script Trace file ?
    Thanks & regards
    MZ

    MZ_AppsDBA wrote:
    Hi Guys
    This is the most childish queries in this forum ..
    I wanna know how to Find out the correct trace file when we Issue alter database backup controlfile to trace at sqlprompt for Creating controlfile script.
    As i find it a bit confusing to go through the same Date & almost same time .trc files out of hundreds of trace file in /bdump directory to find the correct one.
    if we 've to find the Alert log file in /bdump directory $ ls -l al* & we get the alert log file .... if there is any similar way to find out the controlfile script Trace file ?
    Thanks & regards
    MZcreation of the does not happen automatically. What script, and when does it run, do you have that creates the control file trace? Look for files in that time frame. Better, modify that script to specifically name the file .. BACKUP CONTROLFILE TO TRACE AS ....

  • How to find out what records were deleted

    We are facing an issue where some of our requets have been deleted from infocube because of the Overlap request condition in our process chain. We are on BI 7.  We need to find a way where we can see the actual records deleted.
    we can see the Logs from SLG1 and SLG2 but it displays the number of records , however is there a way to find out the actual records deleted.
    this is for a File source system with full loads
    Edited by: AAL123 on Jun 8, 2011 11:48 AM

    Hi,
    Since it is a Flat file, you can reconcile with Cube display data. Randomly take some records from your FF and try to view in Cube display data.
    Hope it helps........
    Regards,
    Suman

  • How to find out the image resolution in illustrator?

    How to find out the image resolution in illustrator cs through javascript or vbscript?
    Thanks,
    Prabudass

    Anyone please help me, how to find out the embedded image resolution in illustrator file through script.
    Thanks,
    Prabudass

  • How to find out the account group information in customer master record?

    how to find out the account group information in customer master record?
    in which tab? thanks in advance

    Hi
    Go to XD02 and select the Extras from the main menu , you will find Account group info -> click on the No.ranges.
    reward if it helps
    SR

  • How to find out the latest Record in per_all_people_f and per_all_assignme

    Hi ,
    How to find out the latest Record in per_all_people_f and per_all_assignments_f
    Requirement : Need to find out the latest record in per_all_people_f and per_all_assignments_f to update the attribute column with pre defined value . Its not possible to track only with person_id / assignment_id and effective end date
    SELECT pp_id
    FROM (SELECT app.person_id pp_id,
    asf.*
    FROM apps.per_all_people_f app,
    apps.per_all_assignments_f asf
    WHERE --app.person_id=123568 and
    asf.person_id = app.person_id AND
    app.effective_end_date = to_date('31-dec-4712') AND
    asf.effective_end_date = to_date('31-dec-4712')
    GROUP BY app.person_id)
    HAVING COUNT(pp_id) > 1
    GROUP BY pp_id
    This query also returns more than 1 value for person_id .
    It would be great if you put comment on this .. Thanks in advance ,
    Arya

    I am getting more records with asf.primary_flag='Y' . If you give ur mail id , i will send the sample data
    ASSIGNMENT_ID     EFFECTIVE_START_DATE     EFFECTIVE_END_DATE     BUSINESS_GROUP_ID     RECRUITER_ID     GRADE_ID     POSITION_ID     JOB_ID     ASSIGNMENT_STATUS_TYPE_ID     PAYROLL_ID     LOCATION_ID     PERSON_REFERRED_BY_ID     SUPERVISOR_ID     SPECIAL_CEILING_STEP_ID     PERSON_ID     RECRUITMENT_ACTIVITY_ID     SOURCE_ORGANIZATION_ID     ORGANIZATION_ID     PEOPLE_GROUP_ID     SOFT_CODING_KEYFLEX_ID     VACANCY_ID     PAY_BASIS_ID     ASSIGNMENT_SEQUENCE     ASSIGNMENT_TYPE     PRIMARY_FLAG     APPLICATION_ID     ASSIGNMENT_NUMBER     CHANGE_REASON     COMMENT_ID     DATE_PROBATION_END     DEFAULT_CODE_COMB_ID     EMPLOYMENT_CATEGORY     FREQUENCY     INTERNAL_ADDRESS_LINE     MANAGER_FLAG     NORMAL_HOURS     PERF_REVIEW_PERIOD     PERF_REVIEW_PERIOD_FREQUENCY     PERIOD_OF_SERVICE_ID     PROBATION_PERIOD     PROBATION_UNIT     SAL_REVIEW_PERIOD     SAL_REVIEW_PERIOD_FREQUENCY     SET_OF_BOOKS_ID     SOURCE_TYPE     TIME_NORMAL_FINISH     TIME_NORMAL_START     BARGAINING_UNIT_CODE     LABOUR_UNION_MEMBER_FLAG     HOURLY_SALARIED_CODE     REQUEST_ID     PROGRAM_APPLICATION_ID     PROGRAM_ID     PROGRAM_UPDATE_DATE     ASS_ATTRIBUTE_CATEGORY     ASS_ATTRIBUTE1     ASS_ATTRIBUTE2     ASS_ATTRIBUTE3     ASS_ATTRIBUTE4     ASS_ATTRIBUTE5     ASS_ATTRIBUTE6     ASS_ATTRIBUTE7     ASS_ATTRIBUTE8     ASS_ATTRIBUTE9     ASS_ATTRIBUTE10     ASS_ATTRIBUTE11     ASS_ATTRIBUTE12     ASS_ATTRIBUTE13     ASS_ATTRIBUTE14     ASS_ATTRIBUTE15     ASS_ATTRIBUTE16     ASS_ATTRIBUTE17     ASS_ATTRIBUTE18     ASS_ATTRIBUTE19     ASS_ATTRIBUTE20     ASS_ATTRIBUTE21     ASS_ATTRIBUTE22     ASS_ATTRIBUTE23     ASS_ATTRIBUTE24     ASS_ATTRIBUTE25     ASS_ATTRIBUTE26     ASS_ATTRIBUTE27     ASS_ATTRIBUTE28     ASS_ATTRIBUTE29     ASS_ATTRIBUTE30     LAST_UPDATE_DATE     LAST_UPDATED_BY     LAST_UPDATE_LOGIN     CREATED_BY     CREATION_DATE     TITLE     OBJECT_VERSION_NUMBER
    931510     7-Nov-08     31-Dec-12     122     (null)     (null)     (null)     3978     1     (null)     14402     (null)     220150     (null)     734956     (null)     (null)     476     (null)     (null)     (null)     (null)     2     E     Y     (null)     100035417-2     (null)     (null)     (null)     45948739     (null)     (null)     (null)     (null)     (null)     (null)     (null)     868007     (null)     (null)     (null)     (null)     449     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)                                        
    797386     26-Aug-08     26-Aug-08     122     (null)     (null)     (null)     3980     3     (null)     14402     (null)     218925     (null)     734956     (null)     (null)     476     (null)     (null)     (null)     (null)     1     E     Y     (null)     100035417     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     740071     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)                                        
    916076     26-Aug-08     31-Dec-12     122     (null)     (null)     (null)     3980     1     4     14402     (null)     218925     (null)     734956     (null)     (null)     476     (null)     (null)     (null)     (null)     1     B     Y     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)                                        
    797386     25-Feb-08     25-Aug-08     122     (null)     (null)     (null)     3980     1     (null)     14402     (null)     218925     (null)     734956     (null)     (null)     476     (null)     (null)     (null)     (null)     1     E     Y     (null)     100035417     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     740071     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)     (null)

  • How to find out the n number of records inserted??

    In File to JDBC Scenarios, i am inserting n records in Oracle.
    How to find out the n number of records inserted??

    Hi,
    If you are using the statement "UPDATE_INSERT", get the response on element <insert_count>count</insert_count>. It will give you the inserted rows.
    This link can be very helpfull.
    [http://help.sap.com/saphelp_nw2004s/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm]
    regards.
    roberti

  • How to find out which validation is failed.

    Hi Experts,
    Here is another problem I am facing. I am getting an exception during record update.
    com.sap.mdm.commands.CommandException: com.sap.mdm.internal.protocol.manual.ServerException: One or more records failed a validation
    I am not able to print additional info about the exception. How to find out exacty which validaton or assignment failed. Please let me know.
    Thanks
    -Sai

    Hi Sai,
    Is your problem solved? If yes, then please mark the thread as answered. If no, then use the following code:
         int failedValidations =     validateRecCmd.getValidationResult().getTotalValidationsFailed();
         if (failedValidations > 0) {
                   for (int cnt = 0; cnt < failedValidations; cnt++) {
                   messages.addvalidateRecCmd.getValidationResult).getFailedValidations(recrd.getId())[cnt]
                                            .getMessage());
    where messages is arrayList which will contain all the error messages where the validations failed.
    Hope it helps.
    Regards.
    Rajat

  • How to find out important fields in table like MARA?

    How to find out important fields in a table for example like MARA?
    Details: In R/3 or ECC table for example MARA;
    1) How to find out what are the important fields?
    2)Does the table have only key figures not characteristics right?
    3) There are so many tables in FI; Can you please tell me what are the important tables?
    4) There is any easy automatic way to figure out that the particular datasource for example 2lis_02_item is pulling data from so and so table. I like to know the process not the results please.
    Thanks in advance.
    York.

    Hi York,
       Let me go by points:
    1. There is nothing like important fields ... The question could be Key fields ... the fields which identify a record uniquely ... If you go to SE11, and go inot the dispaly of MARA table ... you will see that there is tick mark under key to indicate that the field is a key field ... All the fields which are so marked would identify a record in the table uniquely. If your question is otherwise ... (Important fields) ... then it depends on the purpose you wnat to meet ... Some fields might be important for me but not for you ... so there is not hard nad fast rule for important fields.
    2. No... Tables in R/3 or ECC would contain both Key figures and characteristics.
    3. Important tables in FI would be BKPF, BSEG and BSET.
    4. The procedure for finding out which table are used by say 2lis_02_item would be different from that of other non LO/LIS extractors.
    In case of LO/LIS turn on the trace (below process) while populating the setup tables and for thoers while executing RSA3.
    1. Open one session and go to ST05, click on "Activate Trace"
    2. Open another session and execute the transaction you want to track for the tables it is going to hit.
    3. Go to the session of point 1 above and click on DEACTIVATE TRACE
    4. Click on DISPLAY Trace
    This will show you all the tables that were hit while extracting data. Point to remember here is ... it will hit some standard tables as well ... so you will have to filter out what is relevant from what is not.
    Hope this helps.
    best regards,
    Kazmi

  • How can find out long run quries?

    Hi,
    I have some question
    how can find out long run queries , i have use v$session but i have not find out,pls how can find out
    these queries.

    v$session_longops has some limitations, for example it records only some operations see more [url http://www.gplivna.eu/papers/v$session_longops.htm]here
    Another possibility might be using statspack and/or [url http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14211/autostat.htm#PFGRF02601]AWR
    From docs:
    The most current instructions and information on installing and using the Statspack package are contained in the spdoc.txt file installed with your database. Refer to that file for Statspack information. On Unix systems, the file is located in the ORACLE_HOME/rdbms/admin directory. On Windows systems, the file is located in the ORACLE_HOME\rdbms\admin directory.
    Gints Plivna
    http://www.gplivna.eu

  • How to find out the column causing the error while doing update or insert

    I'm getting the below error when attempt to update or insert a long string that is more than its defined length in the DB2. For example in table the column length is defined as 50, however from UI the data for that column is more than 50 chars.
    {color:#ff0000}**Caused by: com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -302, SQLSTAT**
    **E: 22001, SQLERRMC: null**
    **at com.ibm.db2.jcc.b.hh.b(hh.java:1369)**
    **at com.ibm.db2.jcc.b.hh.c(hh.java:1356)**{color}
    The above issue can be fixed by setting maxlength in the UI itself. However in my case, there is a backend program trying to insert or update load of records. If the exact column name causing the error is known, it will be helpful to load the data properly in the next attempt.
    I have worked around it using SQLWarning and DataTruncation, but couldn't find the solution yet.
    Any help on this issue will be really appreciated.

    Medraf wrote:
    what is validator? Is it like validation.xml in struts? Are you suggesting like defining set of validation rules in the xml and apply the same for each record before doing any update or insert in DB? If so, then I could implement this validation logic in my backend code, however it may take more time to complete the batch prcoess.
    How you implement doesn't matter.
    However given a schema generating code for such validation is trivially simple at least for field types and sizes. Relationships are harder but those can be handled via custom rules.
    Alternatively I'm looking for some kind of API in JDBC or Hibernate which gives the detailed sql exception message containing the error info like the column name and the reason for failure while update or insert. If not possible, then validation logic needs to be implemented.Having seen something similar in Oracle years ago I seriously doubt that you are going find it magically appearing in JDBC/hibernate. There might be warning on the SQLException (see the java docs for SQLException) but I wouldn't count on it. Other than that the only possibility is making some sort of call in db2 itself that tells you the error. Only problem with that is it might require the context which might not be available once you see the error (presuming, especially for performance, that you are using batch processing.)
    As a start figure out how to find out using only db2 (docs and/or db2 forums.)

  • How to find out the Transactions used per month & the USER who used that

    Hi,
    1)How to find out the Transactions used per month & the USER who used that?
    2)and can i get the above same for minimum 20 month?
    System : SAP- Enterprise Core Component.

    You can use my program...
    *& Report  Z_ABAP_TCODE_MONITOR
    *****&  Program Type          : Report                                 *
    *****&  Title                 : Z_ABAP_TCODE_MONITOR                   *
    *****&  Transaction code      : ZTCODE_USAGE                           *
    *****&  Developer name        : Shailendra Kolakaluri                  *
    *****&  Deveopment start date : 26 th Dec 2011                         *
    *****&  Development Package   : ZDEV                                   *
    *****&  Transport No          : DEVK906086                                       *
    *****&  Program Description   : This program is to display
    *List all tcodes executed during previous day.
    *& Show the number of users executing tcodes
    *& Modification history
    REPORT  Z_ABAP_TCODE_MONITOR.
    *& List all tcodes executed during previous day.
    *& Show the number of users executing tcodes
    TYPE-POOLS : slis.
    DATA: ind TYPE i,
          fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          layout TYPE slis_layout_alv,
          variant TYPE disvariant,
          events  TYPE slis_t_event WITH HEADER LINE,
          heading TYPE slis_t_listheader WITH HEADER LINE.
    *REPORT  z_report_usage.
    TYPES: BEGIN OF zusertcode,
      date   TYPE swncdatum,
      user   TYPE swncuname,
      mandt     TYPE swncmandt,
      tcode     TYPE swnctcode,
      report TYPE swncreportname,
      count     TYPE swncshcnt,
    END OF zusertcode.
    *data   : date type n.
    DATA: t_usertcode  TYPE swnc_t_aggusertcode,
          wa_usertcode TYPE swncaggusertcode,
          wa           TYPE zusertcode,
          t_ut         TYPE STANDARD TABLE OF zusertcode,
          wa_result    TYPE zusertcode,
          t_result     TYPE STANDARD TABLE OF zusertcode.
    PARAMETER: month TYPE dats DEFAULT sy-datum.
    *PARAMETER: date TYPE dats.
    *select-options : username for wa_usertcode-account.
    START-OF-SELECTION.
    PERFORM get_data.
    PERFORM get_fieldcatalog.
      PERFORM set_layout.
    PERFORM get_event.
    PERFORM get_comment.
      PERFORM display_data.
    FORM get_data .
    *date = sy-datum - 2 .
    After start-of-selection add this line (parameter Month required 01 as day).
      concatenate month+0(6) '01' into month.
      CALL FUNCTION 'SWNC_COLLECTOR_GET_AGGREGATES'
        EXPORTING
          component     = 'TOTAL'
          ASSIGNDSYS    = 'DEV'
          periodtype    = 'M'
          periodstrt    = month
        TABLES
          usertcode     = t_usertcode
        EXCEPTIONS
          no_data_found = 1
          OTHERS        = 2.
      wa-date  = month.
    *wa-date  = date.
      wa-mandt = sy-mandt.
    wa_usertcode-account = username.
      LOOP AT t_usertcode INTO wa_usertcode.
        wa-user = wa_usertcode-account.
        IF wa_usertcode-entry_id+72 = 'T'.
          wa-tcode  = wa_usertcode-entry_id.
          wa-report = space.
        ELSE.
          wa-tcode  = space.
          wa-report = wa_usertcode-entry_id.
        ENDIF.
        COLLECT wa INTO t_ut.
      ENDLOOP.
      SORT t_ut BY report ASCENDING.
      CLEAR: wa, wa_result.
    endform.
    FORM get_fieldcatalog .
    fcat-tabname     = 't_ut'.
    fcat-fieldname   = 'DATE'.
    fcat-seltext_l   = 'Date'.
    fcat-key         = 'X'.
    APPEND fcat.
      CLEAR fcat.
      fcat-tabname     = 't_ut'.
      fcat-fieldname   = 'MANDT'.
      fcat-seltext_l   = 'Client'.
      fcat-key         = 'X'.
      APPEND fcat.
      CLEAR fcat.
      fcat-tabname     = 't_ut'.
      fcat-fieldname   = 'USER'.
      fcat-seltext_l   = 'User Name'.
      fcat-key         = 'X'.
      APPEND fcat.
      CLEAR fcat.
      fcat-tabname     = 't_ut'.
      fcat-fieldname   = 'TCODE'.
      fcat-seltext_l   = 'Transaction Code'.
      fcat-key         = 'X'.
      APPEND fcat.
    ENDFORM.
    *&      Form  SET_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM set_layout .
      layout-colwidth_optimize = 'X'.
    ENDFORM.                    " SET_LAYOUT
    *&      Form  GET_EVENT
          text
    -->  p1        text
    <--  p2        text
    *FORM get_event .
    events-name = slis_ev_top_of_page.
    events-form = 'TOP_OF_PAGE'.
    APPEND events.
    *ENDFORM.                    " GET_EVENT
    **&      Form  GET_COMMENT
          text
    -->  p1        text
    <--  p2        text
    *FORM get_comment .
    DATA: text(30).
    text = 'Billing Report'.
    heading-typ = 'H'.
    heading-info = text.
    APPEND heading.
    *ENDFORM.                    " GET_COMMENT
    **&      Form  top_of_page
          text
    -->  p1        text
    <--  p2        text
    *FORM top_of_page .
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
       EXPORTING
         it_list_commentary       = heading[]
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
    *ENDFORM.                    " top_of_page
    *&      Form  DISPLAY_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM display_data .
      sort t_ut[].
    DELETE ADJACENT DUPLICATES FROM t_ut[] COMPARING ALL FIELDS.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = sy-cprog
          is_layout          = layout
          it_fieldcat        = fcat[]
          i_save             = 'A'
          is_variant         = variant
          it_events          = events[]
        TABLES
          t_outtab           = t_ut
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " DISPLAY_DATA

Maybe you are looking for