on 04-07-2011 5:53 PM
Hi everybody,
I work with web dyn pro and I call "BAPI_BUS1077_CREATE" using the wizard.
When I call "BAPI_BUS1077_CREATE" i pass several tables in the same time as parameters.
i don't understand why only the "subheader table" is taken in account.
All the Other tables are ignored.
I think i use the right flags also.
And i checked the binding of all nodes with tables.
Here is part of the code, i will send a second part in a second message:
lo_node_3 = wd_context->get_child_node( name = 'IMPORTING' ).
lo_node_3->SET_ATTRIBUTE( exporting NAME = 'FLG_HEADER'
value = 'X' ).
lo_node_3->SET_ATTRIBUTE( exporting NAME = 'FLG_IDENT'
value = 'X' ).
lo_node_3->SET_ATTRIBUTE( exporting NAME = 'FLG_PROP_USAGE'
value = 'X' ).
lo_node_3->SET_ATTRIBUTE( exporting NAME = 'FLG_PROP_HEADER'
value = 'X' ).
lo_node_3->SET_ATTRIBUTE( exporting NAME = 'FLG_PROP'
value = 'X' ).
lo_node_3->SET_ATTRIBUTE( exporting NAME = 'FLG_PROP_REL'
value = 'X' ).
lo_node_3->SET_ATTRIBUTE( exporting NAME = 'FLG_PROP_DATA'
value = 'X' ).
lo_node_3->SET_ATTRIBUTE( exporting NAME = 'flg_ident_sublist'
value = 'X' ).
REFRESH: l_sub_header_tab.
CLEAR l_sub_header_wa.
addinf-valdat = '00010101'. "key date 01/25/2007
CLEAR addinf-aennr. "change number
l_sub_header_wa-primarykey = 2. "int. key
l_sub_header_wa-flgprimkey = true.
l_sub_header_wa-subcategry = 'LIST_SUB'. "spec. category
l_sub_header_wa-subauthgrp = 'ALL'. "spec. auth. group
l_sub_header_wa-created_by = 'BE001376'.
l_sub_header_wa-created_on = '07042010'.
APPEND l_sub_header_wa TO l_sub_header_tab.
* prepare the new IDENTIFIER HEADER
REFRESH: l_ident_header_tab.
CLEAR l_ident_header_wa.
l_ident_header_wa-primarykey = 21. "int. key
l_ident_header_wa-flgprimkey = true.
l_ident_header_wa-foreignkey = l_sub_header_wa-primarykey.
l_ident_header_wa-flgfrgnkey = l_sub_header_wa-flgprimkey.
l_ident_header_wa-id_type = 'NAM'. "ident.'s type
l_ident_header_wa-id_categry = 'PROD'. "ident.'s category
l_ident_header_wa-langu = 'E'. "ident.'s language
l_ident_header_wa-identifier = 'Test JMC'. "#EC *
APPEND l_ident_header_wa TO l_ident_header_tab.
REFRESH: l_prop_usage_tab, l_prop_usage_tab_xp.
CLEAR l_prop_usage_wa.
l_prop_usage_wa-primarykey = 216. "int. key
l_prop_usage_wa-flgprimkey = true.
l_prop_usage_wa-foreignkey = l_ident_header_wa-primarykey.
l_prop_usage_wa-flgfrgnkey = l_ident_header_wa-flgprimkey.
l_prop_usage_wa-mastertabl = 'ESTRI'.
l_prop_usage_wa-rating = 'PUBLIC'.
l_prop_usage_wa-val_area = 'REG_EU'.
l_prop_usage_wa-excl_ind = false.
l_prop_usage_wa-act_ind = true.
APPEND l_prop_usage_wa TO l_prop_usage_tab.
* APPEND l_prop_usage_wa TO l_prop_usage_tab_xp.
* prepare the LINES FOR VALUE ASSIGNMENTS
** l_prop_usage_wa-primarykey = 217. "int. key
** l_prop_usage_wa-val_area = 'REG_WORLD'.
** l_prop_usage_wa-mastertabl = 'ESTVA'.
** l_prop_usage_wa-ACT_IND = true.
** APPEND l_prop_usage_wa TO l_prop_usage_tab_xp.
* prepare the PROPERTY HEADER
REFRESH: l_prop_header_tab, l_prop_header_tab_xp.
CLEAR l_prop_header_wa.
l_prop_header_wa-primarykey = 22. "int. key
l_prop_header_wa-flgprimkey = true.
l_prop_header_wa-foreignkey = l_sub_header_wa-primarykey.
l_prop_header_wa-flgfrgnkey = l_sub_header_wa-flgprimkey.
l_prop_header_wa-subchacat = 'SAP_EHS_1013_008'. "COLOR
APPEND l_prop_header_wa TO l_prop_header_tab.
* prepare the VALUE tab
REFRESH: l_prop_val_tab.
CLEAR l_prop_val_wa.
l_prop_val_wa-primarykey = 221.
l_prop_val_wa-flgprimkey = true.
l_prop_val_wa-foreignkey = l_prop_header_wa-primarykey.
l_prop_val_wa-flgfrgnkey = l_prop_header_wa-flgprimkey.
l_prop_val_wa-sequence = 1.
APPEND l_prop_val_wa TO l_prop_val_tab.
* prepare the VALUE ASSIGNMENT ASSESSMENT tab
REFRESH: l_prop_assess_tab.
CLEAR l_prop_assess_wa.
l_prop_assess_wa-primarykey = 2211.
l_prop_assess_wa-flgprimkey = true.
l_prop_assess_wa-foreignkey = l_prop_val_wa-primarykey.
l_prop_assess_wa-flgfrgnkey = l_prop_val_wa-flgprimkey.
l_prop_assess_wa-assessment = '1'. "<<<<<<<<<<<<<<<<<<
APPEND l_prop_assess_wa TO l_prop_assess_tab.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
REFRESH: l_prop_usage_tab.
CLEAR l_prop_usage_wa.
l_prop_usage_wa-primarykey = 2213. "int. key
l_prop_usage_wa-flgprimkey = true. " + JMC
l_prop_usage_wa-foreignkey = l_prop_val_wa-primarykey. " + JMC
l_prop_usage_wa-flgfrgnkey = l_prop_val_wa-flgprimkey. " + JMC
l_prop_usage_wa-val_area = 'REG_WORLD'.
l_prop_usage_wa-mastertabl = 'ESTVA'.
l_prop_usage_wa-ACT_IND = true.
APPEND l_prop_usage_wa TO l_prop_usage_tab.
lo_node_1 = wd_context->get_child_node( name = 'SUB_HEADER' ).
lo_node_1->BIND_TABLE( l_sub_header_tab ).
lo_node_1 = wd_context->get_child_node( name = 'IDENT_HEADER' ).
lo_node_1->BIND_TABLE( l_ident_header_tab ).
lo_node_1 = wd_context->get_child_node( name = 'PROP_HEADER' ).
lo_node_1->BIND_TABLE( l_prop_header_tab ).
lo_node_1 = wd_context->get_child_node( name = 'PROP_VAL' ).
lo_node_1->BIND_TABLE( l_prop_val_tab ).
lo_node_1 = wd_context->get_child_node( name = 'PROP_USAGE' ).
lo_node_1->BIND_TABLE( l_prop_usage_tab ).
lo_node_1 = wd_context->get_child_node( name = 'PROP_DATA' ).
lo_node_1->BIND_TABLE( l_prop_data_tab ).
lo_node_1 = wd_context->get_child_node( name = 'PROP_RELIABILITY' ).
lo_node_1->BIND_TABLE( l_prop_assess_tab ).
DATA lo_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .
lo_COMPONENTCONTROLLER = wd_this->get_componentcontroller_ctr( ).
lo_componentcontroller->execute_bapi_bus1077_create(
).
Hi.
I believe you have to call that BAPI to create the Substance header first. Then do succeeding call to set other details (e.g., Ident, Properties). This is a similar behavior if you try to create a new Substance in tc CG02. One must save first the Header data before proceeding in filling the details.
I hope this helps.
Hi Dengry,
Which part of your coding doesn't work?
If I remeber correctly you can create the header and details at the same time.
The coding looks pretty good to me in regards to linking the tables - here a couple of things that I find odd:
addinf-valdat = '00010101'. "key date 01/25/2007
->Normally you set this addinf-valdat = sy-datum.
l_sub_header_wa-created_by = 'BE001376'.
l_sub_header_wa-created_on = '07042010'.
-> Don't set these - the BAPI populates these fields for you.
You try to set an Ident usage but you don't set the flag for it a far as I can see.
You try to create a property but you do not supply any details like composition or characteristic data - just usages etc. and I'm not sure if that works.
For the usage you need to supply the RATING (PUBLIC etc..) as well.
Just keep in mind:
You can eat an elephant one bite at a time
Here's what I would do:
Create yourself a normal test program in R/3.
Add one piece of information at a time to you coding.
First write coding to create a header.
If that works write additional coding to add an Ident - without usage or the like.
It that works write additional coding to add a composition - without usage or the like.
If that all works wire coding to add usage, assessments etc....
The BAPI (same is true for the API) is a beast - and I know it is very frustrating at the beginning... But ones you understand it - it is a very powerful tool.
Best of luck
Mark
P.s.: Everyone I know who was trying to use the API or BAPI found it very hard and it It took them a couple of days to be able to get it to work ....
Edited by: Mark Pfister on Apr 8, 2011 9:33 AM
Hi Mark,
Thanks for your response. I think you are the last expert of this BAPI :).
I use the same code with simple ABAP and Dynpro with a call function and it works very well.
I started also, as you said, step by step.
In the beginning i add the header after i add an identifiant after the compo ....
Trust me, I spent over than 3 days now trying to resolve only this bug and it has not been fixed-up yet.
I still try to add the composition and here is the code.
lo_node_1 = wd_context->get_child_node( name = 'SUB_HEADER' ).
lo_node_1->GET_ATTRIBUTE( exporting NAME = 'PRIMARYKEY'
importing value = l_sub_header_wa-primarykey ).
lo_node_1->GET_ATTRIBUTE( exporting NAME = 'FLGPRIMKEY'
importing value = l_sub_header_wa-flgprimkey ).
* ------------------------------------------------------------*
* 2.1. Prepare all specification detail data for new creation
* ------------------------------------------------------------*
WC_CLASSE = 'SAP_EHS_1012_003'. " Legal Composition = STD
* prepare the PROPERTY HEADER
REFRESH: l_prop_header_tab.
CLEAR l_prop_header_wa.
l_prop_header_wa-primarykey = 21. "int. key
l_prop_header_wa-flgprimkey = true.
l_prop_header_wa-foreignkey = l_sub_header_wa-primarykey
l_prop_header_wa-flgfrgnkey = l_sub_header_wa-flgprimkey
l_prop_header_wa-subchacat = 'SAP_EHS_1012_003'.
APPEND l_prop_header_wa TO l_prop_header_tab.
* prepare the VALUE tab
REFRESH: l_prop_val_tab.
CLEAR l_prop_val_wa.
l_prop_val_wa-primarykey = 221.
l_prop_val_wa-flgprimkey = true.
l_prop_val_wa-foreignkey = l_prop_header_wa-primarykey.
l_prop_val_wa-flgfrgnkey = true.
* l_prop_val_wa-sequence = 1.
APPEND l_prop_val_wa TO l_prop_val_tab.
* prepare the VALUE ASSIGNMENT COMPONENT tab
* COMPO 1
WC_VALUE1 = '40'.
REFRESH: l_prop_component_tab.
CLEAR l_prop_component_wa.
l_prop_component_wa-primarykey = 2221.
l_prop_component_wa-flgprimkey = true.
l_prop_component_wa-foreignkey = l_prop_val_wa-primarykey.
l_prop_component_wa-flgfrgnkey = l_prop_val_wa-flgprimkey.
l_prop_component_wa-comproot = '00000000000000907142'. " 233
l_prop_component_wa-compcat = 'ZDEFAULT'.
l_prop_component_wa-sequence = 1.
l_prop_component_wa-oplowlimit = '>='.
l_prop_component_wa-DECLOWLIMIT = -1. " ne pas afficher les 0
l_prop_component_wa-DECUPPLIMIT = -1. " ne pas afficher les 0
l_prop_component_wa-low_limit = '10'.
l_prop_component_wa-opupplimit = '<='.
l_prop_component_wa-upp_limit = '60'.
l_prop_component_wa-avg_val = WC_VALUE1.
l_prop_component_wa-exponent = '%'.
* Perform CHECK-DECIMALES using WC_VALUE1.
l_prop_component_wa-DECAVGVAL = WB_DEC.
APPEND l_prop_component_wa TO l_prop_component_tab.
* COMPO 2
WC_VALUE1 = '50'.
CLEAR l_prop_component_wa.
l_prop_component_wa-primarykey = 2222.
l_prop_component_wa-flgprimkey = true.
l_prop_component_wa-foreignkey = l_prop_val_wa-primarykey.
l_prop_component_wa-flgfrgnkey = l_prop_val_wa-flgprimkey.
l_prop_component_wa-comproot = '00000000000001128838'. " 236
l_prop_component_wa-compcat = 'ZDEFAULT'.
l_prop_component_wa-sequence = 2.
l_prop_component_wa-oplowlimit = '>='.
l_prop_component_wa-DECLOWLIMIT = -1. " ne pas afficher les 0
l_prop_component_wa-DECUPPLIMIT = -1. " ne pas afficher les 0
l_prop_component_wa-low_limit = '10'.
l_prop_component_wa-opupplimit = '<='.
l_prop_component_wa-upp_limit = '60'.
l_prop_component_wa-avg_val = WC_VALUE1.
l_prop_component_wa-exponent = '%'.
l_prop_component_wa-DECAVGVAL = WB_DEC.
APPEND l_prop_component_wa TO l_prop_component_tab.
* COMPO 3
WC_VALUE1 = '10'.
CLEAR l_prop_component_wa.
l_prop_component_wa-primarykey = 2223.
l_prop_component_wa-flgprimkey = true.
l_prop_component_wa-foreignkey = l_prop_val_wa-primarykey.
l_prop_component_wa-flgfrgnkey = l_prop_val_wa-flgprimkey.
l_prop_component_wa-comproot = '00000000000000911790'. " 238
l_prop_component_wa-compcat = 'ZDEFAULT'.
l_prop_component_wa-sequence = 3.
l_prop_component_wa-oplowlimit = '>='.
l_prop_component_wa-DECLOWLIMIT = -1. " ne pas afficher les 0
l_prop_component_wa-DECUPPLIMIT = -1. " ne pas afficher les 0
l_prop_component_wa-low_limit = '10'.
l_prop_component_wa-opupplimit = '<='.
l_prop_component_wa-upp_limit = '20'.
l_prop_component_wa-avg_val = WC_VALUE1.
l_prop_component_wa-exponent = '%'.
l_prop_component_wa-DECAVGVAL = WB_DEC.
APPEND l_prop_component_wa TO l_prop_component_tab.
*---------------------------------------------------------------------
lo_node_1 = wd_context->get_child_node( name = 'PROP_COMPONENT' ).
lo_node_1->BIND_TABLE( l_prop_component_tab ).
lo_node_1 = wd_context->get_child_node( name = 'PROP_HEADER' ).
lo_node_1->BIND_TABLE( l_prop_header_tab ).
lo_node_1 = wd_context->get_child_node( name = 'PROP_VAL' ).
lo_node_1->BIND_TABLE( l_prop_val_tab ).
Edited by: dyngry on Apr 8, 2011 11:47 AM
Hi Dyngry,
Looks OK to to me....
Can you send me your test program per mail - I'll run it through the debugger and see if I can figure out what is going wrong...
Do you get any error message back from the BAPI?
Greets
Mark
P.s.: I normally use the API not the BAPI as it is easier to handle / I'm more used to it...
User | Count |
---|---|
8 | |
7 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.