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

About BAPI: BAPI_SALESORDER_CHANGE

Former Member
0 Likes
2,128

Dear Experts,

I want to use "BAPI_SALESORDER_CHANGE" to modify characteristics of sales order item ,

but it doesn't work , it still the old value , my program code is like follows,

Kindly help me how to modify it or other suggestions and thanks a lot in advanced.

-



DATA: IBAPIVBAP  TYPE BAPISDITM  OCCURS 0 WITH HEADER LINE,
           IBAPIVBAPX TYPE BAPISDITMX OCCURS 0 WITH HEADER LINE,
           IBAPICUVA  TYPE BAPICUVAL  OCCURS 0 WITH HEADER LINE,
           IBAPICUCFG TYPE BAPICUCFG  OCCURS 0 WITH HEADER LINE,
           IRETURN    TYPE BAPIRET2   OCCURS 0 WITH HEADER LINE.

              IBAPICUVA-INST_ID   = ICUVA-INST_ID.
              IBAPICUVA-CHARC     = ICUVA-CHARC.
              IBAPICUVA-CHARC_TXT = ICUVA-CHARC_TXT.
              IBAPICUVA-VALUE     = ICUVA-VALUE.
              IBAPICUVA-VALUE_TXT = ICUVA-VALUE_TXT.
              IBAPICUVA-AUTHOR    = ICUVA-AUTHOR.
              IBAPICUVA-VALUE_TO  = ICUVA-VALUE_TO.
              IBAPICUVA-VALCODE   = ICUVA-VALCODE.

              READ TABLE ICUCF WITH KEY SD_DOC = PC_ITAB-VBELN
                                                                POSEX  = PC_ITAB-NPOSNR.
              IF SY-SUBRC = 0.
                 MOVE-CORRESPONDING ICUCF TO IBAPICUCFG.
                 APPEND IBAPICUCFG.

                 IBAPICUVA-CONFIG_ID = ICUCF-CONFIG_ID.
                 APPEND IBAPICUVA.

                 IBAPIVBAP-ITM_NUMBER  = PC_ITAB-NPOSNR.
                 IBAPIVBAP-PO_ITM_NO   = PC_ITAB-NPOSNR.      
                 APPEND IBAPIVBAP.
                 IBAPIVBAPX-ITM_NUMBER = PC_ITAB-NPOSNR.
                 IBAPIVBAPX-PO_ITM_NO  = 'X'.                 
                 IBAPIVBAPX-UPDATEFLAG = 'U'.
                 APPEND IBAPIVBAPX.

                 PERFORM BAPI_CHANGE_CHARACTERISTIC USING PC_ITAB-VBELN
                                               CHANGING L_ERRFLAG.

  


FORM BAPI_CHANGE_CHARACTERISTIC  USING    P_VBELN
                                 CHANGING P_ERRFLAG.
     CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
       EXPORTING
         SALESDOCUMENT               = P_VBELN
*        ORDER_HEADER_IN             =
         ORDER_HEADER_INX            = IORDHDX
       TABLES
         RETURN                      = IRETURN
         ORDER_ITEM_IN               = IBAPIVBAP
         ORDER_ITEM_INX              = IBAPIVBAPX
         ORDER_CFGS_REF              = IBAPICUCFG
         ORDER_CFGS_VALUE            = IBAPICUVA
               .

     READ TABLE IRETURN WITH KEY TYPE = 'E'.
     IF SY-SUBRC = 0.
        P_ERRFLAG = 'X'.
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
     ELSE.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            WAIT = 'X'.
        DO 50 TIMES.
        ENDDO.
     ENDIF.

ENDFORM.                    " BAPI_CHANGE_CHARACTERISTIC


  

12 REPLIES 12
Read only

Former Member
0 Likes
1,541

Hi,

Could you debug and check what values are being populated in

both IORDHDX and P_VBELN.

I think the UPDATEFLAG in IORDHDX should be set to

U: Change an existing sales document

Hope this helps.

Regards,

-Sandeep

Read only

0 Likes
1,541

Hi sandeep2719 , sindhu157 ,

Thanks for your reply , and there had does this setting , but still the situation....

are there have other losing?


 IORDHDX-UPDATEFLAG = 'U'. 

Read only

0 Likes
1,541

Hi,

Do you want to change characters name or characters value.

Regards,

Madhu.

Read only

0 Likes
1,541

Hi madhurao123 ,

Yes, I want to modify the characteristic values .

And..In IORDHDX, it show the error message as follows:

type: E

ID : V4

number: 248

message: there occurs error in ITEM_IN 000031

type: A

ID : CU

Number: 13

message: Internal error , 31, 000031, CFG_IS_INCONSISTENT_OR_INCOMPLETE

Yacoa

Edited by: Yacoa Chen on Dec 5, 2011 6:49 AM

Read only

0 Likes
1,541

Hi,

type: A

ID : CU

Number: 13

message: Internal error , 31, 000031, CFG_IS_INCONSISTENT_OR_INCOMPLETE{quote).

it is showing that there is an inconsistency in characteristics check the combination of characteristic values in cus50 with out any incomplete then it will work.

Regards,

Madhu.

Edited by: madhurao123 on Dec 5, 2011 11:42 AM

Read only

0 Likes
1,541

Hi madhurao123,

You are right , the new value of characteristic value which I want to set is different from the setting in CU50,

do I still could set the new value , and never mind the setting of CU50 ?

If yes , kindly help me how to do it and thanks you very much.

Yacoa

Read only

0 Likes
1,541

Hi,

You are right , the new value of characteristic value which I want to set is different from the setting in CU50

This is ok because you want to change the characteristic values

do I still could set the new value , and never mind the setting of CU50

Here you take that material that want to use in sales order.Enter that material and see the characteristic names and it is values.Change the vales and just simulate it.This is a transaction to simulate the values.This will give you an idea what the combination of values to pass.Example :motor values 1 for one characteristics then you have only option to check the body from fanooc value 2.

Regards,

Madhu.

Read only

0 Likes
1,541

Hi madhurao123,

Sorry, I guess you misunderstanding my meaning ,

I wanna modify the characteristic values by my customerize program code which opening is 'Z' ,

not through transaction code VA02 to modify it one by one.....

Yacoa

Read only

0 Likes
1,541

Hi Yacoa,

I understood that. I am asking you check cu50 to get the an idea about the consistency of the characteristics.The same bapi you can use to change the characteristics values.

Regards,

Madhu.

Read only

0 Likes
1,541

Hi madhurao123 ,

OK....I think I know what you mean , and I'm sure the new value what I set is conform the consistency of the characteristics ,

so I don't know why occurs the error message...

Let me tell more details,

for example , there are two order item 10, 20 , and they are THE SAME MATERIAL, but different characteristic values ,

(suppose item 10 - characteristic value is A , item 20 - characteristic value is B) ,

so I use "BAPI_CHANGE_CHARACTERISTIC" want to modify item 20 to characteristic value A ,

so I copy the characteristic value of item 10 to item 20 , like this


IBAPICUVA-VALUE     = ICUVA-VALUE.

The detail code as the code which I raise this question post ,

and I supose if there are any UPDATEFLAG is losing? so the new value is not update?

Yacoa

Read only

Former Member
0 Likes
1,541

Hi Yocoa,

In IORDHDX, set the UPDATEFLAG to 'U'. This is to Update the sales order.

Regards,

Sindhu.

Read only

Former Member
0 Likes
1,541

Hello,

I have the same problem during update the characteristics.

I get the same error message.

Have you found a solution for this?

Thanks

Arnfried