Hi,
This is the same problem i had. Assuming you already have your custom fields in the CI_COBL, you have to concatenate the ITEMNO_ACC and your custom fields into a string. This will be field 1 of the EXTENSION_CODINGBLOCK. then the FM MAP2I_BAPIEXTC_TO_BAPICOBL_CI will loop thru the Field 1 string while reading your CI_COBL field lengths and separate your values accordingly. See my example...
My CI_COBL fields from BAPICOBL_CI structure:
ITEM_NO_ACC N(10) "SAP already includes this field. not custom
ZZOT_QTY Quan(15)Dec(3) "custom field and length of 19 characters
ZZOT_RATE Curr(11)Dec(2) "custom field and length of 14 characters
So I would need to concatenate the ITEM_NO_ACC (which you get from the DOC_ITEMS in BAPI), ZZOT_QTY, & ZZOT_RATE.
When it loops thru the MAP2I_BAPIEXTC_TO_BAPICOBL_CI, the code will separate the following.....
000000000110.000 1.5 .
The first 10 chars = ITEM_NO_ACC passed from DOC_ITEMS
The next 19 chars = ZZOT_QTY passed from input field or inbound data etc.
The next 14 chars = ZZOT_RATE passed from input field or inbound data etc.
Good luck,
Jessica