cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Script : to display the material description in two lines

Former Member
0 Kudos

Hi All,

I'm working on scripts.

the material description field is been passed from my driver program ..into the script..

Ex: &gs_final-maktx& ..

There r a number of other fields to be displayed ...after this field ....

Is there any option to split the 'Material description into two lines'?

Ex: at present it is :

This is material description

Requirement is:

This is material

description

I mean that there a number of field berfore and after this field......in the same line

I need to jst split the materia description ...& make it to appear in two lines.....!!

Expecting your suggestions....

Edited by: vidya vidya on Nov 11, 2008 3:17 PM

Edited by: vidya vidya on Nov 11, 2008 3:20 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

DATA : LV_TEXT like makt-maktx,

LV_LINE1(20),

LV_LINE2(20).

LV_TEXT = 'This is material description'.

CALL FUNCTION 'RKD_WORD_WRAP'

EXPORTING

TEXTLINE = LV_TEXT

DELIMITER = ' '

OUTPUTLEN = 20

IMPORTING

OUT_LINE1 = LV_LINE1

OUT_LINE2 = LV_LINE2

EXCEPTIONS

OUTPUTLEN_TOO_LARGE = 1

OTHERS = 2.

LV_LINE1 - contains 'This is material'

LV_LINE2 - contains 'description'

0 Kudos

Hi Srikanth,

Iam having similar kind of issue in SAP Scripts, Here my problem is iam having contious text which is coming form print progarm its more than 40 lines know in testing may be it can be more if it goes to production how could i handle this problem.

One more thing here these text is going out of page layout.

Please let me know if any possible solution.

Regards

Bhaskar

former_member181995
Active Contributor
0 Kudos

FM TEXT_SPLIT ?

..but i handled this by code.

DATA:      zzboldsx(18) TYPE c,
      zzboldsx2(18) TYPE c,
      zzboldsx3(18) TYPE c,
      zzboldsx4(18) TYPE c.
DATA: i_lines TYPE STANDARD TABLE OF tline WITH HEADER LINE ,
        r_lines TYPE tline,
        v_cnt LIKE sy-tabix.
CALL FUNCTION 'READ_TEXT'
    EXPORTING
      client                  = sy-mandt
      id                      = stxh-tdid
      language                = stxh-tdspras
      name                    = name
      object                  = stxh-tdobject
    TABLES
      lines                   = i_lines[]
    EXCEPTIONS
      id                      = 1
      language                = 2
      name                    = 3
      not_found               = 4
      object                  = 5
      reference_check         = 6
      wrong_access_to_archive = 7
      OTHERS                  = 8.
  IF sy-subrc = 0.
* Only 4 lines of Header text supported. Can add if needed
    LOOP AT i_lines INTO r_lines.
      CONDENSE r_lines-tdline NO-GAPS.
      v_cnt = v_cnt + 1.
      CASE v_cnt.
        WHEN 1.
          zzboldsx = r_lines-tdline.
        WHEN 2.
          zzboldsx2 = r_lines-tdline.
        WHEN 3.
          zzboldsx3 = r_lines-tdline.
        WHEN 4.
          zzboldsx4 = r_lines-tdline.
        WHEN OTHERS.
          EXIT.
      ENDCASE.
*   zzbolDSX =  i_lines-tdline .
    ENDLOOP.

0 Kudos

Hi Amit,

Thanks for your reply here text is coming in runtime and text is more then 40 lines currently,

it can be more... for other test case.

Please let me know if would suggest me any possible solution.

It will be very much appreciateable.

Thanking you,

Bhaskar

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

You can get the length of the text at runtime and then split it into 40 characters.Also you Can check out from your Functions about the maximum length that would appear during Production.

Also you can reduce the font size of the text.......Increase the window size......to bring it into the layout...

Former Member
0 Kudos

Hi Sreekanth ,

I feel this shld solve the problem.....adjustments need to be done for the remaining fields.....

Former Member
0 Kudos

Hi kesava,

thank you for the reply ,,,,

What if the splitting occurs in between words?

Former Member
0 Kudos

yes you can split 2 lines.

1st line : &gs_final-maktx+0(20)& ..

2nd line : &gs_final-maktx+20(20)& ..