Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BDC: UNBLOCK Sales order in VKM3.

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Maui,

U can use the FM SD_ORDER_CREDIT_RELEASE to release. The tcode VKM3 calls this FM to release.

13 REPLIES 13

former_member181962
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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?

0 Kudos

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

0 Kudos

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?

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

0 Kudos

ok i'll try this one. no need for bdc right?

0 Kudos

ORDER_HEADER_INX? I don't see that structure on that BAPI. It has ORDER_ITEM_INX, is that what you meant?

Former Member
0 Kudos

Hello Maui,

U can use the FM SD_ORDER_CREDIT_RELEASE to release. The tcode VKM3 calls this FM to release.

0 Kudos

Is release the same with Unblocking the SD doc number?

Former Member
0 Kudos

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.

0 Kudos

thanks it worked. Can I possibly get the message to my lt_return?