Call AFIP MTXCA web-service properly from SAP ECC - abap

I am trying to call the AFIP WebService MTXCA directly from SAP ECC.
There is no problem with that. The thing is when I try to get the TOKEN and SIGN from the first WS
https://wsaahomo.afip.gov.ar/ws/services/LoginCms?WSDL
I can not sign the XML to build the right CMS to get the proper answer from AFIP.

cl_secxml_helper=>upload_file( EXPORTING filename = p_xml
IMPORTING bindata = DATA(lv_xml) ).
DATA(lo_object) = cl_sec_sxml_dsignature=>create_reader_instance( if_input = lv_xml ).
lo_object->m_ssf_hash_algorithm = 'SHA1'.
lo_object->m_dsig_hash_algorithm = 'SHA1'.
lo_object->m_dsig_method = 'RSA'.
lo_object->m_signature_ns_prefix = ''.
lo_object->sign_xml( EXPORTING if_ssf_app = 'OAUTH'
if_add_keyinfo = abap_true
if_add_keyinfo_ex = abap_true
IMPORTING ef_signature_xml = DATA(lf_result)
es_signer = DATA(ls_signer) ).
lo_object->embed_signature( EXPORTING if_xml = lv_xml
if_signature = lf_result
if_embed_as_child = abap_true
if_embed_at_end = abap_true
is_signer = ls_signer
IMPORTING ef_result = lf_result ).
cl_soap_xml_helper=>xml_show( xdoc = lf_result ).
ls_request-in0 = lf_result.

Related

Requested module experienced an error while loading - Server - Data:11

Yeah So, I'm coding a Roblox game and this script gets an error every time, I even restarted roblox studio to try fixing it but it didn't work and I tried messing around with the code but I couldn't figure it out, can someone please help?
Script:
local PetModule = require(ServerModules.PetModule)
Module Code:
local module = {}
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Pet = ReplicatedStorage.Pet
function module.EquipPet(Player, PetName)
local PetModel = Pet:FindFirstChild(PetName)
if PetModel then
PetModel = PetModel:Clone()
PetModel.Parent = workspace.Pet:FindFirstChild((Player.Name))
if Player then
local Character = Player.Character
if Character then
if not Character.HumanoidRootPart:FindFirstChild("PetAttachments") then
local PetAttachments = Instance.new("Folder")
PetAttachments.Name = "PetAttachments"
PetAttachments.Parent = Character.HumanoidRootPart
local PetAttachments = Character.HumanoidRootPart:FindFirstChild("PetAttachments")
if PetAttachments then
local att0 = Instance.new("Attachment")
att0.Name = "Attachment1"
att0.Position = PetModel:FindFirstChild("AttachmentPosition").Value
att0.Parent =Character.HumanoidRootPart
local att1 = Instance.New("Attachment")
att1.Name = "Attachment2"
att1.Parent = PetModel.PrimaryPart
local AlignPosition = Instance.new("AlignPosition")
AlignPosition.Attachment0 = att0
AlignPosition.Attachment1 = att1
AlignPosition.RigidityEnabled = false
AlignPosition.MaxForce = PetModel.MaxForce.Value
AlignPosition.Responsiveness = PetModel.Responsiveness.Value
AlignPosition.Parent = PetModel.PrimaryPart
local AlignOrientation = Instance.new("AlignOrientation")
AlignOrientation.Attachment0 = att0
AlignOrientation.Attachment1 = att1
AlignOrientation.RigidityEnabled = false
AlignOrientation.MaxTorque = PetModel.MaxForce.Value
AlignOrientation.Responsiveness = PetModel.Responsiveness.Value
AlignOrientation.Parent = PetModel.PrimaryPart
game:GetService("RunService").Heartbeat:Connect(function()
att0.Position = PetModel.AttachmentPosition.Value
AlignPosition.MaxForce = PetModel.MaxForce.Value
AlignOrientation.MaxTorque = PetModel.MaxForce.Value
AlignPosition.Responsiveness = PetModel.Responsiveness
end)
end
end
end
end
end
function module.UnequipPet(Player)
end
function module.UnequipAllPet(Player)
end
return module
end
If anyone could help me fix this it would be great.
make sure to put "return module" at the end!
return module
is within the function. Try to put it free at the end of the code and...
I'm not sure, but I think it's because you're creating an event connection within module, I had this problem right now. I just stopped creating events within the Module and the problem stopped.
Try removing this from de Code.
game:GetService("RunService").Heartbeat:Connect(function()
att0.Position = PetModel.AttachmentPosition.Value
AlignPosition.MaxForce = PetModel.MaxForce.Value
AlignOrientation.MaxTorque = PetModel.MaxForce.Value
AlignPosition.Responsiveness = PetModel.Responsiveness
end)

BAPI or FM for Promise to pay creation?

I'm working with Promises to pay in UDM_SUPERVISOR transaction and I need to upload Promise to pay data using BAPI/FM from an excel file.
There is a data migration template which will include all the required fields for the creation of a Customer Promise To Pay in the system.
The migration will happen using LTMC migration cockpit tool. Is there any BAPI/FM I can use for uploading Promise To Pay?
Try function modules from FDM_P2P_SERVICES group which is Promise to Pay API.
For example UDM dashboard calls FDM_P2P_CREATE FM under the hood
ls_p2p_partner-obj_type = 'KNB1'.
ls_p2p_partner-obj_key = '0030000001CA09'.
ls_p2p_attr-fin_comp_code = "CA09".
ls_p2p_attr-fin_customer = '0030000001".
ls_p2p_attr-fin_p2p_curr = 'CAD".
ls_p2p_attr-fin_p2p_date = ls_p2p_attr-fin_p2p_due_date = "20220530".
ls_p2p_attr-fin_promised_by = 'Sandeep Phogat".
ls_p2p_attr-fin_contact_tel = "9058262323".
ls_p2p_attr-fin_contact_key = "0000000003".
APPEND ls_p2p_attr TO lt_p2p_attr.
ls_gen_inv_for_partner-obj_type = "BSEG".
ls_gen_inv_for_partner-obj_key = "CA0901000001752017001".
ls_gen_inv_for_partner-open_amount = "0.75".
ls_gen_inv_for_partner-max_p2p_amount = "0.75".
ls_gen_inv_for_partner-assigned_p2p_amount = "0.75".
ls_gen_inv_for_partner-p2p_curr = "CAD".
ls_gen_inv_for_partner-due_date = "20170515".
ls_gen_inv_for_partner-overdue_by = "1841".
ls_gen_inv_for_partner-case_type = "CAPP".
APPEND ls_gen_inv_for_partner TO lt_gen_inv_for_partner.
CALL FUNCTION 'FDM_P2P_CREATE'
EXPORTING
is_p2p_partner = ls_p2p_partner
it_p2p_attr = lt_p2p_attr
it_p2p_invoice = lt_gen_inv_for_partner
IMPORTING
et_p2p_created = lt_p2p_crea_for_partner
EXCEPTIONS
get_number_failure = 1
case_interface_failure = 2.
If you want to upload promises from file, please check /HEX/UPLOAD_P2P standard report.

Open Document returns error (SOFFICEINTEGRATION)

I'm trying to open a Excel file with SOFFICEINTEGRATION to modify the file inplace.
But I always get the CALL_NOT_FLUSHED error, I tried several code snippets (with no_flush = X and no_flush = ' ')
The error "CALL_NOT_FLUSHED" is appearing after calling proxy->open_document
My current code:
DATA proxy TYPE REF TO i_oi_document_proxy.
PARAMETERS dummy.
AT SELECTION-SCREEN OUTPUT.
IF proxy IS NOT BOUND.
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING
control = DATA(lo_container_control)
retcode = DATA(l_rc).
CALL METHOD lo_container_control->init_control
EXPORTING
r3_application_name = 'EXCEL' "#EC NOTEXT
inplace_enabled = 'X'
inplace_scroll_documents = 'X'
parent = cl_gui_container=>screen0
IMPORTING
retcode = l_rc.
CALL METHOD lo_container_control->get_document_proxy
EXPORTING
document_type = 'EXCEL.SHEET'
IMPORTING
document_proxy = proxy.
CALL METHOD proxy->open_document
EXPORTING
document_url = 'file://C:\Users\yourusername\Documents\test.xlsx'
open_inplace = 'X'
IMPORTING
error = DATA(openerr).
ENDIF.

Download an Excel document built with class CL_XLSX_DOCUMENT

My program below creates an Excel document built with the class CL_XLSX_DOCUMENT, which contains two sheets.
How can I download the Excel document on my laptop ?
lo_worksheetpart ?= lo_workbookpart->get_worksheetparts( )->get_part( lv_line_no_loop ).
lo_worksheetpart_1 ?= lo_workbookpart->add_worksheetpart( ).
lv_sheetxml = lo_worksheetpart->get_data( ).
lv_sheetxml_2 = lo_worksheetpart_1->get_data( ).
lo_sharedstringspart = lo_workbookpart->get_sharedstringspart( ).
lv_sharedxml = lo_sharedstringspart->get_data( ).
"Parse and replace
if lt_nameval is not initial.
lv_resultxml = update_shared_string_1(
EXPORTING
iv_xml = lv_sharedxml
iv_node = co_shared_string
it_nameval = lt_nameval ).
"write new excel
lo_sharedstringspart->feed_data( lv_resultxml ).
lv_resultxml = update_sheet_data_1(
EXPORTING
iv_xml = lv_sheetxml
iv_node = co_sheet_data
it_days = lt_days
it_nameval = lt_nameval ).
"write new excel
lo_worksheetpart->feed_data( lv_resultxml ).
endif.
I use the following:
DATA:
lv_fsize TYPE i,
lt_data TYPE tsfixml,
lv_resultxml TYPE xstring.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_resultxml
IMPORTING
output_length = lv_fsize
TABLES
binary_tab = lt_data.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = lv_fsize
filetype = 'BIN'
filename = 'C:\Temp\filename.xlsx
CHANGING
data_tab = lt_data

WCF Client access with Message Contracts

I have a web service , i add some extra class which have message contract and after that it changed the way we access some of the methods( and i have not added message contract to these classes these are data contracts ), earlier i.e before we could create one object for request and response (like see the Before part) we are creating a single object for OrderStatusResponse Class. But if you see now the After(we have to create separate objects for request and response).
is this a side effect of enabling "Always generate message contract?"
Before
SmartConnect.Service1Client Client =
new SmartConnectClient.SmartConnect.Service1Client();
SmartConnect.OrderStatusResponse Status =
new SmartConnectClient.SmartConnect.OrderStatusResponse();
Status.UserID = "1234";
Status.Password = "abcd";
Status.SoftwareKey = "abc";
Status.OrderNumber = "1234";
Status = Client.GetOrderStatus(Status);
lbl_OS.Text = Status.Status.ToString();
lbl_RM.Text = Status.ReturnMessage.ToString();
After
SmartConnectRepublic.SmartConnectClient SmartClient =
new WCF_Client.SmartConnectRepublic.SmartConnectClient();
//SmartConnectRepublic.OrderStatusResponse Status =
new WCF_Client.SmartConnectRepublic.OrderStatusResponse();
WCF_Client.SmartConnectRepublic.GetOrderStatusRequest request =
new WCF_Client.SmartConnectRepublic.GetOrderStatusRequest();
request.status = new WCF_Client.SmartConnectRepublic.OrderStatusResponse();
request.status.OrderNumber = "1055055";
request.status.UserID = "1234";
request.status.Password = "dfsdfsd";
request.status.SoftwareKey = "sdfsdfsdfs";
WCF_Client.SmartConnectRepublic.GetOrderStatusResponse response =
new WCF_Client.SmartConnectRepublic.GetOrderStatusResponse();
response = SmartClient.GetOrderStatus(request);
lbl_Status.Text = response.GetOrderStatusResult.Status;
lbl_RC.Text = response.GetOrderStatusResult.ReturnCode.ToString();
lbl_RM.Text = response.GetOrderStatusResult.ReturnCode.ToString();
Yes, I suspect it is a difference with using message contracts. You seem to have figured it out, though.