My First BAPI - Format a string use assign character.
FUNCTION ZZW_GET_SETTING_FORMAT.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(I_FILE) TYPE C
*" REFERENCE(I_CHARACTER) TYPE C
*" REFERENCE(I_LENGTH) TYPE I
*" EXPORTING
*" REFERENCE(E_FILE) TYPE C
*"----------------------------------------------------------------------
DATA: LINT_INDEX TYPE I.
E_FILE = I_FILE. "Set output file use intput file to format
LINT_INDEX = I_LENGTH - STRLEN( I_FILE ).
IF STRLEN( I_FILE ) < I_LENGTH.
DO LINT_INDEX TIMES.
CONCATENATE I_CHARACTER E_FILE INTO E_FILE.
ENDDO.
ENDIF.
ENDFUNCTION.
效果图:
![](http://p.blog.csdn.net/images/p_blog_csdn_net/zwxrain/87780/o_Set_Format_Character_Bapi_1.bmp)
output the result:
![](http://p.blog.csdn.net/images/p_blog_csdn_net/zwxrain/87780/o_Set_Format_Character_Bapi_2.bmp)