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

BAPI_0050_CREATE Custom fields update failure

0 Likes
1,676

Hi experts,

I am trying to update custom fields using BAPI_0050_CREATE but unable to update the fields in FMBL.

*** Create document
CALL FUNCTION 'BAPI_0050_CREATE'
EXPORTING
header_data = gs_header
testrun = ''
IMPORTING
documentnumber = gv_docno
TABLES
item_data = gt_idata
extension_in = gt_cfields
* period_data = gt_period_data
return = gt_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.

Please help.

Regards,

Jayasree

4 REPLIES 4
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,402

DOCNR is 10 characters, not 9 like '100000312'.

Better use an actual work area of type BAPI_TE_FMBH (or PFM_TE_FMBH in some case/version, check OSS notes for your current version) to move values to VALUEPART1 (Use MOVE statement or a method like cl_abap_container_utilities=>fill_container_c in an unicode system.)

Read only

0 Likes
1,401

I can see the values while debugging but couldnt update in FMBL

Read only

0 Likes
1,401

I suppose that Business Function 'PSM_FM_BCS_CI_1' was activated, did you also implement BAdI 'FMBW_CUSTOMER'?

Read only

1,401

Thanks Raymond. I have tried FMBW_CUSTOMER before but couldn't help.

I have resolved by creating a new enhancement spot at LFMKUF05 in routine: read_extension_in. Updated the dumm_ext to 'X'.

Below code might helpful others.

ENHANCEMENT 1 ZMSCOA_READ_EXTENSION_IN1. "active version
FIELD-SYMBOLS: <ld_ext> TYPE flag.
LOOP AT u_t_extension_in.
CASE u_t_extension_in-structure.
WHEN 'BAPI_TE_FMBL'.
MOVE-CORRESPONDING u_t_extension_in TO l_f_parex_short.
CATCH SYSTEM-EXCEPTIONS conversion_errors = 1.
ASSIGN l_f_parex_short TO <bapi_struc_line> CASTING. "#EC ENHOK
MOVE <bapi_struc_line> TO l_f_te_fmbl.
* Copy customer fields in the line level
MOVE-CORRESPONDING l_f_te_fmbl TO l_f_customer_fields_line.
* By default, we keep the original input for a reversal.
* As fields are not known, the check is done for the whole include
IF NOT l_f_customer_fields_line IS INITIAL.
READ TABLE c_t_lines WITH KEY
docln = l_f_te_fmbl-item_num
rpmax = l_f_te_fmbl-rpmax ASSIGNING <l_f_line>.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING l_f_customer_fields_line TO <l_f_line>.
IF <l_f_line>-zzregion IS NOT INITIAL or <l_f_line>-zzcosting IS NOT INITIAL.
ASSIGN COMPONENT 'DUMMY_EXT' OF STRUCTURE <l_f_line> to <ld_ext>.
<ld_ext> = 'X'.
ENDIF.
ENDIF.
ENDIF.
ENDCATCH.
ENDCASE.
ENDLOOP.
ENDENHANCEMENT.

Regards,

Jayasree