Application Development and Automation 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: 
Read only

Creating Sales Text By BAPI

Former Member
0 Likes
2,853

Hi

I am uploading sales text by using bapi BAPI_MATERIAL_SAVEDATA ...

when i am upload the long text it displays Material Created or extenden but it does appear in mm03 sales text...

I have coded like this..

{ LOOP AT IT_LT.

BAPIMATHEAD-MATERIAL = IT_LT-MATNR.

BAPIMATHEAD-SALES_VIEW = 'X'.

    • Sales data

BAPI_MVKE-SALES_ORG = IT_LT-VKORG.

BAPI_MVKE-DISTR_CHAN = IT_LT-VTWEG.

BAPI_MVKEX-SALES_ORG = IT_LT-VKORG.

BAPI_MVKEX-DISTR_CHAN = IT_LT-VTWEG.

    • LONG TXT

IT_MLTX-APPLOBJECT = 'MKVE'.

IT_MLTX-TEXT_NAME = IT_LT-MATNR.

IT_MLTX-TEXT_ID = '0001'.

IT_MLTX-LANGU = 'E'.

IT_MLTX-LANGU_ISO = 'EN'.

IT_MLTX-FORMAT_COL = '*'.

IT_MLTX-TEXT_LINE = IT_LT-LTEXT.

APPEND IT_MLTX TO IT_MLTX.

CLEAR IT_MLTX.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

HEADDATA = BAPIMATHEAD

SALESDATA = BAPI_MVKE

SALESDATAX = BAPI_MVKEX

IMPORTING

RETURN = IT_RETURN1

TABLES

MATERIALLONGTEXT = IT_MLTX.

READ TABLE IT_RETURN1 WITH KEY TYPE = 'S'.

IF SY-SUBRC = 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = SPACE

IMPORTING

RETURN = IT_RETURN1.

ENDLOOP }

Can any one

1 ACCEPTED SOLUTION
Read only

former_member404244
Active Contributor
0 Likes
1,992

HI,

For texts use the FM "SAVE_TEXT " and see.

Regards,

Nagaraj

7 REPLIES 7
Read only

former_member404244
Active Contributor
0 Likes
1,993

HI,

For texts use the FM "SAVE_TEXT " and see.

Regards,

Nagaraj

Read only

0 Likes
1,992

Hi Nagaraj,

I have use save_text Fm .

When i am uploading the long text i can see the long text in stxh ( through FM read_text in se37..)

But can't see the long text in mm03 sales text...

i have Coded like this

{

LOOP AT IT_LT.

TB_LINES-TDFORMAT = '*'.

TB_LINES-TDLINE = IT_LT-LTEXT.

APPEND TB_LINES.

CLEAR TB_LINES.

THEAD-TDOBJECT = 'MVKE'.

CONCATENATE IT_LT-MATNR IT_LT-VKORG IT_LT-VTWEG INTO

THEAD-TDNAME.

THEAD-TDID = '0001'.

THEAD-TDSPRAS = 'E'.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = THEAD

INSERT = 'X'

TABLES

LINES = TB_LINES

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

.

IF SY-SUBRC = 0.

COMMIT WORK AND WAIT.

ENDIF.

}

Read only

0 Likes
1,992

Hello

Instead commit work and wait use:


    CALL FUNCTION 'COMMIT_TEXT'
       EXPORTING
            OBJECT   = THEAD-TDOBJECT
            NAME     = THEAD-TDFNAME.

Read only

Former Member
0 Likes
1,992

Hello

Try this instead your commit:


CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = IT_RETURN1.

And

IT_MLTX-APPLOBJECT = 'MVKE'. <- not MKVE

Read only

Former Member
0 Likes
1,992

Hi ,

    • LONG TXT

IT_MLTX-APPLOBJECT = 'MKVE'.

IT_MLTX-TEXT_NAME = IT_LT-MATNR.

here text aame would be material number+ sales org+distribution channel

for ex if material number is 366

sales org is 1000

dis channel is 10

then we should be passing

366100010

IT_MLTX-TEXT_ID = '0001'.

IT_MLTX-LANGU = 'E'.

IT_MLTX-LANGU_ISO = 'EN'.

IT_MLTX-FORMAT_COL = '*'.

IT_MLTX-TEXT_LINE = IT_LT-LTEXT.

APPEND IT_MLTX TO IT_MLTX.

CLEAR IT_MLTX.

Regards,

Himanshu

Read only

Former Member
0 Likes
1,992

Hi friends,

Thanks for Your Reply

Read only

0 Likes
1,992

hi,

could you share, how yuor issue resolved.

regards,

chinta