Application Development and Automation 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: 
Read only

BAPI_ALM_ORDER_MAINTAIN doesn't work for update EXTENSION fields.

Former Member
0 Likes
3,963

Hi All

I'm trying to use 'BAPI_ALM_ORDER_MAINTAIN' for 'IW32'.

I can't update Zfields using EXTENSION_IN parameter.

my code is below.

please check it.

-


IW_METHODS-OBJECTTYPE = SPACE.

IW_METHODS-METHOD = 'SAVE'.

IW_METHODS-OBJECTKEY = SPACE.

APPEND IW_METHODS TO IT_METHODS.

IW_EXTENSION_IN-STRUCTURE = 'BAPI_TE_AUFK'.

IW_EXTENSION_IN-VALUEPART1+0(12) = W_AUFNR.

IW_EXTENSION_IN-VALUEPART1+12(4) = W_ZZFIELD01. "Zfield

APPEND IW_EXTENSION_IN TO IT_EXTENSION_IN.

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

TABLES

IT_METHODS = IT_METHODS

EXTENSION_IN = IT_EXTENSION_IN

RETURN = IT_RETURN.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = COS_X.

-


I execute this program, and I checked IT_RETURN value.

there are only type 'S' message.

there isn't type 'E' message.

If you have gooe ideas, please let me know.

Regards.

Rie.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,135

You will have to catch the Extension fields in BADI and then update it to the Internal table which has these Z Fields.

16 REPLIES 16
Read only

Former Member
0 Likes
3,136

You will have to catch the Extension fields in BADI and then update it to the Internal table which has these Z Fields.

Read only

0 Likes
3,135

Thank you for reply, Pranu Pranu.

I made BADI 'IBAPI_ALM_ORD_MODIFY'.

but I can't update Zfield yet.

BADI method MODIFY_INPUT_DATA has CT_HEADER_INT (method parameter) and CT_HEADER_INT_UP,

I found my Zfield in CT_HEADER_INT.

but I cna't found Zfield in CT_HEADER_INT_UP.

How can I code in BADI?

if you know that, please let me know.

Regards,

Rie.

Read only

0 Likes
3,135

Implement the BADI - SE19.

Click on the method and it will take you to code.

Add your logic there.

Hope this helps.

Read only

0 Likes
3,135

Thank you your reply.

I added my code in SE19.

but I can't found my Zfield parameters.

(I can't transfer to Zfied value. I can catch EXTENSION_IN parameter value)

Do I need to entension any structure?

CI_AUFK has already has my Zfeild.

Regards.

Rie.

Read only

0 Likes
3,135

In which tabel you appended the Z fields?

That table should be available in the BADI.

Might be other BADI. Dont have a system to check now.

You said - CT_HEADER_INT has your Z fields. Just read the extension data and push the values in CT_HEADER_INT.

Edited by: Pranu Pranu on Jan 28, 2011 7:45 AM

Read only

0 Likes
3,135

I add my Zfield in CI_AUFK.

MODIFY_INPUT_DATA parameter CT_HEADER_INT has CI_AUFK fields.

but parameter CT_HEADER_INT_UP doesn't have CI_AUFK fields.

so I can't update CI_AUFK fields.

do you have any good idea?

Regards.

Rie.

Read only

0 Likes
3,135

try appending CT_HEADER_INT.

HArdcode for testing.

Read only

0 Likes
3,135

>try appending CT_HEADER_INT.

I did it.

but It doesn't work. ;-<

Read only

0 Likes
3,135

Hi,

don't forget to set the flag in CT_HEADER_INT_UP for all changed field values in CT_HEADER_INT.

Regards

Klaus

Read only

0 Likes
3,135

Append structure - IBAPI_CAUFVD_UPDATE and set the flag as Klaus said.

Set the flags for Z fields.

Read only

0 Likes
3,135

Thank you for your advice, Pranu Pranu .

I appended the structure ( has flag-fieds) in IBAPI_CAUFVD_UPDATE, so finally I updated my Zfields.

I solved my problem.

I appreciate you help-ing me !

Regards.

Rie.

Read only

0 Likes
3,135

Hi Rie,

could you please show us your finished call to the bapi including all the parameter values as this will greatly help subsequent people with similar problems.

Thanks

Neil

Read only

0 Likes
3,135

Hi Neil.

I had to do three steps.

1: using BAPI 'BAPI_ALM_ORDER_MAINTAIN'

2: append structure in IBAPI_CAUFVD_UPDATE

3: create BADI from 'IBAPI_ALM_ORD_MODIFY'

my sample code is below.

by the way, CI_AUFK has my Zfields, so CAUFV has already had my Zfields.

I hope to help you.

-


*---- 1: using BAPI 'BAPI_ALM_ORDER_MAINTAIN'

IW_METHODS-OBJECTTYPE = SPACE.

IW_METHODS-METHOD = 'SAVE'.

IW_METHODS-OBJECTKEY = SPACE.

APPEND IW_METHODS TO IT_METHODS.

CLEAR: IW_METHODS.

IW_METHODS-REFNUMBER = '000001'.

IW_METHODS-OBJECTTYPE = 'HEADER'.

IW_METHODS-METHOD = 'CHANGE'.

IW_METHODS-OBJECTKEY = W_AUFNR.

APPEND IW_METHODS TO IT_METHODS.

IW_EXTENSION_IN-VALUEPART1+0(12) = W_AUFNR.

IW_EXTENSION_IN-VALUEPART1+12(2) = W_ZFIELD. "Zfield

APPEND IW_EXTENSION_IN TO IT_EXTENSION_IN.

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

TABLES

IT_METHODS = IT_METHODS

EXTENSION_IN = IT_EXTENSION_IN

RETURN = IT_RETURN.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = COS_X.

*----2: append structure in IBAPI_CAUFVD_UPDATE

*---- you need to create an APPEND structure in ALMB_CAUFVD_UP_TAB_INT.

*---- (of course you can create that in SE11)

*---- you need to set flag fields (CHAR1) in APPEND structure

*---- 3: create BADI from 'IBAPI_ALM_ORD_MODIFY'

*---- you need to create BADI from 'IBAPI_ALM_ORD_MODIFY' in SE19

*---- and you need to add some Codes in method of 'MODIFY_INPUT_DATA'

*---- my code is below

DATA: LW_HEADER_INT TYPE ALMB_CAUFVD.

DATA: LW_HEADER_INT_UP TYPE IBAPI_CAUFVD_UPDATE.

READ TABLE CT_HEADER_INT INTO LW_HEADER_INT

WITH KEY AUFNR = EXTENSION_IN-VALUEPART1+0(12).

IF SY-SUBRC = 0.

LW_HEADER_INT-ZFIELD = EXTENSION_IN-VALUEPART1+12(2). "set Zfield value

MODIFY CT_HEADER_INT FROM LW_HEADER_INT index SY-TABIX.

ELSE.

LW_HEADER_INT-AUFNR = EXTENSION_IN-VALUEPART1+0(12).

LW_HEADER_INT-ZFIELD = EXTENSION_IN-VALUEPART1+12(2). "set Zfield value

APPEND LW_HEADER_INT TO CT_HEADER_INT.

ENDIF.

READ TABLE CT_HEADER_INT_UP INTO LW_HEADER_INT_UP

WITH KEY AUFNR = EXTENSION_IN-VALUEPART1+0(12).

IF SY-SUBRC = 0.set Zfield value

LW_HEADER_INT_UP-ZFIELD = 'X'. "set Zfield flag

MODIFY CT_HEADER_INT_UP FROM LW_HEADER_INT_UP index SY-TABIX.

ELSE.

LW_HEADER_INT_UP-ZFIELD = 'X'.

APPEND LW_HEADER_INT_UP TO CT_HEADER_INT_UP. "set Zfield flag

ENDIF.

-


Read only

0 Likes
3,135

Thanks Rie that is very clear.

Read only

0 Likes
3,135

Thanks a lot, it helped a lot...it actully solved the problem..

Read only

Former Member
0 Likes
3,135

Well,try to fill the IT_HEADER and IT_HEADER_UP in BAPI_ALM_ORDER_MAINTAIN. I think the BAPI doesnt know which order will be maintain.