2013 Feb 12 9:46 AM
Hello Sir,
I have created a ZBAPI for insert data into SAP ZTable from VB. I have define Export Paramter as Return and Table Parameter as IMport/Export.
Finaly I have written following Code.
*"*"Local Interface:
*" EXPORTING
*" VALUE(RETURN) TYPE BAPIRET2
*" TABLES
*" ZBAPIXXXX STRUCTURE ZBAPIXXXX
*"----------------------------------------------------------------------
MODIFY zpmxxxx FROM zbapixxxx. " INSERT zpmxxxx FROM zbapixxxx
I have used this data insertion from se37. It is insert data into ZTable but when insert data using SWO1 , it does not insert.
I have registered in SWO1 also. It shows in BAPI t-code.
Please guide me how to this.
Thanks!
Ram Shanker
.
2013 Feb 12 10:30 AM
Replace
MODIFY zpmxxxx FROM zbapixxxx.
with
MODIFY zpmxxxx FROM TABLE zbapixxxx.
Of course a better code would look like
LOOP AT zbapixxxx ASSIGNING <fs>.
" Perform check, check table and the like and fill RETURN if error
ENDLOOP.
IF RETURN-TYPE NE 'E'.
CALL FUNCTION 'ZBAPIXXX_UPDATE' IN UPDATE TASK " In his update FM, exectute MODIFY/INSERT
TABLES
zbapixxxx = zbapixxx.
ENDIF.
Regards,
Raymond
2013 Feb 12 9:53 AM
Don't forget that you need a commit.
If this Bapi is to be called from the outside (RFC) then you will need to use BAPI_TRANSACTION_COMMIT. (or put a commit into your function)
2013 Feb 12 9:58 AM
Hi,
I have already put this command.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
But but it does not work means not insert data into ztable.
Ram
2013 Feb 12 10:30 AM
Replace
MODIFY zpmxxxx FROM zbapixxxx.
with
MODIFY zpmxxxx FROM TABLE zbapixxxx.
Of course a better code would look like
LOOP AT zbapixxxx ASSIGNING <fs>.
" Perform check, check table and the like and fill RETURN if error
ENDLOOP.
IF RETURN-TYPE NE 'E'.
CALL FUNCTION 'ZBAPIXXX_UPDATE' IN UPDATE TASK " In his update FM, exectute MODIFY/INSERT
TABLES
zbapixxxx = zbapixxx.
ENDIF.
Regards,
Raymond
2013 Feb 12 11:11 AM
2013 Feb 12 12:00 PM
2013 Feb 12 10:36 AM
Try with below way for more information please read the modify keyword documentation
"MODIFY TABLE itab FROM line."
Regards
Mahesh
2013 Feb 12 10:39 AM
Hi,
MODIFY zpmxxxx FROM table zbapixxxx.
if sy-subrc eq 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
endif.
thanks
Mani