<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Offset for Double Width Japanese Characters in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564758#M21778</link>
    <description>&lt;P&gt;That was the goal of my initial question, to know what you are trying to achieve. So, your problem is not about reading the file, but about transferring WA_UPLOAD_FILE to WA_KYUYONO.&lt;/P&gt;
  &lt;P&gt;As you have a Unicode system, every Japanese character is one character (2 bytes), so WA_UPLOAD_FILE+8(20) will take 20 characters, i.e. 20 Japanese characters for instance or 20 any kind of characters, so I don't understand your complex algorithm. It seems just useless.&lt;/P&gt;
  &lt;P&gt;The question is: what is the goal of this transfer?&lt;/P&gt;
  &lt;P&gt;PS: it's normal that cl_abap_list_utilities=&amp;gt;read_from_display_layout returns 10 characters for Japanese text displayed on 20 columns of an ABAP list. What do you exactly need?&lt;/P&gt;
  &lt;P&gt;I also tested your code + added the declarations of variables, at the end WA_KYUYONO is equal to WA_UPLOAD_FILE, it's why I said I don't understand what is your goal (compilable code copied here for further discussion):&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;REPORT.
DATA: BEGIN OF wa_upload_file, var1(4), var2(3), var3(1), var4(20), END OF wa_upload_file,
      lo_typedescr TYPE REF TO cl_abap_typedescr,
      lo_structdescr TYPE REF TO cl_abap_structdescr,
      lt_components_in TYPE cl_abap_structdescr=&amp;gt;component_table,
      ls_component TYPE abap_componentdescr,
      lv_input_data TYPE string,
      BEGIN OF wa_kyuyono, var1(4), var2(3), var3(1), var4(20), END OF wa_kyuyono,
      lt_components_out TYPE cl_abap_structdescr=&amp;gt;component_table,
      lv_offset TYPE i,
      lv_offset_str TYPE string,
      l_tabix TYPE sytabix,
      lo_elemdescr TYPE REF TO cl_abap_elemdescr,
      lv_offset_data TYPE string,
      l_length TYPE i,
      lv_total_offset TYPE i.
FIELD-SYMBOLS:
               &amp;lt;ls_field&amp;gt; TYPE any.
wa_upload_file = 'JP34HE38理論健康保険料（総報酬）'.
"get abap type for the data
lo_typedescr = cl_abap_typedescr=&amp;gt;describe_by_data( wa_upload_file ).
lo_structdescr ?= lo_typedescr.
lt_components_in = lo_structdescr-&amp;gt;get_components( ).
LOOP AT lt_components_in INTO ls_component.
  UNASSIGN &amp;lt;ls_field&amp;gt;.
  ASSIGN COMPONENT ls_component-name OF STRUCTURE wa_upload_file TO &amp;lt;ls_field&amp;gt;.
  IF lv_input_data IS INITIAL.
    lv_input_data = &amp;lt;ls_field&amp;gt;.
  ELSE.
    CONCATENATE lv_input_data &amp;lt;ls_field&amp;gt; INTO lv_input_data.
  ENDIF.
ENDLOOP.
CLEAR: lo_typedescr, lo_structdescr.
lo_typedescr = cl_abap_typedescr=&amp;gt;describe_by_data( wa_kyuyono ).
lo_structdescr ?= lo_typedescr.
lt_components_out = lo_structdescr-&amp;gt;get_components( ).
CLEAR: lv_offset, lv_offset_str.
LOOP AT lt_components_out INTO ls_component.
  l_tabix = sy-tabix.
  CLEAR: lo_elemdescr, lv_offset_data.
  lo_elemdescr ?= ls_component-type.
  IF lo_elemdescr-&amp;gt;type_kind EQ 'D'.
    l_length = '8'.
  ELSE.
    l_length = lo_elemdescr-&amp;gt;output_length.
  ENDIF.
  cl_abap_list_utilities=&amp;gt;read_from_display_layout(
                                    EXPORTING
                                      display_data   = lv_input_data
                                      display_offset = lv_total_offset
                                      display_length = l_length
                                    IMPORTING
                                      field = lv_offset_data ).
  lv_offset = l_length.
  ADD lv_offset TO lv_total_offset.
  "assign data to structure
  UNASSIGN &amp;lt;ls_field&amp;gt;.
  ASSIGN COMPONENT ls_component-name OF STRUCTURE wa_kyuyono TO &amp;lt;ls_field&amp;gt;.
  IF &amp;lt;ls_field&amp;gt; IS ASSIGNED.
    &amp;lt;ls_field&amp;gt; = lv_offset_data.
  ENDIF.
ENDLOOP.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 04 Oct 2017 08:32:34 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2017-10-04T08:32:34Z</dc:date>
    <item>
      <title>Offset for Double Width Japanese Characters</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564750#M21770</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
  &lt;P&gt;I am working with Offsets for Japanese Characters. Below is sample data.&lt;/P&gt;
  &lt;P&gt;JP34HE38理論健康保険料（総報酬）&lt;/P&gt;
  &lt;P&gt;Below is the logic that I am using for Splitting the above string:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;  "get abap type for the data
  lo_typedescr = cl_abap_typedescr=&amp;gt;describe_by_data( wa_upload_file ).
  lo_structdescr ?= lo_typedescr.
  lt_components_in = lo_structdescr-&amp;gt;get_components( ).

  LOOP AT lt_components_in INTO ls_component.
    UNASSIGN &amp;lt;ls_field&amp;gt;.
    ASSIGN COMPONENT ls_component-name OF STRUCTURE wa_upload_file TO &amp;lt;ls_field&amp;gt;.
    IF lv_input_data IS INITIAL.
      lv_input_data = &amp;lt;ls_field&amp;gt;.
    ELSE.
      CONCATENATE lv_input_data &amp;lt;ls_field&amp;gt; INTO lv_input_data.
    ENDIF.
  ENDLOOP.

  CLEAR: lo_typedescr, lo_structdescr.
  lo_typedescr = cl_abap_typedescr=&amp;gt;describe_by_data( wa_kyuyono ).
  lo_structdescr ?= lo_typedescr.
  lt_components_out = lo_structdescr-&amp;gt;get_components( ).

  CLEAR: lv_offset, lv_offset_str.
  LOOP AT lt_components_out INTO ls_component.
    l_tabix = sy-tabix.
    CLEAR: lo_elemdescr, lv_offset_data.
      lo_elemdescr ?= ls_component-type.
      IF lo_elemdescr-&amp;gt;type_kind EQ 'D'.
        l_length = '8'.
      ELSE.
        l_length = lo_elemdescr-&amp;gt;output_length.
      ENDIF.

        cl_abap_list_utilities=&amp;gt;read_from_display_layout(
                                          EXPORTING
                                            display_data   = lv_input_data
                                            display_offset = lv_total_offset
                                            display_length = l_length
                                          IMPORTING
                                            field = lv_offset_data ).
  
      lv_offset = l_length.
      ADD lv_offset TO lv_total_offset.
      "assign data to structure
      UNASSIGN &amp;lt;ls_field&amp;gt;.
      ASSIGN COMPONENT ls_component-name OF STRUCTURE wa_kyuyono TO &amp;lt;ls_field&amp;gt;.
      IF &amp;lt;ls_field&amp;gt; IS ASSIGNED.
        &amp;lt;ls_field&amp;gt; = lv_offset_data.
      ENDIF.
    ENDIF.
  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Below is how it should split,&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/74379-japanese-characters-issue.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;Var1 is 4 Character, Var2 is 3 Character, Var3 is 1 Character, and Var4 is 20 Character.&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;Issue:&lt;/STRONG&gt; &lt;/P&gt;
  &lt;P&gt;Var4 is 20 Character. However, the method cl_abap_list_utilities=&amp;gt;read_from_display_layout returns only 10 Characters. This is because the &lt;U&gt;character width&lt;/U&gt; occupied is more than 20.&lt;/P&gt;
  &lt;P&gt;How can we work with Offset for these type of Characters? Suppose, if we have another variable, then this would be an issue.&lt;/P&gt;
  &lt;P&gt;Thanks in advance!&lt;/P&gt;
  &lt;P&gt;BR,&lt;BR /&gt;Kiran Kerudi&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 04:43:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564750#M21770</guid>
      <dc:creator>kirankerudi</dc:creator>
      <dc:date>2017-10-03T04:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Offset for Double Width Japanese Characters</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564751#M21771</link>
      <description>&lt;P&gt;&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;I see nowhere how the ABAP list intervenes in your code. It seems that you are just transferring the data from a file into a variable.&lt;/P&gt;
  &lt;P&gt;Please explain the context, what are you trying to achieve? (more details than just "splitting")&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 07:56:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564751#M21771</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2017-10-03T07:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Offset for Double Width Japanese Characters</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564752#M21772</link>
      <description>&lt;P&gt;Hi Sandra,&lt;/P&gt;
  &lt;P&gt;Yes, I am transferring Fixed Length File Data (SJIS File) with GUI_UPLOAD FMs. The above program was just for reference to the context of Offsetting.&lt;/P&gt;
  &lt;P&gt;Best Regards,&lt;/P&gt;
  &lt;P&gt;Kiran&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 08:56:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564752#M21772</guid>
      <dc:creator>kirankerudi</dc:creator>
      <dc:date>2017-10-03T08:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Offset for Double Width Japanese Characters</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564753#M21773</link>
      <description>&lt;P&gt;Why don't you simply read the file by using the code page 8000 ? (SJIS)&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 09:17:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564753#M21773</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2017-10-03T09:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Offset for Double Width Japanese Characters</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564754#M21774</link>
      <description>&lt;P&gt;Hi Kiran,&lt;/P&gt;
  &lt;P&gt;There are two reasons for this.&lt;/P&gt;
  &lt;P&gt;First you need to check your SAP environment for encoding and if not use the unicode environment.&lt;/P&gt;
  &lt;P&gt;Second if you use unicode environment then try by creating a structure of your type.&lt;/P&gt;
  &lt;P&gt;Use move statement and then I will move the first 4 characters to the first field of structure and so on.&lt;/P&gt;
  &lt;P&gt;This will solve the multilangual issue.&lt;/P&gt;
  &lt;P&gt;Regards,&lt;/P&gt;
  &lt;P&gt;Ankit Mahajan&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 12:37:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564754#M21774</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-10-03T12:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: Offset for Double Width Japanese Characters</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564755#M21775</link>
      <description>&lt;P&gt;Without using code page 8000 I would not be able to read SJIS File. So its already in place.&lt;/P&gt;
  &lt;P&gt;Here, the issue is not about the file. I have contents already in the internal table. &lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 00:55:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564755#M21775</guid>
      <dc:creator>kirankerudi</dc:creator>
      <dc:date>2017-10-04T00:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: Offset for Double Width Japanese Characters</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564756#M21776</link>
      <description>&lt;P&gt;Hi Ankit,&lt;/P&gt;
  &lt;P&gt;My SAP Environment is Unicode. Now since its Unicode all characters are two bytes and they are either half-width or full-width. Japanese characters are full-width. So, for Var4 when we move 8(20), it moves characters that are occupying the full.half-width and not the number of characters.&lt;/P&gt;
  &lt;P&gt;Best Regards,&lt;BR /&gt;Kiran&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 01:02:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564756#M21776</guid>
      <dc:creator>kirankerudi</dc:creator>
      <dc:date>2017-10-04T01:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Offset for Double Width Japanese Characters</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564757#M21777</link>
      <description>&lt;P&gt;Hi Kiaran,&lt;/P&gt;
  &lt;P&gt;Then I think we have a solution.&lt;/P&gt;
  &lt;P&gt;Given that the first 8 characters will be EN, we need to move 8(20) which will be Japanease.&lt;/P&gt;
  &lt;P&gt;We know as in Unicode all characters are eighter half-width of full width.&lt;/P&gt;
  &lt;P&gt;And for Japanese it will always be of full width.&lt;/P&gt;
  &lt;P&gt;So instead of 8(20), use 8(40).&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 06:07:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564757#M21777</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-10-04T06:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Offset for Double Width Japanese Characters</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564758#M21778</link>
      <description>&lt;P&gt;That was the goal of my initial question, to know what you are trying to achieve. So, your problem is not about reading the file, but about transferring WA_UPLOAD_FILE to WA_KYUYONO.&lt;/P&gt;
  &lt;P&gt;As you have a Unicode system, every Japanese character is one character (2 bytes), so WA_UPLOAD_FILE+8(20) will take 20 characters, i.e. 20 Japanese characters for instance or 20 any kind of characters, so I don't understand your complex algorithm. It seems just useless.&lt;/P&gt;
  &lt;P&gt;The question is: what is the goal of this transfer?&lt;/P&gt;
  &lt;P&gt;PS: it's normal that cl_abap_list_utilities=&amp;gt;read_from_display_layout returns 10 characters for Japanese text displayed on 20 columns of an ABAP list. What do you exactly need?&lt;/P&gt;
  &lt;P&gt;I also tested your code + added the declarations of variables, at the end WA_KYUYONO is equal to WA_UPLOAD_FILE, it's why I said I don't understand what is your goal (compilable code copied here for further discussion):&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;REPORT.
DATA: BEGIN OF wa_upload_file, var1(4), var2(3), var3(1), var4(20), END OF wa_upload_file,
      lo_typedescr TYPE REF TO cl_abap_typedescr,
      lo_structdescr TYPE REF TO cl_abap_structdescr,
      lt_components_in TYPE cl_abap_structdescr=&amp;gt;component_table,
      ls_component TYPE abap_componentdescr,
      lv_input_data TYPE string,
      BEGIN OF wa_kyuyono, var1(4), var2(3), var3(1), var4(20), END OF wa_kyuyono,
      lt_components_out TYPE cl_abap_structdescr=&amp;gt;component_table,
      lv_offset TYPE i,
      lv_offset_str TYPE string,
      l_tabix TYPE sytabix,
      lo_elemdescr TYPE REF TO cl_abap_elemdescr,
      lv_offset_data TYPE string,
      l_length TYPE i,
      lv_total_offset TYPE i.
FIELD-SYMBOLS:
               &amp;lt;ls_field&amp;gt; TYPE any.
wa_upload_file = 'JP34HE38理論健康保険料（総報酬）'.
"get abap type for the data
lo_typedescr = cl_abap_typedescr=&amp;gt;describe_by_data( wa_upload_file ).
lo_structdescr ?= lo_typedescr.
lt_components_in = lo_structdescr-&amp;gt;get_components( ).
LOOP AT lt_components_in INTO ls_component.
  UNASSIGN &amp;lt;ls_field&amp;gt;.
  ASSIGN COMPONENT ls_component-name OF STRUCTURE wa_upload_file TO &amp;lt;ls_field&amp;gt;.
  IF lv_input_data IS INITIAL.
    lv_input_data = &amp;lt;ls_field&amp;gt;.
  ELSE.
    CONCATENATE lv_input_data &amp;lt;ls_field&amp;gt; INTO lv_input_data.
  ENDIF.
ENDLOOP.
CLEAR: lo_typedescr, lo_structdescr.
lo_typedescr = cl_abap_typedescr=&amp;gt;describe_by_data( wa_kyuyono ).
lo_structdescr ?= lo_typedescr.
lt_components_out = lo_structdescr-&amp;gt;get_components( ).
CLEAR: lv_offset, lv_offset_str.
LOOP AT lt_components_out INTO ls_component.
  l_tabix = sy-tabix.
  CLEAR: lo_elemdescr, lv_offset_data.
  lo_elemdescr ?= ls_component-type.
  IF lo_elemdescr-&amp;gt;type_kind EQ 'D'.
    l_length = '8'.
  ELSE.
    l_length = lo_elemdescr-&amp;gt;output_length.
  ENDIF.
  cl_abap_list_utilities=&amp;gt;read_from_display_layout(
                                    EXPORTING
                                      display_data   = lv_input_data
                                      display_offset = lv_total_offset
                                      display_length = l_length
                                    IMPORTING
                                      field = lv_offset_data ).
  lv_offset = l_length.
  ADD lv_offset TO lv_total_offset.
  "assign data to structure
  UNASSIGN &amp;lt;ls_field&amp;gt;.
  ASSIGN COMPONENT ls_component-name OF STRUCTURE wa_kyuyono TO &amp;lt;ls_field&amp;gt;.
  IF &amp;lt;ls_field&amp;gt; IS ASSIGNED.
    &amp;lt;ls_field&amp;gt; = lv_offset_data.
  ENDIF.
ENDLOOP.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Oct 2017 08:32:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-for-double-width-japanese-characters/m-p/564758#M21778</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2017-10-04T08:32:34Z</dc:date>
    </item>
  </channel>
</rss>

