Skip to Content
Author's profile photo Viral Bhuva

Tips to solve the extension(customer fields) problem in BAPI even though the extension structures are maintained

  • Usually we face problems while using BAPIs for extension. Either extensions are not properly filled or they are filled with some special characters (garbage values).
  • Even if the extension structures for BAPI are properly adjusted I have faced this issue.


  • Let work area for extension(ls_vbap) have following type.

TYPES: BEGIN OF ty_vbap,
vbeln            TYPE vbap-vbeln,
posnr            TYPE vbap-posnr,
zzzlang          TYPE vbap-zzzlang,
zzzdruck         TYPE vbap-zzzdruck

And so on …

  • The extension table (t_extension_in) be of type bapiparex.
  • BAPI accepts the extension table in character format, so we generally change it like :

CLEAR t_extension_in.
t_extension_in-structure     = ‘BAPE_VBAP’.

MOVE ls_vbap to t_extension_in+30 .
t_extension_in-valuepart1    = ls_vbap(240).
t_extension_in-valuepart2    = ls_vbap+240.
APPEND t_extension_in.

  • This BAPI internally changes the extension table to hexadecimal and then it converts it to character format. So sometimes the original values are wrongly interpreted. So we get garbage values (for eg: ### ) in the customer fields.
  • Now if we change the original type of ls_vbap first to hexadecimal and then convert these to character format and then append it to extension table then the internal conversion in BAPI will not give garbage values.

  FIELD-SYMBOLS: <fs_x_vbap>     TYPE x,
<fs_c_vbap>     TYPE c.

  CLEAR t_extension_in.
t_extension_instructure     = ‘BAPE_VBAP’.

* Converting into Hexadecimal value.
ASSIGN ls_vbap        TO <fs_x_vbap>     CASTING.

* Converting Hexadecimal to  char.
ASSIGN <fs_x_vbap> TO <fs_c_vbap>     CASTING.

* Filling Extension table ( excluding first field of 30 char)
t_extension_in+30 = <fs_c_vbap>.

APPEND t_extension_in.

  • After these conversion the values in customer fields will appear correctly.

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Phillip Manning
      Phillip Manning

      Hi there,


      It will handle the storing of numbers in a character string. The BAPI uses the same class internally to unpack that extenstion structure.