Giter VIP home page Giter VIP logo

Comments (8)

gerhard-bnc avatar gerhard-bnc commented on June 19, 2024 1

I tried to push my changes to GitHub fork and in GitHub Create a pull request. For unknown reason too many code differences due to different capitalization of keywords (and these are in the unchanged code, not in the code I pretty printed).
I give up and would want to cancel the change, it has taken way too much time already.
The suggested coding change still attached. It takes care of this issue (1195) as well as issue1199
Github-change-method CONVERT_TO_TABLE.docx

from abap2xlsx.

gerhard-bnc avatar gerhard-bnc commented on June 19, 2024 1

Hi sandraros, sorry, but I now see my copying of code into the word doc was incomplete. For 1.2.3 new it should have been:

*--------------------------------------------------------------------*
* Start of convert content
*--------------------------------------------------------------------*
    lv_index = lines( me->sheet_content ) + 1. "in case iv_begin_row too big

    LOOP AT me->sheet_content ASSIGNING <ls_sheet_content> WHERE cell_row >= iv_begin_row.
      "iv_begin_row might be an empty row with no entries in me->sheet_content
      lv_index = sy-tabix.

      IF iv_empty_rows = abap_true.
        DATA(lv_num_rows) = <ls_sheet_content>-cell_row - iv_begin_row.
        DO lv_num_rows TIMES.
          "add leading empty rows
          APPEND INITIAL LINE TO <lt_data> ASSIGNING <ls_data>.
        ENDDO.
      ENDIF.

      EXIT.
    ENDLOOP.

before the loop extracting the data:

    LOOP AT me->sheet_content ASSIGNING <ls_sheet_content> FROM lv_index.
      AT NEW cell_row.
...

I had for SE80 exactly the pretty printer setting that you quote. When finally (with help from colleague of mine) getting my forked code uploaded to Github, it showed code with mixed case in parts of the class that I did not touch. At that point I quit and too hastily prepared the word doc that I had attached.

from abap2xlsx.

sandraros avatar sandraros commented on June 19, 2024

I recommend using methods, not SHEET_CONTENT directly (alas, for unknown reason, SHEET_CONTENT was not defined as READ-ONLY or private).

I have nothing against adding an optional parameter (it has been done so many times to permit improvements). Could you propose a PR please?

from abap2xlsx.

gerhard-bnc avatar gerhard-bnc commented on June 19, 2024

Thanks for immediate reply and your comment on SHEET_CONTENT, was wondering the same (alas, too little explanation and comments in the code for such things).
I never did any PR here. Will check in next days what that means...

from abap2xlsx.

sandraros avatar sandraros commented on June 19, 2024

Briefly: you have to fork the project to your GitHub account ("fork" button in GitHub), create a new branch, point ZABAPGIT to this branch, do your changes, push to your GitHub fork and then in GitHub you can click on "Create a pull request".

from abap2xlsx.

sandraros avatar sandraros commented on June 19, 2024

It's the problem of the Git diff which is case-sensitive and the SAP SE80 pretty printer which is unable to recognize which pretty printer method to choose (there's one by user for any repository). But ADT seems to recognize it (I never used it).

abap2xlsx requires either

  • this setting in ADT (Ctrl+Shift+F1 to pretty print, it may work either on the selected lines or the whole code):
    image
  • or this SE80 setting (Shift+F1 to pretty print, it works on the whole code):
    image

So, ADT is much better for using the pretty print of abap2xlsx.

Or you do it manually in SE80, you are helped by abapLint which checks the incorrect indenting or lower/upper case, when the pull request is created in the abap2xlsx repository. Also, note that SE80 may indent the selected lines of code by using the right context menu > Format > Format Selection.

from abap2xlsx.

sandraros avatar sandraros commented on June 19, 2024

Thank you. I will try to implement your code. Adding here the lines of your DOCX document.

1 ZCL_EXCEL_WORKSHEET meth. CONVERT_TO_TABLE

1.1 New optional param.

IV_EMPTY_ROWS	TYPE ABAP_BOOL  DEFAULT ABAP_FALSE	Flag Keep empty rows

1.2 Coding change 1

1.2.1 compare

image

1.2.2 old

*--------------------------------------------------------------------*
* Start of convert content
*--------------------------------------------------------------------*
    READ TABLE me->sheet_content TRANSPORTING NO FIELDS WITH KEY cell_row = iv_begin_row.
    IF sy-subrc EQ 0.
      lv_index = sy-tabix.
      ENDIF.

1.2.3 new

*--------------------------------------------------------------------*
* Start of convert content
*--------------------------------------------------------------------*
    lv_index = lines( me->sheet_content ) + 1. "in case iv_begin_row too big

    LOOP AT me->sheet_content ASSIGNING <ls_sheet_content> WHERE cell_row >= iv_begin_row.
      "iv_begin_row might be an empty row with no entries in me->sheet_content
      lv_index = sy-tabix.

      IF iv_empty_rows = abap_true.
        DATA(lv_num_rows) = <ls_sheet_content>-cell_row - iv_begin_row.
        DO lv_num_rows TIMES.
          "add leading empty rows
          APPEND INITIAL LINE TO <lt_data> ASSIGNING <ls_data>.
        ENDDO.
      ENDIF.

1.3 Coding change 2

1.3.1 compare
image

1.3.2 old

IF <ls_data> IS INITIAL.

1.3.3 new

IF <ls_data> IS INITIAL AND iv_empty_rows = abap_false.

from abap2xlsx.

sandraros avatar sandraros commented on June 19, 2024

Thanks for checking!

from abap2xlsx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.