Comparing two cells together and highlighting duplicates
Hello
I have two lists of emails that are of different length. I'd like to compare these two lists and highlight any duplicates, so that I don't send any email twice to the same person.
How is this done in Numbers'09?
Thanks!
jknuutila wrote:
Never mind, I got Yvan's formula to work now, thanks both for your help!
JK,
Yvan's formula and mine are functionally equivalent, but assume different table names. (Yvan posted before I finished composing my answer and I opted to let mine stand when I noticed.) Of course you must always take care to either make your table names match the equation or make the equation match your table names. And of course, the proper parameter separators must be used.
We can often avoid problems with parameter separators in our examples, and we can be careful to use simple, plain English, if we suspect that you are in a location where the semicolon replaces the comma as a separator, and where English may not be the first language. This requires that you edit your Profile Data to show your country/location. The more we know about you, the easier this becomes.
Best regards,
Jerry
Similar Messages
-
Compare two cells in a row and group of rows
Tuesdays 1st 2nd 3rd 4th 5th MB
Jan 4, 2011 7 14 21 28 36 32
Jan 11, 2011 5 15 25 28 38 16
Jan 18, 2011 2 17 25 28 38 25
Okay, say the above is my table, how do I compare two cells in a row for two numbers? Say I wanted to find out if row A2 contained a 7 and a 28?
I thought an IF formula might do it, but can't figure it out.
Thanks in advance!
JimHead Crab wrote:
Tuesdays 1st 2nd 3rd 4th 5th MB
Jan 4, 2011 7 14 21 28 36 32
Jan 11, 2011 5 15 25 28 38 16
Jan 18, 2011 2 17 25 28 38 25
Okay, say the above is my table, how do I compare two cells in a row for two numbers? Say I wanted to find out if row A2 contained a 7 and a 28?
"A2" is an address for a single cell, not a row. Its current content, assuming no empty rows above or empty columns left of what's shown, is "Jan 4, 2011". Perhaps you mean Row 2, or the range B2:G2.
Assuming that you want to know 'if' (or 'how many times') two specific numbers occur in the range of cells from column B to column G in a single row, COUNTIF is the function you want.
Place the two target numbers into cell I1 and J1.
Enter the formula below into I2:
=COUNTIF($B2:$G2,I$1)
Fill the formula right into J2, then fill both down to row 4.
You'll get a count of the occurrences of each number.
If you want only a "Yes" (both numbers appear in the range) or "No" (neither of the numbers appear, or one appears but not the other), use this variation (in I2 or J2):
=IF(AND(COUNTIF($B2:$G2,I$1)>0,COUNTIF($B2:$G2,J$1)>0),"Yes","No")
Regards,
Barry -
'Merge Cell' is greyed out - how do I activate it and merge two cells together?
I am just learning Numbers, trying to merge two cells together should be a very simple process!
I have followed the instructions in help
The 'merge cells' function remains greyed out no matter what I do - I therefore cannot merge two or more cells into one!
Please help, is there something I need to activate in the cell?Hi Claudia,
Actually, a "truly blank document" would be an empty canvas, containing no table of any type, no document header or footer locations, no document margins, no page definitions, no page orientation. Just a blank sheet onto which you could put whatever objects you wish.
Perhaps Apple should have named the 'not blank' templates "Basic" rather than blank, removed the header column, and left the header row intact. That would match the "Basic" table style available in the Tables button's menu, used for adding a table to a Sheet.
If you really do want to always start with a table which has no header rows and no header columns, it's easy enough to set up.
Open a new 'blank' document (Apple's 'blank').
Click on the Table 1 icon in the Sheets list and press delete. (faster than selecting cell A1, then taking two trips to the Table menu to delete first the (header) row then the (header) column)
Click the Tables button and choose Plain to insert a 'plain' table (no header row, no header column)
(optional) Add or delete rows or columns to make the blank table the size you desire.
(optional) Position the table where you want it.
Save the result as a Template.
In Numbers Preferences > General > For New Documents, select Use Template, then Choose your new template.
Until you change that preference, any New document you make will contain your new, 'blank' table.
Regards,
Barry -
Hi!!
I'm doing an ALV, and I need to compare two cells. Only one of them could be inform.
I used this code:
CLASS lcl_event_hadler DEFINITION
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_data_changed
METHOD handle_data_changed.
PERFORM handle_data_changed USING er_data_changed.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_event_handler IMPLEMENTATION
*& Form HANDLE_DATA_CHANGED
text
-->P_ER_DATA_CHANGED text
FORM handle_data_changed USING ir_data_changed
TYPE REF TO
cl_alv_changed_data_protocol.
DATA: ls_mod_cell TYPE lvc_s_modi,
lv_value TYPE lvc_value,
lv_value1 TYPE lvc_value.
SORT ir_data_changed->mt_mod_cells." BY row_id.
LOOP AT ir_data_changed->mt_mod_cells
INTO ls_mod_cell
WHERE fieldname = 'CELL2'.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cell-row_id
i_fieldname = 'CELL2'
IMPORTING
e_value = lv_value1.
ENDLOOP.
LOOP AT ir_data_changed->mt_mod_cells
INTO ls_mod_cell
WHERE fieldname = 'CELL1'.
IF it_prueba-clase IS INITIAL.
CALL METHOD ir_data_changed->modify_cell
EXPORTING
i_row_id = ls_mod_cell-row_id
i_fieldname = ls_mod_cell-fieldname
i_value = campo_prueba.
ENDIF.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cell-row_id
i_fieldname = 'CELL1'
IMPORTING
e_value = lv_value.
IF lv_value = lv_value1.
CALL METHOD ir_data_changed->add_protocol_entry
EXPORTING
i_msgid = 'SU'
i_msgno = '000'
i_msgty = 'E'
i_msgv1 = 'Only one cell '
i_fieldname = ls_mod_cell-fieldname
i_row_id = ls_mod_cell-row_id.
ENDIF.
ENDLOOP.
ENDFORM. " HANDLE_DATA_CHANGED
With this code, i can check only one time the cells. If I clear cell2 press enter, and then I write in cell2 again it code doesn't work.
How can i do it with other method?
Thanks in advanceHead Crab wrote:
Tuesdays 1st 2nd 3rd 4th 5th MB
Jan 4, 2011 7 14 21 28 36 32
Jan 11, 2011 5 15 25 28 38 16
Jan 18, 2011 2 17 25 28 38 25
Okay, say the above is my table, how do I compare two cells in a row for two numbers? Say I wanted to find out if row A2 contained a 7 and a 28?
"A2" is an address for a single cell, not a row. Its current content, assuming no empty rows above or empty columns left of what's shown, is "Jan 4, 2011". Perhaps you mean Row 2, or the range B2:G2.
Assuming that you want to know 'if' (or 'how many times') two specific numbers occur in the range of cells from column B to column G in a single row, COUNTIF is the function you want.
Place the two target numbers into cell I1 and J1.
Enter the formula below into I2:
=COUNTIF($B2:$G2,I$1)
Fill the formula right into J2, then fill both down to row 4.
You'll get a count of the occurrences of each number.
If you want only a "Yes" (both numbers appear in the range) or "No" (neither of the numbers appear, or one appears but not the other), use this variation (in I2 or J2):
=IF(AND(COUNTIF($B2:$G2,I$1)>0,COUNTIF($B2:$G2,J$1)>0),"Yes","No")
Regards,
Barry -
I downloaded the latest iOS7 to my iPad and then the screen went blank and would not respond. I have tried pressing the two buttons together and briefly get the Apple logo but still can not restart, the logo disappears. I have tried connecting to my iMac to restore the iPad but the device does not show up (I have an old iMac). What else can I do?
You need to be running Snow Leopard 10.6.8 at the very least in order to sync your iPad with iTunes so you could update your Mac, if it can be updated, and if you care to do so.
If that's not an option, you will have to find someone that can restore the device for you with their computer running iTunes or make an appointment at an Apple Store and ask them to restore the device for you.
I hope that you have an iCloud backup, because you will lose everything on the device when it is restored.
Snow Leopard can still be purchased in the U.S. Apple Online Store.
http://store.apple.com/us/product/MC573Z/A/mac-os-x-106-snow-leopard
Also, I would not give up on the reset technique....holding down on the sleep and home buttons at the same time until the Apple logo appears. It takes about 10-15 seconds and sometimes just a little longer to get the logo to appear. -
Compare two .txt files and show result
HI
Could anybody show me how to compare two text files and show the result.
i.e.
textfile1.txt
harry.denmark
karry.sweden
textfile2.txt
harry.denmark
karry.sweden
marry.usa
Compare
result=
marry.usa
The text files I want to compare are how ever much larger than this example. (up to 2-3.000 words)
anybody ??
Sincerly
PederHI & thanks for reply
I know almost nothing about java so could you or anybody please show me the code to do this? Or is it perhaps too large or difficult a code?
I know how to compile a .java file and run it in prompt :-) and thats about it (almost)
I offcourse understand if its too much to ask for :-) -
To compare two internal tables and delete records
Hi friends,
I have to compare two internal tables and should delete the records which is not present in both the tables. Reply me as soon as possible.
Thanks.Hi Nagarajan,
1. I don't think there is any direct (one-shot statement)
way to achieve this.
one has to do by writing some logic.
2. Loop at ITAB1.
Read table ITAB2 with key Field1 = ITAB1-Field1.
If sy-subrc <> 0.
delete ITAB1.
endif.
Endloop.
Do the same again with ITAB2.
Loop at ITAB2.
Read table ITAB1 with key Field1 = ITAB2-Field1.
If sy-subrc <> 0.
delete ITAB2.
endif.
Endloop.
3. If any better way is found, i will let u know.
Hope it helps.
Regards,
Amit M. -
How to compare two excel reports and find the difference in BI Publisher
Hi All,
I have a requirement that needs to compare two excel reports in XML Publisher 5.6.2. or BI publisher 10.1.3.4
If anybody has an idea about this pls help us.
Thanks,Since our customer wants to have this comparison only with BI reports....here is the scenario how the comparison should be..
Now,we have a parameters called Customer name and version id. Version id list will be refreshed based on the customer selection.
User can generate the report based on the selected customer name and version id. These data are fetch from the oracle database and we are using Data Template in the BI Publisher.
Now the requirement is customer wants to compare two version id data. for example, v1.2 and v1.3
Now they wanna to see both the reports while generating in the same work sheet, like, v1.2report should display in the left side and the v1.3report has to display in the right hand side of the same work sheet.
Now...If there is any addition happened in v1.3 report,then that cell/data should display as a green color in that report.
If any deletion happened in v1.3report then that should be in the red color.
If any modification happened in v1.3 then that should be in the yellow color.
If there is no difference then that should display as it is.
the thing is that, the both the reports (v1.2 and v1.3)should display side by side in the same worksheet with the format and everything........only the difference should be highlighted.
Template is same for both the reports..
To display the data for both versions i think i can generate the template side by side of both in the same worksheet.
Now, My question is how to find the difference of data in the RTF Template for both the versions
Can anybody assist me?
Thanks,
Edited by: user753355 on Jun 9, 2009 12:03 AM
Edited by: user753355 on Jun 9, 2009 12:06 AM
Edited by: user753355 on Jun 9, 2009 12:16 AM
Edited by: user753355 on Jun 10, 2009 3:59 AM -
Compares two tables S780 and S720 by material , Print the Difference value
Hi abapers,
Report which compares the two tables S780 and S720 by material
the Statistic currency value of these two tables if show the differences
the report should display only Diffrece value:
The selection should be by
Revenue country, Salesorganisation , month and version
output like this
Material Value S720 / Value S780 / currency difference should be print out.
Regards
RajHi
Use join or for all entries
then move the records into a final table
loop at itab
then get the difference.
modify the itab by transporting the difference.
Regards
Shiva -
Hi Guys
I have two csv files with the following headers and I need to import both files into the script to check whether the StaffCode is present in the Creation/Renewal of Contract csv in a DisableAccount Script so I can stop any action to disable the account as
the staff has renewed the contract with the company so the account should not be disabled.
However my accounts are still being disabled. I am not sure now to construct the query so that it detects that the account is to be left alone if the staffcode is present in both files
I does recognize that the $staffcodeN in the renewal file matches the $staffcode in the termination file
but still proceeds to disable or set an expiry date to the account anyway based on the termination file.
How do I stop it from doing that?
1)In the Creation/Renewal of contract file the following headers are present
- TranCode,StaffCode,LastName,FirstName,SocialSecurityNo,DateJoin,Grade,Dept,LastUpdateDate,EffectiveDate
2)In the Disable of contract file the following headers are present
- TranCode,StaffCode,LastName,FirstName,SocialSecurityno,LastDateWorked,Grade,Dept,LastUpdateDate,
My data is not very clean , I have a-lot of special characters such as = , ' ,/ and \ characters to remove first before i can compare the data
Thanks for the help in advance.
Yours Sincrely
Vicki
The following is a short snippet of the code
$opencsv = import-csv "D:\scripts\Termination.csv"
$opencsv2 = import-csv "D:\scripts\RenewContractandNewStaff.csv"
foreach ($usertoaction in $opencsv)
$Trancode = $usertoactionTranCode
$StaffCode = $usertoaction.StaffCode.replace("=","").replace('"','')
$LastName = [string]$usertoaction.LastName.Replace("/","\/").Replace(",","\,")
$FirstName = [string]$usertoaction.FirstName.Replace("/","\/").Replace(",","\,")
$socialsecurityno = $usertoaction.SocialSecurityNo.replace("=","").replace('"','')
$DateJoin = $usertoaction.DateJoin.replace("=","").replace('"','')
$LastDateWorked = $usertoaction.LastDateWorked.replace("=","").replace('"','')
$Grade = [string]$usertoaction.Grade
$Dept = [string]$usertoaction.Dept
$LastUpdateDate = $usertoaction.LastUpdateDate.replace("=","").replace('"','')
$AccountExpiry = [datetime]::Now.ToString($LastDateWorked)
foreach ($usertoaction2 in $opencsv2)
$TrancodeN = $usertoaction2.TranCode
$StaffCodeN = $usertoaction2.StaffCode.replace("=","").replace('"','')
$socialsecurityNoN= $usertoaction2.SocialSecurityNo.replace("=","").replace('"','')
$DateJoinN = $usertoaction2.DateJoin.replace("=","").replace('"','')
$GradeN = [string]$usertoaction2.Grade
$DeptN = $usertoaction2.Dept
$LastUpdateDate = $usertoaction.LastUpdateDate.replace("=","").replace('"','')
$EffectiveDate = $usertoaction.EffectiveDate.replace("=","").replace('"','')
$LastName2 = [string]$usertoaction2.LastName.Replace(",", "").Replace("/","").trim()
$FirstName2 = [string]$usertoaction2.FirstName.Replace("/","").trim()
# Use DirectorySearcher to find the DN of the user from the sAMAccountName.
$Domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$Root = $Domain.GetDirectoryEntry()
$Searcher = [System.DirectoryServices.DirectorySearcher]$Root
$Searcher.Filter = "(sAMAccountName=$samaccountname)"
$doesuserexist1 = $Searcher.Findall()
if ($doesuserexist1 -eq $Null)
{Write-Host $samaccountname "account does not exist"}
elseif ($StaffCodeN -match $staffcode)
write-host "user has renewed the contract, no action taken"
else
if(($lastupdatedate -ne $null)-or($LastDateWorked -ne $null))
write-host "Setting Account Expiry to"$accountexpirydate
#$ChangeUser.AccountExpires = $accountexpirydate
#$Changeuser.setinfo()
if ($UserMailforwarding -ne $null)
#Set Account expiry date to Last Date Worked
# $ChangeUser.AccountExpires = $accountexpirydate
# $Changeuser.setinfo()
write-host "staff" $displayname "with staff employee no" $samaccountname "has
mailforwarding"
Write-host "Please disable the account manually via Active Directory Users & Computers and
Elseif ($accountexpirydate -lt $todaysdate)
#disable the accountHi Vicki,
This Forum has an insert-codeblock function. Using it will make your script far more readable
Your script is missing some parts, it is impossible to follow the problem.
You are performing the same string cleaning action on $opencsv2 for each element in $opencsv, when doing it once should suffice. Why not start it all by cleaning the values and storing the cleaned values in new arrays?
The Compare-Object function is great, why not take it out for a stroll on these lists, it might just safe you lots of unnecessarily complicated code ...
You are creating a new $Domain, $Root and $Searcher object each iteration, when doing it once should suffice. Probably not much of a time-saver, but every little thing contributes.
Try pinpointing the problem by doing extensive logging, not only by writing which action was taken, but writing the inidividual information (variables, mostly) before evaluation occurs. Your if/elseif/else looks sound, so if it's still not doing what you
want, the ingoing data must be different from what you think should be there.
Cheers,
Fred
There's no place like 127.0.0.1 -
Compare two Idoc's and send to te recievers as per the Condition.
Hi,
Scenario: Sender are a Idoc's and Receiver is Mail and File.
Sum the value of field1 of IDOC1 loop and compare with the field 2 of IDOC2. If the Condition satisfy send the data to file and mail reciever else send to only mail reciever.
I tried using a BPM. Steps used in BPM are as follow:
Step: 1
Fork -- with two branches.
Branch 1:loop1-- reciever1 -- container
Branch 2:reciever2
Step2:
Switch with two branches: Check the compare condition of the two Idoc
Branch 1:
Fork with two branches with send step with mail and file recievers
branch 2: Only mail reciever.
However if the condition is true or false the information is send mail to reciever.
I tried with the above steps, but failed.
Any changes required, please let me know.
Regards,
Manojsumit,
I recieve N number of IDOC1. I need Sum the value of field1 of IDOC1 loop and compare with the field 2 of IDOC2.
I tried using a BPM . Steps used in BPM are as follow:
Step: 1
Fork -- with two branches.
Branch 1:loop1-- reciever1 -- container
Branch 2:reciever2
Step2: Transfomation with Mapping program, source and Target message
Step3:
Switch with two branches: Check the compare condition of the two Idoc
Branch 1:
Fork with two branches with send step with mail and file recievers
branch 2: Only mail reciever.
When i checked with workflow i observe that that the message is not moving out of transformation step.But the message mapping is succesfully tested
Thanks,
Manoj -
Snap two mc together and they become one...
So,
I've been playing around with this idea but I'm stuck, so I hope some of you might have an idea... I browsed the forum and found similar post but none of them addressing my specific case...
The story goes like this:
by clicking some buttons on stage I create two different instances of 2 movieClips (from the library) called Event and State..
I want the instances of Event to snap to the State movieclips when they touch (this part works, see the code below), and if they do snap together I'd like them to move as one... So the Event instance should stick to the State instance and the two become as one....
The snapping code is
function snap(e:MouseEvent):void //each Event mc will have an eventlistener for a mouse click
var len:int = this.numChildren;
var g:DisplayObject = this.getChildByName("sta"); //each State instance has been renamed "sta"
for (var k:int = 0; k < len; k++)
if (e.target.hitTestObject(g))
e.target.x = g.x - 150;
e.target.y = g.y;That's actually what I'm figuring out right now even though it's still not working... I found this nice explanation about target and similar...http://theflashconnection.com/book/export/html/45
Anyway what I tried to do is creating the Eve and assign them an eventListener for dragging and not.
var eve:MovieClip = new event_graphic();
eventArray.push(eve); //all new created eve is added to an array and assigned 5 //listeners
for (var i:int = 0; i<eventArray.length; i++)
eventArray[i].buttonMode = true;
eventArray[i].addEventListener(MouseEvent.MOUSE_DOWN, drag);
eventArray[i].addEventListener(MouseEvent.MOUSE_UP, noDrag);
eventArray[i].addEventListener(MouseEvent.CLICK, snap);
the same happens for the State... the function snap is like this now (see the comments on the side)
function snap(e:MouseEvent):void
var len:int = this.numChildren;
// finds eve and sta in the display list
var g:DisplayObject = this.getChildByName("sta");
var h:DisplayObject = this.getChildByName("eve");
for (var k:int = 0; k < len; k++)
//for each obj in the display list check wether eve touches sta
if (e.target.hitTestObject(g))
h.x = g.x - 100;
h.y = g.y - 4;
//eve should snap in position (not working)
var container:MovieClip = new MovieClip();
//if they touch add them to a new MovieClip container
container.addChild(g);
container.addChild(h);
container.addEventListener(MouseEvent.MOUSE_DOWN, drag);
//add a listener for it to be draggable
container.addEventListener(MouseEvent.MOUSE_UP, noDrag);
container.buttonMode = true;
//this should turn the cursor to a hand but it doesn't... as if container didn't exist
trace(container.numChildren);
//here is what I find most confusing because it returns 2, and that is correct being Eve (h) and Sta (g) its //children, so the MC is there on stage somewhere
so it seems like it succesfully created an empty MovieCLip, assigns the children H and G but just doesn't make them draggable....
I also tried to declare the container outside the snap function, same results...
Here are the drag, noDrag functions
function drag(e:MouseEvent):void
e.currentTarget.buttonMode = true;
e.currentTarget.startDrag();
//both e.target and e.currentTarget don't work!!!
function noDrag(e:MouseEvent):void
e.currentTarget.buttonMode = false;
e.currentTarget.stopDrag(); -
Help needed to compare two Key Figures and show out put
hello experts,
I am comparing the Sales data for two year/month. I need to compare these two KF and show the result only if one is greater than the other by 40%. Sample
Jan/2008 Jan /2007
400 600
500 300
300 700
600 400
The columns should be outputted only if Jan 2008 is greater than Jan 2007 by 40% for all customers in a business area. Thank you all in advance.
Regards,
-AkashHi Akash,
Your requirement could be met by
Creating a Calculated Key Figure say variance = ( ( Jan2008 - Jan2007 ) / Jan 2008 ) *100
Then create a new Condition on Variance so as to display rows only when Variance > 40
Hope this solves ur issue.Do revert
Vasavi -
Comparing two internal tables and deleting the record not present in second
Hi All,
I have a internal table itaba with PERNR as primary key and various other columns (1000 records) and table B with PERNR as primary key and 800 records.
Now what is the best way to compare these two and delete the record from table A when its corresponding record is not present in table B?
Thanks and Regards,
MohanHI SIR
u trained us in accenture
Hi all
when ever m running this session in SM35 , M getting error as :
"LEAVE TO TRANSACTION" MARA-BISMT is not allow
in batch input
REPORT YASEC_BDC_NIK_SESSION
no standard page heading
message-id zmm
line-count 65
line-size 150.
tables : mara.
*Top includr program
INCLUDE YNEW_MAIN_TOP.
*include yasec_bdc_nik_session_top.
***********selection screen *******************
selection-screen begin of block b1 with frame title text-001.
selection-screen skip.
PARAMETERS: p_ifile(128) TYPE c .
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: rad1 TYPE c RADIOBUTTON GROUP 1 USER-COMMAND gr1,
rad2 TYPE c RADIOBUTTON GROUP 1 .
SELECTION-SCREEN SKIP.
PARAMETERS: p_sess TYPE c.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK b1.
Subroutine call***************************
INCLUDE YNEW_MAIN_F01.
*include yasec_bdc_nik_session_f01.
*********At selection event triggered *************
at selection-screen on value-request for p_ifile.
To get F4 help for the input file path
PERFORM f_f4_input_file.
AT SELECTION-SCREEN ON p_ifile.
To validate and upload the input file
PERFORM f_load_file.
AT SELECTION-SCREEN ON p_sess.
To validate the Number of Sessions field
IF rad2 IS NOT INITIAL AND sy-ucomm EQ c_onli.
PERFORM f_check_sessions.
ENDIF.
***********Start of selection *******************
start-of-selection.
*To process BDC
PERFORM f_process_bdc.
TOP OF PAGE
TOP-OF-PAGE.
Writes the report heading and for displaying line number.
PERFORM f_report_header.
TYPES : BEGIN OF t_final,
matnr(50) TYPE c,
bismt(18) type c,
end of t_final.
TYPES: BEGIN OF t_fdata,
data(256) TYPE c,
END OF t_fdata.
TYPES: BEGIN OF t_error,
message(100) TYPE c,
END OF t_error.
*Internal table declarations
*Internal table to load the data from the file that is changed throgh BDC
DATA : i_final TYPE STANDARD TABLE OF t_final,
wa_final TYPE t_final.
*Internal table to store the error messages
DATA : i_error TYPE STANDARD TABLE OF t_error,
wa_error TYPE t_error.
*Internal table to load the raw data
DATA : i_fdata TYPE STANDARD TABLE OF t_fdata,
wa_fdata TYPE t_fdata.
*Internal table to store records of BDC
DATA : i_bdcdata TYPE STANDARD TABLE OF bdcdata INITIAL SIZE 0,
wa_bdcdata TYPE bdcdata.
Internal table to store BDC messages
DATA: i_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll INITIAL SIZE 0,
wa_bdcmsgcoll TYPE bdcmsgcoll.
VARIABLE DECLARATIONS
DATA: v_ifile TYPE string,
v_input TYPE i,
c_delimiter TYPE c VALUE 'X',
v_mode TYPE c VALUE 'A',
v_sessions TYPE i.
CONSTANTS
CONSTANTS : c_flagx TYPE c VALUE 'X',
c_slash TYPE c VALUE '/',
c_onli(4) TYPE c VALUE 'ONLI',
c_vl02(4) TYPE c VALUE 'VL02',
c_s TYPE c VALUE 'A'.
FORM f_f4_input_file .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_ifile.
ENDFORM. " f_f4_input_file
*& Form f_load_file
FORM f_load_file .
v_ifile = p_ifile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_ifile
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = i_fdata
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.
*Text-103-Input file does not exist.
MESSAGE e000 WITH text-103 .
ELSEIF NOT i_fdata IS INITIAL.
DELETE i_fdata WHERE data = space.
DESCRIBE TABLE i_fdata LINES v_input.
ENDIF.
IF v_input EQ 0.
Text-104 - Input file is empty.
MESSAGE e000 WITH text-104 .
ENDIF.
ENDFORM. " f_load_file
*& Form f_check_sessions
FORM f_check_sessions .
IF p_sess IS INITIAL.
MESSAGE e000 WITH text-106.
ELSE.
v_sessions = v_input DIV p_sess.
ENDIF.
ENDFORM. " f_check_sessions
*& Form f_process_bdc
text
FORM f_process_bdc.
LOOP AT i_fdata INTO wa_fdata.
SPLIT wa_fdata AT cl_abap_char_utilities=>horizontal_tab
INTO wa_final-matnr
wa_final-bismt.
APPEND wa_final TO i_final.
CLEAR wa_fdata.
ENDLOOP.
IF rad1 = c_flagx.
PERFORM f_passbdc_vl02.
ELSEIF rad2 = c_flagx.
PERFORM f_sessions_vl02.
ENDIF.
ENDFORM. "f_process_bdc
To populate the Screen information
p_program Program Name
p_dynpro Screen Number
FORM bdc_dynpro USING p_program TYPE any
p_dynpro TYPE any.
CLEAR wa_bdcdata.
Populate the BDC structure with the Screen Information.
Move the Program name PROGRAM
wa_bdcdata-program = p_program.
Move the Screen Number DYNPRO
wa_bdcdata-dynpro = p_dynpro.
Indicate the beginning of a new screen
wa_bdcdata-dynbegin = c_flagx.
APPEND wa_bdcdata TO i_bdcdata.
ENDFORM. "f_bdc_dynpro
*& Form f_passbdc_vl02
text
FORM f_passbdc_vl02.
DATA: l_lines_im TYPE i.
SORT i_final BY matnr ASCENDING.
CLEAR wa_final.
LOOP AT i_final INTO wa_final.
CLEAR: i_bdcmsgcoll[],
wa_bdcmsgcoll,
wa_bdcdata.
CLEAR: i_bdcdata[].
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
wa_final-matnr.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MARA-BISMT'.
perform bdc_field using 'MARA-BISMT'
wa_final-bismt.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM02'.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM03'.
CALL TRANSACTION 'MM02' USING i_bdcdata
MODE v_mode
UPDATE c_s
MESSAGES INTO i_bdcmsgcoll.
If error occurred in call transaction 'VA02' then stores all
information of failed records into internal table i_error_im.
IF sy-subrc NE 0.
DESCRIBE TABLE i_bdcmsgcoll LINES l_lines_im.
CLEAR wa_bdcmsgcoll.
READ TABLE i_bdcmsgcoll INTO wa_bdcmsgcoll INDEX l_lines_im.
To capture success and error messages in BDC.
CALL FUNCTION 'FORMAT_MESSAGE' "#EC *
EXPORTING
id = wa_bdcmsgcoll-msgid
lang = wa_bdcmsgcoll-msgspra
no = wa_bdcmsgcoll-msgnr
v1 = wa_bdcmsgcoll-msgv1
v2 = wa_bdcmsgcoll-msgv2
v3 = wa_bdcmsgcoll-msgv3
v4 = wa_bdcmsgcoll-msgv4
IMPORTING
msg = wa_error-message
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ELSE.
WRITE: text-111 COLOR 7.
ENDIF.
CLEAR: wa_final.
REFRESH i_bdcdata.
ENDLOOP.
ENDFORM. "f_passbdc_va02
*& Form bdc_field
text
-->P_FNAM text
-->P_FVAL text
FORM bdc_field USING p_fnam TYPE any
p_fval TYPE any.
CLEAR wa_bdcdata.
Populate the Field Name
wa_bdcdata-fnam = p_fnam.
Populate the field value
wa_bdcdata-fval = p_fval.
APPEND wa_bdcdata TO i_bdcdata.
ENDFORM. "f_bdc_field
*& Form f_sessions_vl02
text
FORM f_sessions_vl02 .
DATA: l_sindex TYPE sy-tabix VALUE 1,
l_eindex TYPE sy-tabix,
l_flag TYPE c VALUE space.
l_eindex = v_input.
SORT i_final BY matnr ASCENDING.
DO p_sess TIMES.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'Y_VL02_NIK'
user = sy-uname
keep = c_flagx
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.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR wa_final.
CLEAR: i_bdcdata[].
LOOP AT i_final INTO wa_final FROM l_sindex TO l_eindex .
IF l_flag = v_sessions.
CLEAR l_flag.
EXIT.
ENDIF.
l_flag = l_flag + 1.
CLEAR: i_bdcdata[].
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
wa_final-matnr.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MARA-BISMT'.
perform bdc_field using 'MARA-BISMT'
wa_final-bismt.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM02'.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM03'.
l_sindex = l_sindex + 1.
ENDLOOP.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 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.
ENDFORM. " f_sessions_vl02
*& Form f_report_header
FORM f_report_header .
FORMAT COLOR COL_HEADING INTENSIFIED ON.
ULINE.
text-201 - Company: Carrier
text-102- Batch Data Communication.
text-202 - System: SAP
WRITE: /1 sy-vline,
3 text-201,
50 text-102,
100 text-202,
AT sy-linsz sy-vline.
text-203 - Program:
text-204 - Date/Time:
WRITE: /1 sy-vline,
3 text-203, sy-repid ,
100 text-204,sy-datum ,c_slash, sy-uzeit,
AT sy-linsz sy-vline.
text-205 - User ID:
text-206 - Page:
WRITE: /1 sy-vline,
3 text-205, sy-uname,
100 text-206, sy-pagno,
AT sy-linsz sy-vline.
FORMAT COLOR OFF.
ULINE.
ENDFORM. " f_report_header
FORM bdc_transaction USING tcode.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = tcode
TABLES
dynprotab = i_bdcdata
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.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
WRITE: / text-109 ,wa_final-matnr,
text-110 .
ENDIF.
ENDFORM. "bdc_transaction -
How to compare two internal table and store value in third table
Dear All,
There is two tabel say I_T1 & T2, in I_T1 there are 4 rows , in T2 there are multiple rows against the same field. Say there is a filed X common in both table .
Value of I_T1-X are
10
20
50
90
and value ot T2-X are
10
15
20
30
40
50
.100
Now i want to fetch data form T2 against the common field of I_T1-X and store into other internal table.
Plz suggest me the proper way of doing this.
Rewards points assured for proper answer.
Regards,
Gulrez Alamhi this is like your requirement.
in this i am storing the values into the final table
REPORT ZZZZ000000.
tables:mara,marc,mard,makt.
data:begin of it_mara occurs 0,
matnr like mara-matnr,
mtart like mara-mtart,
meins like mara-meins,
end of it_mara.
data:begin of it_marc occurs 0,
matnr like marc-matnr,
pstat like marc-pstat,
werks like marc-werks,
end of it_marc.
data:begin of it_mard occurs 0,
werks like mard-werks,
lgort like mard-lgort,
labst like mard-labst,
end of it_mard.
data:begin of it_final occurs 0,
matnr like mara-matnr,
mtart like mara-mtart,
meins like mara-meins,
pstat like marc-pstat,
werks like marc-werks,
lgort like mard-lgort,
labst like mard-labst,
maktx like makt-maktx,
end of it_final.
select-options:s_matnr for mara-matnr.
select matnr
mtart
meins
from mara
into table it_mara
where matnr in s_matnr.
if not it_mara[] is initial.
select matnr
pstat
werks
from marc
into table it_marc
for all entries in it_mara
where matnr = it_mara-matnr.
if not it_marc[] is initial.
select werks
lgort
labst
from mard
into table it_mard
for all entries in it_marc
where werks = it_marc-werks.
endif.
endif.
loop at it_mara.
it_final-matnr = it_mara-matnr.
it_final-mtart = it_mara-mtart.
it_final-meins = it_mara-meins.
read table it_marc with key matnr = it_mara-matnr.
it_final-werks = it_marc-werks.
it_final-pstat = it_marc-pstat.
read table it_mard with key werks = it_marc-werks.
it_final-lgort = it_mard-lgort.
it_final-labst = it_mard-labst.
if sy-subrc = 0.
select maktx from makt into it_final-maktx where matnr = it_final-matnr.
endselect.
endif.
append it_final.
endloop.
loop at it_final.
write:/ it_final-matnr under 'material',
it_final-mtart under 'material type',
it_final-meins under 'unit of measure',
it_final-werks under 'plant' ,
it_final-pstat under 'status',
it_final-lgort under 'storage loc',
it_final-labst under 'stock',
it_final-maktx.
endloop.
reward points if useful,
venkat.
Maybe you are looking for
-
How can I get the data back in my Date Book on Palm Desktop
No device I have an old Tungsten E2 and jut lost everything out of the Datebook. Only the data on Datebook and it's still on my Handheld. How do I get the backup file for Datebook? Or how do I sinc from Handheld to the Palm Desktop?
-
MacBook Pro can't print to HP LaserJet 2100tn
Hello, I have an ethernet-connected HP LaserJet 2100tn in my office. I can print to it from my G4 laptop, but not from my new MBP. Some background/info: -The HP has its IP set correctly and it is on the same network as my Mac. I can print to it from
-
Acrobat 8 Standard page rotation stopped working
I am working with scanned documents and regularly need to rotate selected pages and save them in their proper orientation. Yesterday I was able to do this via Document --> Rotate Pages and then save. However today it is no longer working; I had not
-
File transfers - ASC vs BIN ?
Hi everyone ! Can somebody explain to me the "technical" difference between transfering files in ASC vs BIN mode. I use TCode CG3Y to download files from the SAP server to my PC and I noticed that ASC mode truncates (after ?? characters on the same l
-
Log is being created. But whe
error message on any of these programs:audiohqu.exesurmix2.exectplay2.exectcplfw .exe?Message is "An error log is being created".Love to read the log, but where is it's? I don't see any "*.log" extensions in the Creative subdirectory.