on 11-30-2005 10:44 AM
I wanna to write a program for creating profit center (KE51). Here are part of the codes:
form create_profit_center.
refresh bdctab.
perform fill_screen using:
'SAPLRKPM' '0200' 'X' space space,
space space space 'PRCT_V-PRCTR' 'TEST1',
space space space 'BDC_OKCODE' '/0',
'SAPLRKPM' '0298' 'X' space space,
space space space 'PRCT_V-DATAB' '01.01.2005',
space space space 'PRCT_V-DATBI' '31.12.9999',
space space space 'PRCT_V-KTEXT' 'Test Profit Center 3',
space space space 'PRCT_V-LTEXT' 'Test Profit Center 3',
space space space 'PRCT_V-VERAK' 'ABC',
space space space 'PRCT_V-KHINR' '1001',
space space space 'BDC_OKCODE' 'PRCT_SCREEN_CC'.
.
.
.
call transaction 'KE51' using bdctab mode 'A' update 'S'.
if sy-subrc <> 0.
write 😕 'Error when creating profit center.'.
endif.
endform.
form fill_screen using program
dynpro
dynbegin
fnam
fval.
clear bdctab.
bdctab-program = program.
bdctab-dynpro = dynpro.
bdctab-dynbegin = dynbegin.
bdctab-fnam = fnam.
bdctab-fval = fval.
append bdctab.
endform.
When I execute the program in mode 'A' (view all the input screen), the program got stuck to the first screen. I can't see any fields (at least I expected the field 'PRCT_V-PRCTR is filled with the value 'Test1')being filled but only an error 'Make an entry in all required fields'.
Can anyone please help? Thanks!
Try to use the follwoing code.
CALL FUNCTION 'BAPI_PROFITCENTER_CREATE'
EXPORTING
PROFITCENTERID = IT_PROFITCENTERID
VALIDFROM = L_DATEFROM
VALIDTO = L_DATETO
BASICDATA = IT_BASICDATA
TESTRUN = IT_TESTRUN
IMPORTING
RETURN = IT_RETURN
TABLES
COMPANYCODES = IT_COMPANYCODES.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
IMPORTING
RETURN = IT_RETURN_WA.
U have to fill the values for the various fields & the internal table.
Hope this will work for U.
Pl. award the points.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gundam,
pls pay attention to OSS-notes to KE5+, esp. note 378309
-> and better use bapi :
BAPI_PROFITCENTER_CREATE
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
add the following logic after the refresh bdctab statement.
perform fill_screen using:
'SAPLSPO4' '0300' 'X' space space,
space space space 'SVALD-VALUE'<Controlling Area>,
space space space 'BDC_OKCODE' 'FURT'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your reply.
I have tried to add
Data: V_kokrs like csks-kokrs value 'CA01'.
SET PARAMETER ID 'CIC' FIELD V_KOKRS.
OR
perform fill_screen using:
'SAPLSPO4' '0300' 'X' space space,
space space space 'SVALD-VALUE'<Controlling Area>,
space space space 'BDC_OKCODE' 'FURT'.
but it does not work. The error still exists.
I know that it is required to enter the controlling area before creating profit center. But when you have once saved the controlling area, it will no longer automatically prompt out when using t-code ke51 again. You need to go to the menu 'Extras -> set controlling area' if you wanna to set the controlling area again. So during recording, the starting screen is 'SAPLRKPM' '0200' instead of 'SAPLSPO4' '0300'. I just wonder in normal case you got stuck in a screen, your input value will be colored in red. But in my case, even I have set the value of profit center, the field is still blank.
I will now try to do it via BAPI. But I am still have interest in what's wrong with the BDC. Thanks!
Hi,
While uploading data through KE51 you must pass the controlling area SVALD-VALUE in the initial screen itself bcoz its mandatory field.
So make sure that you have to fill all the mandatory fields.
Regards
KER
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gundam,
Re-record the screen flow and the required fields which need to be filled for creating profit center(KE51).
Your error suggests, either you havent recorded properly giving all required fields or missed something while coding.
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gundam,
First you need to identify to which controlling area the profit center belongs to:
Then SET the parameter for controlling area using
Data: V_kokrs like csks-kokrs value 'CA01'.
SET PARAMETER ID 'CIC' FIELD V_KOKRS.
then execute your code. Hope it will solve ur problem.
Regards,
Sudhakar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.