Skip to Content
Product Information
Author's profile photo Shirley Wu

How to Use Public API Service for Condition Records – Part 1

Background

Using public API service, you can create, read, update, and delete condition records for pricing. The service contains entities for condition record, validity of condition record, pricing scale, and condition supplement.

We provide users public API service for sales and purchase. This public API class is: CL_PRCG_CNDNRECORD_API_FACTORY.

1. For Sales

1. Basic Function

Public API for Sales provide 4 method to do CURD of condition records.

· GET_CONDITION_RECORD: This method is used to display condition record as you input the some search criterial. (GET_PRCG_VALIDITIES is a method with same function, we recommend users so not use this one)

· CREATE_CONDITION_RECORD: You can create condition records with validity and its supplement and scales or just create supplement and scales for existed condition records.

· UPDATE_CONDITION_RECORD: Update some changeable fields for condition records.

· DELETE_CONDITION_RECORD: Delete condition records or supplement or scales.

2. Example of CURD mandatory input

1. CREATE_CONDITION_RECORD

Importing Parameters:

Ø CT_CONDITION_RECORD

Ø CT_CONDITION_VALIDITY

Ø CT_CONDITION_SUPPLEMENT

Ø CT_CONDITION_SCALE

Create example: if you want to create a condition record with validity (maybe also supplement and scale), do the following steps.

1. Prepare the basic input data

Condition Type: PPR0

Condition Table: A305

You can check the key fields of table A305, as below

(you can check the mapping excel for global field name with its technical name in bottom of this guide):

Ø VKORG – Sales Organization

Ø VTWEG – Distribution Channel

Ø KUNNR – Customer

Ø MATNR – Material

2. Input mandatory fields into importing parameter

You can create a new condition record with its validity, supplement and scale.

CT_CONDITION_RECORD (required)

CT_CONDITION_VALIDITY (required)

CT_CONDITION_SUPPLEMENT (optional)

CT_CONDITION_SCALE (optional)

You can also create a supplement or scale for existed condition record.

Validity, supplement and scale for one condition record will be connected by its condition record number. You can create multiple condition records in one time.

Following example, please check the mandatory fields for importing parameters:

CT_CONDITION_RECORD

CONDITIONRECORD

$$00000001

CONDITIONSEQUENTIALNUMBER

01

CONDITIONTABLE

305

CONDITIONAPPLICATION

V

CONDITIONTYPE

PPR0

CONDITIONRATEVALUE

666

CONDITIONRATEVALUEUNIT

EUR

CONDITIONQUANTITY

1

CONDITIONQUANTITYUNIT

CAR

CT_CONDITION_VALIDITY

CONDITIONRECORD

$$00000001

CONDITIONVALIDITYENDDATE

Default (or input value)

CONDITIONVALIDITYSTARTDATE

Default (or input value)

SALESORGANIZATION

0001

DISTRIBUTIONCHANNEL

01

CUSTOMER

100020

MATERIAL

TG11

CT_CONDITION_SUPPLEMENT

CONDITIONRECORD

$$00000001 (or an existed number)

CONDITIONTYPE

PPR0

CONDITIONRATEVALUE

821

CONDITIONRATEVALUEUNIT

EUR

CT_CONDITION_SCALE

CONDITIONRECORD

$$00000001 (or an existed number)

CONDITIONSEQUENTIALNUMBER

01

CONDITIONSCALELINE

0002

CONDITIONRATEVALUE

600

CONDITIONRATEVALUEUNIT

EUR

CONDITIONSCALEQUANTITY

100

CONDITIONSCALEQUANTITYUNIT

CAR

3. Execute after input parameters

Create Execute Successful: if you create successfully, you can receive messages, which filled in the following 2 parameters:

Ø ET_MESSAGE

Ø ET_CNDN_RECORD_MAPPING

For example, if you create a condition record with validity, no supplement and scale.

Message format: (PRCG_CNDNRECORD_API (015)) Condition record 0000202628 (temp. No. $$00000001) is created and valid from 20190820 to 99991231.

1.png2.png

2. GET_CONDITION_RECORD

Importing Parameters:

Ø IS_CNDNRECORD_CRITERIA_HEADER

Ø IT_CNDNRECORD_CRITERIA_ITEM

Ø IS_CNDNRECORD_QUERY_OPTION

Get example: if you want to search condition records, do the following steps:

1. Prepare search criteria you want to input.

IS_CNDNRECORD_CRITERIA_HEADER (optional)

CONDITIONVALIDITYSTARTDATE

31.12.1999

CONDITIONVALIDITYENDDATE

31.10.1999

DELTDCONDITIONRECORDISEXCLUDED

X

IT_CNDNRECORD_CRITERIA_ITEM (required, you need to input at least one entry)

CONDITIONTABLE

SIGN

OPTION

LOW

HIGH

E.g. 1

I

EQ

305

CONDITIONRECORD

SIGN

OPTION

LOW

HIGH

E.g. 1

I

EQ

0000202628

CONDITIONTYPE

SIGN

OPTION

LOW

HIGH

E.g. 1

I

EQ

PPR0

CONDITIONFIELDSELECTIONOPTION

PRCGCONDITIONFIELDRANGENAME

PRCGCONDITIONFIELDRANGESIGN

PRCGCONDITIONFIELDRANGEOPTION

PRCGCONDITIONFIELDRANGELOW

PRCGCONDITIONFIELDRANGEHIGH

E.g. 1

MATERIAL

I

EQ

TG11

IS_CNDNRECORD_QUERY_OPTION (optional)

“QUERYOPTIONCOUNTISSET” and “QUERYOPTIONINLINECOUNTISSET” cannot be set at same time.

PRCGQUERYOPTIONTOP

10

PRCGQUERYOPTIONSKIP

1

PRCGQUERYOPTIONORDERBY

SORTFIELD

SORTSEQUENCE

E.g. 1

MATERIAL

DESC

QUERYOPTIONCOUNTISSET

QUERYOPTIONINLINECOUNTISSET

X

2. Fill the parameters

You can input search criterial as example, in this example:

I filled CONDITIONTABLE: I EQ 305

3. Execute successfully

If no error raise, you can check export parameters, find the detail information of condition records.

Continue to learn about public API for Sales:

Part 2: Sales — UPDATE & DELETE

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Sai Giridhar Kasturi
      Sai Giridhar Kasturi

      Thanks for the info

      Author's profile photo Gerard Magorrian
      Gerard Magorrian

      Thank you for adding this useful info to the S/4HC Community.

      Please continue to share valuable content with our members and help to build a stronger Community.

      If you feel that this content should be available with the standard documentation, please use the [Feedback] and [Comments] features within the related portal.

      Author's profile photo Tobiasz Hołtyn
      Tobiasz Hołtyn

      Hello Shirley Wu,

      Thanks for the info.
      Is it possible to use this class when our condition table has custom/z fields?

      Regards,