‎2007 Apr 23 11:24 PM
Hi All,
I want to extract data for this structure fields, can some one tell me, is their and bapi to extract data of this structure, or is there any bapi or FM or program uses this structure.
answers are highly appreciated
Thanks in advance
jog
‎2007 Apr 24 8:50 PM
Hi RS,
This is great help to me, Thank you.
my report is dealing with cost centers and cost elements too.
its giving me dump, when I put objnr from PRPS or CSKS in the function module, instead
can I use first two characters from objnr from table CSKS in FM CONVERSION_EXIT_OBART_OUTPUT and get the obart and OBJART_TXT ( this is called by above FM), since I need only obart and text.
one more question.
how can I get cost element with cost element group. and also
cost center with cost center group.
I greatly appreciate you help.
Thanks
‎2007 Apr 24 12:37 AM
Hi,
What do you mean by extracting a data form structure. Structure is only one line. It is not a table. KAEP_CM is a strucutre. It does not store any data.
Pleaes explain what exactly you want to do?
Regards,
RS
‎2007 Apr 24 3:04 AM
HI,
In my report , I need to diplay Cost Object Type - OBART
and Cost Object Type Description - OBJART_TXT which are present in this structure,
I tried to look in other tranparant tables but didn't find these fields,
can you let me know is there any bapi or FM through which I can get these fields for dispaly,
Iam using tables - ekko,ekkn,.
can you please let me know if there is any table or way through which I can get these values.
Thanks for you help,
jog
‎2007 Apr 24 3:52 AM
Hi,
What type of custom report are you developing? When you say you want to display OBART, but you should get it from somewhere to display. And what is the object you want to get this field for.
Please clarify what kind of report you are developing? What are the other different tables you are accessing?
By the way, i found one table having field OBART and it is <b>PLAF</b>.
Regards,
RS
‎2007 Apr 24 4:25 PM
Hi,
Thanks for the reply,
the report is about Purchasing commitments by cost objects. - obart I am looking for is 'Cost Object Type' , this is related to cost object.
tables iam accessing are - ekkn, ekko, ekpo, proj,CSKB,eket,prps, anla.
is there any way I can access this field for cost object type.
Thanks in advance.
‎2007 Apr 24 5:04 PM
Hi,
Are you using planned order. Because the field OBART only exist in the tables realted to planned order.
If you are using planned order then you this is how table PLAF associated with PO data.
PLAF-KONNR = "PO number"
PLAF-KTPNR = "PO line item number"
The other thing you can do is to read PLIX ( this si view, but you can select data form it same as you select from table). This is a view of table PSPL and PFLA. Read the data from this view based on WBS number ( internal ), <b>PLIX-PSPEL</b>.
Also, check if table COOI is of any help to you. It stores commitment line items.
Let me know if you have any question.
Regards,
RS
‎2007 Apr 24 6:01 PM
Hi,
if you run report T code - KSB2 or CJI5 in the output , you can see object type, that is what Iam looking for,
is there any way I can get using the above mentioned tables or any other tables or FM's.
Thanks
‎2007 Apr 24 7:15 PM
Hi,
I debugged the code and i found out the FM to use. Check this code. I assume that in your case object is WBS element. That is the reason i am reading OBJNR from PRPS based on wbs element in below code. ( tcode CJI5 )
Let me know if in your custom report you are dealing with Cost center and Cost element too. ( Tcode KSB2 ). I can findout what are the tables to get object no for those.
Just to make easy for you. If in your case, you only deal with WBS element / Cost center, then OBART and OBJART_TXT values are as below. You can get object number of Cost center from table CSKS ( CSKS-OBJNR )
Object OBART OBJART_TXT
WBS PS WBS element
Cost Center KS Cost Center*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
TYPE-POOLS: kaep.
PARAMETERS: p_posid LIKE prps-posid OBLIGATORY.
DATA: ld_objnr LIKE covp-objnr,
ld_objnr_ext LIKE ccr1z-objnr,
ld_text LIKE sy-msgli,
ld_ident LIKE sy-msgv1,
ls_ionra LIKE ionra,
l_objart_txt TYPE kaep_objnr_master-objart_txt.
SELECT SINGLE
objnr FROM prps
INTO ld_objnr
WHERE posid = p_posid.
CALL FUNCTION 'OBJECT_IDENTIFICATION_GET'
EXPORTING
objnr = ld_objnr
no_bukrs = 'X'
no_erkrs = 'X'
no_kokrs = 'X'
langu = sy-langu
datum = sy-datlo
IMPORTING
e_text = ld_text
ident_txt20 = l_objart_txt
ident_objid = ld_ident
e_ionra = ls_ionra
EXCEPTIONS
obart_invalid = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE:/ 'OBART = ', ls_ionra-obart.
write:/ 'OBART_TEXT = ', l_objart_txt.
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*Let me know if you have any question.
Regards,
RS
‎2007 Apr 24 8:50 PM
Hi RS,
This is great help to me, Thank you.
my report is dealing with cost centers and cost elements too.
its giving me dump, when I put objnr from PRPS or CSKS in the function module, instead
can I use first two characters from objnr from table CSKS in FM CONVERSION_EXIT_OBART_OUTPUT and get the obart and OBJART_TXT ( this is called by above FM), since I need only obart and text.
one more question.
how can I get cost element with cost element group. and also
cost center with cost center group.
I greatly appreciate you help.
Thanks
‎2007 Apr 24 8:57 PM
Hi,
Yes you can do that and that is what i mentioned in my prevous post. There is gave you the OBART and OBJART_TXT for wbs element and cost center.
Object OBART OBJART_TXT
------ ------ ------------
WBS PS WBS element
Cost Center KS Cost CenterThe approach you are talking is also correct. Take first two cahracter. Use FM CONVERSION_EXIT_OBART_OUTPUT. It will give you both OBART and OBJART_TXT.
I am just curious what kind of short dump you are getting. I have create a small program with the same code i post before and it is working fine. Let me know if you have madea any chages to code and what short dump you are getting.
Let me know if you need any other information.
Regards,
RS
‎2007 Apr 24 9:28 PM
Hi ,
I have one more question related to this report,
how can I get cost element with cost element group. and also
cost center with cost center group?
please let me know if this is ok or will send more dump message
Here is the Dump message - ABAP runtime errors RAISE_EXCEPTION
OBJECTKEY_INVALID" raised.
000580 if not l_objectkey_invalid is initial and not i_check_key is initial.
> raise objectkey_invalid.
000600 endif.
Thanks
‎2007 Apr 25 12:29 AM
Hi,
The logic to get cost element / cost center based on cost element group and cost center group is bit complex. You will have to debug the code of KSB2 and see how SAP is doing. I kind of have a idea how is works but it is a too much of debugging. I can give you a code to select cost element / cost center group. Rest you will have to debug the code of KSB2 and findout how it derives cost element / cost center based on that.
See this code to understand how to select cost center / cost element group.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
PARAMETERS: kstgr LIKE rkpln-ksgru MEMORY ID ksg,
koagr LIKE rkpln-kagru MEMORY ID kag.
*" This is just en example. You have to use whatever "controlling area"
*" and "Chart fo Account" you are using in your system.
DATA: l_kokrs LIKE tka01-kokrs VALUE 'OMUS', "Controlling area
l_ktopl LIKE tka01-ktopl VALUE 'OMUS'. "Chart of account
AT SELECTION-SCREEN ON VALUE-REQUEST FOR kstgr.
PERFORM f4_groups USING 'KOSTL'
l_kokrs "<-- Pass controlling area here
CHANGING kstgr.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR koagr.
PERFORM f4_groups USING 'KSTAR'
l_ktopl "<-- Pass Chart of account here
CHANGING koagr.
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*
*&---------------------------------------------------------------------*
FORM f4_groups USING value(v_field) LIKE rgsbs-field
value(v_searchfield) TYPE any
CHANGING c_group TYPE c.
DATA: ld_searchfield LIKE rgsbs-searchfld.
ld_searchfield = v_searchfield.
CALL FUNCTION 'K_GROUP_SELECT'
EXPORTING
field_name = v_field
searchfld = ld_searchfield
searchfld_input = space
set = c_group
IMPORTING
set_name = c_group
EXCEPTIONS
no_set_picked = 1
OTHERS = 2.
IF sy-subrc NE 0.
CLEAR c_group.
ENDIF.
ENDFORM. " F4_GROUPS
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*Are you still getting the short dump. Then paste you code here. I will look at it.
Regards,
RS
‎2007 Jun 05 3:44 PM
Hi,
Can this CJI5 extract be dumped into a flat file and then loaded into BW for reproting? Is that a better way to do this report ? Thanks