EAN13 checkum in ABAP?
Hi ABAP guru,
I urgently need to convert the following logic into ABAP programming to generate a checksum digit for Barcode EAN13:
proc checksum {first12digits} {
set total 0
for {set i 0} {$i < 12} {incr i} {
set multiplicator [expr ($i % 2 == 0) ? 1 : 3]
incr total [expr [string index $first12digits $i] * $multiplicator]
set checksum [expr 10 - ($total % 10)]
return $checksum
Please help and I promise maximum points for answer.
Thanks
Hello
On ECC 6.0 there is a function module ARCHIV_BARCODECHECK_EAN_13 available.
However, testing the function module (SE37) does not return any reasonable results (which might be a problem of the testing framework).
Below you see the coding of the fm:
FUNCTION ARCHIV_BARCODECHECK_EAN_13.
*"*"Lokale Schnittstelle:
*" IMPORTING
*" BARCODE LIKE TOAV0-ARC_DOC_ID
*" BARCODETYPE LIKE TOACM-BARCODE_TY
*" EXPORTING
*" RETURN
IF BARCODETYPE EQ 'EAN_13'.
DATA: STRING(40) TYPE C.
DATA: I TYPE I, M TYPE I, N TYPE I, NUTZ TYPE I, SUM TYPE I.
DATA: L TYPE I, PRUEF TYPE I.
FIELD-SYMBOLS: <S1>.
RETURN = FALSE.
STRING = BARCODE.
L = STRLEN( STRING ).
IF STRING CO '0123456789'.
ENDIF.
IF SY-FDPOS EQ L.
IF L > 1.
L = L - 1.
ASSIGN STRING+L(1) TO <S1>.
MOVE <S1> TO PRUEF.
IF PRUEF EQ 0.
PRUEF = 10.
ENDIF.
I = L - 1.
N = 1.
DO L TIMES.
ASSIGN STRING+I(1) TO <S1>.
MOVE <S1> TO NUTZ.
M = N MOD 2.
IF M EQ 1.
SUM = SUM + ( NUTZ * 3 ).
ELSE.
SUM = SUM + NUTZ.
ENDIF.
N = N + 1.
I = I - 1.
ENDDO.
ENDIF.
M = SUM MOD 10.
M = 10 - M.
IF PRUEF EQ M.
RETURN = OK.
ENDIF.
ELSE.
RETURN = FALSE.
ENDIF.
ELSE.
RETURN = FALSE.
ENDIF.
ENDFUNCTION.
Regards
Uwe
Similar Messages
-
Issue in Creation of XML file from ABAP data
Hi,
I need to create a XML file, but am not facing some issues in creation of XML file, the in the required format.
The required format is
-<Header1 1st field= u201CValueu201D 2nd field= u201CValueu201D>
- <Header2 1st field= u201CValueu201D 2nd field= u201CValueu201Du2026u2026. Upto 10 fields>
<Header3 1st field= u201CValueu201D 2nd field= u201CValueu201Du2026u2026. Upto 6 fields/>
<Header4 1st field= u201CValueu201D 2nd field= u201CValueu201Du2026u2026. Upto 4 fields/.>
<Header5 1st field= u201CValueu201D 2nd field= u201CValueu201Du2026u2026. Upto 6 fields/>
</Header2>
</Header1>
Iu2019m using the call transformation to convert ABAP data to XML file.
So please anybody can help how to define XML structure in transaction XSLT_TOOL.
And one more thing, here I need to put the condition to display the Header 3, Header 4, Header 5 values. If there is no record for a particular line item in header 3, 4 & 5, I donu2019t want to display full line items; this is only for Header 3, 4 & 5.
Please help me in this to get it resolved.Hello,
you can use CALL TRANSFORMATION id, which will create a exact "print" of the ABAP data into the XML.
If you need to change the structure of XML, you can alter your ABAP structure to match the requirements.
Of course you can create your own XSLT but that is not that easy to describe and nobody will do that for you around here. If you would like to start with XSLT, you´d better start the search.
Regards Otto -
Logical command in ABAP.....Urgent
Hi,
i am pretty new using ABAP program so i neeed help urgently. i am trying to move a file on the application server from one directory to the other and i was using the open dataset function to do that. but the file i am trying to move is pretty big and because i am using internal table to store, it is causing problems with the space.
i have consulted the basis guys and they have managed to create a logical file for copying from one directory to the other on the application server. to help you furthter. i am enclosing the mail sent to me.
I have created a logical command which should copy the file from one location to the other but you need to pass it the source dir and file name and the destination dir and file name.
The logical command is ZCOPY and uses cmd /c copy
Copies one or more files to another location.
COPY [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B]
[+ source [/A | /B] [+ ...]] [destination [/A | /B]]
source Specifies the file or files to be copied.
/A Indicates an ASCII text file.
/B Indicates a binary file.
destination Specifies the directory and/or filename for the new file(s).
/V Verifies that new files are written correctly.
/N Uses short filename, if available, when copying a file with a
non-8dot3 name.
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
/Z Copies networked files in restartable mode.
The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line. Default is
to prompt on overwrites unless COPY command is being executed from
within a batch script.
the problem now is i have no idea about how to use the logical command. can any one help me.
Thank you,
Ravi.If memory is not an issue, then there should be no reason why this should not work.
report zrich_0001.
parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.txt',
d2 type localfile default '/usr/sap/TST/SYS/Data2.txt'.
data: itab type table of string with header line.
start-of-selection.
* Read old file
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into itab.
if sy-subrc <> 0.
exit.
endif.
append itab.
enddo.
endif.
close dataset d1.
* Write to new file
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
* Delete the old file
delete dataset d1.
Regards,
Rich Heilman -
Logical Database in Abap Objects
Hi to All
I want do it a program report using a Logical Database.
Is this possible ??? But when I make a GET <node>, occurs the following error:
"" Statement "ENDMETHOD" missing. ""
I'm doing the following:
CLASS MONFIN IMPLEMENTATION.
METHOD TRAER_DATOS.
GET VBRK.
ENDMETHOD.
ENDCLASS.
Please, somebody tell me how I use the logical database in Abap Objects.
Thank you very much
Regards
Dario R.Hi there
Logical databases whilst of "some use" are not really part of OO.
If you want to use a logical database in an abap OO program I would create a special class which just does the get data from your DB and pass this either at record or table level.
Techniques such as GET XXXX LATE aren't really part of any OO type of application since at Object Instantiation time you should be able to access ALL the attributes of that object.
As far as OO is concerned Logical databases are a throwback to "Dinosaur Technology".
Since however modules such as SD and FI are still heavily reliant on relational structures (i.e linked tables etc) then there is still some limited life in this stuff but for OO try and solve it by another method.
If you really must use this stuff in OO then do it via a FMOD call and save the data in a table which your method will pass back to your application program.
You can't issue a GET command directly in a method.
Cheers
Jimbo -
LOGICAL DATABASE IN HR ABAP PRPGRAMMING
Hi Friends,
what is use of LOGICAL DATABASE IN HR ABAP PROGRAMMING
AND END-OF-SELECTION EVENT IN HR PROGRAMMING PROGRAMMING???
regards,
vijay.hi
HR Logical Databases
In Human Resources (HR), the following logical databases can be used as a data source for HR InfoSets:
PNP (PNPCE)
PAP
PCH
By selecting a logical database, you determine the HR data that can be reported on using an InfoSet.
Logical Database PCH
This logical database generally enables you to report on all HR infotypes. However, you are advised not to use this logical database unless you want to report on Personnel Planning data.
Logical Database PNP (or PNPCE)
Use logical database PNP to report on HR master data. It is possible to use logical database PCH to access this data, but PNP meets such reporting requirements more quickly because it is best suited to the task of selecting persons.
Logical database PNP enables you to access HR master data and infotypes from Personnel Planning. For example, you have the following options:
Reporting on the costs, number of attendees booked, and instructor for a business event on which an employee is booked
Reporting on working time and planned compensation for a position that an employee occupies
Reporting on the validity and proficiency of a qualification that an employee fulfils
From a technical perspective, this means you can use PNP to report on all of the infotypes that exist for objects (infotype 1000) that have a direct relationship (infotype 1001) with the Person object.
The ability to access infotypes from Personnel Planning using logical database PNP is a special feature that you can only use in the context of SAP Query and Ad Hoc Query. You cannot use this functionality for ABAP reports you programmed yourself.
You can also use logical database PNP to report on data from Personnel Time Management (infotypes 2000 to 2999) and Payroll (special payroll infotypes for the USA and customer infotypes; for more information, access Customizing for the Human Resources Information System and see Payroll Results).
Logical Database PAP
Logical database PAP enables you to access data from Recruitment.
regards
navjot
reward if helpfull -
Dear SDN,
In an integration scenario we are using sender File Adapter and a ABAP XSLT Mapping.
Is there any way to get the source FileName from such mapping. Im trying to use the adapter-specific message attributes, but it doesn't work, and I didn´t find an example, probably I and doing somthing wrong.
regards,
GPThank you for your help,
I just try to access the adapter-specific attibutes using:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">
<xsl:variable name="filename" select="key:create('http://sap.com/xi/XI/System/File', 'Directory')" />
</xsl:stylesheet>
but the following error raised:
<SAP:Stack>Error while calling mapping program YXSLT_TEST (type Abap-XSLT, kernel error ID CX_XSLT_RUNTIME_ERROR) Call of unknown function</SAP:Stack>
have you had this situation? -
ABAP-- diff between sy-sy-tabix and sy-index
Hi Guru's,
Pleae can anybody expalins me what is the difference between sy-tabix and sy-index(Loop Index) ?
Because in one case i am Modifyimg the internal table inside the do loop by giving sy-index ((Index of Internal Tables)(MODIFY scarr_tab INDEX sy-index FROM scarr_wa TRANSPORTING currcode. ) in the syntax and in other case inside loop statement i am modifyng same record by giving sy-tabix MODIFY scarr_tab INDEX sy-tabix FROM scarr_wa TRANSPORTING currcode.) in the syntax.
in both cases its working fine but i am not getting which one i have to use where to modify the internal table?
regards
SATYAHi Henry,
SY-INDEX is the value of the current iteration. It is applicable for the following programming constructs in ABAP -
DO...ENDDO.
WHILE...ENDWHILE.
SY-TABIX (TABle IndeX) is applicable to internal tables. If you scroll down in the link which Eddie has given, you will find a more detailed explanation for sy-tabix and which statements affect its value.
Regards,
Anand Mandalika. -
Comas(,) are not getting displayed in the output while using OO ABAP
Hi All,
I am using ABAP objects to display the ALV report in which there is a requirement to output Quantity fields. The Quantity fields are getting displayed without comas ','. Please help me in getting back the comas in the output.
Eg:
Below logic is used in my program.
Class name: cl_salv_form_layout_grid
Code:
obj_footer->create_text(
row = v_row_cnt
column = v_col_cnt
text = Quantity).
Expected output:
39,545.000
Current Output:
39545.000
Thanks in advance for your help.
Thanks & Regards,
Siva.Hi,
Please check if the images are in the server and in the /images alias path.
thanks,
Sharmila -
Hi All,
I like to know, is it NULL and Space value is same in ABAP, if it is not how to check null value.
Thank you.
Senthileverything is correct though some answers are not correct.
A Database NULL value represents a field that has never been stored to database - this saving space, potentially.
Usually all SAP tables are stored with all fields, empty fields are stored with their initial value.
But: If a new table append is created and the newly-added fields do not have the 'initial value' marked in table definition, Oracle will just set NULL values for them.
as mentioned: There is no NULL value to be stored in an ABAP field. The IS NULL comparison is valid only for WHERE clause in SELECT statement. WHERE field = space is different from WHERE field IS NULL. That's why you should check for both specially for appended table fields.
If a record is selected (fulfilling another WHERE condition) into an internal table or work area, NULL values are convertted to their initial values anyway.
Hope that sheds some light on the subject!
regards,
Clemens -
Sale order before the regeneration of ABAP report: RSM13000
Hi there,
I am just wondering about something.
After we installed support packages, users could not get any sales order without to get any error message and I we could only see an error message via SM21 which says:
Run-time error "LOAD_TYPEPOOL_VERSION_MISMATCH" occurred.
So after we regenerated the ABAP report: RSM13000 after that everythings seems to be ok.
Now the question is: When we try to find the order numbers which the users created before the regeneration we find nothing.
What about this numbers? Did they have not been created at all or what hapened? They customer is asking now.
Thanks in advance
HanseatikI still do not know. We created them again
-
Report J_1IEWT_CERT getting cancelled, generating ABAP dump!
A long running report J_1IEWT_CERT in background mode is getting cancelled after running for a while and generating the following dump :
Error analysis
When changing or deleting one or more lines of the internal table
"\PROGRAM=J_1IEWT_CERT\DATA=PRINTTAB[]" or when inserting in the table
"\PROGRAM=J_1IEWT_CERT\DATA=PRINTTAB[]", 0 was used as
the line index. An index less than or equal to zero is not
allowed.
The error can occur when using the following options:
1. "INDEX idx" for specifying the line number in the table
"\PROGRAM=J_1IEWT_CERT\DATA=PRINTTAB[]"
where you want to change, insert or delete.
2. "FROM idx" for specifying the start index when deleting a line
area from or inserting a line area into the table
"\PROGRAM=J_1IEWT_CERT\DATA=PRINTTAB[]".
3. "TO idx" for specifying the end index when deleting a line
area from or inserting a line area into the table
"\PROGRAM=J_1IEWT_CERT\DATA=PRINTTAB[]".
At the time of the termination, the table contained 17008 lines.
How to correct the error
If the error occurred in your own ABAP program or in an SAP
program you modified, try to remove the error.
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"TABLE_INVALID_INDEX" " "
"J_1IEWT_CERT" or "J_1IEWT_CERT_F01"
"FILTER_DATA"
If you cannot solve the problem yourself and want to send an error
notification to SAP, include the following information:
1. The description of the current problem (short dump)
To save the description, choose "System->List->Save->Local File
(Unconverted)".
2. Corresponding system log
Display the system log by calling transaction SM21.
Restrict the time interval to 10 minutes before and five minutes
after the short dump. Then choose "System->List->Save->Local File
(Unconverted)".
3. If the problem occurs in a problem of your own or a modified SAP
program: The source code of the program
In the editor, choose "Utilities->More
Utilities->Upload/Download->Download".
Tried searching for some SAP Notes to fix the issue, no success as of now, Please help me out...Have you checked these notes ?
363107 Short dump occurs during TDS certificate printing.
803806 Error while genrating TDS certificate 03.01.2005
1066049 J1INCERT - Error while generating TDS certificate
Regards,
Subhash -
Debugging is not working in R/3 from WebDynpro-ABAP developed webpage input
Dear Friends,
We are facing a serious problem for debugging. Expecting valuable input for the same.
Debugging is not working in R/3 from WebDynpro-ABAP developed webpage input in Production Server.
The debugging (for WebDynpro-ABAP application) is working in Dev. Server for
1st ] Within R/3
Ex. debug for bapi within R/3. i.e. value enter as input in R/3 only.
2nd ] From webpage to R/3
Ex. Some input given on the internet web page developed through WebDynpro and external breakpoint set in R/3 it works. It directs to R/3 code through debugging.
In Prod. Server the 1st case above is working but the 2nd case is not working.
In Prod. Server the WebDynpro developed applications are running successfully through internet explorer webpage inputs. So running the application is not a problem in prod. Server but debugging of the same is the problem.
The setting which are done in Prod. server are,
1] RZ10 in parameters are set for port and host name.
2.1] In SMICM check for ICM.
2.2] Host file updated in Windows-System 32.
3] In SICF following services are active,
3.1] default_host/sap/bc/webdynpro
3.2] default_host/sap/public/bc
3.3] default_host/sap/public/bc/webdynpro/viewdesigner
3.4] default_host/sap/bc/wdvd
3.5] default_host/sap/public/icman
3.6] default_host/sap/bc/gui/sap/its/webgui
3.7] default_host/sap/public/ping
3.8] default_host/sap/bc/error
3.9] default_host/sap/bc/echo
4] In SE80
4.1] Internet services-System-are published
4.2] Internet services-WEBGUI-are published
4.3] Utilities-Setting-ABAP Editor-Debugging-Username & New Debugger set.
4.4] Utilities-Setting-ABAP Editor-Editor-Front-End Editor(New) set.
5] In Su01 for user profiles sap_all & sap_new is assigned and role SAP_BC_WEBSERVICE_DEBUGGER is assigned.
6] The support packages are also updated to latest level.
7] Gone through following links but not getting any clues.
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/48/74d50bd1431b5ae10000000a42189c/frameset.htm
http://help.sap.com/saphelp_nw04s/helpdata/EN/77/3545415ea6f523e10000000a155106/frameset.htm
Thanks in Advance.
Best Regards,
Abhijit.No cross posting
Read the "Rules of Engagament"
Regards
Juan -
Hi experts,
Here are some questions for u pls send answers asap.
1. What are the exceptions in function module?
2. What is Return code?
3. What are the interface programs we have?
4. What is the typical structure of ABAP/4 Program?
5. How can we make the user to get satisfaction while developing the code?
6. What is production order report?
7. Generally What are the objects we have to develop in end to end full life cycle implementation project w. r. to SD and MM functional modules?
8. How can u find a required exit , include and form routines in an user exit ?
9. What is the difference between SMOD and CMOD ?
10. What is the difference between AT NEW and ON CHANGE OF ?
11. We have two fields Customer and Batch in selection screen. If we select Batch field down arrow button( for F4 help) we will get a popup with possible values.
To get that What code we have to write and where?
12. Explain SD Flow?
13. Can we only process synchronously in CALL Tr. Cant we process in asynchronous? Actually What is processing?
14. Can we use only one application at a time in CALL Tr. ?
15. If we have a data in integer and numeric format in flat file , is it possible to upload data or not ? if yes how?
16. Technical specs preparation comes under blueprint phase or Realization phase?
17. In which phase a developer can work ?
18. While handling a Tabstrip Report, Where we have to maintain selection screen of each tabstrip report? Wheather it is in source code or in screen painter? Explain in detail with one tabstrip report which is having different tabs in selection screen?
19. In which event we have to write SET CURSOR FIELD logic in a report?
20. How can u add different tabs in a report?
21. Hoe can u handle a tabstrip in areport?
22. Explain Cluster and Pooled Tables with definitions and what is the advantage of cluster and pooled tables?
23. What is the structure of VIEW?
24. How we provide F4 help in DDIC? What are steps (Navigation)?
25. What is primary key and foreign key. What they will do?Did you get the job then? :o)
Kind regards
Ash Thomas
<a href=http://www.ashthomas.com>Sap Abap Developer & Sap Abap Programmer</a>
<a href=http://www.ashthomas.com>www.ashthomas.com</a> -
Hi folks,
I am getting abap display for my report which is also required as hard cpoy when I fire a printout for the same. But I need to increase the font size of the report. How can I achieve thisHI.
Go to Cutomize local layout (Right most icon from menu bar).
go to Option
go to Graphic
Change font here.
Regards.
jay -
IE Script error when double clicking on a view in Abap Webdynpro component
Hello experts,
I am running mini SAP trial version 2004 with Internet explorer 7.0 and also installed gui patch 23.
I am making a sample application in SE80 and when double clicking on a view in Abap Webdynpro component I get following error:
<b>Internet Explorer Script Error</b>
An error has occured in the script on this page.
Line: 1
Char: 1
Error: 'wdp_show_menu' is undefined
Code: 0
URL: http://satellite5200:8000/sap/bc/wdvd/painting.html?_vdrespkey=EOJ6V1JQMX0VLTQ7AP6DQM64Y&_vdframe=painting&sap-client=000
Do you want to continue running scripts on this page?
Thanks in advance.
BhupendraHi Bhupendra,
If you are seeing this error in the Se 80 editor , i guess you can ignoire that ...While running the application it will not show any error.
Thanks
Anzy
Maybe you are looking for
-
How to add a table (J2ME CDC)
Is there a way to add a table? I am using Eclipse IDE & IBM J9 ( Personal Profile 1.1, FP 1.1, CDC 1.1) Thanks in advance.
-
I'm new wiith Blackberry and need some help
Hi There, I'm working on a school in the netherlands and thay are thinking here to give some people a blackberry phone to syncronize there calendar and mail. We are using a Microsoft Exchange 2007 server (with webacces active) for the calendar and ma
-
Re: Satellite A660-12P - can't find the right display driver for Win XP
Hey everyone, i need some help with this one: I just made a dual boot Win7 (x64)/XP (x86) on my laptop, but i can't find the right display drivers for the video controller VGA compatible on XP. Does someone know where i can find them? Many thanks,
-
Safarin 6.0 doesn't work smoothly
I notice that Safari 6.0 doesnt work smoothly. However, when i test a same website on Chrome ver 20, they work smoother when i scroll up and down. Is there anyone to meet the same problem as me?
-
Reporting time type for 0HR_PT_2
Hi, I am creating the reporting time types in ECC system, to extract it to BW. I have always used "Attendance/Abscences Assignment" I would like to know, in which scenario, we will use "Time Type Assignment" or "Wage types Assignment" Thanks and Rega