Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

User Exit is calling before approve/reject status get upadted into database

Hello,

I have follwoing requiremenet from client:

SAP Transactions VKM1 to VKM4 are used to release or reject sales orders blocked due to credit checks.

SAP Transactions VKM1, VKM3 and VKM4 are used to release or reject sales orders blocked due to credit checks. SAP transaction VKM2 is used to see released documents and reject them if required

SAP will pass the following information to client's System whenever a sales order is released or rejected in SAP:

 Sales Order Number

 Approved or Rejected Status

For this i am using EXIT_SAPFV45K_001.

I am writing following code in the include.

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

  • VARIABLE DECLARATION *

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

DATA : result TYPE string.

DATA : v_pfile TYPE rlgrap-filename.

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

  • TYPE DECLARATION *

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

TYPES : BEGIN OF t_status,

vbeln TYPE vbeln_va, " Sales Document Number

cmgst TYPE cmgst, " Overall status of credit

status(50) TYPE c,

date TYPE sy-datum,

time TYPE sy-uzeit,

END OF t_status.

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

  • INTERNAL TABLE DECLARATION *

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

DATA : it_status TYPE STANDARD TABLE OF t_status,

it_stat TYPE STANDARD TABLE OF t_status.

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

  • WORK AREA DECLARATION *

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

DATA: wa_status TYPE t_status,

wa_stat TYPE t_status.

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

wait up to 300 seconds.

SELECT single cmgst

INTO wa_status-cmgst

FROM vbuk

WHERE vbeln = ivbak-vbeln.

IF wa_status-cmgst = 'B'.

wa_status-status = 'Rejected'.

ELSEIF wa_status-cmgst = 'A'.

wa_status-status = 'No Action'.

ELSEIF wa_status-cmgst = 'C'.

wa_status-status = 'Partially released'.

ELSEIF wa_status-cmgst = 'D'.

wa_status-status = 'Released'.

ELSEIF wa_status-cmgst = ' '.

wa_status-status = 'Status not set'.

ENDIF.

wa_status-date = sy-datum.

wa_status-time = sy-uzeit.

wa_stat-vbeln = ivbak-vbeln.

wa_stat-cmgst = wa_status-cmgst.

wa_stat-status = wa_status-status.

wa_stat-date = wa_status-date.

wa_stat-time = wa_status-time.

APPEND wa_stat TO it_stat.

CLEAR wa_stat.

v_pfile = 'c:\SalesOrder.txt'.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

filename = v_pfile

filetype = 'DAT'

TABLES

data_tab = it_stat

EXCEPTIONS

file_open_error = 1

file_write_error = 2

invalid_filesize = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

no_authority = 10

OTHERS = 11.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

now i am releasinng/rejecting any sales order using transaction vkm1 to vkm4. It is not putting updated data in text file.

I think my user exit is calling before data get updated in database table vbuk.

So what is the solution for this??

Any other alternative rather than using user exit???

Regards,

Anuja Dhondge

Former Member
Not what you were looking for? View more on this topic or Ask a question