Skip to Content
0
Former Member
Jan 16, 2016 at 04:41 AM

Status_read FM not working properly in outbound idoc

110 Views

Hi all,

I am updating custom segment with status of quotation in outbound idoc FM (IDOC_OUTPUT_ORDRSP ) in exit EXIT_SAPLVEDC_003

1. Status_read Function module working fine for all status in runtime except approval status for pending status it is working fine. ( I checked the code with hardcoded text for approval Status and it works , So Jest table not updating approval status at run time process ).

2. Status_read FM not returning approval status at runtime from va22 , but if we run the idoc manually then it works fine .

* Get BELNR ( Which will have the Sales order number in this interface )
lv_vbeln = ls_e1edk01-belnr.

* Converting to internal format
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_vbeln
IMPORTING
output = lv_vbeln.


IF lv_vbeln IS NOT INITIAL.
* Get Sales Order Header details

SELECT SINGLE vbeln
erdat
erzet
ernam
angdt
auart
objnr
ktext
vkorg FROM vbak INTO ls_vbak
WHERE vbeln EQ lv_vbeln.
IF sy-subrc EQ 0.

* Get the Status Profile and User Stauts
CALL FUNCTION 'STATUS_READ'
EXPORTING
objnr = ls_vbak-objnr
only_active = lc_x
IMPORTING
obtyp = lv_obtyp
stsma = lv_stsma
stonr = lv_stonr
TABLES
status = lt_status
EXCEPTIONS
object_not_found = 1
OTHERS = 2.
IF sy-subrc EQ 0.
* Delete records other than the User status
DELETE lt_status WHERE stat NA lc_e.

* Read the active user status
READ TABLE lt_status INTO ls_status WITH KEY inact = space.
IF sy-subrc EQ 0.
IF lv_stsma IS NOT INITIAL AND ls_status-stat IS NOT INITIAL.
SELECT SINGLE txt30 FROM tj30t INTO ( lv_text )
WHERE stsma EQ lv_stsma
AND estat EQ ls_status-stat
AND spras EQ sy-langu. "#EC WARN_OK
ENDIF.
ENDIF.
* Object status text
ENDIF.
ENDIF.


Please help me in this