on 09-27-2022 12:58 PM
Hi,
How to split an xstring in SAP ABAP based on totally on size and the string does not have an identifier to judge the position to break.
Please help if you know some solution. Thanks!
Best Regards
Anvesh Kumar
Osapiens service gmbH
germany
Based on byte size. If the xstring is 4 MB , I want to split it in 2 portion of 2-2 MB. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Don't add an answer when you should comment. It even says right next to the answer box:
You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that your answer complies with our Rules of Engagement.
CLASS lcl_app DEFINITION.
PUBLIC SECTION.
CLASS-METHODS split_xsequence
IMPORTING
xsequence TYPE xsequence
width TYPE i
RETURNING
VALUE(result) TYPE xstring_table.
ENDCLASS.
CLASS lcl_app IMPLEMENTATION.
METHOD split_xsequence.
result = VALUE #(
FOR off = 0 THEN off + width WHILE off < xstrlen( xsequence )
LET len = nmin( val1 = width val2 = xstrlen( xsequence ) - off ) IN
( CONV #( xsequence+off(len) ) ) ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA(xstring_table) = lcl_app=>split_xsequence( xsequence = '415152' width = 2 ).
ASSERT xstring_table = value xstring_table( ( conv #( '4151' ) ) ( conv #( '52' ) ) ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.