Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI for KE11 Sales & Profit Plan

Former Member
0 Kudos

Hi,

Instead of using BDC, is there any BAPI to upload data to transaction KE11?

Thanks,

Chelsea

6 REPLIES 6

Former Member
0 Kudos

Hi,

I've tried using BAPI_COPAPLANNING_POSTDATA to post data. However, even if it has successfully posted, the line of record does not appear in KE11 for a specific layout.

Please advise me.

Thanks.

Cheers,

Chelsea

0 Kudos

Hi Chelsea,

Try with a call to BAPI_TRANSACTION_COMMIT after BAPI_COPAPLANNING_POSTDATA.

Regards,

Suresh Datti

Former Member
0 Kudos

Hi Suresh,

I've commit work and the database gets updated. The use of BAPI_COPAPLANNING_GETDATA even returns the record that was posted by POSTDATA. However when i execute KE11 with a layout, the line of record which has just been posted with the BAPI did not appear.

Does it mean i have to use BDC to post to KE11 and cant use the BAPI in this case?

Regards,

Chelsea

0 Kudos

>>Does it mean i have to use BDC to post to KE11 and cant use the BAPI in this case?

No.. it shouldn't be that way.. the issue could be somethingelse..

Regards,

Suresh Datti

Former Member
0 Kudos

Hi Suresh,

Assuming I have not posted anything yet so that the start of record id will be '1'. The following is my test code:

--Fill Selection table--


Perform F_SELECTION Using:

'PALEDGER' 'I' 'EQ' '01' '01',

'VRGAR' 'I' 'EQ' 'F' 'F',

'VERSI' 'I' 'EQ' '015' '',

'PERIO' 'I' 'BT' '2006001' '2006012',

'WERKS' 'I' 'EQ' 'SG21' '',

'TOSLS' 'I' 'EQ' 'COM' ''.

--Fill SelectedFields table--


PERFORM F_SELECTEDFIELDS USING:

'PALEDGER',

'VRGAR',

'VERSI',

'PERIO',

'WERKS',

'TOSLS',

'SALEQ_ME',

'SBU',

'SALEQ',

'SNETT'.

--Fill Data--


DATA-RECORD_ID = '1'.

DATA-FIELDNAME = 'TOSLS'.

DATA-VALUE = 'COM'.

APPEND DATA.

DATA-FIELDNAME = 'PALEDGER'.

DATA-VALUE = '01'.

APPEND DATA.

DATA-FIELDNAME = 'VRGAR'.

DATA-VALUE = 'F'.

APPEND DATA.

DATA-FIELDNAME = 'WERKS'.

DATA-VALUE = 'SG21'.

APPEND DATA.

DATA-FIELDNAME = 'PERIO'.

DATA-VALUE = '2006006'.

APPEND DATA.

DATA-FIELDNAME = 'VERSI'.

DATA-VALUE = '015'.

APPEND DATA.

DATA-FIELDNAME = 'SBU'.

DATA-VALUE = 'ADC'.

APPEND DATA.

DATA-FIELDNAME = 'SALEQ'.

DATA-VALUE = '1000'.

APPEND DATA.

DATA-FIELDNAME = 'SALEQ_ME'.

DATA-VALUE = 'KG'.

APPEND DATA.

DATA-FIELDNAME = 'SNETT'.

DATA-VALUE = '1000'.

DATA-CURRENCY = 'USD'.

APPEND DATA.

DATA-FIELDNAME = 'SPERF'.

DATA-VALUE = '1000'.

DATA-CURRENCY = 'USD'.

APPEND DATA.

CLEAR DATA.

--Post Data using BAPI--


CALL FUNCTION 'BAPI_COPAPLANNING_POSTDATA'

EXPORTING

OPERATINGCONCERN = P_ERKRS

TYPEOFPROFITANALYSIS = TYPEOFPROFITANALYSIS

TESTRUN = ''

TABLES

SELECTEDFIELDS = SELECTEDFIELDS

SELECTION = SELECTION

DATA = DATA

RETURN = RETURN.

COMMIT WORK AND WAIT.

---end of code--


Return table is initial and database gets updated.

The layout set has only SBU, Sales Qty, Sales Net and Sales Performance Gross.

Regards,

Chelsea

Former Member
0 Kudos

Hi Suresh,

There's a difference in the database table between updating using the bapi and updating via ke11.

Using KE11, the sales qty, nett sales and sales perf are being updated on SALEQ001, SNETT001 and SPERF001.

Using Bapi, the 3 fields are being updated on SALEQ002, SNETT002 and SPERF002.

However, using the BAPI, there's no way i can specify which field data should go into.

Thanks,

Chelsea