cancel
Showing results for 
Search instead for 
Did you mean: 

code for user exit

Former Member
0 Kudos

Hello,

I need to add a field (MATNR) to the extract structure of data source 0EC_PCA_1. How should the user exit code look for this?

Thanks a lot!!

BR,

Fredrik

Accepted Solutions (1)

Accepted Solutions (1)

edwin_harpino
Active Contributor
0 Kudos

hi Fredrik,

yes, you are right GLPCT

- 0EC_PCA_1 extract from and

- there is material number REP_MATNR

checking sap help for datasource 0EC_PCA_1

http://help.sap.com/saphelp_bw33/helpdata/en/de/46663758459166e10000009b38f8cf/frameset.htm

found there is material number GLPCT-REP_MATNR - Representative material which mapped to infoobject 0REP_MATL and 0REP_MATL is reference to 0mat_plant - material plant.

so, you may no need to write user exit, you can use 0rep_matl.

hope this helps.

Former Member
0 Kudos

Hello,

Unfortunately they do not post actual PCA postings to REP_MATNR (in R/3). Insted they use MATNR. So I don't think I will get the data into the extractor without adding the MATNR field.

If I should add it in the extractor structure and populate it, there is a problem since GLPCT doesn't include the field either...

Do you agree? How should this be handled?

I appreciate your help!

Regards,

Fredrik

Former Member
0 Kudos

I think u will need to write the user-exit after enhancing the extract structure..

Maybe below link can help u with the steps..

cheers,

Vishvesh

Former Member
0 Kudos

Hello,

The problem is that the source table for the data source (GLPCT), doesn't include the field either. GLPCT is an aggregated table populated from tables GLPCA (actuals) and GLPCP (budget) and the MATNR field is not inculded in the transfer structure GLPCA --> GLPCT.

Is it impossible to report both plan and actuals in PCA on material number? How would you solve it? I have tried the multi cube path as well, but I'm not sure this would work..

Best regards,

Fredrik

edwin_harpino
Active Contributor
0 Kudos

hi,

GLPCA has MATNR,

use some of fields from GLPCT (RLDNR RRCTY RVERS RYEAR DRCRK RPMAX RBUKRS RPRCTR ?) to match GLPCA ?

data: l_s_ISPCACST like ISPCACST,

l_tabix like sy-tabix,

lv_matnr like glpca-matnr.

tables : GLPCA.

case i_datasource.

when '0EC_PCA_1'.

loop at c_t_data into l_s_ISPCACST.

select single matnr into lv_matnr

from GLPCA

where RLDNR = l_s_ISPCACST-RLDNR

and RRCTY = l_s_ISPCACST-RRCTY

and ...

if sy-subrc = 0.

l_s_ISPCACST-zzmatnr = lv_matnr.

endif.

modify c_t_data from l_s_ISPCACST index l_tabix.

endloop.

hope this helps.

Former Member
0 Kudos

This seems like a very good idea! Thanks!

I'm a bit concerned though, becasuse I don't want to mess up the other reports which are already created using this extractor. If the figures will be wrong, is all I have to do to delete the code in the user exit and things will be back to normal?

BR,

Fredrik

edwin_harpino
Active Contributor
0 Kudos

hi Fredrik,

do testing in dev first,

and if the figures wrong, no need to delete the code,

you can remark use * or just change the 'when' e.g

when 'zzzz0EC_PCA_1'.

then the code won't be executed and back to normal.

hope this helps.

Former Member
0 Kudos

Ok,

I will try this way!

Thanks!!!

BR,

Fredrik

Former Member
0 Kudos

If u later find that something is wrong with the data,after the user-exit is configured,u can comment out the user exit code(rather than deleting it).

Comment the code at the step where u say..

When datasource is 'ABC' then run include program <include program for that datasource>

Anyway the user-exit will populate data only for the enhanced fields,and will not effect data in std delivered fields.

cheers,

Vishvesh

Former Member
0 Kudos

Ok,

Thank you! I appreciate you help!!! I will try this and let you know the results...

Best regards,

Fredrik

Former Member
0 Kudos

I the extract structure I have the field FISCPER (7 NUMC) which consists of period and year of posting. In GLPCA we have RYEAR (year, 4 NUMC) and POPER (period, 2 NUMC).

How can I write the select for this so that I get the correct match?

BR,

Fredrik

Former Member
0 Kudos

Hello friends,

Do I need to specify the select statement more detailed than below? I assume I also need the FISCPER? How can I do this?

Thankx,

Fredrik

&----


*& Include ZXRSAU01

&----


data: l_s_ISPCACST like ISPCACST,

l_tabix like sy-tabix,

lv_matnr like glpca-matnr.

tables : GLPCA.

case i_datasource.

when '0EC_PCA_1'.

loop at c_t_data into l_s_ISPCACST.

select single matnr into lv_matnr

from GLPCA

where RPRCTR = l_s_ISPCACST-RPRCTR *profit center

and RACCT = l_s_ISPCACST-RACCT *account

and RMVCT = l_s_ISPCACST-RMVCT *transaction type

if sy-subrc = 0.

l_s_ISPCACST-zzmatnr = lv_matnr.

endif.

modify c_t_data from l_s_ISPCACST index l_tabix.

endloop.

Former Member
0 Kudos

I think RYEAR will have values like '2006' and POPER like '01'.

FISCPER must be internally valuating as '2006001',or is it '01.2006'(most probably first one)

Irrespective of format,u can write a statement like..

ext structure field FISCPER = work area field-RYEAR + '0' + work area field-POPER.

or

ext structure field FISCPER = work area field-POPER + '.' + work area field-RYEAR

(here selected record once matched,comes into work area's record).

cheers,

Vishvesh

Former Member
0 Kudos

Which fields would you select on in order to get the correct match of MATNR?

I appreciate the help...!

//Fredrik

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Fredrik,

See the documents below,

1. User Exits in SAP BW (ppt)

https://websmp104.sap-ag.de/~sapidb/011000358700005475091999

2. User Exits Examples (doc)

https://websmp104.sap-ag.de/~sapidb/011000358700005475101999

Hope it Helps

Srini

Former Member
0 Kudos

Hi,

Go through this link

/message/124151#124151 [original link is broken]

Assign some points if it helps.

Regards,

Ravi

edwin_harpino
Active Contributor
0 Kudos

hi Fredrik,

the user exit may look like

data: l_s_pca1 like [extract structure of 0EC_PCA_1],

l_tabix like sy-tabix,

lv_matnr like mara-matnr.

tables : [tablename that matnr will take data].

case i_datasource.

when '0EC_PCA_1'.

loop at c_t_data into l_s_pca1.

select single matnr into lv_matnr

from [table]

where field = l_s_pca1-field.

if sy-subrc = 0.

l_s_pca1-zzmatnr = lv_matnr.

endif.

modify c_t_data from l_s_pca1 index l_tabix.

endloop.

hope this helps.

Former Member
0 Kudos

Hello,

If I look into the function module ECPCA_BIW_GET_DATA which pouplates data source 0EC_PCA_1, it looks to me as if it takes the data from source table GLPCT. Is this correct? In this table, I can't see the MATNR field... However, the same function module also populates ds 0EC_PCA_3 and in this one, the matnr exists, so I guess that the MATNR-field is somehow available in table GLPCT. Or am I wrong? How does this work?

The field name I've added in an append is zzmatnr and here I need to add the MATNR which originally is entered in PCA table GLPCA.

Could you please help me with the code details? I don't know ABAP and I'm not really sure of which source table to use. Is it GLPCT?

data: l_s_ISPCACST like ISPCACST,

l_tabix like sy-tabix,

lv_matnr like glpct-matnr.

tables : GLPCT.

case i_datasource.

when '0EC_PCA_1'.

loop at c_t_data into l_s_ISPCACST.

select single matnr into lv_matnr

from GLPCT

where field = l_s_ISPCACST-zzmatnr.

if sy-subrc = 0.

l_s_ISPCACST-zzmatnr = lv_matnr.

endif.

modify c_t_data from l_s_ISPCACST index l_tabix.

endloop.

Best regards,

Fredrik