Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Where I am wrong (Points will be assigned to those who solve it)

Former Member
0 Kudos

Where am I wrong? Should be somewhere in BAPITEXT or MATERIALLONGTEXT

It s urgent. Points will be assigned to those who solve it

I would like to change text in MM02->Basic data1->Basic data text (in biggest window) for material e.g 383

&----


*& Report ZTEXT

*&

&----


*&

*&

&----


REPORT ZTEXT.

DATA: lines LIKE tline OCCURS 0 WITH HEADER LINE,

Ltexts like thead-tdname.

DATA: BEGIN OF XHEAD.

INCLUDE STRUCTURE THEAD.

DATA: END OF XHEAD.

data: BAPITEXT like BAPI_MLTX OCCURS 0 WITH HEADER LINE.

CLEAR ltexts.

Ltexts+00(18) = '000000000000000383'.

  • tp_name+00(06) = '000000'.

  • tp_name+06(12) = <ta_output>-matnr.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = 'GRUN'

language = '5'

name = Ltexts

object = 'MATERIAL'

TABLES

lines = lines

  • IMPORTING

  • header = xhead

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

LOOP AT LINES.

WRITE:/ LINES-TDLINE.

LINES-TDLINE+0(2) = 'oo'.

modify lines.

ENDLOOP.

BAPITEXT-TEXT_NAME = LINES-TDLINE.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

*"----


""Lokale Schnittstelle:

EXPORTING

HEADDATA-MATERIAL = '000000000000000383'.

TABLES

MATERIALLONGTEXT = BAPITEXT.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

IN MATERIALLONGTEXT , you are passing an internal table BAPI_TEXT. But no where you are appening the values into it.

All you are doing is just populating the header line...

so append the BAPI_TEXT with values and if you want multiple lines you should move this before ENDLOOP.

5 REPLIES 5

Former Member
0 Kudos

Hello,

I know it. But I will not tell you, as I don't want points.

Please have a look at this link (espacially step 2 "Use a good subject line"): https://wiki.sdn.sap.com/wiki/x/FgQ

Thank you!

Best regards

Stephan

Former Member
0 Kudos

IN MATERIALLONGTEXT , you are passing an internal table BAPI_TEXT. But no where you are appening the values into it.

All you are doing is just populating the header line...

so append the BAPI_TEXT with values and if you want multiple lines you should move this before ENDLOOP.

0 Kudos

Hi,

Try this Function Module ,

SAVE_TEXT.

CALL FUNCTION 'SAVE_TEXT'
    EXPORTING
      CLIENT          = SY-MANDT
      HEADER          = THEAD
      SAVEMODE_DIRECT = 'X'
    TABLES
      LINES           = LINES
    EXCEPTIONS
      ID              = 1
      LANGUAGE        = 2
      NAME            = 3
      OBJECT          = 4
      OTHERS          = 5.
  IF SY-SUBRC <> 0.


    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

Regards,

Balakumar.G.

Reward points if helpful.

Former Member
0 Kudos

Try using SAVE_TEXT FM.

For more information of how to use this FM, check the below link.

[http://help.sap.com/saphelp_40b/helpdata/en/d6/0db8ef494511d182b70000e829fbfe/content.htm|http://help.sap.com/saphelp_40b/helpdata/en/d6/0db8ef494511d182b70000e829fbfe/content.htm]

Hope this helps.

Thanks,

Balaji

0 Kudos

No, This is not what she asked . She wanted to change the long text via BAPI and her question was , it was not updating it.