Запись в журнале SAP API "Проводка записей журнала из внешних систем" (SAP_COM_0002) - PullRequest
0 голосов
/ 27 мая 2018

Кто-нибудь успешно создал запись в журнале в системе S / 4HANA Cloud с помощью приложения POSTMAN или Cloud Platform?Я продолжаю получать 401 несанкционированный в POSTMAN.Я попытался PO GET API URL, и он работает нормально.

https://:/sap/bc/srt/scs/sap/journalentrycreaterequestconfi

{
"JournalEntryBulkCreateRequest": {
    "MessageHeader": { "CreationDateTime": "2018-05-27T12:50:30.45+01:00" },
    "JournalEntryCreateRequest": {
        "MessageHeader": { "CreationDateTime": "2018-05-27T12:50:30.45+01:00" },
        "JournalEntry": {
            "OriginalReferenceDocumentLogicalSystem": "",
            "OriginalReferenceDocumentType": "BKPFF",
            "OriginalReferenceDocument": "",
            "BusinessTransactionType": "RFBU",
            "AccountingDocumentType": "",
            "DocumentHeaderText": "Header Value",
            "CompanyCode": "US01",
            "CreatedByUser": "CB9980000010",
            "DocumentDate": "2018-05-27",
            "PostingDate": "2018-05-27",
            "item": [
                {
                    "GLAccount": "0021517000",
                    "AmountInTransactionCurrency": {
                        "Amount": "1200.00",
                        "currencyCode": "USD"
                    },
                    "DocumentItemText": "Text1"
                },

                {
                    "GLAccount": "0010010000",
                    "AmountInTransactionCurrency": {
                        "Amount": "-1200.00",
                        "currencyCode": "USD"
                    },
                    "DocumentItemText": "Text2"
                }                   

            ]
        }
    }
}

1 Ответ

0 голосов
/ 05 октября 2018

Это запрос на мыло, поэтому вам нужно позвонить, отправив данные XML Envelop.

var request =
            "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope\"" +
            " xmlns:sfin=\"http://sap.com/xi/SAPSCORE/SFIN\"><soapenv:Header/><soapenv:Body><sfin:JournalEntryBulkCreateRequest>" +
            "<MessageHeader><CreationDateTime>" + currentDate.toISOString() + "</CreationDateTime></MessageHeader>" +
            "<JournalEntryCreateRequest><MessageHeader><CreationDateTime>" + currentDate.toISOString() + "</CreationDateTime></MessageHeader>" +
            "<JournalEntry>" +
            "<OriginalReferenceDocumentType>BKPFF</OriginalReferenceDocumentType>" +
            "<OriginalReferenceDocument>" + Item[1] + "</OriginalReferenceDocument>" + // Report number
            "<OriginalReferenceDocumentLogicalSystem>INBOUND</OriginalReferenceDocumentLogicalSystem>" +
            "<BusinessTransactionType>RFBU</BusinessTransactionType>" +
            "<AccountingDocumentType>SA</AccountingDocumentType>" +
            "<DocumentHeaderText>Certify NonReimbursement</DocumentHeaderText>" +
            "<CreatedByUser>CC0000000001</CreatedByUser>" +
            "<CompanyCode>" + Item[8] + "</CompanyCode>" +
            "<DocumentDate>" + this.parseJsonDate(documentDate) + "</DocumentDate>" +
            "<PostingDate>" + this.parseJsonDate(postingdate) + "</PostingDate>" +
            "<Item>" +
            "<CompanyCode>" + Item[8] + "</CompanyCode>" +
            "<GLAccount>" + this.suffixZeros(nonExpAcc + "") + "</GLAccount>" +
            "<AmountInTransactionCurrency currencyCode=\"" + Item[5] + "\">-" + Item[4] + "</AmountInTransactionCurrency>" +
            "<DebitCreditCode>S</DebitCreditCode>" +
            "</Item>" +
            "<Item>" +
            "<CompanyCode>" + Item[8] + "</CompanyCode>" +
            "<GLAccount>" + this.suffixZeros(Item[3] + "") + "</GLAccount>" +
            "<AmountInTransactionCurrency currencyCode=\"" + Item[5] + "\">" + Item[4] + "</AmountInTransactionCurrency>" +
            "<DebitCreditCode>H</DebitCreditCode>" +
            "<AccountAssignment>" +
            "<CostCenter>" + this.suffixZeros(Item[7] + "") + "</CostCenter>" +
            "</AccountAssignment>" +
            "</Item>" +
            "</JournalEntry></JournalEntryCreateRequest></sfin:JournalEntryBulkCreateRequest></soapenv:Body></soapenv:Envelope>";
...