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_CONTRACT_CREATE with extensionin

Former Member
0 Likes
3,672

Hi all

My problem is the following:

I call the bapi BAPI_CONTRACT_CHANGE with some extensions (zfields) in the table EKKO. One of those Zfields is an amount.

*/  Extension
  ls_extensionin-structure             = 'BAPI_TE_MEOUTHEADER'.
  ls_bapi_te_meoutheader-zcontratcadre = ls_party-internal_id-content.
  ls_bapi_te_meoutheader-zlotnr        = ls_party-receiving_site-internal_id-content.
  ls_bapi_te_meoutheader-number        = ls_pur_contr-id-content.
  ls_bapi_te_meoutheader-zamount       = ls_pur_contr-open_target_amount-content.

*/ TCH - Start
  CALL METHOD cl_abap_container_utilities=>fill_container_c
    EXPORTING
      im_value               = ls_bapi_te_meoutheader
    IMPORTING
      ex_container           = lv_container
    EXCEPTIONS
      illegal_parameter_type = 1
      OTHERS                 = 2.
  ls_extensionin+30 = lv_container.
  APPEND ls_extensionin  TO lt_extensionin.

but when I check in debugger the value of the amount, I get this: ##倀ఀ

The reason why I use this method, is to convert the structure into a string, so I can fill my extension.

Does anyone have an idea how to convert this amount into the valueparts of the extension?

Best regards

7 REPLIES 7
Read only

Former Member
0 Likes
2,886

Hi,

Hope this thread will help you

Regards,

Flavya

Read only

Former Member
0 Likes
2,886

Flavya

I have problems filling the extensionin with in the valuepart an amount. If I convert this into a string of 960 characters, the amount is not converted or wrongly converted so passing this will dump later in the BADI.

Read only

KevinPK_Chan
Explorer
0 Likes
2,886

Provide update below, even this is a very old post but I can see many people asking for similar questions.

The trick is, shift the lv_container by 30 char, which is the length of the structure. Same trick for reading the extension using cl_abap_container_utilities=>read_container_c

*/  Extension
  ls_extensionin-structure             = 'BAPI_TE_MEOUTHEADER'.
  ls_bapi_te_meoutheader-zcontratcadre = ls_party-internal_id-content.
  ls_bapi_te_meoutheader-zlotnr        = ls_party-receiving_site-internal_id-content.
  ls_bapi_te_meoutheader-number        = ls_pur_contr-id-content.
  ls_bapi_te_meoutheader-zamount       = ls_pur_contr-open_target_amount-content.

*/ TCH - Start
  CALL METHOD cl_abap_container_utilities=>fill_container_c
    EXPORTING
      im_value               = ls_bapi_te_meoutheader
    IMPORTING
      ex_container           = lv_container+30
    EXCEPTIONS
      illegal_parameter_type = 1
      OTHERS                 = 2.
  ls_extensionin+30 = lv_container.
  APPEND ls_extensionin  TO lt_extensionin.
Read only

0 Likes
2,886

Hi @Kevin,

How do you know that the lv_container is 30 characters in length?

Read only

oppenheim_jm
Participant
0 Likes
2,886

Hi Kristof,

Please can you list how you defined your data types lv_container and ls_extensionin?

I have a similar problem with a different BAPI.

Thanks

Joe

Read only

KevinPK_Chan
Explorer
0 Likes
2,886

Hi oppenheim.jm ,

The variable lv_container is type of BAPIPAREX.

DATA: lv_container          TYPE  BAPIPAREX.

The first 30 characters is for the field STRUCTURE. So we're filling our data after 30-char.

Read only

0 Likes
2,886

Thanks kevin-chang. Exactly what I was looking for! Appreciate the feedback!