cancel
Showing results for 
Search instead for 
Did you mean: 

plz help me out bapi message (urgent)

Former Member
0 Kudos

hi

i need help. i m passing values in bapi n taking message from table in bapi to print in out put.

requirment is..

a) Pass the following parameters:

NUMBER = NETWORK

Tables: I_COMPONENTS_CHANGE

COMPONENT = IT_COMP-COMPONENT

BATCH = P_CHARG

Tables: I_COMPONENTS_CHANGE_UPDATE

COMPONENT = IT_COMP-COMPONENT

BATCH = “X”

b) The components that failed update are provided in table, E_MESSAGE_TABLE. If MESSAGE_TYPE = “E”, get EXTERNAL_OBJECT_ID and MESSAGE_TEXT. Remove spaces from EXTERNAL_OBJECT_ID and then match against IT_COMP-COMPONENT to get MATERIAL, PLANT and NETWORK and write MATERIAL, PLANT and NETWORK and MESSAGE_TEXT to the job log.

so for that i m doing coding like (this is part of my program)

LOOP AT i_temp_comp.

CLEAR : i_comp_change,i_comp_upd,i_e_msg.

REFRESH : i_comp_change,i_comp_upd,i_e_msg.

LOOP AT i_comp WHERE network = i_temp_comp-network.

l_number = i_comp-network.

i_comp_change-component = i_comp-component.

i_comp_change-batch = p_charg.

APPEND i_comp_change.

i_comp_upd-component = i_comp-component.

i_comp_upd-batch = c_x.

APPEND i_comp_upd.

ENDLOOP.

CALL FUNCTION 'BAPI_NETWORK_COMP_CHANGE'

EXPORTING

number = l_number

TABLES

i_components_change = i_comp_change

i_components_change_update = i_comp_upd

e_message_table = i_e_msg.

IF NOT i_e_msg[] IS INITIAL.

LOOP AT i_e_msg.

IF i_e_msg-message_type = c_e.

READ TABLE i_comp WITH KEY network = l_number

component = i_e_msg-external_object_id. "#EC *

IF sy-subrc IS INITIAL.

i_output-material = i_comp-material.

i_output-plant = i_comp-plant.

i_output-network = i_comp-network.

i_output-message = i_e_msg-message_text.

APPEND i_output.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

ENDLOOP.

problem is it is not showing message in i_output.

so no data is printing.

plz help me out

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

There are several IFs in your code here.


IF NOT i_e_msg[] IS INITIAL.
  LOOP AT i_e_msg.
    IF i_e_msg-message_type = c_e.
      READ TABLE i_comp WITH KEY network = l_number
          component = i_e_msg-external_object_id. "#EC *
      IF sy-subrc IS INITIAL.
        i_output-material = i_comp-material.
        i_output-plant = i_comp-plant.
        i_output-network = i_comp-network.
        i_output-message = i_e_msg-message_text.
        APPEND i_output.
      ENDIF.
    ENDIF.
  ENDLOOP.
ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.

It can be any IF failure. Check in debugging and see how this "i_e_msg" internal table is filled. May be the return table is giving the component number in external format and you have it in internal format or vice-versa in the READ statement "component = i_e_msg-external_object_id".

suresh_datti
Active Contributor
0 Kudos

Hi,

Did you try to debug it? Put a break point before the statement 'IF NOT i_e_msg[] IS INITIAL.' and verify if this table is getting filled at all in the function call to 'BAPI_NETWORK_COMP_CHANGE'.

Suresh

Former Member
0 Kudos

Hi,

Why dont you use the FM FORMAT_MESSAGE for this and check in the debugging mode whether it is returning any values to the return table or not....