There is few ways to concatenate with blank space if we google it out.
Below is the classic example.
Rules:
- Make sure the variable field is in the correct length.
Below is the code snippet.
CONCATENATE sy-mandt wa_po-ebeln wa_po-ebelp INTO tp_tabkey RESPECTING BLANKS
Others way is using class CL_ABAP_CONTAINER_UTILITIES. If you want to set the space based on others data type. Below is the code snippet.
FORM insert_space USING p_ebeln TYPE ekko-ebeln
CHANGING tp_ebeln.
CALL METHOD CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C
EXPORTING
IM_VALUE = p_ebeln
IMPORTING
EX_CONTAINER = tp_ebeln.
* EXCEPTIONS
* ILLEGAL_PARAMETER_TYPE = 1
* others = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
No comments:
Post a Comment