Giter Site home page Giter Site logo

Comments (4)

AlexandreHT avatar AlexandreHT commented on July 24, 2024

I don't have issues on my system in French, what's the actual result?
Have you tried changing the language to sy-langu in format_message

from abap-logger.

cavabap avatar cavabap commented on July 24, 2024
can_log_batch_msgs, 'Did not log BDC return messages correctly'
can_log_chained_exceptions: 'Did not log chained exception correctly'

The Details are,
"Erwartet [Specify the object to be tested], tatsächlich [Geben Sie das zu testende Objekt an]"
which translates to,
"Expected [Specify the object to be tested], actual [Geben Sie das zu testende Objekt an]"

I'm actually logged in German. But when the unit tests are executing in Eclipse / SAP GUI, sy-langu = 'E'.
When zcl_logger->lcl_test->get_messages ->call function 'BAL_LOG_MSG_READ' is called, the SAP system returns the messages in German.

Even when I alter the call to 'BAL_LOG_MSG_READ' with the language parameter, the messages are still returned in German.

call function 'BAL_LOG_MSG_READ'
        exporting
          i_s_msg_handle = msg_handle
          i_langu = 'E'
        importing
          e_s_msg        = msg_detail
          e_txt_msg      = msg_text. "messages are still in German!

When I dived into the function module 'BAL_LOG_MSG_READ' and debugged it, I found the text was set in the Function Module 'BAL_DSP_TEXT_MSG_READ' with the following code.

* when language is current language, use MESSAGE INTO
  IF i_langu = sy-langu.
    MESSAGE ID     i_msgid
            TYPE   'S'
            NUMBER i_msgno
            WITH   i_msgv1
                   i_msgv2
                   i_msgv3
                   i_msgv4
            INTO   e_message_text.
    EXIT.
  ENDIF.

i_langu = 'E' and sy-langu = 'E' - but for some reason the text is being returned in German! This is very strange.
I assume this is somehow because my Eclipse / SAP GUI login language is German - but the Unit Tests are being executed in English and somehow this is messing the MESSAGE statement up.

format_message is returning the text in English (as it should).

This affects both SAP GUI and Eclipse.

Changing the FORMAT_MESSAGE language from 'E' to sy-langu didn't change anything. It always returned the messages in English...
I did manage to fix the problem by exchanging CALL FUNCTION 'FORMAT_MESSAGE' by using MESSAGE directly.
This way I get the same 'curious' language behaviour and the test (that the texts are the same) passes.

  method format_message.
"    call function 'FORMAT_MESSAGE'
"      exporting
"        id        = id
"        lang      = 'E'
"        no        = no
"        v1        = v1
"        v2        = v2
"        v3        = v3
"        v4        = v4
"      importing
"        msg       = msg
"      exceptions
"        not_found = 1
"        others    = 2.
"*      TODO: raise abap unit
    MESSAGE ID id TYPE 'S' NUMBER no WITH v1 v2 v3 v4 INTO msg.
  endmethod.

Obviously my fix is dependant on the the implementation of BAL_LOG_MSG_READ / BAL_DSP_TEXT_MSG_READ and the behaviour of MESSAGE during Unit Tests.

Cheers

Martin

from abap-logger.

FinkeFlo avatar FinkeFlo commented on July 24, 2024

Yes this will fix the issue.
@AlexandreHT i think you don't have this issue because there is no translated message in French?

from abap-logger.

cavabap avatar cavabap commented on July 24, 2024

That fix doesn't work for me...

from abap-logger.

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.