‎2010 Oct 19 1:31 PM
Hello!
Regarding a QM requirement, I have created a rather simple BDC recording to change the activity type of an order to new ones (based on particular conditions not relevant here) on transaction IW32.
However, if the order is technically complete, I have to cancel the technical completion, change the activity type, and then complete the order technically again (so it remains just the way it was before modification).
The only order types relevant in the requirement are YM01 and YM02. For YM01, the BDC recording works like a charm. But when executing the proper recording for type YM02, the last OK code (i.e. pressing the OK button on the Complete subscreen) is ignored and the process remains incomplete: the orders are never completed technically again.
Here is the recording:
0 T IW32 BS AA X F
SAPLCOIH 101 X
0 BDC_OKCODE /00
0 CAUFVD-AUFNR 80000005
SAPLCOIH 3000 X
0 BDC_OKCODE =WIAR
SAPLCOIH 3000 X
0 BDC_OKCODE /00
0 CAUFVD-ILART 206
SAPLCOIH 3000 X
0 BDC_OKCODE =ARCH
SAPLIWO1 200 X
0 BDC_OKCODE =WTER
0 RIWO1-CLNOT XAny help would greatly appreciated!
Best regards,
André Santos
‎2010 Oct 19 3:50 PM
Hi,
May be you are receiving a warning message window after "complete the order" ?
In my system this screen appear and I need to add:
SAPMSSY0 0120 X
BDC_OKCODE =&ONTIn step by step (or visible) your BDC works?
Best regards,
Leandro Mengue
‎2010 Oct 19 3:50 PM
Hi,
May be you are receiving a warning message window after "complete the order" ?
In my system this screen appear and I need to add:
SAPMSSY0 0120 X
BDC_OKCODE =&ONTIn step by step (or visible) your BDC works?
Best regards,
Leandro Mengue
‎2010 Oct 20 1:16 PM
Leandro, thanks for the answer!
The BDC recording does not work when executed visibly or step by step. After some extensive debugging, I realized that the final screen (the technical complete confirmation screen) is not an actual subscreen, even though it has its own number. That screen is actually generated by an FM, so apparently that's why it's ignored when the BDC is executed.
I found a BAPI to replace that missing step: BAPI_ALM_ORDER_MAINTAIN. However, I'm having a hard time figuring out how to reference the orders I need it to complete. The FM asks for an IT_METHODS table and I couldn't tie the method to the orders:
it_methods-refnumber = ???
it_methods-objecttype = 'HEADER'. "That's what I found on the example, not sure whether this is right or not.
it_methods-method = 'TECHNICALCOMPLETE'.
it_methods-objectkey = ??? "Maybe the order number itself?
APPEND it_methods.Has anyone used this BAPI before?
Edited by: André Felipe Oliveira dos Santos on Oct 20, 2010 2:18 PM
‎2010 Oct 20 2:57 PM
Apparently I got this to work.
REFNUMBER is a counter of record blocks to be processed (e.g. 1 for the first order, 2 for the second, etc.).
HEADER is the structure/table to change order details and perform order related actions, such as the method TECHNICALCOMPLETE. It has to be passed on as the value for OBJECTTYPE.
Whenever you add HEADER to the IT_METHODS table, you have to fill in at least the order number and order plant in the IT_HEADER table, and mark both with an X on in the IT_HEADER_UP table (being these tables of FM BAPI_ALM_ORDER_MAINTAIN ).
Thanks!
‎2010 Oct 20 3:14 PM
Hi there,
lw_header-orderid = <gfs_qmel>-aufnr.
append lw_header to lt_header.
lw_header_up-orderid = <gfs_qmel>-aufnr.
append lw_header_up to lt_header_up.
lw_methods-objectkey = <gfs_qmel>-aufnr.
lw_methods-refnumber = 1.
lw_methods-objecttype = 'HEADER'.
lw_methods-method = 'TECHNICALCOMPLETE'.
append lw_methods to lt_methods.
lw_methods-objectkey = <gfs_qmel>-aufnr.
lw_methods-refnumber = 1.
lw_methods-objecttype = ''.
lw_methods-method = 'SAVE'.
append lw_methods to lt_methods.
call function 'BAPI_ALM_ORDER_MAINTAIN'
tables
it_methods = lt_methods
it_header = lt_header
it_header_up = lt_header_up
return = lt_return.
Edited by: gzervas on Oct 20, 2010 4:15 PM
Edited by: gzervas on Oct 20, 2010 4:17 PM