Creating Material text in va02 item lines using Bapi
Dear all,
I want to add Material Sales Text in Text Tab of Tab Control on VA02 line items.
ie when I open a sales order in va02. And I click on the line item in the sales order, I want to add on Material text in , Text Tab.
I am using BAPI_SALESORDER_CHANGE AND table ORDER_TEXT for updating the text.
I am not sure if order_text is the right table to update the text.
My code is
REPORT zapo_ranjan_test .
DATA:order_header_inx LIKE bapisdh1x.
DATA:return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA:order_item_in LIKE bapisditm OCCURS 0 WITH HEADER LINE.
DATA:order_item_inx LIKE bapisditmx OCCURS 0 WITH HEADER LINE.
DATA : test1 like BAPISDTEXT occurs 0 with header line.
order_header_inx-updateflag = 'U'.
order_item_in-itm_number = '000003'.
APPEND order_item_in.
order_item_inx-itm_number = '000003'.
order_item_inx-updateflag = 'U'.
append order_item_inx.
test1-doc_number = '2292443'.
test1-itm_number = '000003'.
test1-text_id = '0001'.
test1-text_line = 'Phone Number'.
append test1.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = '0002292443'
ORDER_HEADER_IN =
order_header_inx = order_header_inx
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
TABLES
return = return
order_item_in = order_item_in
order_item_inx = order_item_inx
PARTNERS =
PARTNERCHANGES =
PARTNERADDRESSES =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
SCHEDULE_LINES =
SCHEDULE_LINESX =
ORDER_TEXT = test1
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
EXTENSIONIN =
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
COMMIT WORK.
Write : / 'Done.'.
My bapi returns documnet changed successfully.
Look forwad to get any clue or help .
regards,
Ranjan A
Hi Ranjan,
For creating text in Va02, you may use "SAVE_TEXT" FM instead of BAPI.
you need to know the text object and text id before using this FM.
Below is a sample code for that:
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_success-vbeln
IMPORTING
output = wa_success-vbeln.
i_header-tdobject = 'VBBK'.
i_header-tdname = wa_success-vbeln.
i_header-tdid = '0001'.
i_header-tdspras = 'E'.
APPEND i_header.
CLEAR v_text.
CONCATENATE 'GEO DN# ' wa_success-donum INTO v_text.
i_tline-tdformat = '*'.
i_tline-tdline = v_text.
APPEND i_tline.
CLEAR v_text.
CONCATENATE 'CUSTOM INV# ' wa_success-ivnum INTO v_text.
i_tline-tdformat = '*'.
i_tline-tdline = v_text.
APPEND i_tline.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = i_header
insert = ' '
savemode_direct = 'X'
TABLES
lines = i_tline "I_TAB
EXCEPTIONS
id = 01.
Best Regards,
Pradeep.
Similar Messages
-
Not able to create a text file in Client Machine using Forms 10g
Hi - I'm mot able to create a text file in Client Machine using Forms 10g. I'm getting error when system executes the bolded line.(i.e. CLIENT_TEXT_IO.FOPEN). During run-time system is throwing "ORA-06508: PL/SQL: could not find program unit being called".
I had attached webutil.pll in the form.
Please advise me.
DECLARE
l_Temp CLIENT_TEXT_IO.FILE_TYPE;
LC$Name Varchar2(100) ;
LC$Fic Varchar2(100) ;
LN$Lines Pls_integer := 0 ;
LC$Line Varchar2(4000) ;
Cursor C_CUR Is
Select * From TEST_TEXTIO where rownum <= 50;
BEGIN
LC$Name := 'tmp_file.txt' ;
LC$Fic := 'c:\temp\tmp_file.txt';
Begin
l_temp := CLIENT_TEXT_IO.FOPEN( 'C:\temp\tmp_file.txt', 'W');
Exception
when others then
message( 'OPEN FILE ERROR ' || LC$Fic ||sqlerrm );
display_error;
raise form_trigger_failure;
End ;
-- Write the lines --
For Cur In C_CUR Loop
LC$Line := Cur.CODE || ' -> ' || Cur.COL1 || ',' || Cur.COL2 || ',' || Cur.Col3 ;
CLIENT_TEXT_IO.PUT_LINE( LF$File, LC$Line ) ;
LN$Lines := C_CUR%ROWCOUNT ;
End loop ;
-- Close the file --
CLIENT_TEXT_IO.FCLOSE( LF$File ) ;
Exception
When others Then
message('err='||sqlerrm);message(' ');
display_error;
CLIENT_TEXT_IO.FCLOSE( LF$File ) ;
Raise ;
END;
Thanks.
ArunHi ,
i have one Question though its not related to thos question if some could help me it will be really helpful,
i have created one program to import and export excel to forms vice versa, if the form is attached with webutil its working fine am using ole2.but i have a new idea if i add this program in menu, it can be used for all the forms attched to that menu, i made program also, but problem am facing right now is if the form is not attched with webutil it will not work so is there possiblity to share my webutil from one form to another form ,so i will keep one form as a interface form in that webutil will be attched ,i can share that webutil to all other forms so that all the forms no need to attach webutil again
if its possible means please suggest some ideas -
Creating a material with just the basic view using BAPI
Hi
I intend to create a new material with just the basic view using BAPI BAPI_MATERIAL_SAVEDATA -
To do this - I believe I have to fill in the structure HEADDATA data - ( mandatory ) with the required values - I fill values for fields IND_SECTOR, MATL_TYPE & basic view ( check this field ) and leave the MATERIAL field as blank (assuming internal numbering ) and then fill values of the CLIENTDATA structure with values for the basic data view.
Is this correct ? Will my material number created be returned in the RETURN structure - how do I look for the material number exclusively in my RETURN structure ?hi
good
go through this progarm which ll give you detail idea about BAPI_MATERIAL_SAVEDATA
REPORT ZBAPIMM01 LINE-SIZE 255 NO STANDARD PAGE HEADING
LINE-COUNT 065(001).
TABLES: T001L, "Storage Locations
MARA, "General Material Data
MAKT, "Material Descriptions
MBEW, "Material Valuation
MARC. "Plant Data for Material
DATA: BAPI_HEAD LIKE BAPIMATHEAD,
BAPI_MAKT LIKE BAPI_MAKT, "Material Description
BAPI_MARA1 LIKE BAPI_MARA, "Client Data
BAPI_MARAX LIKE BAPI_MARAX,
BAPI_MARC1 LIKE BAPI_MARC, "Plant View
BAPI_MARCX LIKE BAPI_MARCX,
BAPI_MBEW1 LIKE BAPI_MBEW, "Accounting View
BAPI_MBEWX LIKE BAPI_MBEWX,
BAPI_RETURN LIKE BAPIRET2.
DATA: BEGIN OF INT_MAKT OCCURS 100.
INCLUDE STRUCTURE BAPI_MAKT.
DATA: END OF INT_MAKT.
DATA: BEGIN OF INT_MAT OCCURS 100,
WERKS(4), "Plant
MTART(4), "Material type
MATNR(18), "Material number
MATKL(9) , "Material group
MBRSH(1), "Industry sector
MEINS(3), "Base unit of measure
GEWEI(3), "Weight Unit
SPART(2), "Division
EKGRP(3), "Purchasing group
VPRSV(1), "Price control indicator
STPRS(12), "Standard price
PEINH(3), "Price unit
SPRAS(2), "Language key
MAKTX(40), "Material description
END OF INT_MAT.
SELECT-OPTIONS:
PLANT FOR MARC-WERKS OBLIGATORY MEMORY ID PLT,
MATERIAL FOR MARA-MATNR MEMORY ID MAT,
MATLTYPE FOR MARA-MTART MEMORY ID MTY,
DIVISION FOR MARA-SPART MEMORY ID DIV.
PARAMETERS: F_FILE LIKE RLGRAP-FILENAME
DEFAULT 'C:\DATA\ZMATERIAL.XLS' MEMORY ID F_FILE,
GETDATA AS CHECKBOX, "Tick to download materials data to local harddisk
UPDDATA AS CHECKBOX. "Tick to update date to Materials Master
IF GETDATA = 'X'.
PERFORM DOWNLOAD_DATA.
PERFORM DOWNLOAD_FILE.
ENDIF.
IF UPDDATA = 'X'.
PERFORM UPLOAD_FILE.
PERFORM UPDATE_MM.
ENDIF.
FORM DOWNLOAD_DATA.
SELECT * FROM MARC WHERE LVORM EQ ' '
AND WERKS IN PLANT
AND MATNR IN MATERIAL.
CLEAR MARA.
SELECT SINGLE * FROM MARA WHERE MATNR = MARC-MATNR.
CHECK MATLTYPE.
CHECK DIVISION.
CLEAR MBEW.
SELECT SINGLE * FROM MBEW WHERE MATNR = MARC-MATNR
AND BWKEY = MARC-WERKS.
CLEAR MAKT.
SELECT SINGLE * FROM MAKT WHERE SPRAS = 'EN'
AND MATNR = MARC-MATNR.
WRITE:/ MARC-WERKS, "Plant
MARA-MTART, "Material type
MARA-MATNR, "Material number
MARA-MATKL, "Material group
MARA-MBRSH, "Industry sector
MARA-MEINS, "Base unit of measure
MARA-GEWEI, "Weight Unit
MARA-SPART, "Division
MARC-EKGRP, "Purchasing group
MBEW-VPRSV, "Price control indicator
MBEW-STPRS, "Standard price
MBEW-PEINH, "Price unit
MAKT-SPRAS, "Language key
MAKT-MAKTX. "Material description
INT_MAT-WERKS = MARC-WERKS. "Plant
INT_MAT-MTART = MARA-MTART. "Material type
INT_MAT-MATNR = MARA-MATNR. "Material number
INT_MAT-MATKL = MARA-MATKL. "Material group
INT_MAT-MBRSH = MARA-MBRSH. "Industry sector
INT_MAT-MEINS = MARA-MEINS. "Base unit of measure
INT_MAT-GEWEI = MARA-GEWEI. "Weight Unit
INT_MAT-SPART = MARA-SPART. "Division
INT_MAT-EKGRP = MARC-EKGRP. "Purchasing group
INT_MAT-VPRSV = MBEW-VPRSV. "Price control indicator
INT_MAT-STPRS = MBEW-STPRS. "Standard price
INT_MAT-PEINH = MBEW-PEINH. "Price unit
INT_MAT-SPRAS = MAKT-SPRAS. "Language key
INT_MAT-MAKTX = MAKT-MAKTX. "Material description
APPEND INT_MAT.
CLEAR INT_MAT.
ENDSELECT.
ENDFORM.
FORM DOWNLOAD_FILE.
call function 'WS_DOWNLOAD'
EXPORTING
FILENAME = F_FILE
FILETYPE = 'DAT'
FILETYPE = 'WK1'
tables
data_tab = INT_MAT
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC = 0.
FORMAT COLOR COL_GROUP.
WRITE:/ 'Data Download Successfully to your local harddisk'.
SKIP.
ENDIF.
ENDFORM.
FORM UPLOAD_FILE.
call function 'WS_UPLOAD'
EXPORTING
FILENAME = F_FILE
FILETYPE = 'DAT'
FILETYPE = 'WK1'
tables
data_tab = INT_MAT
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC = 0.
FORMAT COLOR COL_GROUP.
WRITE:/ 'Data Upload Successfully from your local harddisk'.
SKIP.
ENDIF.
ENDFORM.
FORM UPDATE_MM.
LOOP AT INT_MAT.
Header
BAPI_HEAD-MATERIAL = INT_MAT-MATNR.
BAPI_HEAD-IND_SECTOR = INT_MAT-MBRSH.
BAPI_HEAD-MATL_TYPE = INT_MAT-MTART.
BAPI_HEAD-BASIC_VIEW = 'X'.
BAPI_HEAD-PURCHASE_VIEW = 'X'.
BAPI_HEAD-ACCOUNT_VIEW = 'X'.
Material Description
REFRESH INT_MAKT.
INT_MAKT-LANGU = INT_MAT-SPRAS.
INT_MAKT-MATL_DESC = INT_MAT-MAKTX.
APPEND INT_MAKT.
Client Data - Basic
BAPI_MARA1-MATL_GROUP = INT_MAT-MATKL.
BAPI_MARA1-BASE_UOM = INT_MAT-MEINS.
BAPI_MARA1-UNIT_OF_WT = INT_MAT-GEWEI.
BAPI_MARA1-DIVISION = INT_MAT-SPART.
BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-UNIT_OF_WT = 'X'.
BAPI_MARAX-DIVISION = 'X'.
Plant - Purchasing
BAPI_MARC1-PLANT = INT_MAT-WERKS.
BAPI_MARC1-PUR_GROUP = INT_MAT-EKGRP.
BAPI_MARCX-PLANT = INT_MAT-WERKS.
BAPI_MARCX-PUR_GROUP = 'X'.
Accounting
BAPI_MBEW1-VAL_AREA = INT_MAT-WERKS.
BAPI_MBEW1-PRICE_CTRL = INT_MAT-VPRSV.
BAPI_MBEW1-STD_PRICE = INT_MAT-STPRS.
BAPI_MBEW1-PRICE_UNIT = INT_MAT-PEINH.
BAPI_MBEWX-VAL_AREA = INT_MAT-WERKS.
BAPI_MBEWX-PRICE_CTRL = 'X'.
BAPI_MBEWX-STD_PRICE = 'X'.
BAPI_MBEWX-PRICE_UNIT = 'X'.
WRITE:/ BAPI_HEAD, BAPI_MARC1.
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
HEADDATA = BAPI_HEAD
CLIENTDATA = BAPI_MARA1
CLIENTDATAX = BAPI_MARAX
PLANTDATA = BAPI_MARC1
PLANTDATAX = BAPI_MARCX
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
VALUATIONDATA = BAPI_MBEW1
VALUATIONDATAX = BAPI_MBEWX
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA = BAPI_MVKE1
SALESDATAX = BAPI_MVKEX
STORAGETYPEDATA =
STORAGETYPEDATAX =
IMPORTING
RETURN = BAPI_RETURN
TABLES
MATERIALDESCRIPTION = INT_MAKT
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
IF BAPI_RETURN-TYPE = 'E'.
WRITE:/ 'Error Message ', BAPI_RETURN.
ENDIF.
ENDLOOP.
ENDFORM.
*---End of Program
thanks
mrutyun^ -
Error while creating Materialized View step 3 of 6 using wizard
have oracle 9i Rel 1 on Windows 2000 server. Master Site has been setup. Database links are created at Materialized view site. But while creating Materialized View Group using wizard there is following error on step 3 of 6.
Statement:----------------
/*OracleOEM*/ SELECT 1 FROM SYS.dba_constraints@masterdbname WHERE OWNER='username' and table_name='tabname' AND constraint_type='P'
Stack Trace:----------------
ORA-00942: table or view does not exist.
ORA-02063: preceding line from masterdbname.
All parameters for replication are correct.
Please help me early.
ThanksHello,
In the masterdbname, logging as sys user, you must grant select permission on sys.dba_constraints view to mvadmin_dbname user (where dbname is the replicated database name).
Regards, -
Dynamically need to create multiple text or select items.
Hi All,
There is a requirement in my application, we need to create multiple textbox or selectlist items, on click of "add" button in apex.
Any help on this how i can process the request to create multiple items dynamically on click of "add" button.
Regards,
Sruthitamiri!!APEX_ITEM
-
Creating Billing Plan data for sales order using BAPI
Hello,
Someone ones if there is any way to create a sales order (BAPI) and then create a billing plan (by means of another BAPI)?
Or is there any way to create both at the same time?
Kind Regards.Hi David and Nisha here is the code for creating sales order with bapi
*& Report YOBJ_BAPI_SALESORDER
*& REPORT : CREATING SALES ORDER USING STANDARD BAPI
*& AUTHOR : S.PAVAN KUMAR INUMARTHY
REPORT YOBJ_BAPI_SALESORDER.
DATA : ORDER_HEADER_IN LIKE STANDARD TABLE OF BAPISDHD1 WITH HEADER LINE.
DATA : ORDER_ITEMS_IN LIKE STANDARD TABLE OF BAPISDITM WITH HEADER LINE.
DATA : ORDER_PARTNERS LIKE STANDARD TABLE OF BAPIPARNR WITH HEADER LINE.
DATA : RETURN TYPE STANDARD TABLE OF BAPIRET2 WITH HEADER LINE.
DATA : SALESDOCUMENT LIKE BAPIVBELN-VBELN.
*APPENDING VALUES FOR HEADER.
ORDER_HEADER_IN-DOC_TYPE = 'TA'.
ORDER_HEADER_IN-SALES_ORG = '1000'.
ORDER_HEADER_IN-DISTR_CHAN = '10'.
ORDER_HEADER_IN-DIVISION = '00'.
ORDER_HEADER_IN-SALES_GRP = '130'.
ORDER_HEADER_IN-SALES_OFF = '1030'.
APPEND ORDER_HEADER_IN.
*APPENDING VALUES FOR ITEM
ORDER_ITEMS_IN-MATERIAL = 'M-13'.
ORDER_ITEMS_IN-PLANT = '1000'.
ORDER_ITEMS_IN-SALES_UNIT = 'ST'.
ORDER_ITEMS_IN-DIVISION = '07'.
ORDER_ITEMS_IN-GROSS_WGHT = '28000'.
ORDER_ITEMS_IN-NET_WEIGHT = '28000'.
ORDER_ITEMS_IN-UNTOF_WGHT = 'KG'.
ORDER_ITEMS_IN-VOLUME = '0.780'.
ORDER_ITEMS_IN-VOLUNIT = 'M3'.
APPEND ORDER_ITEMS_IN.
*APPENDING VALUES FOR PARTNER
ORDER_PARTNERS-PARTN_ROLE = 'AG'.
ORDER_PARTNERS-PARTN_NUMB = '0000001000'.
ORDER_PARTNERS-COUNTRY = 'DE'.
ORDER_PARTNERS-TRANSPZONE = 'D000080000'.
APPEND ORDER_PARTNERS.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
* SALESDOCUMENTIN =
ORDER_HEADER_IN = ORDER_HEADER_IN
* ORDER_HEADER_INX =
* SENDER =
* BINARY_RELATIONSHIPTYPE =
* INT_NUMBER_ASSIGNMENT =
* BEHAVE_WHEN_ERROR =
* LOGIC_SWITCH =
* TESTRUN =
* CONVERT = ' '
IMPORTING
SALESDOCUMENT = SALESDOCUMENT
TABLES
RETURN = RETURN
ORDER_ITEMS_IN = ORDER_ITEMS_IN
* ORDER_ITEMS_INX =
ORDER_PARTNERS = ORDER_PARTNERS
* ORDER_SCHEDULES_IN =
* ORDER_SCHEDULES_INX =
* ORDER_CONDITIONS_IN =
* ORDER_CONDITIONS_INX =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CFGS_BLOB =
* ORDER_CFGS_VK =
* ORDER_CFGS_REFINST =
* ORDER_CCARD =
* ORDER_TEXT =
* ORDER_KEYS =
* EXTENSIONIN =
* PARTNERADDRESSES =
IF SY-SUBRC = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
ENDIF.
WRITE : 'SALES ORDER IS :', SALESDOCUMENT.
I have tested and go it.
please go through it -
Change only material qunatity in sales order by using BAPI
Hi All,
How to change only the material quantity in existing sales order by using BAPI.
Please help me in this regards.
Regards
Deekshitha.Hi
See the sample code and do accordingly
REPORT Z_SALES_ORDER_CHANGE
NO STANDARD PAGE HEADING
LINE-SIZE 132
LINE-COUNT 65(0)
MESSAGE-ID ZZ.
TABLES: VBAP.
DATA:
V_FILEIN(90) TYPE C,
V_RECIN TYPE I,
V_RECVBAP TYPE I,
V_RECORDER TYPE I,
V_VBELN LIKE VBAP-VBELN,
ORDERHEADERINX LIKE BAPISDH1X.
DATA: BEGIN OF I_ORDERS OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
BRGEW(18) TYPE C,
VOLUM(18) TYPE C,
END OF I_ORDERS.
DATA: BEGIN OF I_OUTPUT OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
GEWEI LIKE VBAP-GEWEI,
BRGEW LIKE VBAP-BRGEW,
VOLUM LIKE VBAP-VOLUM,
CKWGT TYPE C,
CKVOL TYPE C,
END OF I_OUTPUT.
DATA: BEGIN OF ORDERITEMIN OCCURS 0.
INCLUDE STRUCTURE BAPISDITM.
DATA: END OF ORDERITEMIN.
DATA: BEGIN OF ORDERITEMINX OCCURS 0.
INCLUDE STRUCTURE BAPISDITMX.
DATA: END OF ORDERITEMINX.
DATA: BEGIN OF RETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA: END OF RETURN.
DATA: BEGIN OF BAPIRETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA: END OF BAPIRETURN.
PARAMETERS:
P_PATH(45) TYPE C DEFAULT '/usr/users/ftpsapom/' LOWER CASE,
P_FNAME(32) TYPE C DEFAULT '/sweetjo.txt' LOWER CASE.
START-OF-SELECTION.
CONCATENATE PATH AND FILE NAME INTO ONE VARIABLE
CONCATENATE P_PATH P_FNAME INTO V_FILEIN.
OPEN DATASET
IF V_FILEIN IS INITIAL.
MESSAGE E002 WITH 'FILE' V_FILEIN 'DOES NOT CONTAIN ANY DATA!'.
ELSE.
OPEN DATASET V_FILEIN
FOR INPUT
IN TEXT MODE.
IF SY-SUBRC = 0.
READ DATASET
DO.
READ DATASET V_FILEIN INTO I_ORDERS.
IF SY-SUBRC = 0.
APPEND I_ORDERS.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET
CLOSE DATASET V_FILEIN.
IF SY-SUBRC <> 0.
MESSAGE E002 WITH 'ERROR - CLOSING' V_FILEIN.
ENDIF.
ELSE.
MESSAGE E002 WITH 'ERROR - COULD NOT OPEN' V_FILEIN.
ENDIF.
ENDIF.
SORT AND REMOVE DUPLICATES FROM I_ORDERS
SORT I_ORDERS BY VBELN POSNR.
DELETE ADJACENT DUPLICATES FROM I_ORDERS.
POPULATE I_OUTPUT
LOOP AT I_ORDERS.
SHIFT I_ORDERS-POSNR LEFT DELETING LEADING SPACE.
CONCATENATE '0' I_ORDERS-POSNR INTO I_ORDERS-POSNR.
SELECT SINGLE BRGEW VOLUM
FROM VBAP
INTO (VBAP-BRGEW, VBAP-VOLUM)
WHERE VBELN = I_ORDERS-VBELN
AND POSNR = I_ORDERS-POSNR.
IF SY-SUBRC = 0.
IF VBAP-BRGEW = 0.
I_OUTPUT-CKWGT = 'X'.
ENDIF.
IF VBAP-VOLUM = 0.
I_OUTPUT-CKVOL = 'X'.
ENDIF.
I_OUTPUT-VBELN = I_ORDERS-VBELN.
I_OUTPUT-POSNR = I_ORDERS-POSNR.
I_OUTPUT-GEWEI = 'ST'.
I_OUTPUT-BRGEW = I_ORDERS-BRGEW.
I_OUTPUT-VOLUM = I_ORDERS-VOLUM.
APPEND I_OUTPUT.
CLEAR: I_OUTPUT.
ENDIF.
V_RECIN = V_RECIN + 1.
ENDLOOP.
POPULATE BAPI DATA AND RUN BAPI
CLEAR: ORDERHEADERINX, ORDERITEMIN, ORDERITEMINX,
RETURN, BAPIRETURN.
REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
ORDERHEADERINX-UPDATEFLAG = 'U'.
LOOP AT I_OUTPUT WHERE CKWGT = 'X' OR CKVOL = 'X'.
V_RECVBAP = V_RECVBAP + 1.
IF I_OUTPUT-VBELN <> V_VBELN AND SY-TABIX <> 1.
V_RECORDER = V_RECORDER + 1.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = V_VBELN
ORDER_HEADER_INX = ORDERHEADERINX
TABLES
RETURN = RETURN
ORDER_ITEM_IN = ORDERITEMIN
ORDER_ITEM_INX = ORDERITEMINX.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = BAPIRETURN.
WRITE OUT RETURN
LOOP AT RETURN.
WRITE: / RETURN.
ENDLOOP.
WRITE: / BAPIRETURN.
SKIP.
CLEAR: ORDERITEMIN, ORDERITEMINX,
RETURN, BAPIRETURN.
REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
ENDIF.
ORDERITEMIN-ITM_NUMBER = I_OUTPUT-POSNR.
ORDERITEMIN-UNTOF_WGHT = I_OUTPUT-GEWEI.
IF NOT I_OUTPUT-CKWGT IS INITIAL.
ORDERITEMIN-GROSS_WGHT = I_OUTPUT-BRGEW.
ORDERITEMINX-GROSS_WGHT = 'X'.
ENDIF.
IF NOT I_OUTPUT-CKVOL IS INITIAL.
ORDERITEMIN-VOLUME = I_OUTPUT-VOLUM.
ORDERITEMINX-VOLUME = 'X'.
ENDIF.
APPEND ORDERITEMIN.
ORDERITEMINX-ITM_NUMBER = I_OUTPUT-POSNR.
ORDERITEMINX-UNTOF_WGHT = 'X'.
ORDERITEMINX-UPDATEFLAG = 'U'.
APPEND ORDERITEMINX.
V_VBELN = I_OUTPUT-VBELN.
ENDLOOP.
RUN BAPI ON LAST ORDER
IF NOT ORDERITEMIN IS INITIAL.
V_RECORDER = V_RECORDER + 1.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = V_VBELN
ORDER_HEADER_INX = ORDERHEADERINX
TABLES
RETURN = RETURN
ORDER_ITEM_IN = ORDERITEMIN
ORDER_ITEM_INX = ORDERITEMINX.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = BAPIRETURN.
WRITE OUT RETURN
LOOP AT RETURN.
WRITE: / RETURN.
ENDLOOP.
WRITE: / BAPIRETURN.
SKIP.
ENDIF.
WRITE OUT RECORD COUNT FROM FILE
WRITE: / 'RECORD COUNT FROM FILE ', V_RECIN.
SKIP.
WRITE OUT RECORD COUNT FROM FILE
WRITE: / 'RECORD COUNT OF LINES TO CHANGE ', V_RECVBAP.
SKIP.
WRITE OUT RECORD COUNT FROM FILE
WRITE: / 'RECORD COUNT OF ORDERS TO CHANGE ', V_RECORDER.
SKIP.
TOP OF PAGE
TOP-OF-PAGE.
WRITE:/1(5) TEXT-H01, 6(8) SY-DATUM MM/DD/YY,
100(8) TEXT-H02, 126(8) SY-PAGNO.
WRITE:/1(5) TEXT-H03, 6(8) SY-UZEIT USING EDIT MASK '__:__:__',
20(77) TEXT-H04,
100(8) TEXT-H05, 108(25) SY-REPID.
WRITE:/1(6) TEXT-H06, 8(12) SY-UNAME,
20(4) TEXT-H07, 25(32) SY-HOST,
100(13) TEXT-H08, 121(8) SY-SYSID,
129 '/', 130(3) SY-MANDT.
ULINE.
SKIP.
Reward points if useful
Regards
Anji -
Issue in material master update from presentation server using BAPI....
Hi Guru's...
i am trying to change the material master from presentation server (desktop flat file)
using BAPI(BAPI_MATERIAL_SAVEDATA) ....
while executing my program i am getting the message like material had changed...
but while in mm02 i am un able to fine the updates...
please find below program logic and correct me if any mistakes....
thanks in advance...
*& Report ZAREPAS36
REPORT zarepas36.
DATA : gs_bapimathead TYPE bapimathead,
gs_clientdata TYPE bapi_mara,
gs_clientdatax TYPE bapi_marax.
TYPES : BEGIN OF gty_itab1,
matnr(18),
matkl(9),
spart(2),
ntgew(13),
gewei(3),
meins(3),
END OF gty_itab1.
DATA : gt_itab1 TYPE STANDARD TABLE OF gty_itab1,
gwa_itab1 TYPE gty_itab1.
TYPES: BEGIN OF gty_itab2,
abc(132),
END OF gty_itab2.
DATA: gt_itab2 TYPE STANDARD TABLE OF gty_itab2,
gwa_itab2 TYPE gty_itab2.
flat file at selection screen
PARAMETERS: p_files TYPE string.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = p_files
filetype = 'ASC'
CHANGING
data_tab = gt_itab2
EXCEPTIONS
OTHERS = 8.
LOOP AT gt_itab2 INTO gwa_itab2.
IF gwa_itab2-abc(1) = 'S'.
gwa_itab1 = gwa_itab2-abc(132).
APPEND gwa_itab1 TO gt_itab1.
ENDIF.
ENDLOOP.
loop at gt_itab1 into gwa_itab1.
*Material
gs_bapimathead-material = gwa_itab1-matnr.
*Material details at client data
*material group.
gs_clientdata-matl_group = gwa_itab1-matkl.
gs_clientdatax-matl_group = 'X'.
*Division
gs_clientdata-division = gwa_itab1-spart.
gs_clientdatax-division = 'X'.
*Net Weight
gs_clientdata-net_weight = gwa_itab1-ntgew.
gs_clientdatax-net_weight = 'X'.
*Unit of Weight
gs_clientdata-unit_of_wt = gwa_itab1-gewei.
gs_clientdatax-unit_of_wt = 'X'.
*Base Unit of Measure
gs_clientdata-base_uom = gwa_itab1-meins.
gs_clientdatax-base_uom = 'X'.
endloop.
*calling BAPI for making changes in material and saving thru BAPI.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = gs_bapimathead
clientdata = gs_clientdata
clientdatax = gs_clientdatax.
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WRITE: / 'Error occured while changing material'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE: / 'material',gs_bapimathead-material,'changed'.
ENDIF.hi hello Guru's
i resolved the issuee..
pleaso go thru the below proram logic for your reference..........
*& Report ZAREPAS36
REPORT zarepas36.
DATA : gs_bapimathead TYPE bapimathead,
gs_clientdata TYPE bapi_mara,
gs_clientdatax TYPE bapi_marax.
TYPES : BEGIN OF gty_itab1,
matnr(18),
matkl(9),
spart(2),
ntgew(13),
gewei(3),
meins(3),
END OF gty_itab1.
DATA : gt_itab1 TYPE STANDARD TABLE OF gty_itab1,
gwa_itab1 TYPE gty_itab1.
TYPES: BEGIN OF gty_itab2,
abc(132),
END OF gty_itab2.
DATA: gt_itab2 TYPE STANDARD TABLE OF gty_itab2,
gwa_itab2 TYPE gty_itab2.
DATA:ls_return TYPE bapiret2,
lt_bapiret2 TYPE standard table of bapiret2.
flat file at selection screen
PARAMETERS: p_files TYPE string.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = p_files
filetype = 'ASC'
CHANGING
data_tab = gt_itab2
EXCEPTIONS
OTHERS = 8.
LOOP AT gt_itab2 INTO gwa_itab2.
IF gwa_itab2-abc(1) = 'S'.
gwa_itab1 = gwa_itab2-abc(132).
APPEND gwa_itab1 TO gt_itab1.
ENDIF.
ENDLOOP.
LOOP AT gt_itab1 INTO gwa_itab1.
*Material
gs_bapimathead-material = gwa_itab1-matnr.
*Material details at client data
*material group.
gs_clientdata-matl_group = gwa_itab1-matkl.
gs_clientdatax-matl_group = 'X'.
*Division
gs_clientdata-division = gwa_itab1-spart.
gs_clientdatax-division = 'X'.
*Net Weight
gs_clientdata-net_weight = gwa_itab1-ntgew.
gs_clientdatax-net_weight = 'X'.
*Unit of Weight
gs_clientdata-unit_of_wt = gwa_itab1-gewei.
gs_clientdatax-unit_of_wt = 'X'.
*Base Unit of Measure
gs_clientdata-base_uom = gwa_itab1-meins.
gs_clientdatax-base_uom = 'X'.
ENDLOOP.
*calling BAPI for making changes in material and saving thru BAPI.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = gs_bapimathead
clientdata = gs_clientdata
clientdatax = gs_clientdatax
IMPORTING
return = ls_return.
LOOP AT lt_bapiret2 INTO ls_return.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WRITE: / 'Error occured while changing material'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE: / 'material',gs_bapimathead-material,'changed'.
ENDIF. -
How long does it take to create material master data from PO lines?
Hi ,
I was wondering if I could use an expert's opinion on the time and effort (FTEs) that goes into cleaning 50,000 PO lines that contain item descriptions to create a clean item master and a (basic) catalog.
The idea is:
To remove duplicates, invalid, non recurring/ redudant items
To create categories and sub categories (Standard - no coding)
Is there any defined tool and process-steps, not only for SAP but in general? Do consultants do this manually (with Excel spreadsheets) or some other means.
Any references will be very useful.
Thanks and regards.could be any time from a day to some months, just depends how big the mess is and how detailed the wishlist is and how well you want become.
Most consultants will do this probably with Excel as they are used to it.
Mixed tools can speed the process up if the people are used to those tools, or slow it down if they are not and need training before they can start.
Is it really only the description which will finally be different for some thousand materials that finally need to be created?
I would start with TAANA transaction, this would give me already an aggregated view on the items, as it can be used to group and count the items by description (and other parameters such as year) so it is down in seconds to the number of variations. Means the duplicates are eliminated.
Then you identify the one-time buys from previous years and remove them from the list (the output of TAANA can be worked on with Excel inplace)
Now starts the hard work to remove the garbage. This is usually a manual work, looking for typos which made this different from the same item with the correct description. And even identifying duplicates that are totally different written "Elbow - stainless steel" and "Stainless steel elbow" and far apart from each other in your list.
For this I use Excel with the Fuzzy Lookup Add-in
Watch some videos on youtube to see how it works, it's great.
And finally you load the materials with LSMW. If you are experienced with SAP material masters then you know which fields this materials need, they all could be defined as constants and your input file could only have the description, if that is really the only difference, which I actually don't believe. There might be differences in material group, in the unit of measure and usually in the purchasing group too (probably even more fields). And exact those differences in the other fields have to be considered in the cleanup too.
So, just technically eliminating duplicates and the worst garbage and all the one-time buys and finally load uniformed NLAG materials with just different descriptions could be done in a day. But the experience tells me that this can quickly evolve to a bigger long term project with harmonizing the way how the description will be written, harmonizing units and material groups. -
Change schedule lines using bapi salesorder_change
Hello,
I am using 'SD_SALESDOCUMENT_CHANGE' to change sales order. schedule lines are not changed.
I get an express inbox message saying :
===================================================================
Update was terminated
Error Info... 00 671: ABAP/4 processor: SAPSQL_ARRAY_INSERT_DUPREC
======================================================================
I don't know what to do.
any body solved this problem? what is wrong in the way I wrote it?
Thanks in advanced ,
Sara
I populate schedule lines this way:
lv_schedule-itm_number = svbap-posnr.
lv_schedule-sched_line = '0001'.
lv_schedule-req_qty = svbap-kwmeng.
lv_schedule-req_date = im_vbak-vdatu.
move im_vbak-vdatu to: lv_schedule-tp_date,
lv_schedule-ms_date,
lv_schedule-load_date,
lv_schedule-gi_date.
append lv_schedule to et_schedule.
* schedule lines X
lv_schedulex-itm_number = svbap-posnr.
lv_schedulex-sched_line = '0001'.
lv_schedulex-updateflag = 'U'.
lv_schedulex-req_qty = 'X'.
lv_schedulex-req_date = 'X'.
move 'X' to: lv_schedulex-tp_date,
lv_schedulex-ms_date,
lv_schedulex-load_date,
lv_schedulex-gi_date.
append lv_schedulex to et_schedulex.Hi,
The function I use is the one used in the BAPI CHANGE.
Online changing the delivery date changes the date in the schedule lines.
I can't understand why it is not updated.
Sara -
How to create a Sales Order with external number using BAPI
Hi People,
I am wonderning how to create Sales order using external number range by BAPI (SALESORDER_CREATEFROMDAT202).
I tried search but could not succeed in finding the solution.
Please share if anyone has some info.
Thanks in advance.
Regards,
PraveenAs per my understanding, the BAPI
SALESORDER_CREATEFROMDAT202
mentioned by you, is not BAPI. In fact, that is basic IDoc Type. For processing an Inbound IDoc, we use FM IDOC_INPUT_ORDERS.
If you want to create sales order other than IDoc, refer FM BAPI_SALESORDER_CREATEFROMDAT2. There you can provide external sales order no in SALESDOCUMENTIN. In addition to that check whether your sales doc type is relevant for external number range or not. If yes. then make sure you are providing external number according to the number range maintained.
If you still have any concerns, please revert back.
Thanks, JP -
Material Master: Update the Z fields using BAPI
Hi to all,
My requirement is simple. But I do not have much knowledge on BAPI. I have got some information that we can extend th BAPI and update the Z fields in material master. I have added the z fields in MARA. So when I call the bapi z fields has to get update.
Which BAPI can i use? I have got one BAPI - BAPI_MATERIAL_SAVEDATA. plz suggest me to do it.
1. how do i enhance the BAPI or extend th BAPI.
2. Is ther any approch to do it.
thnks
Yerukala SettyHi,
Append the z fields to BAPI_TE_MARA and BAPI_TE_MARAX structures using append structures.
Populate two structures for the fields in BAPI_TE_MARA and BAPI_TE_MARAX.
To BAPI_MATERIAL_SAVEDATA, under EXTENSIONIN parameters, pass structure name as BAPI_TE_MARA and Value Part1, 2, 3, 4 with the filled structure info.
Similarly append X structure as well.
Regards,
Ganga -
Create new work center in HR by using bapi.
Hello, everyone.
I'm trying to create a new work center in HR related to an organizational unit by using the bapi: BAPI_HRMASTER_SAVE_REPL_MULT.
For some reason I'm getting an error message:
"Object [work_center_id] does not exist in status 1".
This status comes from the field PL_STATUS at 1001, 1032 infotypes that I'm sending to the bapi.
Does anyone have a solution for me ??
Thanks in advance,
A.S.Not relevant anymore
-
How to change currency in PO item by using BAPI 'BAPI_PO_CREATE1'
Hi. i want to change currency in PO item.i just find this field in condition table in this BAPI. code is as below
*POPULATE condition data
CLEAR t_po_condition.
t_po_condition-ITM_NUMBER = v_poitem * 10. " Item No.
t_po_condition-COND_TYPE = 'PBXX'. " Condition type
t_po_condition-CALCTYPCON = C_B. " Calculation type
t_po_condition-COND_VALUE = SEQ_FILEH-NETPR. " Condition value
t_po_condition-CURRENCY = SEQ_FILEH-WAERS.
t_po_condition-COND_P_UNT = SEQ_FILEH-PEINH.
t_po_condition-CONDCHAMAN = c_x.
t_po_condition-COND_UPDAT = c_x.
APPEND t_po_condition.
*POPULATE condition data flags
CLEAR t_po_conditionX.
t_po_conditionX-ITM_NUMBER = v_poitem * 10.
t_po_conditionX-ITM_NUMBERX = C_X.
t_po_conditionX-COND_TYPE = C_X.
t_po_conditionX-CALCTYPCON = C_X.
t_po_conditionX-COND_VALUE = C_X.
t_po_conditionx-CURRENCY = C_X.
t_po_conditionX-COND_P_UNT = C_X.
t_po_conditionx-CONDCHAMAN = c_x.
t_po_conditionx-COND_UPDAT = c_x.
APPEND t_po_conditionX.
any advice?Just Select The Total Column, then Drag & Drop accordingly..
whereever you want..
Alternatively you can do by
in the top right corner of the item overview you have a button for table control (above the vertical scroll bar).
If you click that button, you get a pop-up from where you can customize the layout.
Press the blue info button there and read how this is to be done. -
Use of long text in maintenance item
Hi Experts ,
What is use of long text in maintenance item, Which T code is use for to create long text for maintenance item
With best regards,
AVI DDS.hi
if you have maintained the tasklist ,i think it will copy the maintenance item short and long text to the maintenance order or notification created
regards
thyagarajan
Maybe you are looking for
-
OS X 10.8.3 Kills Wifi
Running Mac Mini. Just upgraded to 10.8.3 Wed AM (it is now Thu PM). Computer has lost all wifi functionality. Boot the computer and login. Open browser and everything is fine for about 15 minutes then it gets slower and slower until it stops. Boot t
-
SPL block at PO in GTS - GR creation is allowing in ECC
Hi All, SPL functionality is working fine for SD cycly but not for MM cycle. SD process: Sales order created, blocked in GTS automatically. When we try to create delivery in ECC before releasing order in GTS, the system showing error. That means deli
-
Error Handling in tables using ABap Webdynpro
Hi All, I am new to this ABAP webdynpro programming. I have a small question. I am using a table control in one of my iview. I need to check some validations on some columns of this table. Let's say I have a table with 3 columns A,B and C. Case 1 :
-
i have 1 user which is connected through three different sessions. one user----->three sessions session_ids for example 50,51,52 now i want to commit a transaction of that user with seission id 52. How can i acchive this task. MY problem is that one
-
Hi I have to make few objects in web dynpro.. I have seen the tutorials on sdn But can naybody provide me with some other material in which i can find some other objects with step by step instruction. I really need a good hand in web dynpro in abap.