2011 Jul 14 4:08 PM
Hi to all,
I'm creating Sales Order by using BAPI_SALESORDER_CREATEFROMDAT2. I need to add custom field in additional data B Item .
In BAPI there is a property structure "extensionin" to fill. I've also extended with append structure the table VBAP and the
structure BAPE_VBAP and BAPE_VBAPX.
Please note the in VBAP the fields are in currency domain while in BAPE_VBAP are CHAR.
The fields in the order aren't filled. Can anyone tell me why ?
Thanks in advance
Andrew
Hi to all,
I'm creating Sales Order by using BAPI_SALESORDER_CREATEFROMDAT2. I need to add custom field in additional data B Item .
In BAPI there is a property structure "extensionin" to fill. I've also extended with append structure the table VBAP and the
structure BAPE_VBAP and BAPE_VBAPX.
Please note the in VBAP the fields are in currency domain while in BAPE_VBAP are CHAR.
The fields in the order aren't filled. Can anyone tell me why ?
Thanks in advance
Andrew
2011 Jul 14 9:56 PM
Hi Andrew_70,
fields must be customized as editable - otherwise BAPi will refuse to fill them.
Regards,
Clemens
2011 Jul 15 4:10 AM
Andrew,
Can you please post the code how are you filling Extension tables in BAPI ? I guess you must be missing something there.
Also, is there any constraint to have BAPE_VBAP also have same data type (CURR) as it is in VBAP. I guess it should be ideally same.
BR,
Diwakar
2011 Jul 18 11:45 AM
Hi ,
my problem is to fill ALL of the custom fields added in Sales Order. I have in additional data tab, 12 custom fields (corresponding to the value of the months from january until december ).
Well, it works perfectly for all the moths except december and I don't know why. This is the code:
ls_extensionin-structure = 'BAPE_VBAP'.
ls_bape_vbap-vbeln = ' '.
ls_bape_vbap-posnr = ls_bapi_h-posnr_h.
ls_bape_vbap-zz_cyear = ls_bapi-comp_year.
ls_bape_vbap-zz_cbegin = ls_bapi_h-start_date.
ls_bape_vbap-zz_cende = ls_bapi_h-end_date.
ls_bape_vbap-zz_btg_01 = ls_bapi_h-amount_01.
ls_bape_vbap-zz_btg_02 = ls_bapi_h-amount_02.
ls_bape_vbap-zz_btg_03 = ls_bapi_h-amount_03.
ls_bape_vbap-zz_btg_04 = ls_bapi_h-amount_04.
ls_bape_vbap-zz_btg_05 = ls_bapi_h-amount_05.
ls_bape_vbap-zz_btg_06 = ls_bapi_h-amount_06.
ls_bape_vbap-zz_btg_07 = ls_bapi_h-amount_07.
ls_bape_vbap-zz_btg_08 = ls_bapi_h-amount_08.
ls_bape_vbap-zz_btg_09 = ls_bapi_h-amount_09.
ls_bape_vbap-zz_btg_10 = ls_bapi_h-amount_10.
ls_bape_vbap-zz_btg_11 = ls_bapi_h-amount_11.
ls_bape_vbap-zz_btg_12 = ls_bapi_h-amount_12. "This is the field missing
ls_extensionin-valuepart1 = ls_bape_vbap.
APPEND ls_extensionin TO lt_extensionin.
2011 Jul 18 1:40 PM
Hi Andrew,
just an idea: According to documentation the data part of a BAPI table extension can have a maximum length of 960 characters. Possibly this is reduced in Unicode, leaving 480 or less. If your fields altogether exceed this length, something may get cut off. You could test by re-arranging the sequence of the amount_nn fields in the BAPI extension.
If this really is the case, you would have to define a second extension structure or just reduce the length of the amount_nn to the maximum required length.
Other than this I have no idea right now except checking in debugger.
Regards,
Clemens
2011 Jul 18 2:33 PM
Ok, I've checked that in debug last value is cut off.
So I was thinking to use valupart2 field in this way:
ls_extensionin-valuepart1 = ls_bape_vbap.
ls_extensionin-valuepart2 = ls_bape_vbap+239(18). "last value december month
APPEND ls_extensionin TO lt_extensionin.
It's not clear how to fill the other structure BAPE_VBAPX (flag also on valuepart2 ? ).
At the moment is not working...last value is always missing.
Thanks
2011 Jul 18 5:19 PM
So I hope that the last field is not getting cut-off when passing in Valuepart2 field.
To pass the BAPE_VBAKX its not necessary to pass to the valuepart2 field. You can pass it in valuepart1 as long as it is not getting cut-off. Make sure to check it in the debugger.
Cheers!!
Abhi
2011 Jul 19 10:02 AM
Hi, this is the structures. Please note that I've cutted one field in the structure so the offset in now at 234 characters.
ls_extensionin-structure = 'BAPE_VBAP'.
ls_bape_vbap-vbeln = ' '.
ls_bape_vbap-posnr = ls_bapi_h-posnr_h.
ls_bape_vbap-zz_cyear = ls_bapi-comp_year.
ls_bape_vbap-zz_cbegin = ls_bapi_h-start_date.
ls_bape_vbap-zz_cende = ls_bapi_h-end_date.
ls_bape_vbap-zz_btg_01 = ls_bapi_h-amount_01.
ls_bape_vbap-zz_btg_02 = ls_bapi_h-amount_02.
ls_bape_vbap-zz_btg_03 = ls_bapi_h-amount_03.
ls_bape_vbap-zz_btg_04 = ls_bapi_h-amount_04.
ls_bape_vbap-zz_btg_05 = ls_bapi_h-amount_05.
ls_bape_vbap-zz_btg_06 = ls_bapi_h-amount_06.
ls_bape_vbap-zz_btg_07 = ls_bapi_h-amount_07.
ls_bape_vbap-zz_btg_08 = ls_bapi_h-amount_08.
ls_bape_vbap-zz_btg_09 = ls_bapi_h-amount_09.
ls_bape_vbap-zz_btg_10 = ls_bapi_h-amount_10.
ls_bape_vbap-zz_btg_11 = ls_bapi_h-amount_11.
ls_bape_vbap-zz_btg_12 = ls_bapi_h-amount_12.
ls_extensionin-valuepart1 = ls_bape_vbap(234).
ls_extensionin-valuepart2 = ls_bape_vbap+234(18).
APPEND ls_extensionin TO lt_extensionin.
CLEAR:ls_extensionin.
ls_extensionin-structure = 'BAPE_VBAPX'.
ls_bape_vbapx-vbeln = ' '.
ls_bape_vbapx-posnr = ls_bapi_h-posnr_h.
ls_bape_vbapx-zz_cyear = gc_x.
ls_bape_vbapx-zz_cbegin = gc_x.
ls_bape_vbapx-zz_cende = gc_x.
*
ls_bape_vbapx-zz_btg_01 = gc_x.
ls_bape_vbapx-zz_btg_02 = gc_x.
ls_bape_vbapx-zz_btg_03 = gc_x.
ls_bape_vbapx-zz_btg_04 = gc_x.
ls_bape_vbapx-zz_btg_05 = gc_x.
ls_bape_vbapx-zz_btg_06 = gc_x.
ls_bape_vbapx-zz_btg_07 = gc_x.
ls_bape_vbapx-zz_btg_08 = gc_x.
ls_bape_vbapx-zz_btg_09 = gc_x.
ls_bape_vbapx-zz_btg_10 = gc_x.
ls_bape_vbapx-zz_btg_11 = gc_x.
ls_bape_vbapx-zz_btg_12 = gc_x.
ls_extensionin-valuepart1 = ls_bape_vbapx.
APPEND ls_extensionin TO lt_extensionin.
clear ls_extensionin.
In debug I've checked that 234(18) is valued but it still not working.
Butìì
2011 Jul 19 1:04 PM
Hi,
Try passing
lv_data = is_bape_vbap. (lv_data should be of type char960)
ls_extensionin-valuepart1 = lv_data+0(240).
ls_extensionin-valuepart2 = lv_data+240(240).
ls_extensionin-valuepart3 = lv_data+480(240).
ls_extensionin-valuepart4 = lv_data+720(240).
Regards,
Bhavani
2011 Jul 19 9:50 PM
Yes, Andrew, that's it, I forgot.
It's in the online help about [Actions for an Enhancement Based on Existing SAP Database Tables |http://help.sap.com/saphelp_46c/helpdata/en/c3/4099ac8b8911d396b70004ac96334b/content.htm] and they supply a [well-documented source code Example for Filling the ExtensionIn Parameter |http://help.sap.com/saphelp_46c/helpdata/en/6b/3f6d2b6d0711d396a50004ac96334b/content.htm].
Hope you can close it soon!
Regards,
Clemens
2011 Jul 20 2:22 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |