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

function location creation with BAPI

Former Member
0 Likes
1,748

Hi,

I am new to EAM/PM. I am trying to create function location via JCO/BAPI:  BAPI_FUNCLOC_CREATE

Here is part of my code:

  1.       JCoFunction function = destination.getRepository().getFunction("BAPI_FUNCLOC_CREATE"); 
  2.       function.getImportParameterList().setValue("EXTERNAL_NUMBER","1018-1043-292020222222222222222222222223"); 
  3.       function.getImportParameterList().setValue("LABELING_SYSTEM", "A"); 
  4.       JCoStructure structure = function.getImportParameterList().getStructure("DATA_GENERAL"); 
  5.       structure.setValue("PLANPLANT", "3000"); 
  6.       JCoStructure structure2 = function.getImportParameterList().getStructure("DATA_SPECIFIC"); 
  7.       structure2.setValue("SUPFLOC", "1018-1043"); 
  8.       structure2.setValue("STRIND", "ZLINE"); 
  9.       structure2.setValue("CATEGORY", "M"); 
  10.       function.execute(destination); 
  11.  
  12.       JCoStructure returnStructure = function.getExportParameterList().getStructure("RETURN"); 
  13.       System.out.println(returnStructure.getString("MESSAGE")); 

I got the error output:

  1. Functional location 1018-1043 does not exist  

Anything wrong with the parameter settings.

Please help.

Kevin

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
931

I got it solved.

structure2.setValue("SUPFLOC", "1018-1043");

SUPFLOC should be set by an internal number which is like "?0100000000000005581".

4 REPLIES 4
Read only

Former Member
0 Likes
931
Read only

Former Member
0 Likes
931

Hi, Functional location have superior FL to 4 levels. Say XXXX, XXXX-ABCD, XXXX,-ABCD-1234

like this. Each time it will see the superior FL exist or not. That may cause error.

Read only

0 Likes
931

Hi

As Nivedita suggested what i believe is you have to first create superior function location as an hierarchy. For example first create 1018 this then 1018--1043 then 1018-1043-292020222222222222222222222223

thanks

Nabheet

Read only

Former Member
0 Likes
932

I got it solved.

structure2.setValue("SUPFLOC", "1018-1043");

SUPFLOC should be set by an internal number which is like "?0100000000000005581".