cancel
Showing results for 
Search instead for 
Did you mean: 

Need to create a Network and assign this n/w to WBS

former_member187692
Participant
0 Kudos


I was trying to create a network from abap editor using the  'BAPI_BUS2002_CREATE' but I have encountered a dump. Here is my entire code below:-

*  Declaration based on the Import & Export parameters of BAPI create  

DATA LV_AUFNR TYPE NW_AUFNR.
DATA LV_NETWRK TYPE BAPI_BUS2002_NEW. 

DATA LT_RESULT TYPE TABLE OF BAPIRET2.  

PARAMETERS: P_AUFNR TYPE NW_AUFNR. " Order Number

*  Trying to pass the value of network entered in parameters to the FM for creation.

LV_NETWRK-NETWORK = P_AUFNR.

CALL FUNCTION 'BAPI_PS_INITIALIZATION'.

CALL FUNCTION 'BAPI_BUS2002_CREATE'
   EXPORTING
     I_NETWORK          = LV_NETWRK
   TABLES
     ET_RETURN          = LT_RESULT.


CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Regards.

Accepted Solutions (1)

Accepted Solutions (1)

former_member341917
Active Participant
0 Kudos

Hi,

I am a functional consultant so i will explain in that language only.

1) Call function "BAPI_PS_INITIALIZATION"

2) Call function "BAPI_BUS2002_CREATE". here dont give the network no as it is system generated number.

parameters required to create network are.

   a) Network type

   b) Network Profile

   c) MRP Controller

   d) Description

    e) Plant etc.

3)  Call function "BAPI_PS_PRECOMMIT"

4) last call function "BAPI_TRANSACTION_COMMIT".

Regards

Avinash

former_member341917
Active Participant
0 Kudos

Hi

Forgot Parameter" WBS Element".

Regards

Avinash

former_member187692
Participant
0 Kudos

Hey I got the fields needed for network but this "BAPI_PS_PRECOMMIT" did not run successfully.

Error analysis:-

Short text

precommit did not run successfully.

Long Text

technical information about the message:

Message class .............. "CNIF_PI"

number............................. 33

Variable 1 ..................... " "

Variable 2 ..................... " "

Variable 3 ..................... " "

Variable 4 ..................... " "

Below code is were system go to dump( dump is happening for  standard code ):-

   

***INCLUDE LPS_BAPIF01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  CHK_PRECOMMIT
*&---------------------------------------------------------------------*
*       check precommit
*----------------------------------------------------------------------*
FORM chk_precommit.

  DATA: chk_precommit_ok TYPE c,
        chk_error        type c.

  CALL FUNCTION 'PS_FLAG_GET_GLOBAL_FLAGS'
       IMPORTING
            e_precommit_ok = chk_precommit_ok
            e_error        = chk_error.

  IF chk_precommit_ok = space.
*   Precommit wurde noch nicht aufgerufen.
    MESSAGE x030(cnif_pi).    <------------------ system goes to dump at this place
  ELSEIF chk_precommit_ok <> 'Y'.
*   Precommit wurde nicht erfolgreich durchlaufen.
    MESSAGE x033(cnif_pi).
  elseif not chk_error is initial.
*   At least one single BAPI failed
    MESSAGE x056(cnif_pi).
  ENDIF.

* commit work was called successfully after the precommit.
  PERFORM ps_bapi_init_global_variables.

former_member187692
Participant
0 Kudos

And yes, since network no is system generated ( i have mentioned the other parameters as input fields - which you have mentioned ).

I understand that WBS is not mandatory element for now.

But I am still getting the error as mentioned in my previous thread .


former_member341917
Active Participant
0 Kudos

Hi,

i have checked IDEAS and it is working fine make sure that WBS Element is given when do so.

i have done a test case in ideas

1) go to SE37 and clcik on Function Module--> execute--> Test sequence

2)a new window opens enter the BAPIs there in sequence

     BAPI_PS_INITIALIZATION

    BAPI_BUS2002_CREATE

    BAPI_PS_PRECOMMIT

     BAPI_TRANSACTION_COMMIT

     clcik on enter button.

3) a new window opens click on execute button

4) click on F3 button

5) next clcik on execute button, a new screen opens in import parameters click on "details view//edit"

6) a new screen opens click on single entry and give the following parameters as mentioned in my previous reply, here WBS element "XXXXX"is mandatory.

7) click on F3 button and execute bapi "BAPI_PS_PRECOMMIT"

😎 clcik on F3 button and execute bapi "BAPI_TRANSACTION_COMMIT".


the result u will get with no error.


Regards,

Avinash






former_member341917
Active Participant
0 Kudos

Hi

mistake WBS Element is not mandatory field and even if it is not mandatory try to give WBS element as u r going to assign anyway  to the WBS element next.

i have checked both the cases it is creating network.

Regards

Avinash

former_member187692
Participant
0 Kudos

Hi Avinash,

                    In the SE37 -> test sequence -> for BAPI_BUS2002_CREATE, the return table has 2 entries.

1.) object network could not be created

2.) missing mandatory field "profile': object network cannot be created.

                    When I am executing the BAPI_PS_PRECOMMIT, in its return table I get 1 more entries

1.) error in individual BAPIs or precommit: posting not possible.   ( ID:-     CNIF_PI )     

What I don't understand is that why is the return table entries populating when I only running a test sequence n exceuting.

                    Since now in my BAPI_PS_PRECOMMIT return table has already a error entries, when the BAPI_TRANSACTION_COMMIT is called it is going for dump.

former_member187692
Participant
0 Kudos

Hi Avinash,

                    I understand that if i getting the above error i think i am not passing the values properly.

Can  you help me passing the value in I_Network ( type   BAPI_BUS2002_NEW ).

former_member341917
Active Participant
0 Kudos

Hi Krishna,

as i have clearly mentioned in my previous reply try to follow the steps as written. any way i am explaining it again.

1) Go to se37, in FM give BAPI_BUS2002_CREATE and click on execute button.

2) anew screen opens in import parameters click on "details view//edit"

3) a new screen opens given the parameters as show in the attached screenshot and press ok button.

4) click on F3 and  will go to previous screen and in the main screen click on execute button. 

hope it will solve ur Problem

Regards

Avinash

former_member187692
Participant
0 Kudos

Hi Avinash,

                       thanks for ur help & support , was able to get a picture of how it is being created.

I don't want to a discussion again but a small info is req on the below msg which appears for me in the return table .

" Individual check for creating the object Network %00000000001 required "

Regards,

Krishna.

former_member341917
Active Participant
0 Kudos

Hi,

Before the Network is saved the system will give the number as u shown in ur message, once it is saved system will generate internal number as per the Number range given to it.

Regards

Avinash

Answers (0)