Update sales text in MM02
Hi Experts,
We are trying to upload sales text in MM02 transaction, which does not have screen field. Please advise whether I can use SAVE_TEXT or BAPI to change material. Sample code will be very much helpful.
Thanks in advance.
Hi
You have to use the CREATE_TEXT fun module and to pass the paramters OBJECT,ID, OBJECTNAME and LANGUAGE correctly after declaring them correctly
see the sample code for long text creation
REPORT zmm_longtext
NO STANDARD PAGE HEADING
LINE-SIZE 255.
Internal Table for Upload of Long Texts Data
DATA: BEGIN OF itab1 OCCURS 0,
matnr LIKE mara-matnr, " Material
text1 LIKE tline-tdline, " Long Text
text2 LIKE tline-tdline, " Long Text
text3 LIKE tline-tdline, " Long Text
text4 LIKE tline-tdline, " Long Text
text5 LIKE tline-tdline, " Long Text
text6 LIKE tline-tdline, " Long Text
text7 LIKE tline-tdline, " Long Text
text8 LIKE tline-tdline, " Long Text
text9 LIKE tline-tdline, " Long Text
text10 LIKE tline-tdline, " Long Text
text11 LIKE tline-tdline, " Long Text
text12 LIKE tline-tdline, " Long Text
text13 LIKE tline-tdline, " Long Text
text14 LIKE tline-tdline, " Long Text
text15 LIKE tline-tdline, " Long Text
text16 LIKE tline-tdline, " Long Text
text17 LIKE tline-tdline, " Long Text
text18 LIKE tline-tdline, " Long Text
text19 LIKE tline-tdline, " Long Text
text20 LIKE tline-tdline, " Long Text
text21 LIKE tline-tdline, " Long Text
text22 LIKE tline-tdline, " Long Text
text23 LIKE tline-tdline, " Long Text
text24 LIKE tline-tdline, " Long Text
text25 LIKE tline-tdline, " Long Text
END OF itab1.
Internal Table for Upload of Long Texts Data
DATA: BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr, " Material
text LIKE tline-tdline, " Long Text
END OF itab.
To create Long Text lines for CREATE_TEXT function module
DATA:BEGIN OF dt_lines OCCURS 0.
INCLUDE STRUCTURE tline. " Long Text
DATA:END OF dt_lines.
Variable declarations for CREATE_TEXT function module
DATA : dl_name TYPE thead-tdname, " Object Name
dl_lan TYPE thead-tdspras, " Language
gv_matnr TYPE matnr.
Constants
CONSTANTS:
Object ID for Long Text of Material Basic Data 1
c_best TYPE thead-tdid VALUE 'GRUN',
c_material TYPE thead-tdobject VALUE 'MATERIAL'. " Object
Parameters
PARAMETERS p_file LIKE rlgrap-filename.
At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Get the F4 Values for the File
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
Start Of Selection
START-OF-SELECTION.
*To Upload Flat file
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = itab1
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.
SORT itab1 BY matnr.
LOOP AT itab1.
CLEAR gv_matnr.
SELECT SINGLE matnr INTO gv_matnr
FROM mara WHERE bismt = itab1-matnr.
IF itab1-text25 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text25.
APPEND itab.
ENDIF.
IF itab1-text24 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text24.
APPEND itab.
ENDIF.
IF itab1-text23 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text23.
APPEND itab.
ENDIF.
IF itab1-text22 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text22.
APPEND itab.
ENDIF.
IF itab1-text21 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text21.
APPEND itab.
ENDIF.
IF itab1-text20 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text20.
APPEND itab.
ENDIF.
IF itab1-text19 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text19.
APPEND itab.
ENDIF.
IF itab1-text18 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text18.
APPEND itab.
ENDIF.
IF itab1-text17 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text17.
APPEND itab.
ENDIF.
IF itab1-text16 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text16.
APPEND itab.
ENDIF.
IF itab1-text15 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text15.
APPEND itab.
ENDIF.
IF itab1-text14 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text14.
APPEND itab.
ENDIF.
IF itab1-text13 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text13.
APPEND itab.
ENDIF.
IF itab1-text12 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text12.
APPEND itab.
ENDIF.
IF itab1-text11 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text11.
APPEND itab.
ENDIF.
IF itab1-text10 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text10.
APPEND itab.
ENDIF.
IF itab1-text9 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text9.
APPEND itab.
ENDIF.
IF itab1-text8 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text8.
APPEND itab.
ENDIF.
IF itab1-text7 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text7.
APPEND itab.
ENDIF.
IF itab1-text6 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text6.
APPEND itab.
ENDIF.
IF itab1-text5 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text5.
APPEND itab.
ENDIF.
IF itab1-text4 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text4.
APPEND itab.
ENDIF.
IF itab1-text3 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text3.
APPEND itab.
ENDIF.
IF itab1-text2 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text2.
APPEND itab.
ENDIF.
IF itab1-text1 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text1.
APPEND itab.
ENDIF.
CLEAR itab.
ENDLOOP.
DELETE itab WHERE matnr EQ ' '.
Upload the Texts
SORT itab BY matnr.
LOOP AT itab.
dt_lines-tdformat = 'ST'.
dt_lines-tdline = itab-text.
APPEND dt_lines.
dl_lan = sy-langu.
dl_name = itab-matnr.
Call the Function Module to Create Text
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = c_best
flanguage = dl_lan
fname = dl_name
fobject = c_material
save_direct = 'X'
fformat = '*'
TABLES
flines = dt_lines
EXCEPTIONS
no_init = 1
no_save = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE:/ 'Long Text Creation failed for Material'(001),
itab-matnr.
ELSE.
WRITE:/ 'Long Text Created Successfully for Material'(002),
itab-matnr.
ENDIF.
AT END OF matnr.
REFRESH dt_lines.
ENDAT.
ENDLOOP.
<b>Reward points for useful Answers</b>
Regards
Anji
Similar Messages
-
Problem in Updating sales text in MM02 via BDC
Hi All,
I've created a BDC to update the Sales text for MM02. As the no of tabs for the view in MM02 are different for different materials, wrong tabs are selected while executing the BDC for different materials. I need to always select Sales text in the view.
Kindly suggest.
Thanks and Regards,
NehaHi,
If you are only updating the sales text, then why not use function module SAVE_TEXT?
refresh : headerl, itab3.
headerl-tdobject = 'MVKE'.
headerl-tdname = '000000000300000560000101'. "(Material : 000000000300000560, Sorg : 0001, Dist channel: 01)
headerl-tdid = '0001'.
headerl-tdspras = 'E'.
append headerl.
move '*' to itab3-tdformat.
move 'Testing sales text' to itab3-tdline.
append itab3.
call function 'SAVE_TEXT'
exporting
header = headerl
insert = 'X'
savemode_direct = 'X'
tables
lines = itab3
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
Vinod
Edited by: Vinod Kumar on May 26, 2010 12:48 PM -
Mm02 - Sales text view update?
Hi Friends,
I am working on the material master change (i.e MM02 transaction) and I need to upload Material master u2013sales text view and purchase order text view and all other additional data views.
I have updated one material in recording mode (i.e through SHDB transaction).
I am unable to find the sales text field name. But I find BDC_SUBSCR in my recording.
Pls find the below recording log.
SAPLMGMM 4040 X
BDC_OKCODE =BU
BDC_SUBSCR SAPLMGMM 2010TABFRA1
BDC_SUBSCR SAPLMGD1 1004SUB1
MAKT-MAKTX test material desc XXX
BDC_SUBSCR SAPLMGD1 2121SUB2
Pls let me know how to update sales text view and po text view in MM02 transaction.
Thanks in advance.
Regards
raghuYou have to use FM SAVE_TEXT to upload sales text and purchase order test.
You can't record a BDC for custom controls like text editor.
MOVE V_MATNR TO tname-tdname.
MOVE 'MARA' TO TNAME-TDOBJECT.
MOVE 'SL1 TO TNAME-TDID.
MOVE SY-LANGU TO TNAME-TDSPRAS.
APPEND TNAME
TXTLINES-TDFORMAT = '*'.
TXTLINES-TDLINE = 'This is your purchase order text'.
APPEND TXTLINES.
CLEAR TXTLINES.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = TNAME
INSERT = 'X'
SAVEMODE_DIRECT = 'X'
*OWNER_SPECIFIED = ' '
*LOCAL_CAT = ' '
IMPORTING
*FUNCTION =
NEWHEADER = TNAME
TABLES
LINES = TXTLINES
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. -
I'm trying to update sales text in Material master MM02 through LSMW direct Input method
My source file is as below
H MATNRSALESORGDC 0001 E
I TESTING TESTING TESTING BY
I for QW tttt
I tttttttttttttttttttttttttt
I tttttttttttttttttttttttttt
H MATNRSALESORGDC 0001 E
I TESTING TESTING TESTING BY
I TESTING
Object is MVKE
Once the Direct Input method is done I'm getting a success message of the texts being created but the texts are not getting updated . How to trace where is it failing or should I maintain any tables before loading texts Guide me as I have to load many material texts
I tried to load a different material with same sales org it is loading . I'm not able to find the difference between both the materials
did anyone faced this issue can u guide me how to figure it out
Thanks
NaginiMy BI recording is not showing the Long Text for Sales Text at all. Can anybody help?
MM02 Change Material &
SAPLMGMM 0060
BDC_CURSOR RMMG1-MATNR
BDC_OKCODE =ENTR
RMMG1-MATNR 17783622846 MATNR Material Number
SAPLMGMM 0070
BDC_CURSOR MSICHTAUSW-DYTXT(08)
BDC_OKCODE =ENTR
MSICHTAUSW-KZSEL(08) X KZSEL_08 Checkbox
SAPLMGMM 0080
BDC_CURSOR RMMG1-VTWEG
BDC_OKCODE =ENTR
RMMG1-VKORG jp01 VKORG Sales Organization
RMMG1-VTWEG 01 VTWEG Distribution Channel
SAPLMGMM 4040
BDC_OKCODE =TEAN
BDC_SUBSCR SAPLMGMM
BDC_SUBSCR SAPLMGD1
MAKT-MAKTX POLYSILAZANE NP110-0 MAKTX Material Description (Short Text)
BDC_SUBSCR SAPLMGD1
SAPLMG19 1000
BDC_CURSOR DESC_LANGU_NEW
BDC_OKCODE =ENTR
DESC_LANGU_NEW ;
SAPLMGMM 4040
BDC_OKCODE =BU
BDC_SUBSCR SAPLMGMM
BDC_SUBSCR SAPLMGD1
MAKT-MAKTX POLYSILAZANE NP110-0 MAKTX Material Description (Short Text)
BDC_SUBSCR SAPLMGD1
BDC_CURSOR LANG_TC_TAB_TC-SPTXT(
SAPLSEUO 0300
BDC_CURSOR G_LINE_1
BDC_OKCODE =YES -
Sales Text of material master using create_text
Hi All,
I need to update Sales Text field for existing materials in material master.
(mm02->sales Text view>sales text)
This text will be of 40-50 char length.
Now if i use CREATE_TEXT with following paramters, no text is getting updated in the material master.
Import Paramters:
FID: 0001
FLANGUAGE: EN
FNAME: <material no><sales org><Dist channel>
FOBJECT: MVKE
SAVE-DIRECT : X
FFORMAT: *
Tables:
FLINES: <Sales text>
After execution of this FM, no error message is popped up.
Is it the right way to update the sales Text or any changes need to be done in defining paramters in Function module?
Kindly Guide me.....
Regards
PavanMArtin,
Can you inform me what all paramters to be passed in SAVE-TEXT module?
Regards
Pavan -
Uploading sales text and Purchase order text for material master
Hi,
I have created, material master with LSMW byt not updated SALES TEXT and Purchase order text with LSMW now i want to uplaod the sales and po text for material master can you give some link or ref. code to upload the text i have near 1000 items for which i want to uplaod text when i have done the recording with SHDB i have not found filed in recording.
regards,
zafarHi,
I have made the code in se38
as below but still it is not working
REPORT ZTEST_TEXT.
data: headerl like thead occurs 0 with header line.
data itab3 like tline occurs 0 with header line.
headerl-tdobject = 'MATERIAL'.
headerl-tdname = '00000000000LSMW123'. "(Material : 000000000300000560, Sorg : 0001, Dist channel: 01)
headerl-tdid = 'BEST'.
headerl-tdspras = 'E'.
append headerl.
move '*' to itab3-tdformat.
move 'Testing PO text' to itab3-tdline.
append itab3.
call function 'SAVE_TEXT'
exporting
header = headerl
insert = ' '
savemode_direct = ' '
tables
lines = itab3
exceptions
id = 1
language = 2
name = 3
object = 4
others = 5.
IF SY-SUBRC = 0.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
OBJECT = headerl-tdobject
NAME = headerl-tdname.
ENDIF.
break-point.
regards,
zafar -
How to update the sales text in the Sales Order.
Dear all,
I want to Update the sales text in the Sales Order. I used the "CREATE_TEXT" but i couldn't update using it.
Can u please guide me, how to use the Function Module to update the sales Order line item text values.
Thank U
UwanthiHI
Check this link
User Exit to update Sales order text (Terms of delivery) on saving it
Regards,
Krishna -
Update Sale Order Header Text through Enhancement
Hi Experts,
I Have a requirement to update the sale order Header Text , when the sale order is opened in VA02 and saved.
Here in I tried using edit_text, it updates sale order header text directly in DB during run time even before the save action is completed.
But I need to just fill the header text and that has to be saved during the save action only.
I tried coding the same in the user exit (userexit_save_document) but this user exit gets triggered only when there is some changes made to the document when opened in VA02 & Saved.
Is there any user exist to pass sale Order Header text and save when save button is clicked irrespective of the document been changed or not.
Thanks in advance
SathishHi Brad Bohn,
My actual requirement is to trigger an Idoc when the user goes to VA02 transaction and clicks save.
IDoc gets triggered only when there is some changes to that document, that is through NAST table entry based on the output configurations in NACE transaction.
Now that the user wants to trigger an IDoc even if there is no change (ie. to reprocess the IDoc) when he just opens a sale order in VA02 and click save.
It is not possible to trigger an IDoc through configurations when there is no actual change in VA02 and saved.
So it has to be forcefully sent by making some additions to the Order through coding, so I choose that Text box to fill some additional data and save .
Kindly Let me Know any thing could be done for this scenario.
Thanks in advance
Sathish -
How to insert sales text (MM02) into a single record of a Ztable.
Hi,
I'm extracting data from different data base tables and populating a Ztable which has Matnr as primary key and sales text as a field.
I have already used READ_TEXT to display the text and it is displayed in multiple records which in turn leads to duplication of Material numbers.
Now I want to avoid duplication of records (Matnr) as this being a primary record, and display the sales text of a particular material number into one single record.
Can anyone tell me how to insert sales text (MM02) transaction into one single record.
Thanks,
Govindsorry i am not enough clear about your requirement...
as i can understand i am explaining to you.
suppose your itab contains repaeating matnr.
matnr
1
1
2
2
2
3
3
like this.
data : text(200),
matnr like mara-matnr.
loop at itab.
call READ_TEXT fnmodule.
loop at tline.
concatenate text tline-tdline into text.
endloop.
matnr = itab-matnr.
at end of matnr.
itab1-matnr = matnr.
itab1-text = text.
append itab1.
clear text.
endat.
endloop.
NB change the code as per your requirement
regards
shiba dutta -
Updating Sales Order Header Text
Hello Experts,
Could you please help me in knowing how to update or maintain the Sales Order Header Texts programatically while creation of sales Orders.
Here the scenario is ---Sales orders are getting created inCRM and there they are maintaining some text from webshop. Immediately a sales order will also gets created in ECC.
Now i would like to know how to do that from ECC side?? Please help...
Br,
AnilHi,
I guess you'd have to find a BADI or user exit to update the texts in ECC. Check which IDOC brings the data from CRM to ECC. And the segment that carries the TEXTs. Then in the BADI you may either pass the date to appropriate fields or call the SAVE_TEXT function module in update task.
Regards
Prasenjit -
Problem in Material master sales text update
Hi,
I have make the LSMW for uploading material master sales text update by using standad batch / direct input object 001 program /SAPDMC/SAP_LSMW_IMPORT_TEXTS but as the formate of NAME required is as below
Materila code 18 Char SALES ORG 4 CHAR DIS. CHANNEL 2 CHAR total 24 char but in our system some material code is only 6 CHAR e.g ABCXYZ now when we pass the value for name
ABCXYZ SORGDC , it works OK we have to add blank spaces between material code asnd sales organuization so that total lenght of material should be 18 char so is there any option for this insted of addin gblank spaces because for each material code lenght is diffrent due to external number range .
regards,
zafar
Moderator Message: Search before you post. If you fail to get an answer, type a question, spell-check it and post it here.
Edited by: kishan P on Feb 16, 2011 4:47 PMfrom http://help.sap.com/saphelp_erp2005/helpdata/en/f4/b49e8c453611d189710000e8322d00/content.htm
Text Entry Area
Type your text into the text entry lines. You can type continuously: SAPscript fills your text using a line length of 72 characters as soon as you choose ENTER or a function.
To enter text in the line editor continuously, the checkbox Automatic tab at field end must be marked. For more information on setting automatic tabbing, see Setting Automatic Tabbing and Entering Text.
Note that the line editoru2019s text filling has no influence on the final appearance of the text. Your text is formatted no earlier than at the time it is displayed or printed. For more information, see Previewing and Printing SAPscript Documents. -
Maintain sales text View through BAPI_MATERIAL_SAVEDATA
Hi,
in BAPI_MATERIAL_SAVEDATA, can we maintain the Sales Text view in mm02 through this BAPI.
Regards,
Masoom AliHi,
Fill the data in BAPI structure "MATERIALLONGTEXT".
Pass following parameters in the structure
APPLOBJECT : MVKE
TEXT_NAME : {Material+SalesOrg+Dist Channel}
TEXT_ID : 0001
LANGU : sy-langu
FORMAT_COL : *
TEXT_LINE : "Sales text which is to be updated"
Regards
Vinod
Edited by: Vinod Kumar on Jul 23, 2010 4:49 PM -
How to pass text to Material Sales text, item note, while creating a sales
hi ,
i tried my level best with the help of friends (SDN).
but i am unable to reach the target.
my requirement is to enter text into
1) material sales text
2) item note
3) packing note
4) delivery text
5) purchase order text
6) production memo
in sales order using bapi. here i am submitting the code i wrote.
kindly some one help me.
thanks in advance
regards,
pavan
<i>report zmybapi1 .
data : my_order_header_in like bapisdhd1 occurs 0 with header line,
my_order_header_ix like bapisdhd1x occurs 0 with header line.
data : my_orderitemsin like bapisditm occurs 0 with header line,
my_orderitemsix like bapisditmx occurs 0 with header line.
data : my_order_partners like bapiparnr occurs 0 with header line.
data : my_return like bapiret2 occurs 0 with header line.
data : w_vbeln like bapivbeln-vbeln.
data:
my_orderschedulesin like bapischdl occurs 0 with header line,
my_orderschedulesinx like bapischdlx occurs 0 with header line.
data : my_orderconditionsin like bapicond occurs 0 with header line,
my_orderconditionsinx like bapicondx occurs 0 with header line.
<b>data : my_ordertext like bapisdtext occurs 0 with header line.</b>
start-of-selection.
this is to assign values to internal table my_order_header_in
my_order_header_in-doc_type = 'TA'.
my_order_header_in-sales_org = 'JNJ1'.
my_order_header_in-distr_chan = '02'.
my_order_header_in-division = 'J1'.
my_order_header_in-sales_off = 'JNJ1'.
my_order_header_in-purch_no_c = 'testbapipo'.
my_order_header_in-purch_date = sy-datum.
my_order_header_in-req_date_h = sy-datum.
append my_order_header_in.
this is to assign values to internal table my_orderitemsin
my_orderitemsin-material = '000000000000000727'.
my_orderitemsin-plant = 'JNJ1'.
my_orderitemsin-target_qu = 'EA'.
my_orderitemsin-target_qty = '10'.
append my_orderitemsin.
this is to assign values to internal table my_order_partners
my_order_partners-partn_role = 'AG'.
my_order_partners-partn_numb = '0000000011'.
append my_order_partners.
my_order_partners-partn_role = 'WE'.
my_order_partners-partn_numb = '0000000011'.
append my_order_partners.
This is to assign values to internal table my_orderschedulesin
my_orderschedulesin-itm_number = '10'.
my_orderschedulesin-itm_number = '000010'.
my_orderschedulesin-req_qty = '10'.
my_orderschedulesin-SCHED_LINE = '0001'.
append my_orderschedulesin.
*This is to assign values to internal table my_orderconditionin
my_orderconditionsin-itm_number = '000010'.
my_orderconditionsin-cond_type = 'ZPR1'.
my_orderconditionsin-cond_st_no = ''.
my_orderconditionsin-cond_count = '1'.
my_orderconditionsin-cond_value = '40'.
my_orderconditionsin-cond_p_unt = '1'.
my_orderconditionsin-currency = 'INR'.
append my_orderconditionsin.
<b> my_ordertext-itm_number = '00010'.
my_ordertext-text_id = '0002'.
my_ordertext-langu = 'EN'.
my_ordertext-langu_iso = 'EN'.
my_ordertext-text_line = 'This is for item note'.
my_ordertext-format_col = '*'.
my_ordertext-function = '009'.
*</b> <b>append my_ordertext.</b>
my_order_header_ix-updateflag = 'I'.
my_order_header_ix-doc_type = 'X'.
my_order_header_ix-sales_org = 'X'.
my_order_header_ix-distr_chan = 'X'.
my_order_header_ix-division = 'X'.
my_order_header_ix-sales_off = 'X'.
my_order_header_ix-purch_no_c = 'X'.
my_order_header_ix-purch_date = 'X'.
my_order_header_ix-req_date_h = 'X'.
append my_order_header_ix.
my_orderitemsix-updateflag = 'I'.
my_orderitemsix-material = 'X'.
my_orderitemsix-target_qty = 'X'.
my_orderitemsix-plant = 'X'.
my_orderitemsix-target_qu = 'X'.
append my_orderitemsix.
my_orderschedulesinx-updateflag = 'I'.
my_orderschedulesinx-sched_line = '0001'.
my_orderschedulesinx-req_qty = 'X'.
append my_orderschedulesinx.
my_orderconditionsinx-itm_number = '000010'.
my_orderconditionsinx-cond_type = 'ZPR1'.
my_orderconditionsinx-cond_st_no = 'X'.
my_orderconditionsinx-cond_count = 'X'.
my_orderconditionsinx-updateflag = 'U'.
my_orderconditionsinx-cond_value = 'X'.
my_orderconditionsinx-cond_p_unt = 'X'.
my_orderconditionsinx-currency = 'X'.
append my_orderconditionsinx.
call function 'BAPI_SALESORDER_CREATEFROMDAT2'
exporting
SALESDOCUMENTIN =
order_header_in = my_order_header_in
order_header_inx = my_order_header_ix
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
importing
salesdocument = w_vbeln
tables
return = my_return
order_items_in = my_orderitemsin
order_items_inx = my_orderitemsix
order_partners = my_order_partners
ORDER_SCHEDULES_IN = my_orderschedulesin
order_schedules_inx = my_orderschedulesinx
ORDER_CONDITIONS_IN = my_orderconditionsin
ORDER_CONDITIONS_INX = my_orderconditionsinx
ORDER_CFGS_REF =
<b>ORDER_TEXT = my_ordertext</b>
if sy-subrc ne 0.
write: my_return-message, my_return-number, my_return-type.
else.
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
write: my_return-message, my_return-number, my_return-type.</i>hi prashant,
i tried the save_text but , i am unable find the exact value which i have to enter for the field tdobject.
this is updated program as per u r instruction.
<b>Text object not found</b>
the code now is
<b>report zmybapi1 .
data : my_order_header_in like bapisdhd1 occurs 0 with header line,
my_order_header_ix like bapisdhd1x occurs 0 with header line.
data : my_orderitemsin like bapisditm occurs 0 with header line,
my_orderitemsix like bapisditmx occurs 0 with header line.
data : my_order_partners like bapiparnr occurs 0 with header line.
data : my_return like bapiret2 occurs 0 with header line.
data : w_vbeln like bapivbeln-vbeln.
data:
my_orderschedulesin like bapischdl occurs 0 with header line,
my_orderschedulesinx like bapischdlx occurs 0 with header line.
data : my_orderconditionsin like bapicond occurs 0 with header line,
my_orderconditionsinx like bapicondx occurs 0 with header line.
data : my_ordertext like bapisdtext occurs 0 with header line.
data : my_header like thead occurs 0 with header line.
data : my_tline like tline occurs 0 with header line.
start-of-selection.
this is to assign values to internal table my_order_header_in
my_order_header_in-doc_type = 'TA'.
my_order_header_in-sales_org = 'JNJ1'.
my_order_header_in-distr_chan = '02'.
my_order_header_in-division = 'J1'.
my_order_header_in-sales_off = 'JNJ1'.
my_order_header_in-purch_no_c = 'testbapipo'.
my_order_header_in-purch_date = sy-datum.
my_order_header_in-req_date_h = sy-datum.
append my_order_header_in.
this is to assign values to internal table my_orderitemsin
my_orderitemsin-material = '000000000000000727'.
my_orderitemsin-plant = 'JNJ1'.
my_orderitemsin-target_qu = 'EA'.
my_orderitemsin-target_qty = '10'.
append my_orderitemsin.
this is to assign values to internal table my_order_partners
my_order_partners-partn_role = 'AG'.
my_order_partners-partn_numb = '0000000011'.
append my_order_partners.
my_order_partners-partn_role = 'WE'.
my_order_partners-partn_numb = '0000000011'.
append my_order_partners.
This is to assign values to internal table my_orderschedulesin
my_orderschedulesin-itm_number = '10'.
my_orderschedulesin-itm_number = '000010'.
my_orderschedulesin-req_qty = '10'.
my_orderschedulesin-SCHED_LINE = '0001'.
append my_orderschedulesin.
*This is to assign values to internal table my_orderconditionin
my_orderconditionsin-itm_number = '000010'.
my_orderconditionsin-cond_type = 'ZPR1'.
my_orderconditionsin-cond_st_no = ''.
my_orderconditionsin-cond_count = '1'.
my_orderconditionsin-cond_value = '40'.
my_orderconditionsin-cond_p_unt = '1'.
my_orderconditionsin-currency = 'INR'.
append my_orderconditionsin.
my_ordertext-doc_number = '0000008632'.
my_ordertext-itm_number = '00010'.
my_ordertext-text_id = '0002'.
my_ordertext-langu = 'EN'.
my_ordertext-langu_iso = 'EN'.
my_ordertext-text_line = 'This is for item note'.
my_ordertext-format_col = '*'.
my_ordertext-function = '009'.
append my_ordertext.
my_order_header_ix-updateflag = 'I'.
my_order_header_ix-doc_type = 'X'.
my_order_header_ix-sales_org = 'X'.
my_order_header_ix-distr_chan = 'X'.
my_order_header_ix-division = 'X'.
my_order_header_ix-sales_off = 'X'.
my_order_header_ix-purch_no_c = 'X'.
my_order_header_ix-purch_date = 'X'.
my_order_header_ix-req_date_h = 'X'.
append my_order_header_ix.
my_orderitemsix-updateflag = 'I'.
my_orderitemsix-material = 'X'.
my_orderitemsix-target_qty = 'X'.
my_orderitemsix-plant = 'X'.
my_orderitemsix-target_qu = 'X'.
append my_orderitemsix.
my_orderschedulesinx-updateflag = 'I'.
my_orderschedulesinx-sched_line = '0001'.
my_orderschedulesinx-req_qty = 'X'.
append my_orderschedulesinx.
my_orderconditionsinx-itm_number = '000010'.
my_orderconditionsinx-cond_type = 'ZPR1'.
my_orderconditionsinx-cond_st_no = 'X'.
my_orderconditionsinx-cond_count = 'X'.
my_orderconditionsinx-updateflag = 'U'.
my_orderconditionsinx-cond_value = 'X'.
my_orderconditionsinx-cond_p_unt = 'X'.
my_orderconditionsinx-currency = 'X'.
append my_orderconditionsinx.
call function 'BAPI_SALESORDER_CREATEFROMDAT2'
exporting
SALESDOCUMENTIN =
order_header_in = my_order_header_in
order_header_inx = my_order_header_ix
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
importing
salesdocument = w_vbeln
tables
return = my_return
order_items_in = my_orderitemsin
order_items_inx = my_orderitemsix
order_partners = my_order_partners
ORDER_SCHEDULES_IN = my_orderschedulesin
order_schedules_inx = my_orderschedulesinx
ORDER_CONDITIONS_IN = my_orderconditionsin
ORDER_CONDITIONS_INX = my_orderconditionsinx
ORDER_CFGS_REF =
ORDER_TEXT = my_ordertext
if sy-subrc ne 0.
write: my_return-message, my_return-number, my_return-type.
else.
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
write: my_return-message, my_return-number, my_return-type.
my_header-tdobject = ''.
my_header-tdname = ' '.
my_header-tdid = '0002'.
my_header-tdspras = 'EN'.
append my_header.
my_tline-tdformat = '*'.
my_tline-tdline = 'This is for item note'.
append my_tline.
call function 'SAVE_TEXT'
exporting
CLIENT = SY-MANDT
header = my_header
INSERT = ' '
SAVEMODE_DIRECT = ' '
OWNER_SPECIFIED = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
tables
lines = my_tline
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.
endif.</b>
thanks in advance
regards,
pavan -
Problem for uplaoding sales text using LSMW
Hi,
I have use LSMW for uplaoding material masters sales and purchase order text , first I have done for purchase order text with object : MATERIAL and ID : BEST it works fine for this after that when I am trying same for uploading sales text OBJECT : MVKE and ID : 0001 it is picking file proerly and till final BDC step it is not giving any error but in material master sales text is not getting updated for that material.
what canb be the problemm
also for pO text for matnr i have given only material code 18 Chr.
and for sales text i hva egiven MATNR + SALES ORG. + DISTRIBUTION CHANNEL as it required for sales text.
regards,
zafarDear Zafar,
I found a similar problem while uploading Porduction order long text. May be this information is useful for you.
The common task of changing the long text of a production orderu2019s operation can bring some surprises.
The first problem that is usually encountered is that after updating the long text with the function SAVE_TEXT, the new text is not visible in standard SAP transactions like CO03. The new text can be read with the function READ_TEXT though. The trick is that SAP uses the u201Clong text existsu201D indicator, the field TXTSP in the table AFVC. To make the text u201Cvisibleu201D to standard transactions, we have to set the TXTSP value to the current language (or the textu2019s language). Unfortunately, this has to be done with the direct UPDATE on the AFVC u2013 there are no known workarounds.
Another problem can be seen when the same order is processed by users that use different languages. While SAP allows to store the long text for the same operation in several languages, actually, only one text object will be active at the same time in regard to standard transactions u2013 the object in the last saved language. That means, when SAP writes the text back, the TXTSP will be overwritten with the current language (say, language A). If the next user is working in another language (language B), SAP will present the text in the u201Cfirstu201D language (A) in the CO03 (even if the text in language B exists!). But after saving, the text will be written in the new language and TXTSP will be set accordingly.
So, when working with long texts directly, you have to read with READ_TEXT using the language stored in TXTSP, NOT with the current language. When saving, you save in the current language and set the TXTSP to the current language. This way you are consistent with what SAP does and this will prevent you from surprises in a multilingual environment.
Regards,
Kamal -
How to capture Purchase order text from MM02
Hi Friends ,
i have a requirement like i have to capture the purchase order text from MM02
from one program.
Pls give helpful code .
Thanks & Regards
Jagadeeshwar.Bachuhi
check this code
Hi,
declare the paramters like:
To fetch Long Text lines for READ_TEXT function module
DATA:BEGIN OF dt_lines OCCURS 0.
INCLUDE STRUCTURE tline. " Long Text
DATA:END OF dt_lines.
Variable declarations for Read_TEXT function module
DATA : dl_name TYPE thead-tdname, " Object Name
dl_lan TYPE thead-tdspras. " Language
Constants
CONSTANTS:
Object ID for Long Text of Sales Item Text
c_best TYPE thead-tdid value 'Z026', ID
c_object TYPE thead-tdobject . " Object
Object will be VBBK, and the Object name will be the concatenation of Sales order and Item No(for Item texts) and only Sales order for Header texts.
Language will be default sy-Langu.
In the loop of Sales orders call this fun module and use by passing all the above 4 paramters ID,OBJECT,NAME and LANG.
You double click on that text
GOTO -> header you will know the all above paramters.
READ_TEXT
READ_TEXT provides a text for the application program in the specified work areas.
The function module reads the desired text from the text file, the text memory, or the archive. You must fully specify the text using OBJECT, NAME, ID, and LANGUAGE. An internal work area can hold only one text; therefore, generic specifications are not allowed with these options.
After successful reading, the system places header information and text lines into the work areas specified with HEADER and LINES.
If a reference text is used, SAPscript automatically processes the reference chain and provides the text lines found in the text at the end of the chain. If an error occurs, the system leaves the function module and triggers the exception REFERENCE_CHECK.
Function call:
CALL FUNCTION 'READ_TEXT'
EXPORTING CLIENT = SY-MANDT
OBJECT = ?...
NAME = ?...
ID = ?...
LANGUAGE = ?...
ARCHIVE_HANDLE = 0
IMPORTING HEADER =
TABLES LINES = ?...
EXCEPTIONS ID =
LANGUAGE =
NAME =
NOT_FOUND =
OBJECT =
REFERENCE_CHECK =
WRONG_ACCESS_TO_ARCHIVE =
Export parameters:
CLIENT
Specify the client under which the text is stored. If you omit this parameter, the system uses the current client as default.
Reference field: SY-MANDT
Default value: SY-MANDT
OBJECT
Enter the name of the text object to which the text is allocated. Table TTXOB contains the valid objects.
Reference field: THEAD-TDOBJECT
NAME
Enter the name of the text module. The name may be up to 70 characters long. Its internal structure depends on the text object used.
Reference field: THEAD-TDNAME
ID
Enter the text ID of the text module. Table TTXID contains the valid text IDs, depending on the text object.
Reference field: THEAD-TDID
LANGUAGE
Enter the language key of the text module. The system accepts only languages that are defined in table T002.
Reference field: THEAD-TDSPRAS
ARCHIVE_HANDLE
If you want to read the text from the archive, you must enter a handle here. The system uses it to access the archive. You can create the handle using the function module ACHIVE_OPEN_FOR_READ.
The value '0' indicates that you do not want to read the text from the archive.
Reference field: SY-TABIX
Default value: 0
Import parameters:
HEADER
If the system finds the desired text, it returns the text header in this parameter.
Structure: THEAD
Table parameters:
LINES
The table contains all text lines that belong to the text read.
Structure: TLINE
Exceptions:
ID
The text ID specified in the parameter ID does not exist in table TTXID. It must be defined there together with the object of the text module.
LANGUAGE
The parameter LANGUAGE contains a language key that does not exist in table T002.
NAME
The parameter NAME contains the name of a text module that does not correspond to the SAPscript conventions.
Possible errors:
The field contains only blanks.
The field contains the invalid characters * or ,.
OBJECT
The parameter OBJECT contains the name of a text object that does not exist in table TTXOB.
NOT_FOUND
The system did not find the specified text module.
REFERENCE_CHECK
The text module to be read has no text lines of its own but refers to the lines of another text module. This reference chain can include several levels. For the current text, the chain is interrupted, that is, one of the text modules referred to in the chain no longer exists.
WRONG_ACCESS_ TO_ARCHIVE
The exception WRONG_ACCESS_TO_ARCHIVE is triggered if an archive is accessed using an incorrect or non-existing archive handle or an incorrect mode (that is, read if the archive is open for writing or vice versa).
regards
siva
Maybe you are looking for
-
I have no print button option in my pdf files only a save or cancel option. How can I fix?
-
How can I make a calendar that anyone can import
Hi, I'm the director of an event that takes place over one week in October. I made a calendar in my iCal that showed all common public events. I exported it and saved the calendar as am ics file, but my friends, who all use windows, who tried it got
-
Using JDeveloper for Apps(GL/AR/AP/OM/INV)
Hi, I'm in a project to implement Oracle Apps 11i, GL/AR/AP/OM/INV/++ modules. We have a lot of extensions to do (more than 1500 days-man). We use AIM and, accordingly, we suggested the client to use the standard development tools for an Apps impleme
-
Sharing pics from Aperture with iPhoto?
i mainly use Aperture for all my photos since i shoot in RAW. But i would love to be able to have a copy of all my photos in iPhoto so i have a quick reference for all my pics and the family can all use them/view them. Currently i just copy the apert
-
DPS app on Microsoft Surface?
How do I get my DPS iPad app towork on Microsoft Surface? Make a custom folio right?