2007 Jan 11 3:39 PM
HI
I am trying to call a bdc in my workflow based on the user decission i.e. after user makes a particular decission it has to call BDC. I am using a call transaction statment for calling my BDC, I have defined a FM for the same the code i have written is : call transaction 'zapprove' after this i have made a business object based on this and defined the task. I am calling the task after the user decission in order to run the BDC but it is not updating the required table. I have checked the BDC as well as FM and BO all of them are working fine so i am not able to find the particular error. Please help me on this.
thanks in advance.
2007 Jan 11 4:45 PM
Are you passing some data in function module?
You can call this transaction through a report having a selection screen....whatever you enter in the selection screen is passed through method (workflow-task-method).
Then pass those datas in ur bdc.
In your method direclty write the code ...which will be something like this:
SUBMIT zcrm_cr_dr_audit_zvap6 WITH p_vbeln = wa_zvap6-vbeln
WITH p_status = wa_zvap6-status
WITH p_order = wa_zvap6-serv_issue
WITH p_r_doc = wa_zvap6-ref_doc....etc...
Are you passing some data in function module?
You can call this transaction through a report having a selection screen....whatever you enter in the selection screen is passed through method (workflow-task-method).
Then pass those datas in ur bdc.
In your method direclty write the code ...which will be something like this:
SUBMIT zcrm_cr_dr_audit_zvap6 WITH p_vbeln = wa_zvap6-vbeln
WITH p_status = wa_zvap6-status
WITH p_order = wa_zvap6-serv_issue
WITH p_r_doc = wa_zvap6-ref_doc....etc...
2007 Jan 11 4:27 PM
Hi,
If BO and BDC are working fine than it would be a probelm while passing data from workflow to BO. So, Keep a break point in your BO for the method for which BDC executes, and test the workflow.
Regards,
Ramu N.
2007 Jan 11 4:42 PM
thanks ramu
but i didnt got you completely so can please explain it abit as my BO have only one method i.e to call BDC.
2007 Jan 11 4:52 PM
Hi,
In your business object go the method 'call BDC' and click on Program than you will go to the coding in the business object there keep a break point there.
Then start the workflow the workflow stops at the break point when the task for which you are using the method executes than check whether the BO method is working fine or not. Some times the data would not be passed to the BO in that case check the binding.
Regards,
Ramu N.
2007 Jan 11 4:45 PM
Are you passing some data in function module?
You can call this transaction through a report having a selection screen....whatever you enter in the selection screen is passed through method (workflow-task-method).
Then pass those datas in ur bdc.
In your method direclty write the code ...which will be something like this:
SUBMIT zcrm_cr_dr_audit_zvap6 WITH p_vbeln = wa_zvap6-vbeln
WITH p_status = wa_zvap6-status
WITH p_order = wa_zvap6-serv_issue
WITH p_r_doc = wa_zvap6-ref_doc....etc...
2007 Jan 12 5:25 AM
thanks shweta
but i am using the same code as you said and i am still having the problem so is there any other possible method to make it working .
thanks again.
Saurabh Anand.
2007 Jan 12 6:32 AM
Hi,
Check this code I am using this to upload leave data for T-Code PA30.
I have used FM to meet my reuqirement. My BO method will call the function module which in turn uses BDC to update the corresponding tables.
In the business object method i have called the function module, here OBJECT-KEY-NUMBER is the Keyfield in the BO.
BEGIN_METHOD UPLOAD CHANGING CONTAINER.
CALL FUNCTION 'ZHR_LEAVEFORM_UPLOAD_2001'
EXPORTING
LEAVENUMBER = OBJECT-KEY-NUMBER
EXCEPTIONS
FORM_NOT_FOUND = 01
NOT_UPDATED = 02
OTHERS = 03.
CASE SY-SUBRC.
WHEN 0. " OK
WHEN 01. " to be implemented
WHEN 02. " to be implemented
WHEN OTHERS. " to be implemented
ENDCASE.
END_METHOD.
In the function module i am usinf BDC to update
*"----
""Local Interface:
*" IMPORTING
*" REFERENCE(LEAVENUMBER) TYPE ZHR_LEAVE-LEAVENUMBER
*" EXCEPTIONS
*" FORM_NOT_FOUND
*" NOT_UPDATED
*"----
DATA : V_BEGDA TYPE CHAR10,
V_ENDDA TYPE CHAR10,
V_TEMP TYPE I.
CLEAR OK-CODE.
SELECT SINGLE *
FROM ZHR_LEAVE
WHERE LEAVENUMBER = LEAVENUMBER.
IF SY-SUBRC NE 0.
RAISE FORM_NOT_FOUND.
ENDIF.
WRITE ZHR_LEAVE-BEGDA TO V_BEGDA USING EDIT MASK '__.__.____'.
WRITE ZHR_LEAVE-ENDDA TO V_ENDDA USING EDIT MASK '__.__.____'.
PERFORM BDC_DYNPRO USING 'SAPMP50A' '1000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=INS'.
PERFORM BDC_FIELD USING 'RP50G-PERNR'
ZHR_LEAVE-PERNR.
PERFORM BDC_FIELD USING 'RP50G-TIMR6'
'X'.
PERFORM BDC_FIELD USING 'RP50G-BEGDA'
V_BEGDA.
PERFORM BDC_FIELD USING 'RP50G-ENDDA'
V_ENDDA.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RP50G-SUBTY'.
PERFORM BDC_FIELD USING 'RP50G-SUBTY'
ZHR_LEAVE-LGART.
PERFORM BDC_FIELD USING 'RP50G-CHOIC'
'2001'.
PERFORM BDC_DYNPRO USING 'MP200000' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'P2001-STDAZ'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=UPD'.
IF ZHR_LEAVE-LGART = '0020'.
V_TEMP = V_BEGDA - V_ENDDA.
IF V_TEMP = '0'.
PERFORM BDC_FIELD USING 'P2001-BEGUZ'
ZHR_LEAVE-FROMTIME.
PERFORM BDC_FIELD USING 'P2001-ENDUZ'
ZHR_LEAVE-TOTIME.
ENDIF.
ENDIF.
CALL TRANSACTION 'PA30' USING IT_BDCDATA MODE 'N' UPDATE 'S' MESSAGES
INTO IT_MESSAGES.
IF SY-SUBRC <> 0.
ZHR_LEAVE-STATUS = 'S'.
UPDATE ZHR_LEAVE.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'LEAVE_2001'
KEEP = 'X'
USER = SY-UNAME.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'PA30'
TABLES
DYNPROTAB = IT_BDCDATA.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
ELSE.
ZHR_LEAVE-STATUS = 'C'.
ENDIF.
ENDFUNCTION.
Regards,
Ramu N.
2007 Jan 12 11:25 AM
ramu thanks a lot for your help but my problem is still there i am sending the whole codes that i am using in order to get BDC triggered from workflow just go through it and suggest me where i am going wrong. I also tried ur method but the problem remains to be same so please help me.
FM CODE .
FUNCTION ZBAPI_APPROVE.
*"----
""Local interface:
*" IMPORTING
*" VALUE(ZPERNR1) LIKE ZAPPROVE-ZPERNR OPTIONAL
*" EXPORTING
*" VALUE(RETURN) LIKE BAPIRETURN STRUCTURE BAPIRETURN
*"----
SUBMIT ZPZ03_BDC
EXPORTING LIST TO MEMORY AND RETURN.
ENDFUNCTION.
FM ENDS****************************************************
**********************************BDC******************************************************
report ZPZ03_BDC
no standard page heading line-size 255.
TABLES:ZPMC_B.
DATA: IT_ZPMC_B LIKE ZPMC_B OCCURS 0 WITH HEADER LINE,
WA_ZPMC_B LIKE LINE OF IT_ZPMC_B.
DATA:BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA: ZBANKN(14),
DATE1(10).
*PARAMETERS: P_PERNR LIKE ZPMC_B-ZPERNR.
SELECT SINGLE * FROM ZPMC_B INTO WA_ZPMC_B
WHERE ZSTATUS = 'WAITING'.
*ZBANKN = WA_ZPMC_B-ZBANKN.
perform bdc_dynpro using 'SAPLEHC3' '0100'.
perform bdc_field using 'BDC_CURSOR'
'Q0009_ESS-SUBTYPE'.
perform bdc_field using 'BDC_OKCODE'
'=CHAN'.
perform bdc_field using 'Q0009_ESS-SUBTYPE'
'0'.
perform bdc_dynpro using 'SAPLEHC3' '0200'.
perform bdc_field using 'BDC_CURSOR'
'P0009-BANKN'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = SY-DATUM
IMPORTING
DATE_EXTERNAL = DATE1.
perform bdc_field using 'P0009-BEGDA'
DATE1.
perform bdc_field using 'P0009-BANKS'
WA_ZPMC_B-ZBANKS.
perform bdc_field using 'P0009-BANKL'
WA_ZPMC_B-ZBANKL.
perform bdc_field using 'P0009-BANKN'
WA_ZPMC_B-ZBANKN.
perform bdc_field using 'P0009-ZLSCH'
WA_ZPMC_B-ZZLSCH.
CALL TRANSACTION 'PZ03' USING BDCTAB MODE 'N'
UPDATE 'S'.
WA_ZPMC_B-ZA_DATE = SY-DATUM.
WA_ZPMC_B-ZSTATUS = 'COMPLETED'.
MODIFY ZPMC_B FROM WA_ZPMC_B.
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCTAB.
BDCTAB-PROGRAM = PROGRAM.
BDCTAB-DYNPRO = DYNPRO.
BDCTAB-DYNBEGIN = 'X'.
APPEND BDCTAB.
ENDFORM.
----
Insert field *
----
FORM BDC_FIELD USING FNAM FVAL.
CLEAR BDCTAB.
BDCTAB-FNAM = FNAM.
BDCTAB-FVAL = FVAL.
APPEND BDCTAB.
ENDFORM.
*******************************************BDC ENDS*************************************
************************************************************************************************
*******************************************BO***********************************************
Implementation of object type ZAPPROVE *****
INCLUDE <OBJECT>.
BEGIN_DATA OBJECT. " Do not change.. DATA is generated
only private members may be inserted into structure private
DATA:
" BEGIN OF PRIVATE,
" to declare private attributes remove comments and
" insert private attributes here ...
" END OF PRIVATE,
KEY LIKE SWOTOBJID-OBJKEY.
END_DATA OBJECT. " Do not change.. DATA is generated
BEGIN_METHOD ZBAPIAPPROVE CHANGING CONTAINER.
DATA:
ZPERNR1 TYPE ZAPPROVE-ZPERNR,
RETURN LIKE BAPIRETURN.
SWC_GET_ELEMENT CONTAINER 'Zpernr1' ZPERNR1.
CALL FUNCTION 'ZBAPI_APPROVE'
EXPORTING
ZPERNR1 = ZPERNR1
IMPORTING
RETURN = RETURN
EXCEPTIONS
OTHERS = 01.
CASE SY-SUBRC.
WHEN 0. " OK
WHEN OTHERS. " to be implemented
ENDCASE.
SWC_SET_ELEMENT CONTAINER 'Return' RETURN.
END_METHOD.
************************************BO ENDS**********************************************
************************************************************************************************
when i test my BO it is working perfectly and as far as i know there is no programming part included during task defination so i am not able to follow up where i am going wrong.
Please help me on this.
Thanks in advance.
Saurabh Anand
2007 Jan 12 12:00 PM
Hi,
I think you BO and FM are perfectly right. I think you are going wrong some where in the workflow.
As I said to keep the break point in your BO, keep the break point at
CALL FUNCTION 'ZBAPI_APPROVE'
and test your workflow the workflow stops when it reaches the Task for which this method executes, if it does not stop means that this method is not called in any of your tasks.
Regards,
Ramu N.
2007 Jan 12 12:12 PM
Hi ramu
Thanks...........
I am tryin to set a breakpoint in BO but after placing the breakpoint when i save the BO the breakpoint gets lost so help me with this issue.
Thanks for ur help but i think i need a bit more from you.
Saurabh Anand.
2007 Jan 12 12:14 PM
Saurabh,
You must have declared parameters in your method...and used it as container element also.
Show me the code you have sritten for that...(htat set_elemnt_container and Get_element_container ) part of code.
I hope you know that when you declare the parameters in method it is case sensitive.
I dont't know how to attach a doc over here....if you give me your mail id i can send you some screenshots to explain it.
2007 Jan 12 12:34 PM
HI SHWETA,
My email id is [email protected] so you can mail me the screenshots on this and i will post the codes in half a hour after crosschecking my codes.
thanks .
Saurabh Anand.
2007 Jan 12 12:42 PM
Hi,
Try to keep the break point in your FM and do the testing.
Regards,
Ramu N.
2007 Jan 16 4:54 AM
thanks to all ,
my problem has been resolved fully and i am really thankfull to all of you for your help. The basic problem in calling BDC was that I didn't assigned my Approver the authorization to use the Transaction PZ03 which I was trying to update using BDC,
There has been no problem with the codes as being said by Ramu.N whome i am really thankful for going through my codes and giving his suggestion. The Screenshots sent to me by Shweta has been also been very helpfull to me,
So once again Thanks to you all out there for providing the help.
Saurabh Anand
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |