Application Development and Automation 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: 
Read only

RFC enabled function module is not runing the BDC code in it.

Former Member
0 Likes
1,715

Dear Experts,

1. We have created a RFC enabled function module to change status of a activity and to save it we are using BDC code and we have also put the code in the RFC FM only.

The RFC fm is runing fine and changing the data and also saving it by runing the BDC when run in the R/3 system only.

But when i run the FM from portal its just chaning the status but not runing the BDC code in it.

below i am puting the code of the FM.

************************************************************************

FUNCTION ZRFC_CRM_STATUS_CHANGE_EXTERN .

*"----

-


""Local Interface:

*" IMPORTING

*" VALUE(CHECK_ONLY) TYPE XFELD DEFAULT ' '

*" VALUE(CLIENT) LIKE SY-MANDT DEFAULT SY-MANDT

*" VALUE(OBJNR) TYPE CRM_JSTO-OBJNR OPTIONAL

*" VALUE(USER_STATUS) LIKE CRM_JEST-STAT

*" VALUE(SET_INACT) TYPE XFELD DEFAULT ' '

*" VALUE(SET_CHGKZ) LIKE CRM_JSTO-CHGKZ OPTIONAL

*" VALUE(XNOAUTO) LIKE CRM_JSTO_UPD-XNOAUTO OPTIONAL

*" VALUE(NO_CHECK) TYPE XFELD DEFAULT ' '

*" VALUE(ZOBJNR) TYPE CHAR80

*" VALUE(OBJECT_ID) TYPE CRMT_OBJECT_ID

*" EXPORTING

*" VALUE(STONR) LIKE TJ30-STONR

*" EXCEPTIONS

*" OBJECT_NOT_FOUND

*" STATUS_INCONSISTENT

*" STATUS_NOT_ALLOWED

*"----

-


*{ INSERT D60K900707 1

DATA: BEGIN OF JSTAT_TMP.

INCLUDE STRUCTURE JSTAT.

DATA: END OF JSTAT_TMP.

data: bdcdata like bdcdata occurs 0 with header line.

data: dire type CRMD_ACTIVITY_H-direction.

CLEAR: DIRE.

OBJNR = ZOBJNR.

MANDT = CLIENT.

JSTAT_TMP-STAT = USER_STATUS.

JSTAT_TMP-INACT = SET_INACT.

IF USER_STATUS+0(1) NE EXTERN.

RAISE STATUS_NOT_ALLOWED.

ENDIF.

  • Statusobjekt ggf. einlesen

PERFORM STATUS_READ USING OBJNR IOBTYP ISTSMA NOT_FOUND.

CHECK NOT_FOUND = OFF.

  • ggf. Änderungsbelege aktivieren

IF SET_CHGKZ = 'X' AND JSTO_BUF-CHGKZ = SPACE AND CHECK_ONLY = SPACE.

PERFORM SET_CHGKZ USING OBJNR.

ENDIF.

  • set XNOAUTO-flag if desired

IF XNOAUTO = 'X' AND CHECK_ONLY = SPACE.

PERFORM SET_XNOAUTO USING OBJNR.

ENDIF.

crm_jostd-OBJNR = OBJNR.

  • Status-Puffer füllen

REFRESH JEST_BUF_A.

REFRESH JEST_BUF_E.

CLEAR JEST_BUF_A.

CLEAR JEST_BUF_E.

CLEAR JEST_K.

MOVE MANDT TO JEST_K-MANDT.

MOVE crm_jostd-OBJNR TO JEST_K-OBJNR.

READ TABLE JEST_BUF WITH KEY JEST_K BINARY SEARCH.

IF SY-SUBRC IS INITIAL.

TABIX = SY-TABIX.

MOVE-CORRESPONDING JEST_BUF TO JEST_BUF_E.

APPEND JEST_BUF_E.

MOVE-CORRESPONDING JEST_BUF TO JEST_BUF_A.

MOVE MANDT TO JEST_BUF_A-MANDT.

APPEND JEST_BUF_A.

DO.

ADD 1 TO TABIX.

READ TABLE JEST_BUF INDEX TABIX.

IF SY-SUBRC IS INITIAL AND JEST_BUF-OBJNR = crm_jostd-OBJNR.

MOVE-CORRESPONDING JEST_BUF TO JEST_BUF_E.

APPEND JEST_BUF_E.

MOVE-CORRESPONDING JEST_BUF TO JEST_BUF_A.

MOVE MANDT TO JEST_BUF_A-MANDT.

APPEND JEST_BUF_A.

ELSE.

EXIT.

ENDIF.

ENDDO.

ENDIF.

g_no_check = no_check.

OBJNR = ZOBJNR.

PERFORM STATUS_CHANGE_EXTERN USING CHECK_ONLY

OBJNR

JSTAT_TMP

EXTERN.

clear g_no_check.

  • Zurückschreiben in Puffer

PERFORM CHG_JEST_BUF_E.

  • ggf. Statusordnungsnummer ermitteln

IF STONR IS REQUESTED.

CALL FUNCTION 'CRM_STATUS_READ'

EXPORTING

OBJNR = OBJNR

ONLY_ACTIVE = 'X'

IMPORTING

STONR = STONR.

ENDIF.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'

    • IMPORTING

    • RETURN =

.

*COMMIT WORK.

wait up to 10 seconds.

CLEAR bdcdata.

bdcdata-program = 'SAPLCRM_1O_MANAG_UI'.

bdcdata-dynpro = '0100'.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

CLEAR bdcdata.

bdcdata-fnam = 'BDC_OKCODE'.

bdcdata-fval = '=READ'.

APPEND bdcdata.

CLEAR bdcdata.

bdcdata-program = 'SAPLCRM_1O_MANAG_UI'.

bdcdata-dynpro = '0510'.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

CLEAR bdcdata.

bdcdata-fnam = 'BDC_CURSOR'.

bdcdata-fval = 'GV_OBJECT_ID'.

APPEND bdcdata.

CLEAR bdcdata.

bdcdata-fnam = 'GV_OBJECT_ID'.

bdcdata-fval = OBJECT_ID.

APPEND bdcdata.

CLEAR bdcdata.

bdcdata-fnam = 'BDC_OKCODE'.

bdcdata-fval = '=OKAY'.

APPEND bdcdata.

CLEAR bdcdata.

bdcdata-program = 'SAPLCRM_1O_MANAG_UI'.

bdcdata-dynpro = '0100'.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

CLEAR bdcdata.

bdcdata-fnam = 'BDC_OKCODE'.

bdcdata-fval = '=1OMAIN_TT'.

APPEND bdcdata.

CLEAR bdcdata.

bdcdata-program = 'SAPLCRM_1O_MANAG_UI'.

bdcdata-dynpro = '0100'.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

CLEAR bdcdata.

bdcdata-fnam = 'BDC_CURSOR'.

bdcdata-fval = 'CRMT_7010_ACTIVITY_UI-DIRECTION'.

APPEND bdcdata.

select single direction from CRMD_ACTIVITY_H into dire

where guid = objnr.

if sy-subrc = 0.

if dire = '0'.

dire = '1'.

elseif dire = '1'.

dire = ''.

elseif dire is initial.

dire = '1'.

endif.

endif.

CLEAR bdcdata.

bdcdata-fnam = 'CRMT_7010_ACTIVITY_UI-DIRECTION'.

bdcdata-fVAL = DIRE.

APPEND bdcdata.

CLEAR bdcdata.

bdcdata-fnam = 'BDC_OKCODE'.

bdcdata-fval = '=SAVE'.

APPEND bdcdata.

CALL TRANSACTION 'CRMD_BUS2000126' using bdcdata mode 'N'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'

    • IMPORTING

    • RETURN =

.

*COMMIT WORK.

wait up to 5 seconds.

*} INSERT

ENDFUNCTION.

***********************************************************************

Thanks and regards

Neel

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,344

Did you try to use BAPI_ACTIVITYCRM_CHANGEMULTI ?

CRMD_BUS2000126 is enjoy and uses controls, the batch session may fail.

Regards

8 REPLIES 8
Read only

Former Member
0 Likes
1,344

Hi Neel,

Check whether you have enabled the Remote-enabled module option in your Func Module.

This option will be in Attributes tab under the heading Processing type.

Thanks...

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,345

Did you try to use BAPI_ACTIVITYCRM_CHANGEMULTI ?

CRMD_BUS2000126 is enjoy and uses controls, the batch session may fail.

Regards

Read only

0 Likes
1,344

Dear experts,

Already the FM is RFC enabled other i won't be able to call it from portal

and coming to using the BAPI_ACTIVITY CHANGE fm that acting very weird so we are using the CRM EXTERN CHANGE USER STATUS fm which is working fine but the only problem is even when we comit from BAPI_TRANSACTION_COMMIT its not getting the delta queue of BW updated eventhough its chaning the status.

So for the above reasons we are using the BDC code in the FM for pressing the save button then its will update the changes to BW delta queue as well.

its working fine when i run it from the system in tcode SE37 only the BDC code is not runing when i am doing it from portal apart from the fm is chaning the status .

thanks and regards

Neel

Read only

0 Likes
1,344

I agree, we had the same problem on other objects, the function module to change external status don't update the data beyond, only the status table (JEST, etc..) so we called the BAPI for status and a dummy BAPI_XXXX_CHANGE (without changing any field) just to insure update of change date and fill any data extraction queues. (via the Function modules started in update task in standard transaction or BAPI)

Regards

Read only

0 Likes
1,344

Dear Raymond,

Yes exactly my problem is that....so how can we proceed in this what is the dummy function module you used in CRM just to update the extraction queueus.

If i am right.

first i will run the Custom function module to change the Status and then run the dummy fm so that i can update the extraction queues.

can you give me some step to step

thanks and regards

Neel

Read only

0 Likes
1,344

You misunderstood me, i had the problem with another object, so the "dummy" BAPI i used wont be of interest for you. You have to fin such a BAPI for CRM.

Regards

Read only

former_member230535
Participant
0 Likes
1,344

Hi all,

I encounter the same problem. My FM can run successfully by Tcode SE37. But when I run it form my .NET program I encounter the following errors:

Unable to initialise ABAP Control Framework ...

Control Framework: Fatal error - GUI cannot be reached

Runtime error RAISE_EXCEPTION has occurred

How to solve this problem? Please help me !!!

Thanks,

Dai Nguyen Quang,

THP Group.

Read only

0 Likes
1,344

Hi Dai,

> I encounter the same problem.

??  It rather looks like a completely different problem to me than what has been discussed in this thread... Please open a new thread for this, instead of "resurrecting" this very old one...

Regards, Ulrich