05-12-2006 11:43 AM
How to call the transaction of vkm3 and get the message that was successfully unblocked and transfer the message to the structure table? My code is not working, kindly check. thanks!
IMPORT:
lv_session: general flag for unblock
LV_SO_NO: SD document number
TABLE:
lt_error : bdcmsgcoll
CODE:
IF lv_session = 'X'.
PERFORM open_group.
ENDIF.
First Screen
PERFORM bdc_dynpro2 USING 'RVKRED04'
'1000'.
PERFORM bdc_field2 USING 'VBELN-LOW'
lv_so_no.
PERFORM bdc_field2 USING 'BDC_OKCODE'
'=ONLI'.
Second Screen
PERFORM bdc_dynpro2 USING 'SAPMSSY0'
'0120'.
PERFORM bdc_field2 USING 'BDC_OKCODE'
'X'.
PERFORM bdc_field2 USING 'BDC_OKCODE'
'=FREI'.
PERFORM bdc_field2 USING 'BDC_OKCODE'
'=SAVE'.
Third Screen
PERFORM bdc_dynpro2 USING 'SAPLSPO1'
'0100'.
PERFORM bdc_field2 USING 'BDC_OKCODE'
'=YES'.
Fourth Screen
PERFORM bdc_dynpro2 USING 'RVKRED04'
'1000'.
PERFORM bdc_field2 USING 'BDC_OKCODE'
'/EE'.
CALL TRANSACTION 'VKM3' USING bdcdata
MODE 'N'
MESSAGES INTO it_bdcmsgcoll.
COMMIT WORK AND WAIT.
IF sy-subrc EQ '0'.
LOOP AT it_bdcmsgcoll.
Fill internal table to avoid type conflict in function module
lt_errors-msgid = it_bdcmsgcoll-msgid.
lt_errors-msgnr = it_bdcmsgcoll-msgnr.
lt_errors-msgv1 = it_bdcmsgcoll-msgv1.
lt_errors-msgv2 = it_bdcmsgcoll-msgv2.
lt_errors-msgv3 = it_bdcmsgcoll-msgv3.
lt_errors-msgv4 = it_bdcmsgcoll-msgv4.
ENDLOOP.
ENDIF.
IF lv_session = 'X'.
PERFORM close_group.
ENDIF.
ENDFUNCTION.
05-12-2006 12:32 PM
Hello Maui,
U can use the FM SD_ORDER_CREDIT_RELEASE to release. The tcode VKM3 calls this FM to release.
05-12-2006 11:46 AM
Looks like this is a report transaction.
Use
submit statement for the report RVKRED04 instead of call transaction.
syntax:
submit RVKRED04
with VBELN in r_vbeln
.
.
.
Regards,
Ravi
05-12-2006 11:47 AM
What is the standard message returned by the transaction VKM3? In your BDC if you can check that you are getting this message, then you can assume that order has been successfully blocked.
Regards,
Ravi
Note : Please mark the helpful answers
05-12-2006 11:52 AM
this is function module. In the transaction vkm3, You have to check the SO Doc number and click flag before you save to be able to Unblock the SO document number. It doesn't record the time when I check the box. what would the BDC_OKCODE for it?
05-12-2006 11:59 AM
Hi,
In that case there should be a function / BAPI which should unblock the sales order. Did you search for a BAPI?
Unfortunately, I don't have access to a SAP system now?
Regards,
Ravi
05-12-2006 12:04 PM
Is there an existing bapi for it? I just made my own bapi. and copy the recordings. But it doesn't check the list. hwat sould be the BDC_OKCODE?
05-12-2006 11:56 AM
the message displayed are not the message raised through 'MESSAGE' syntax in VKM3, but they are basically displayed as a list. So these message will not get stored in your internal table it_bdcmsgcoll.
05-12-2006 12:28 PM
You can use BAPI_SALESORDER_CHANGE.
All you need to do is pass order number to 'SALES_DOCUMENT'.
Pass 'U' to field 'UPDATE_FLAG' of structure 'ORDER_HEADER_INX'.
Pass 'X' to field 'BILL_BLOCK' of structure 'ORDER_HEADER_INX'.
Do commit work and wait.
It works i just checked it from SE37.
05-12-2006 12:36 PM
05-12-2006 12:40 PM
ORDER_HEADER_INX? I don't see that structure on that BAPI. It has ORDER_ITEM_INX, is that what you meant?
05-12-2006 12:32 PM
Hello Maui,
U can use the FM SD_ORDER_CREDIT_RELEASE to release. The tcode VKM3 calls this FM to release.
05-12-2006 12:35 PM
05-12-2006 12:44 PM
Hi,
Billing block is not the same as CREDIT RELEASE. I guess it is better if you use the FM SD_ORDER_CREDIT_RELEASE as mentioneed by abhijit. It works perfectly fine for your requirement.
05-12-2006 12:56 PM
thanks it worked. Can I possibly get the message to my lt_return?