SAP Business ByDesign provides the web service QueryCodeListIn to query and read ByD code lists.

You’ll find a documentation of the web service on SAP Business ByDesign – SAP Help Portal Page > Web Service APIs.

 

Below, I explain how to use web service QueryCodeListIn in context of other ByD web services.

 

 

Example Scenario

 

Assume we have a master data integration scenario in which we query, read, create and update accounts in ByD. ByD web services for accounts always request and return language-independent codes, for example industrial sector code 23 (meaning “Construction”).

However, for some integration scenarios the code description is required as well, to be able to display account data in a human readable form.

 

 

How to use web service QueryCodeListIn?

 

The request signature of web service QueryCodeListIn mainly contain 3 elements:

  • Code data type name
  • Code data type namespace
  • Language code

 

The code data type specifies the data type for which the code list shall be requested.

The language code specifies in which language the code list descriptions shall be returned.

 

The key question is: How do I get the code data type name and namespace?

 

Step 1:

Get the WSDL of the web service which used the code; in our example scenario QueryCustomerIn or ManageCustomerIn.

You can download the web service WSDL via ByD UI, work center view Application and User Management > Communication Arrangements.

The code data type name and namespace URI are provided by the WSDL of the account/contact web service (the data type of the corresponding element):

 

Step 2:

Get the code data type name from the WSDL:

Capture.JPG

 

Step 3:

Get the code data type namespace URI from the WSDL:

Capture2.JPG

 

Now you have all information available to query the code list for industrial sector codes:

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:glob=”http://sap.com/xi/SAPGlobal20/Global“>

   <soapenv:Header/>

   <soapenv:Body>

      <glob:CodeListByIDQuery_sync>

         <CodeListSelectionByID>

            <SelectionByCodeDataType>

               <Name>IndustrialSectorCode</Name>

               <NamespaceURI>http://sap.com/xi/AP/Common/GDT</NamespaceURI>

            </SelectionByCodeDataType>

            <SelectionByLanguageCode>EN</SelectionByLanguageCode>

         </CodeListSelectionByID>

      </glob:CodeListByIDQuery_sync>

   </soapenv:Body>

</soapenv:Envelope>

 

 

… some more Query Code List Request Examples

 

Country Codes:

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:glob=”http://sap.com/xi/SAPGlobal20/Global“>

   <soapenv:Header/>

   <soapenv:Body>

      <glob:CodeListByIDQuery_sync>

         <CodeListSelectionByID>

            <SelectionByCodeDataType>

               <Name>CountryCode</Name>

               <NamespaceURI>http://sap.com/xi/AP/Common/GDT</NamespaceURI>

            </SelectionByCodeDataType>

            <SelectionByLanguageCode>EN</SelectionByLanguageCode>

         </CodeListSelectionByID>

      </glob:CodeListByIDQuery_sync>

   </soapenv:Body>

</soapenv:Envelope>

 

Region Codes:

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:glob=”http://sap.com/xi/SAPGlobal20/Global“>

   <soapenv:Header/>

   <soapenv:Body>

      <glob:CodeListByIDQuery_sync>

         <CodeListSelectionByID>

            <SelectionByCodeDataType>

               <Name>RegionCode</Name>

               <NamespaceURI>http://sap.com/xi/AP/Common/GDT</NamespaceURI>

            </SelectionByCodeDataType>

            <SelectionByLanguageCode>EN</SelectionByLanguageCode>

            <SelectionByContext>

               <Parameter>

                  <Name>CountryCode</Name>

                  <Value>DE</Value>

                  <ListAgencyID></ListAgencyID>

               </Parameter>

            </SelectionByContext>

         </CodeListSelectionByID>

      </glob:CodeListByIDQuery_sync>

   </soapenv:Body>

</soapenv:Envelope>

 

Customer ABC Classification Codes:

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:glob=”http://sap.com/xi/SAPGlobal20/Global“>

   <soapenv:Header/>

   <soapenv:Body>

      <glob:CodeListByIDQuery_sync>

         <CodeListSelectionByID>

            <SelectionByCodeDataType>

               <Name>CustomerABCClassificationCode</Name>

               <NamespaceURI>http://sap.com/xi/AP/Common/GDT</NamespaceURI>

            </SelectionByCodeDataType>

            <SelectionByLanguageCode>EN</SelectionByLanguageCode>

         </CodeListSelectionByID>

      </glob:CodeListByIDQuery_sync>

   </soapenv:Body>

</soapenv:Envelope>

 

Company Legal Form Codes:

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:glob=”http://sap.com/xi/SAPGlobal20/Global“>

   <soapenv:Header/>

   <soapenv:Body>

      <glob:CodeListByIDQuery_sync>

         <CodeListSelectionByID>

            <SelectionByCodeDataType>

               <Name>CompanyLegalFormCode</Name>

               <NamespaceURI>http://sap.com/xi/AP/Common/GDT</NamespaceURI>

            </SelectionByCodeDataType>

            <SelectionByLanguageCode>EN</SelectionByLanguageCode>

         </CodeListSelectionByID>

      </glob:CodeListByIDQuery_sync>

   </soapenv:Body>

</soapenv:Envelope>

 

Tax Rate Type Codes:

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:glob=”http://sap.com/xi/SAPGlobal20/Global“>

   <soapenv:Header/>

   <soapenv:Body>

      <glob:CodeListByIDQuery_sync>

         <CodeListSelectionByID>

            <SelectionByCodeDataType>

               <Name>TaxRateTypeCode</Name>

               <NamespaceURI>http://sap.com/xi/AP/Common/GDT</NamespaceURI>

            </SelectionByCodeDataType>

            <SelectionByLanguageCode>EN</SelectionByLanguageCode>

            <SelectionByContext>

               <Parameter>

                  <Name>CountryCode</Name>

                  <Value>DE</Value>

                  <ListAgencyID></ListAgencyID>

               </Parameter>

               <Parameter>

                  <Name>TaxTypeCode</Name>

                  <Value>2</Value>

                  <ListAgencyID></ListAgencyID>

               </Parameter>

            </SelectionByContext>

            </SelectionByContext>

         </CodeListSelectionByID>

      </glob:CodeListByIDQuery_sync>

   </soapenv:Body>

</soapenv:Envelope>

Chart of Account Codes:

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:glob=”http://sap.com/xi/SAPGlobal20/Global“>

   <soapenv:Header/>

   <soapenv:Body>

      <glob:CodeListByIDQuery_sync>

         <CodeListSelectionByID>

            <SelectionByCodeDataType>

               <Name>ChartOfAccountsCode</Name>

               <NamespaceURI>http://sap.com/xi/AP/FinancialAccounting/Global</NamespaceURI>

            </SelectionByCodeDataType>

            <SelectionByLanguageCode>EN</SelectionByLanguageCode>

         </CodeListSelectionByID>

      </glob:CodeListByIDQuery_sync>

   </soapenv:Body>

</soapenv:Envelope>

 

Chart of Account Item Codes:

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:glob=”http://sap.com/xi/SAPGlobal20/Global“>

   <soapenv:Header/>

   <soapenv:Body>

      <glob:CodeListByIDQuery_sync>

         <CodeListSelectionByID>

            <SelectionByCodeDataType>

               <Name>ChartOfAccountsItemCode</Name>

               <NamespaceURI>http://sap.com/xi/AP/FinancialAccounting/Global</NamespaceURI>

            </SelectionByCodeDataType>

            <SelectionByLanguageCode>EN</SelectionByLanguageCode>

            <SelectionByContext>

               <Parameter>

                  <Name>ChartOfAccountsCode</Name>

                  <Value>CAAT</Value>

                  <ListAgencyID></ListAgencyID>

               </Parameter>

            </SelectionByContext>

         </CodeListSelectionByID>

      </glob:CodeListByIDQuery_sync>

   </soapenv:Body>

</soapenv:Envelope>

 

Accounting Document Type Code (aka Journal Entry Type Code):

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:glob=”http://sap.com/xi/SAPGlobal20/Global“>

<soapenv:Header/>

<soapenv:Body>

<glob:CodeListByIDQuery_sync>

<CodeListSelectionByID>

<SelectionByCodeDataType>

<Name>AccountingDocumentTypeCode</Name>

<NamespaceURI>http://sap.com/xi/AP/FinancialAccounting/Global</NamespaceURI>

</SelectionByCodeDataType>

<SelectionByLanguageCode>EN</SelectionByLanguageCode>

</CodeListSelectionByID>

</glob:CodeListByIDQuery_sync>

</soapenv:Body>

</soapenv:Envelope>

 

Object Type Codes (for example Journal Entry Source Document Type Codes):

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:glob=”http://sap.com/xi/SAPGlobal20/Global“>

<soapenv:Header/>

<soapenv:Body>

<glob:CodeListByIDQuery_sync>

<CodeListSelectionByID>

<SelectionByCodeDataType>

<Name>ObjectTypeCode</Name>

<NamespaceURI>http://sap.com/xi/Common/DataTypes</NamespaceURI>

</SelectionByCodeDataType>

<SelectionByLanguageCode>EN</SelectionByLanguageCode>

</CodeListSelectionByID>

</glob:CodeListByIDQuery_sync>

</soapenv:Body>

</soapenv:Envelope>

 

Industry Classification System Code and Industrial Sector Code:

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:glob=”http://sap.com/xi/SAPGlobal20/Global“>

   <soapenv:Header/>

   <soapenv:Body>

      <glob:CodeListByIDQuery_sync>

         <CodeListSelectionByID>

            <SelectionByCodeDataType>

               <Name>IndustrialSectorCode</Name>

               <NamespaceURI>http://sap.com/xi/AP/Common/GDT</NamespaceURI>

            </SelectionByCodeDataType>

            <SelectionByLanguageCode>EN</SelectionByLanguageCode>

            <SelectionByContext>

               <Parameter>

                  <Name>IndustryClassificationSystemCode</Name>

                  <Value>0005</Value>

                  <ListAgencyID></ListAgencyID>

               </Parameter>

            </SelectionByContext>

         </CodeListSelectionByID>

      </glob:CodeListByIDQuery_sync>

   </soapenv:Body>

</soapenv:Envelope>

Payment Method / Payment Form Code

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:glob=”http://sap.com/xi/SAPGlobal20/Global“>

   <soapenv:Header/>

   <soapenv:Body>

      <glob:CodeListByIDQuery_sync>

         <CodeListSelectionByID>

            <SelectionByCodeDataType>

               <Name>PaymentFormCode</Name>

               <NamespaceURI>http://sap.com/xi/AP/Common/GDT</NamespaceURI>

            </SelectionByCodeDataType>

            <SelectionByLanguageCode>EN</SelectionByLanguageCode>

         </CodeListSelectionByID>

      </glob:CodeListByIDQuery_sync>

   </soapenv:Body>

</soapenv:Envelope>

 

 

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Roberto Wahl

    Hi Knut,

    Thank you for this great explanation.

    Do you use it also for customer specific fields? We actually work with SAP Cloud for Customer (same Codebase and WebServices like ByD). But we face the problem that the QueryCodeListIn only works for standard fields.

    BR
    Roberto

    (0) 
  2. Simon Angel

    Knut, Thanks for this it is really useful. I am trying to extract a few more challenging options which I can’t seem to find.

    Would you open to an email if I gave a you a short list of what we are looking for?

    BR

    Simon

     

     

    (0) 
  3. Navin Kandasamy

    Hi Knut,

    Thanks for your wonderful blog.

    Can we get Custom Codelists using the service QueryCodeListIn.

    I have a requirement to fetch all the custom codelists which will be used by ECC team.

     

    Regards

    Navin

    (0) 

Leave a Reply