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_NETWORK_COMP_ADD

Former Member
0 Likes
1,667

on execution of BAPI_NETWORK_COMP_ADD no error is reported. to commit the work BAPI_TRANSACTION_COMMIT is also executed. Even though no errors are reported the components are not getting add to net work. some one may please give the reason and solution for solving the problem.

Regards,

Venkata Reddy

2 REPLIES 2
Read only

Former Member
0 Likes
912

Hi Venkata,

Try this test piece of code:

REPORT zvsaddnetwcomp .

PARAMETERS: sit LIKE bapi_network_list-network, "network number

operace LIKE bapi_network_comp_add-activity, "activity

matnr LIKE mara-matnr, "material number

test(1) type c. "test indicator

DATA: BEGIN OF mattab OCCURS 10.

INCLUDE STRUCTURE bapi_network_comp_add.

DATA: END OF mattab.

DATA: BEGIN OF messtab OCCURS 10.

INCLUDE STRUCTURE bapi_meth_message.

DATA: END OF messtab.

DATA: ret1 LIKE bapiret2.

data: messno type i.

START-OF-SELECTION.

MOVE matnr TO mattab-material. "material number

MOVE 1 TO mattab-entry_quantity. "quantity

MOVE '8' TO mattab-type_of_pur_resv. "procurement type (8 = WBS assignment)

MOVE 'L' TO mattab-item_cat. "item category

MOVE operace TO mattab-activity. "activity number

MOVE '2' TO mattab-manual_requirements_date. "2-allign to end date of activity

APPEND mattab.

CALL FUNCTION 'BAPI_NETWORK_COMP_ADD'

EXPORTING

number = sit

IMPORTING

return = ret1

TABLES

i_components_add = mattab

e_message_table = messtab.

describe table messtab lines messno.

if messno = 0.

write: 'Test finished, all components Ok!'.

if test is initial.

      • IMPORTANT:without commit, component is not created!!!!!!

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

endif.

endif.

Be sure that network is not blocked by other user at the time program is running.

Rgrds,

V.

Read only

Former Member
0 Likes
912

I had the same problem. This BAPI is very shaky. SAP transactions CJ20N and CN2* doesn't use this BAPI.

There could be 2 solutions.

1. did you check for Warning or Informational messages from BAPI?

I get a Informational message and then it won't post anything.

Even though no error is found.

2. Use Commit and Wait instead of just Commit.

Also, from what I have found. If i have 2 or more components under same activity, I have to post components together. If I post one component at a time, it doesn't work.