23 - ABAP Programming - String Operations - CONDENSE and STRLEN

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ก.ย. 2024

ความคิดเห็น • 16

  • @madhusudanraogandi89
    @madhusudanraogandi89 10 วันที่ผ่านมา +1

    Good session ❤
    Thank you Rahul sir 🎉

  • @Gathering_wisdom
    @Gathering_wisdom หลายเดือนก่อน

    Sir if I take string st1 = ' wel come' .
    Then how can we remove that space? In other programing language there is way to remove space within same string

  • @dhevak-ece6915
    @dhevak-ece6915 9 หลายเดือนก่อน +1

    Sir why we are specifying (2) in the bracket of length?

    • @sapabapbyrahulmehta
      @sapabapbyrahulmehta  9 หลายเดือนก่อน

      This is the length of the variable LV_LENGTH.

  • @lunalovegood-vi7ss
    @lunalovegood-vi7ss 7 หลายเดือนก่อน +1

    How to use condense for df16_dec data type?

    • @sapabapbyrahulmehta
      @sapabapbyrahulmehta  7 หลายเดือนก่อน +1

      You need to do type casting. Take another variable of character type, pass your variable value to that character variable and apply condense on to that new variable.

  • @nagajyothidavuri761
    @nagajyothidavuri761 2 หลายเดือนก่อน +1

    Hello sir,
    i am giving
    DATA(lv_input) = 'Welcome to home'.
    DATA lv_length(5) TYPE n.
    lv_length = strlen( lv_input ).
    WRITE:/ lv_length.
    in this i am getting output is: 00015
    i want to remove leading zeroes is this possible?
    and DATA(lv_input) = 'Welcome to home'.
    DATA(lv_length) = strlen( lv_input ).
    WRITE:/ lv_length.
    i wrote like this i am getting output like : 15
    why?

    • @sapabapbyrahulmehta
      @sapabapbyrahulmehta  2 หลายเดือนก่อน

      First is Explicit declaration , you declared the variable( LV_LENGTH) explicitly. If you want to remove the leading zero's. You can use SHIFT string operation or use the function module : CONVERSION_EXIT_ALPHA_OUTPUT. In the same playlist, you will be able to learn - SHIFT string operation. Now in the second case, you are going for inline data declaration, so system is taking the length of the variable based upon the value Welcome to home, so it has leading space and then 15.

    • @nagajyothidavuri761
      @nagajyothidavuri761 2 หลายเดือนก่อน

      @@sapabapbyrahulmehta okay sir thank you so much

  • @EkanshDubey21
    @EkanshDubey21 4 หลายเดือนก่อน

    Hi Sir, Ekansh this side, i have doubt regarding strlen. for example : strlen( 'ABAP' ) returns length 4, strlen( ' ABAP' ) with 2 leading spaces returns length 6, but strlen( 'ABAP ' ) with 2 trailing spaces returns only length 4 . Does this mean strlen ignores trailing spaces in the string ? Could you please check this and let me know.

  • @siddhantsahu5040
    @siddhantsahu5040 ปีที่แล้ว

    Without using STRLEN how to find the length of the string sir..??

    • @sapabapbyrahulmehta
      @sapabapbyrahulmehta  ปีที่แล้ว

      Hello Siddhant, As per my knowledge, STRLEN inbuilt function is used to calculate the String length in SAP. At the same time, we can achieve everything through Writing our own code also, Using Do loop and taking the characters one by one , we can calculate the length , but that will be more complex way to do this.