on 04-16-2014 5:38 AM
Hi Experts,
As per my requirement, I need to write a custom java userexit for freight condition. I have done all the UserExit development environment setup on my local machine ( as per PricingUserExitManualV105 guide). I have got code written in ECC side (ABAP) for custom pricing routine (mentioned below)
CONSTANTS : lc_s TYPE rsscr_kind VALUE 'S',
lc_eq TYPE char2 VALUE 'EQ',
lc_i TYPE c VALUE 'I'.
*--- Local Declaration
DATA : lt_tvarvc TYPE STANDARD TABLE OF tvarvc.
*--- Field symbols
FIELD-SYMBOLS : <lfs_tvarvc> TYPE tvarvc,
<lfs_auart> TYPE edm_auart_range.
SELECT * FROM tvarvc INTO TABLE lt_tvarvc
WHERE name = 'ZZSD_ZA00_HDR_MAT'
AND type = lc_s.
*BREAK cbade.
sy-subrc = 4.
if komp-kposn ne 0.
check: komp-prsfd ca 'BX'.
check: komp-kznep = space.
endif.
IF lt_tvarvc[] is NOT INITIAL.
UNASSIGN <lfs_tvarvc>.
READ TABLE lt_tvarvc ASSIGNING <lfs_tvarvc> with KEY LOW = KOMP-MATNR.
IF ( <lfs_tvarvc> is ASSIGNED ) AND ( KOMT1-KSCHL = 'ZA00' ).
sy-subrc = 4.
ELSE.
sy-subrc = 0.
ENDIF.
else.
sy-subrc = 0.
ENDIF.
I am using RequirementAdapter class for this userexit. Would it be OK as per requirement ?
.
Question 1 ) Do i need to define/declare "constants" and "feild-symbols" in Java userexit, as mention in above ABAP code ?
Question2 ) How to write SELECT statement code in Java UserExit ?
Question 3) What would be equivalent code/logic in Java userexit for READ TABLE statement ?
Please do help me with your suggestions/expertise.
Thanks in advance
Hi Yatendra Pal Singh,
SAP not recommended to directly read from tables in pricing user exits though there are ways to do it.
Instead of that you can pass the data from ABAP to IPC using pricing BADI "CRM_COND_COM_BADI".
If you more details or examples you can go to the blog
http://scn.sap.com/community/crm/web-channel/blog/2012/09/26/sap-ipc-development-help
Hope this helps you.
Thanks.
Sarath.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sarath,
Please correct me if i am going wrong.
For constant should it be like :
ABAP side : lc_s TYPE rsscr_kind VALUE 'S',
Java code : (type) Ic_s = item.getAttributeValue("Z-attr-name");
Is that right ?
And what would be equivalent logic for below definition:
DATA : lt_tvarvc TYPE STANDARD TABLE OF tvarvc.
Thanks
Hi Yatendra,
Question 1 ) Do i need to define/declare "constants" and "feild-symbols" in Java userexit, as mention in above ABAP code ?
Java has no such thing as 'field-symbols', thanks God for that, so the answer would be a no. And there is no such thing as 'constants' in Java, thou you can reach the same using a final class with a public static final variable of any given type you want.
Question2 ) How to write SELECT statement code in Java UserExit ?
You simply don't, and if you have such in ECC just raise ' ECC user exit is incorrect and should be fixed '... very very popular topic, pretty sure you will have a hard time to prove, but I'm certain you will prove that ECC userExit code in ABAP is a joke (because that code is a joke and I'm fairly positive it was created by an intern or something..)
Question 3) What would be equivalent code/logic in Java userexit for READ TABLE statement ?
as Sarath mentioned above, as soon you implement the BADI in ABAP code and Map the attributes accordingly, you will end up with no collection or Array inside the userExit itself, as stuff has been calculated before in the BADI and only final values have been passed forward to your custom Java code.
Hope it helps, you should read Sarath hyperlink as he compiled a master piece on IPC extensions.
Cheers,
D.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sarath & Daniel, Thanks for the reply.
Just getting confused. If all logic has to written in CRM_COND_COM_BADI implementation than what would be the use of all Java API's provided for IPC ? ( this might be silly question to ask )
Can you please help me to understand this with some example(related to my above routine code) ? That would be really helpful.
One for query, what would be the approach if ECC routine contains some table(fields) which doesn't exists in CRM side ?
Thanks again
User | Count |
---|---|
8 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.