Sha256 - how to do this javascript in ABAP. Is it possible?
Hello,
I would like to use the amazon product advertising api. For this my requests need to be "signed". In an example I found the following javaScript for signing requests:
function sign(secret, message) {
var messageBytes = str2binb(message);
var secretBytes = str2binb(secret);
if (secretBytes.length > 16) {
secretBytes = core_sha256(secretBytes, secret.length * chrsz);
var ipad = Array(16), opad = Array(16);
for (var i = 0; i < 16; i++) {
ipad<i> = secretBytes<i> ^ 0x36363636;
opad<i> = secretBytes<i> ^ 0x5C5C5C5C;
var imsg = ipad.concat(messageBytes);
var ihash = core_sha256(imsg, 512 + message.length * chrsz);
var omsg = opad.concat(ihash);
var ohash = core_sha256(omsg, 512 + 256);
var b64hash = binb2b64(ohash);
var urlhash = encodeURIComponent(b64hash);
return urlhash;
Could someone please tell me if this is also possible with ABAP and if yes, how?
Thanks a lot in advance. Unfortunatley I don't get it done by myself.
bye, Vanessa
Hi
You can code JavaScript directly in your ABAP code.
data: l_JS_PROCESSOR type ref to CL_JAVA_SCRIPT,
l_RETURN_VALUE type STRING,
l_SOURCE type STRING.
Create a new javaScript
l_JS_PROCESSOR = CL_JAVA_SCRIPT=>CREATE( ).
Your Javascript code
concatenate
'var l_source = "Hello,"; '
'l_source += " World"; '
into l_SOURCE separated by CL_ABAP_CHAR_UTILITIES=>CR_LF.
compile the code
l_JS_PROCESSOR->COMPILE( SCRIPT_NAME = 'MYSCRIPT.JS' SCRIPT = L_SOURCE ).
syntax errors ?
if l_JS_PROCESSOR->LAST_CONDITION_CODE <> 0.
write: / 'Error', l_JS_PROCESSOR->LAST_ERROR_MESSAGE.
exit.
else.
write / 'compiled'.
endif.
execute
l_JS_PROCESSOR->EXECUTE( SCRIPT_NAME = 'MYSCRIPT.JS' ).
Errors ?
if l_JS_PROCESSOR->LAST_CONDITION_CODE <> 0.
write: / 'Error in execution',l_JS_PROCESSOR->LAST_ERROR_MESSAGE.
exit.
else.
write / 'Script was executed'.
endif.
return the output variable
l_RETURN_VALUE = l_JS_PROCESSOR->EVALUATE( JAVA_SCRIPT = 'l_source;' ).
write : / l_RETURN_VALUE.
Similar Messages
-
How to do this in WebDynpro ABAP?
Hi!
I'm new to WD ABAP, and I need to create a webdynpro with the same funcionality as the User Management Administration available in the Portal, ie:
1. AN ALV list with a search criteria: OK, created on view VLIST.
2. When the user selects one line of the ALV, it would open another view below the view VLIST, not replacing the view VLIST (as it happens when using navigation link).
3. Inside this second view, there is a tabstrip, and one of the tabs display another ALV list, with a <b>Modify</b> button. When the user clicks on <b>Modify</b>, another ALV will "appear" side by side with the first one (inside the tab), so that the user can move items from one ALV to the other (just like the role assignment in the user management administration of the portal).
Can it be done in ABAP WebDynpro? If yes, how can I do it?
Thank you very much.
AndreHi Andre,
I think what you are looking for is the EMPTY view.
Since a naviagtion event (fire plug) can result in multiple views being changed.
So you can have
VIEW COMBI
with 2 UI View containers
VC1
VIEW1
VC2
VIEW2
Event X can be mapped to result in
VIEW COMBI
VC1
VIEW4
VC2
VIEW5
or
VIEW COMBI
VC1
VIEW4
VC2
EMPTY VIEW
So you can controller exactly which views are visible when easily
See right click embed empty view in the WINDOW
regards
Phil -
How to fix This "JavaScript and ActiveX must be enabled to view the image gallery"
I can't wiew pictures at bt.dk. How dó i fix This error .
You can enable JavaScript in Settings>Safari>JavaScript>On. ActiveX is MS/Windows software that cannot be installed on an iPad.
-
PCA_PLANDATA_POST -How to use this FM in ABAP
Hi,
I want to update Plan data using this FM.
How do we proceed?
data: begin of i_glpct occurs 0.
include structure glpct.
data: end of i_glpct.
SELECT * FROM glpct
INTO CORRESPONDING FIELDS OF table i_glpct
WHERE rldnr = '8A'
and RRCTY = '1'
and Racct = '0000801020'
and rvers = '001'.
LOOP AT i_glpct.
i_glpct-HSl01 = '33'.
CALL FUNCTION 'PCA_PLANDATA_POST'
EXPORTING
I_DOCTY = 'P0'
I_PLACT = '1'
I_BATCH = ' '
IMPORTING
E_RECORDS = '1'
TABLES
t_glpct = i_glpct
T_DOCUMENTS =
EXCEPTIONS
POSTING_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.
else.
write:/10 'Sucessfully updated'.
ENDIF.
ENDLOOP.It works but my t-code data is not update in R/3.
I used commit work.
What else could be the problem?
REPORT x.
data: begin of i_glpct occurs 0.
include structure glpct.
data: end of i_glpct.
data: begin of t_glpct occurs 0.
include structure glpct.
data: end of t_glpct.
data: l_wait type BAPITA-WAIT,
is_return_com like bapiret2.
SELECT * FROM glpct
INTO CORRESPONDING FIELDS OF TABLE i_glpct
WHERE rldnr = '8A'
and RRCTY = '1'
and Racct = '0000801020'
and rvers = '001'.
LOOP AT i_glpct.
i_glpct-HSl01 = '33'.
modify i_glpct.
ENDLOOP.
read table i_glpct.
CALL FUNCTION 'PCA_PLANDATA_POST'
EXPORTING
I_DOCTY = 'P0'
I_PLACT = '1'
I_BATCH = ' '
IMPORTING
E_RECORDS =
TABLES
t_glpct = i_glpct
T_DOCUMENTS =
EXCEPTIONS
POSTING_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.
else.
commit WORK.
write:/10 'Sucessfully updated'.
ENDIF. -
How to use mathematical calculations in abap
Hi!
In my program,
I declared one variable as w_h(2) type n.
i am doing calculation as,
w_h = 100 /60.
its giving the o/p as 2(1.66...). but in 1.6 i want that 1 alone as my o/p.normally math function floor() is there to bring the o/p as 1. in abap how to use this floor function. or any other possible is there to get the o/p as 1.could anybody plz help me.define w_h as i.
data: w_h type i.
Edited by: mayank jain on Sep 8, 2009 9:42 AM -
Help out? i was watching a 43 min episode and it works fine in the first like 20 minutes but later on in freezes, it turns the screen completely black afterwards, there's still sound, but theres no video, the screen is completely black while audio continues to play. How to fix this? and what were the possible causes for this?
Try:
- Reset the iOS device. Nothing will be lost
Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
least ten seconds, until the Apple logo appears.
- Delete/unsunc he video and then resync/redownload
- Reset all settings
Go to Settings > General > Reset and tap Reset All Settings.
All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
- Restore from backup. See:
iOS: Back up and restore your iOS device with iCloud or iTunes
- Restore to factory settings/new iOS device. -
How to execute this SQL Query in ABAP Program.
Hi,
I have a string which is the SQL Query.
How to execute this sql Query (SQL_STR) in ABAP Program.
Code:-
DATA: SQL_STR type string.
SQL_STR = 'select * from spfli.'.
Thanks in Advance,
VinayHi Vinay
Here is a sample to dynamically generate a subroutine-pool having your SQL and calling it.
REPORT dynamic_sql_example .
DATA: BEGIN OF gt_itab OCCURS 1 ,
line(80) TYPE c ,
END OF gt_itab .
DATA gt_restab TYPE .... .
DATA gv_name(30) TYPE c .
DATA gv_err(120) TYPE c .
START-OF-SELECTION .
gt_itab-line = 'REPORT generated_sql .' .
APPEND gt_itab .
gt_itab-line = 'FORM exec_sql CHANGING et_table . ' .
APPEND gt_itab .
gt_itab-line = SQL_STR .
APPEND gt_itab .
gt_itab-line = 'ENDFORM.' .
APPEND gt_itab .
GENERATE SUBROUTINE POOL gt_itab NAME gv_name MESSAGE gv_err .
PERFORM exec_sql IN PROGRAM (gv_name) CHANGING gt_restab
IF FOUND .
WRITE:/ gv_err .
LOOP AT gt_result .
WRITE:/ .... .
ENDLOOP .
*--Serdar -
How to use this function module on abap hr GET_PDSNR_RANGE
how to use this function module on abap hr GET_PDSNR_RANGE
thankx.PASS INETRNAL TABLE WITH SOME DATA TO TABELLE FOR GENERATING PDSNR SEQUENCE
-
How to solve this problem?
Make sure that you do not block JavaScript
*https://support.mozilla.org/kb/JavaScript
Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.org/kb/Safe+Mode
*https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes -
How to add this two fields AUGBL & ZLSCH in FBL3 in abap 3.1 version
How to add the clearing document no. & payment method in FBL3 tcode. Can any one explain me step by step process how to add that two fields. This is ABAP 3.1 version. It's urgent requirement.
Moderator Message: Duplicate thread locked. Please carry on with this thread: How to add this two fields AUGBL & ZLSCH in FBL3 in abap 3.1 version
Message was edited by: Suhas SahaDid you read the note provided in How to add this two fields AUGBL & ZLSCH in FBL3 in abap 3.1 version ?
Regards,
Raymond -
How to approach this requirment
Business overview:
For every organisation account management will be the core functionality. The account management should include the following:
customer - company - vendor.
1. customer info
2. vendor info
3.organisation info
4.material info
5.purchase order info
6.sales order info
7.subsequent documents such as delivery doc,invoice doc n accounting doc info.
Reports:
1.purchase order line item wise report.
2.open purchase order.
3.sales order line item wise report.
4.open sales order report.
5.open invoice item wise.
Im new to ABAP, pl someone guide me how to approach this requirment. Which r the tables n fields i need to work with?
Thank you.Hi Ashwini,
I am giving you some of the important details of tables as per your requirement.But there could be more tables than i am providing.
Just a list of tables that come in handy.
Sales orders
Name Description Uses
LIKP Shipped Lines header
LIPS Shipped Lines detail
VBAK Order header Every order (unless archiving)
VBAP Table fields Every line item (unless archiving)
VBBE Open sales order line items Great file, but be careful.Contents don't reflect orders
that do not affect purchasing (go figure).
VBEP Schedule line item
VBFA Document flow Let's you move from order to shipping document to invoice.
VBUK Order status
VBUP Line item detail status
VBFK Invoicing header
VBFP Invoicing detail
Material Management
Name Description Uses
MARA Inventory Master
MARC Plant Data
MARD Current Inventory
MAKT Descriptions
MBEW Material Valuation
T179 Product Hierarchy
MVKE Sales data (materials)
MKPF Material document Status code 'R' in VBFA
Purchasing
Name Description Uses
EINA Purchasing inforecord by MATNR/LIFNR contains things like vendor material
number and access key for EINE
EINE Purchasing inforecord detail Contains minimum purchase, group, currency
EKPO Purchase orders
EKET Scheduled lines
EKES Vendor confirmed lines
IKPF Header- Physical Inventory Document
ISEG Physical Inventory Document Items
LFA1 Vendor Master (General section)
LFB1 Vendor Master (Company Code)
NRIV Number range intervals
RESB Reservation/dependent requirements
T161T Texts for Purchasing Document Types
Forecasting
Name Description Uses
MAPR
PROP
PROW
Classification
Name Description Uses
KSSK Material number to class
KLAS Class description
KSML Characteristic name
CABN/CABNT Characteristic name description
CAWN/CAWNT Characteristic name
AUSP Numeric values
CAUFV Service order header
AFPO Service order line Holds items that will create "reservations"
RESB SM Reservations Materials needed for line
Customer Data
KNA1 Customer Master
KNVV Sales information
KNVP Partners (ship-to, etc)
Since you are new to abap, its better you to know the system tables and other tables for configuring:
System tables
Name Description Uses
DD02T Table texts
DD03L Table fields Lists the fields in a table
DD04T Data element texts
USR02 Valid user names
Config tables (normally begin with "T")
Name Description Uses
T001 Client table
T002 Languages
T005 Region (Country)
TCURR Currency and exchange rates
TVAK Order type
TVSB Shipping condition
TVAGT Rejected reason for order line
Other tables
Name Description Uses
STXH Text header
STXL Text detail
Reward points if useful.
Thnakyou,
Regards. -
How to approach this requirement
Business overview:
For every organisation account management will be the core functionality. The account management should include the foll:
customer - company - vendor.
1. customer info
2. vendor info
3.organisation info
4.material info
5.purchase order info
6.sales order info
7.subsequent documents such as delivery doc,invoice doc n accounting doc info.
Reports:
1.purchase order line item wise report.
2.open purchase order.
3.sales order line item wise report.
4.open sales order report.
5.open invoice item wise.
Im new to ABAP, Please someone guide me how to approach this requirement. Which are the tables and fields i need to work with?
Thank You.
AshwiniHi:
Refer to SAP Tables in this documentation.
http://www.erpgenie.com/abap/tables.htm
You will find the realted fields in the weblink.If you are not unable to find the field and table, go to functional consultant and ask him about the filed.
he will show you and click on F1.you can see the techncail information.Click on this and you will see table name and field name.
Please let me know if you need more information.
Assign points if useful.
Regards
Sridhar M -
How can I get JavaScript for Windows 7 in order to connect to certain links?
I have JavaScript 1.6.0_27 and a website is sending me information which I cannot get because their website only supports up to JavaScript 1.6.0_26. How can I install JavaScript 1.6.0_26 on my computer?
Please continue at --> https://support.mozilla.com/en-US/questions/891126
Moderator: Duplicate; please LOCK this thread - https://support.mozilla.com/en-US/questions/891123 -
When creating a new window in safari, using command T, the marker have not activated the search field. It means you have to click there every time. Changed after upgrading to Mavericks. Anyone knows how to change this?
Yes, you can do something like that. What you would do is create a button for each image and then hide them. When I do this type of thing I place all of the buttons on a template page and then hide the template.
You can then use JavaScript to copy the icon from any of the hidden buttons to the main button that you've set up to display the image. For example, suppose you set up 10 buttons named b1, b2, b3, ...b10. The code to copy the icon from one of them to the button used to display the image (b0) would be something like this:
// Get the icon from the b3 button
var oIcon = getField("b3").buttonGetIcon();
// Get reference to the b0 button
var f = getField("b0");
// Set the icon of the b0 button to the icon retrieved from the hidden button
f.buttonSetIcon(oIcon);
// Show the b0 button
f.display = display.visible;
This code would go in the Mouse Up event of the smaller button. -
How to convert special characters in ABAP to XML?
Hi All.
We have a scenario where from XI (exchange Infrastructure), a BAPI is called which returns an XML. From that XML, a PDF is generated.
Now, if the XML contains any special characters, it will fail.
So if any CHinese char or >, # etc signs are there, it fails.
Can you please tell me how to convert my string in ABAP to a proper XML?
I am new to it and I was trying the following code
DATA: today TYPE string,
result TYPE string.
today = 'This is testing'.
CALL TRANSFORMATION ID
SOURCE today = today
RESULT XML result.
IF sy-subrc = 0.
WRITE result.
ENDIF.
But it does not return me anything.
Thanks in adv.hi
good
go through these links,hope these would help you to solve your problem
http://www.sap-press.de/download/dateien/792/sappress_abapreference_2edition.pdf
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/c2567f2b-0b01-0010-b7b5-977cbf80665d
thanks
mrutyun^
Maybe you are looking for
-
Problem with pricing condition type in case of proforma invoicing
Hello All, the problem is related to a pricing condition type in case of proforma invoice where the details are as follows - Name of Condition Type - ZADC - Add 10% on Cost Access seq. Z038 Diff
-
Need help in creating a view with Encryption for hiding the code used by the multiple users
Hi, Can anyone help me out in creating view with encryption data to hide the stored procedure logic with other users. I have create a stored procedure with encryted view but while running this manually temporary views are getting created, therefore t
-
Advanced "Save as PDF" script that saves 2 PDF presets with 2 different Names
HI Everyone, I am looking to improve a save as pdf workflow and was hoping to get some direction. Here is the background... I routinely have to save numerous files as 2 separate PDFs with different settings (a high res printable version and a low res
-
Error/Exception handling in PI (Inbound Proxy)
Dear All, I need some help in PI Error handling. If PI sends data to an ABAP inbound proxy and an error occurs in PI because of type mismatch (e.g. Unable to convert date). This error is persistent in the PI monitor, but how do I let the Sender know
-
Error has occurred in workflow processing
Hi All, The email notification sent back to employees to notify them that the timecard was submitted successfully is erroring. I looked in the workflow administrator resp and noticed the employee notifications were failing. Please see the below error