2007 Jan 23 12:30 PM
I'm using the BAPI " BAPI_DOCUMENT_CHECKOUTVIEW2 " to get the details of the CV04N document.
My code is as follows :-
CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW2'
DESTINATION 'NONE'
EXPORTING
documenttype = wa_final-doc_type
documentnumber = wa_final-doc_nr
documentpart = wa_final-doc_part
documentversion = wa_final-doc_version
documentfile = gs_bapi_doc_files2
IMPORTING
return = gs_bapiret2
TABLES
documentstructure = gt_bapi_doc_structure
documentfiles = gt_bapi_doc_files2
components = gt_bapi_doc_comp.
I'm getting the Table entries for the selection data for the first time.
But when I give the same selection for the 2nd time the BAPI is not even getting called.
Can anyone tell me what's the reason ?
I even tried calling it in a subroutine ..............
PERFORM get_file_path_2 IN PROGRAM (gv_program)
USING wa_final
CHANGING gt_bapi_doc_structure
gt_bapi_doc_files2
gt_bapi_doc_comp
gs_bapiret2
IF FOUND.
But it's still the same case again.
I'm not able to debug for the 2nd time. It's not even going in t othe Call Function Statement.
Can anyone tell me what could be the reason ?
Regards,
Deepu.K
I even passed the destination thru a variable. Then also it works for 1 time only but the next time it fails.
Message was edited by:
deepu k
2007 Jan 23 1:06 PM
Hi,
you have to use Bapi_transaction_commit function module for commit. Don't use commit statement.
DO 2 TIMES.
CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW2'
DESTINATION 'NONE'
EXPORTING
documenttype = wa_final-doc_type
documentnumber = wa_final-doc_nr
documentpart = wa_final-doc_part
documentversion = wa_final-doc_version
documentfile = gs_bapi_doc_files2
IMPORTING
return = gs_bapiret2
TABLES
documentstructure = gt_bapi_doc_structure
documentfiles = gt_bapi_doc_files2
components = gt_bapi_doc_comp.
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDDO.
If this doesn't work then please send the code to [email protected]
i will see to it and will tell you.
Regards,
Aman
I'm using the BAPI " BAPI_DOCUMENT_CHECKOUTVIEW2 " to get the details of the CV04N document.
My code is as follows :-
CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW2'
DESTINATION 'NONE'
EXPORTING
documenttype = wa_final-doc_type
documentnumber = wa_final-doc_nr
documentpart = wa_final-doc_part
documentversion = wa_final-doc_version
documentfile = gs_bapi_doc_files2
IMPORTING
return = gs_bapiret2
TABLES
documentstructure = gt_bapi_doc_structure
documentfiles = gt_bapi_doc_files2
components = gt_bapi_doc_comp.
I'm getting the Table entries for the selection data for the first time.
But when I give the same selection for the 2nd time the BAPI is not even getting called.
Can anyone tell me what's the reason ?
I even tried calling it in a subroutine ..............
PERFORM get_file_path_2 IN PROGRAM (gv_program)
USING wa_final
CHANGING gt_bapi_doc_structure
gt_bapi_doc_files2
gt_bapi_doc_comp
gs_bapiret2
IF FOUND.
But it's still the same case again.
I'm not able to debug for the 2nd time. It's not even going in t othe Call Function Statement.
Can anyone tell me what could be the reason ?
Regards,
Deepu.K
I even passed the destination thru a variable. Then also it works for 1 time only but the next time it fails.
Message was edited by:
deepu k
2007 Jan 23 12:46 PM
Hi Deepu,
include a commit statement if the call is successful after the bapi.
Probably, you are locking the document and hence its failing for the second time.
Regards,
Ravi
2007 Jan 23 12:49 PM
Hello Ravi,
I used a commit work statement.
But even then it's failing for the 2nd time.
Regards,
Deepu.K
2007 Jan 23 12:48 PM
Hi,
put do 2 times.
call bapi.
enddo.
then check is it coming for two times or not.
and also check the values of tables and structure you are passing 2nd time.
Regards,
Aman
2007 Jan 23 12:53 PM
Hello Aman,
I implemented what u told.
The first 2 times it is going and working fine.
But for the 2nd 2 times it's not going into the CALL FUNCTION STATEMENT.
Regards,
Deepu.K
2007 Jan 23 1:06 PM
Hi,
you have to use Bapi_transaction_commit function module for commit. Don't use commit statement.
DO 2 TIMES.
CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW2'
DESTINATION 'NONE'
EXPORTING
documenttype = wa_final-doc_type
documentnumber = wa_final-doc_nr
documentpart = wa_final-doc_part
documentversion = wa_final-doc_version
documentfile = gs_bapi_doc_files2
IMPORTING
return = gs_bapiret2
TABLES
documentstructure = gt_bapi_doc_structure
documentfiles = gt_bapi_doc_files2
components = gt_bapi_doc_comp.
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDDO.
If this doesn't work then please send the code to [email protected]
i will see to it and will tell you.
Regards,
Aman
2007 Jan 23 1:17 PM
Hello Aman ,
Thanks for ur reply. But this problem is stll not leaving me.
THis is my code :-
*********************************************************************************
* Display_Doc FUNCTIONALITY
*********************************************************************************
WHEN 'DISPLAY_DOC'.
DATA: wa_bapi_doc_files2 TYPE LINE OF lt_bapi_doc_files2,
wa_file_path TYPE LINE OF lt_file_path.
CLEAR : gv_data,gv_tv_data.
FREE : gv_data,gv_tv_data.
gv_data ?= cl_htmlb_manager=>get_data( request = runtime->server->request
name = 'tableview'
id = gv_tv_id ).
gv_tv_data = gv_data->data.
IF gv_tv_data->selectedrowindex IS NOT INITIAL.
CLEAR wa_final.
READ TABLE gt_final INTO wa_final INDEX gv_tv_data->selectedrowindex .
IF sy-subrc = 0.
* Call the BAPI FM to get the Filename of the Document
REFRESH : gt_bapi_doc_structure,gt_bapi_doc_files2,gt_bapi_doc_comp.
CLEAR : gs_bapi_doc_files2.
*** PERFORM get_file_path_2 IN PROGRAM (gv_program)
*** USING wa_final
*** CHANGING gt_bapi_doc_structure
*** gt_bapi_doc_files2
*** gt_bapi_doc_comp
*** gs_bapiret2
*** IF FOUND.
* runtime->keep_context = 0.
ENDIF.
ENDIF.
DO 2 TIMES.
CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW2' DESTINATION gv_rfc_destination
EXPORTING
documenttype = wa_final-doc_type
documentnumber = wa_final-doc_nr
documentpart = wa_final-doc_part
documentversion = wa_final-doc_version
documentfile = gs_bapi_doc_files2
IMPORTING
return = gs_bapiret2
TABLES
documentstructure = gt_bapi_doc_structure
documentfiles = gt_bapi_doc_files2
components = gt_bapi_doc_comp.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDDO.
* runtime->keep_context = 1.
* Populate the table gt_file_path with the File Path's
REFRESH gt_file_path.
IF gt_bapi_doc_files2[] IS NOT INITIAL.
CLEAR wa_bapi_doc_files2.
LOOP AT gt_bapi_doc_files2 INTO wa_bapi_doc_files2.
CLEAR wa_file_path.
IF sy-langu = 'D'.
MOVE: 'Dateipfad' TO wa_file_path-file,
wa_bapi_doc_files2-docfile TO wa_file_path-path.
ELSE.
MOVE: 'File Path' TO wa_file_path-file,
wa_bapi_doc_files2-docfile TO wa_file_path-path.
ENDIF.
APPEND wa_file_path TO gt_file_path.
CLEAR wa_file_path.
ENDLOOP.
ENDIF.
PS: I'm using this FM in BSP so I think u maynot check my code.
Regards,
Deepu.K
2007 Jan 23 1:23 PM
Hi Deepu,
Just check what does the return table contain immediately after the call and look for any meaningful messages that would tell what has gone wrong.
if it doesn't even go into the call, just remove the destination addition and see(Anyway you are passing none to the destination).
Regards,
Ravi
2007 Jan 23 1:37 PM
Hello Ravi,
When I remove the destinatione 'NONE' statement I get a return value as follows :-
gs_bapiret2-type : 'E'.
MESSAGE : 'BOM not found for this material/plant/usage'
MESSAGE_V1 : 'Program not started via RFC. No return possible.'
This is the return when I execute my application for the 1rst time.
But when I give the tag destination 'NONE' the same BAPI is giving me the output with no return messages.
So what should I do now ?
Regards,
Deepu.K
null
.
2009 Aug 06 8:50 AM
When I used the LE_DSP_REMOTE function for splitting the deliveries I faced with the same problem. In my program I was calling
the program many times but it was failing except the first call. If you use the function in this way it can be called many times:
data: taskname type string.
CALL FUNCTION 'LE_DSP_REMOTE'
STARTING NEW TASK taskname
EXPORTING
IF_SIMULATE = IF_SIMULATE1
IF_CONFIRM_DECENTRAL = IF_CONFIRM_DECENTRAL1
IF_PMODE = IF_PMODE1
TABLES
IT_RES = IT_RES2
ET_DETAIL = ET_DETAIL1
ET_SUMM = ET_SUMM1
ET_SUMM_23 = ET_SUMM_231
EXCEPTIONS
ERROR_IN_SUBFUNCTIONS = 1
OTHERS = 2
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |