cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI table parameter getting initialized

Former Member
0 Kudos

I am creating an app for storing user registration information via BAPI calls. The BAPI ZSD_PORTAL_REGISTRATION_INSERT has a table parameter DIVISION_INFO that gets populated with data from the view controller. When I execute the BAPI the response tells me the table was empty, as the ABAP code "IF DIVISION_INFO IS NOT INITIAL" check fails.

The class representation of the table parameter is Zzsd_Pt_Div_Reg. I tried the following code to hard-code data in the customer controller and still it fails...

Zsd_Portal_Registration_Insert_Input input = new Zsd_Portal_Registration_Insert_Input();

Zsd_Pt_Div div = new Zsd_Pt_Div();

Zzsd_Pt_Div_Reg div_reg = new Zzsd_Pt_Div_Reg();

div_reg.setDivision_Id("3A");

div_reg.setStatus("11");

Zzsd_Pt_Div_Reg_List lst = new Zzsd_Pt_Div_Reg_List();

lst.addZzsd_Pt_Div_Reg(div_reg);

//input.addDivision_Info(div_reg);

input.setDivision_Info(new Zzsd_Pt_Div_Reg_List());

wdContext.nodeZsd_Portal_Registration_Insert_Input().bind(input);

Any idea why the table parameter is not getting thru to the ABAP function module ? Please advise.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Srikanth,

Replace your code with following :

BAPI table parameter getting initialized

Posted: Nov 24, 2005 3:09 AM

I am creating an app for storing user registration information via BAPI calls. The BAPI ZSD_PORTAL_REGISTRATION_INSERT has a table parameter DIVISION_INFO that gets populated with data from the view controller. When I execute the BAPI the response tells me the table was empty, as the ABAP code "IF DIVISION_INFO IS NOT INITIAL" check fails.

The class representation of the table parameter is Zzsd_Pt_Div_Reg. I tried the following code to hard-code data in the customer controller and still it fails...

Zsd_Portal_Registration_Insert_Input input = new Zsd_Portal_Registration_Insert_Input();

Zsd_Pt_Div div = new Zsd_Pt_Div();

Zzsd_Pt_Div_Reg div_reg = new Zzsd_Pt_Div_Reg();

div_reg.setDivision_Id("3A");

div_reg.setStatus("11");

Zzsd_Pt_Div_Reg_List lst = new Zzsd_Pt_Div_Reg_List();

lst.addZzsd_Pt_Div_Reg(div_reg);

//input.addDivision_Info(div_reg);

input.setDivision_Info(lst);

wdContext.nodeZsd_Portal_Registration_Insert_Input().bind(input);

Also you need to bind "div" where it is required in heirarchy.

Regards,

Bhavik

Former Member
0 Kudos

Bhavik,

Thanks for the suggestion. It worked !!!

The context structure is as follows:

Zsd_Portal_Registration_Insert_Input

-Firstname

-Lastname

-Zipcode

-Phone

-Division_Info (model node)

The actual piece of code is:

Zsd_Portal_Registration_Insert_Input input = new Zsd_Portal_Registration_Insert_Input();

input.setFirstname("Sri");

input.setLastname("Patlu");

input.setZipcode("53454");

input.setPhone("123431243");

Zzsd_Pt_Div_Reg div_reg = new Zzsd_Pt_Div_Reg();

div_reg.setDivision_Id("3A");

div_reg.setStatus("11");

div_reg.setComments("RACO");

div_reg.setRegno("1000");

Zzsd_Pt_Div_Reg_List lst = new Zzsd_Pt_Div_Reg_List();

lst.addZzsd_Pt_Div_Reg(div_reg);

//input.addDivision_Info(div_reg);

input.setDivision_Info(lst);

wdContext.nodeZsd_Portal_Registration_Insert_Input().bind(input);

wdContext.nodeDivision_Info().bind(div_reg);

I still unclear as to why I should bind "div_reg" inspite of setting the division_info in the line "input.setDivision_Info(lst);"

Thanks anyways !

Former Member
0 Kudos

Hi Srikanth,

You have created model structure for Zzsd_Pt_Div_Reg and assigned values to it also.

now you are adding this object(div_reg) to list of Zzsd_Pt_Div_Reg_List.

So, you have ready model structure in your lst object.

After doing this you need to bind this model object to Division_Info of your input model object.

But you were creating new object and assigning to the Division_Info instead of previously created object(lst).

Second, when you bind model object with your context node with following code:

wdContext.nodeDivision_Info().bind(div_reg);

It win't create model relation between root context node and your Division_Info node.

This is my understanding.

Regards,

Bhavik

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Srikanth,

Please provide your complete Node Structure, with Cardinality of each node.

One problem I see is that you have populated "lst" but not using it anywhere. There should be a statement like

input.addDivision_Info(lst);

if Division_Info is a Node is of cardinality 0..n or 1..n

Regards,

Shubham