Function Module to modify MARC table
Hi all,
Is There any Function Module which modifys the table MARC.
please suggest.
regards,
chandra.
Hello Reddy,
Check this sample code:
*& Report ZYTEST02 *
report zytest02 .
parameters:matnr like bapimathead-material,
maktx like bapi_makt-matl_desc default 'Mat. autm. AE',
werks like bapi_marc-plant,
vkorg like bapi_mvke-sales_org,
vtweg like bapi_mvke-distr_chan.
start-of-selection.
perform material_create using matnr
maktx
werks
vkorg
vtweg.
*& Form material_create
* text
* -->P_MATERIAL text
form material_create using value(p_matnr)
value(p_maktx)
value(p_werks)
value(p_vkorg)
value(p_vtweg).
tables: mara.
* shift p_matnr right deleting trailing space.
* translate p_matnr using ' 0'.
data: headdata like bapimathead occurs 0 with header line.
data: clientdata like bapi_mara.
data: clientdatax like bapi_marax.
data: salesdata like bapi_mvke.
data: salesdatax like bapi_mvkex.
data: plantdata like bapi_marc.
data: plantdatax like bapi_marcx.
data: return like bapiret2.
data: taxclassifications like bapi_mlan occurs 0 with header line.
data: commitmessages like bapi_matreturn2 occurs 0 with header line.
data: returnmessages like bapiret2 occurs 0 with header line.
data: materialdescription like bapi_makt occurs 0 with header line.
data: charx value 'X'.
* Kopfdaten
headdata-material = p_matnr.
headdata-matl_type = 'FERT'.
headdata-ind_sector = 'M'.
* Sichten die gepflegt werden sollen
headdata-basic_view = charx. "Sicht auf Grunddaten
headdata-sales_view = charx. "Sicht auf Vertriebsdaten
* Daten für die Sicht GRUNDDATEN 1
materialdescription-langu = sy-langu.
materialdescription-matl_desc = p_maktx.
append materialdescription.
* Mandantenspezifische Materialdaten
clientdata-base_uom = 'ST'.
clientdatax-base_uom = charx.
clientdata-trans_grp = '0001'.
clientdatax-trans_grp = charx.
* Materialdaten auf Werksebene
plantdata-plant = p_werks.
plantdatax-plant = p_werks.
plantdata-loadinggrp = '0001'.
plantdatax-loadinggrp = charx.
* Verkaufsdaten
salesdata-sales_org = p_vkorg.
salesdatax-sales_org = p_vkorg.
salesdata-distr_chan = p_vtweg.
salesdatax-distr_chan = p_vtweg.
* Steuerklassifikation
taxclassifications-depcountry = 'DE'.
taxclassifications-tax_type_1 = 'MWST'.
taxclassifications-taxclass_1 = '1'.
append taxclassifications.
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
headdata = headdata
clientdata = clientdata
clientdatax = clientdatax
plantdata = plantdata
plantdatax = plantdatax
* FORECASTPARAMETERS =
* FORECASTPARAMETERSX =
* PLANNINGDATA =
* PLANNINGDATAX =
* STORAGELOCATIONDATA =
* STORAGELOCATIONDATAX =
* VALUATIONDATA =
* VALUATIONDATAX =
* WAREHOUSENUMBERDATA =
* WAREHOUSENUMBERDATAX =
salesdata = salesdata
salesdatax = salesdatax
* STORAGETYPEDATA =
* STORAGETYPEDATAX =
importing
return = return
tables
materialdescription = materialdescription
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* INTERNATIONALARTNOS =
* MATERIALLONGTEXT =
taxclassifications = taxclassifications
returnmessages = returnmessages
* PRTDATA =
* PRTDATAX =
* EXTENSIONIN =
* EXTENSIONINX =
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = charx
importing
return = commitmessages.
* commit work and wait.
* Für den Fall das es notwendig wird die Exclusive Sperre wegräumen
CALL FUNCTION 'DEQUEUE_EMMARAE'
EXPORTING
matnr = p_matnr.
* if return-type ne 'S'.
format color col_negative.
loop at returnmessages.
write: / returnmessages-message.
endloop.
* endif.
loop at commitmessages.
write: / commitmessages-message.
endloop.
endform. " material_create
If useful reward.
Vasanth
Similar Messages
-
Function module to modify the vendor confirmation data
Hi,
I am using ME_CONFIRMATION_UPODATE to add a new record to table EKES, ie I am able to see the vendor confirmation in purchase order. Can I use the same function module to modify the same record in above table EKES or anyother function module is there? My requirment is to change the delivery date once again in confirmation tab in purchase order.
Please help,
Thanks,
Vengal Rao.Hi All,
I could use the same function module and change the delivery date, i thing I changed is the data in field KZ , instead of 'I' used 'U'. to update the existing data.
Thanks,
Vengal Rao. -
Function Module: how to setting table import parameter
hi, i'm developing a function module. i create a TABLES where it will allow multiple variables IMPORT from user input to this function module. the tables i set as OPTIONAL and decribed as below.
PSPID PS_PSPID CHAR 24
POSID PS_POSID CHAR 24
AUFNR AUFNR CHAR 12
PSY J_STATUS CHAR 5
PUS J_STATUS CHAR 5
in my source code, i done a select statement to process the IMPORT input . the problems i face,for the PSY and PUS input, if the one or both input is BLANK, NO RESULT will display. What i'm try to do , if input one or both is BLANK, it wil neglect the input and return as ALL RESULT (return result oir all status for input pspis / posid / aufnr) . attached the select statement. thank you
itparm[] = objparm[].
select
a~pspnr a~stspr a~objnr a~pspid
b~psphi b~objnr as wobjnr b~posid
c~aufnr c~objnr as nobjnr c~pspel
d~objnr as jeobjnr d~inact d~stat
e~objnr as jcobjnr e~udate e~usnam e~utime e~stat as jcstat e~inact as jcinact
f~istat as syistat
f~txt04 as sytxt04
f~spras
g~estat as usestat
g~txt04 as ustxt04
into corresponding fields of table itobj
from proj as a
inner join prps as b on a~pspnr = b~psphi
inner join aufk as c on b~pspnr = c~pspel
inner join jest as d on c~objnr = d~objnr
inner join jcds as e on d~objnr = e~objnr
and d~stat = e~stat
inner join tj02t as f on e~stat = f~istat
inner join tj30t as g on a~stspr = g~stsma
for all entries in itparm
where ( a~pspid = itparm-pspid
or b~posid = itparm-posid
or c~aufnr = itparm-aufnr )
and ( f~istat = itparm-PSY and g~estat = itparm-PUS ).Thanks for your quick reply. actually the data will be somehing like this. since i developed a function module, i keep the import parameter in a table.
PSPID PS_PSPID CHAR 24
POSID PS_POSID CHAR 24
AUFNR AUFNR CHAR 12
PSY J_STATUS CHAR 5
PUS J_STATUS CHAR 5
the example data will be in OTPARM internal table
PSPID POSID AUFNR PSY PUS
aa-aa-aa a1 I001
bb-bb-bb b1 E009
cc-cc-cc
i'll store this into an internal table. from the data. it can be seen there a BLANK input. so the blank input should not be included into WHERE connditions. that why in the previous solution, i use SELECT inside LOOP because every line of the IMPORT tables will be generated with different WHERE conditions. i tried to do something like this:
PSPID POSID AUFNR PSY PUS cond_syx
aa-aa-aa a1 I001 if proj~pspid = itparm-pspid and prps~posid = itparm~posid and ....
bb-bb-bb b1 E009 if proj~pspid = itparm-pspid and aufk~aufnr = itparm~paufnr and ....
cc-cc-cc if proj~pspid = itparm-pspid
and implement with FOR ALL ENTERIES, but at the WHERE conditions i failed to put the CONF_SYX. please comment and give opinions. Thanks you very much. -
How to save function module in a custom table..
hi experts,
i need your help, how can i save a customize function module into a custom table?is this possible?
i need your reply ASAP..
thanks,
mauHi,
pls chk this links:
Generic extraction via function module blog siggi
/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
Generic extraction via function module
BW genenric delta not TABLE but VIEW
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/d1/801ee8454211d189710000e8322d00/frameset.htm
Re: how to use a function module
http://help.sap.com/saphelp_nw70/helpdata/en/2a/f9ff95493111d182b70000e829fbfe/frameset.htm
**pls assign points,if link is useful*
Regards
CSM Reddy -
Function Module to read EDIDC table data.
Dear All,
I am retrieving data from EDIDC table depending upon the creation date and message type. But it is consuming a lot time and hence while going for more than one month data , it gives run time error.
I found while going through debugger that maximum time is consumed by the SELECT query in retrieving the EDIDC data.
Is there any Function Module for retrieving EDIDC table data.
If so kindly let me know.How can a fm replace this performance issue ? You have only two fields to be passed such as creation date and message type.
For the table EDIDC there is a secondary index 3 for message type. Did you use that ? What is your query written ?
If you look into the standard report RSEIDOC2, the field for creation date used is UPDDAT. It implies usage of secondary index 2
Refer line no 114
Regards
Kesav -
Function module to modify the user roles & profiles
Hi All,
I am working on user maintenance and i need a function module to modify the user roles & profiles.
Thanks in Advance.
Phani.i used the below fms
BAPI_USER_ACTGROUPS_ASSIGN for assigning the roles.
delete the profiles of the user qnd assign the profiles to the user:
BAPI_USER_PROFILES_DELETE
BAPI_USER_PROFILES_ASSIGN
i used the above FMs for my requirement.
Regards,
Phani. -
Is there any delivered BAPI or Functional modules available for MCHB table
Hi Experts,
I have a requirement where I have to pull inventory data from MCHB table without custom code. Is there any delivered BAPI or Functional modules available for MCHB table?
Kindly help!
Thanks
GopalHi,
Can you check using the Fun Modules
MG_BATCH_CHECK_STOCK
VB_READ_BATCH_WITHOUT_STOCK
VB_BATCH_GET_ALL_STOCKS
Regards,
Anji -
Storing the output of a function module into a custom table
Hi Gurus,
Is it possible to store the output of a function module into a custom table.How can this be done?Is it complex?hi,
After u execute the FM and get values in the internal table ITAB_RESULT. Create a custom table having structure same as ITAB_RESULT call it ZRESULT.
data :wa type ITAB_RESULT.
call FM and get result it ITAB_RESULT
loop at itab_result.
move-corresponding itab_result to wa.
insert wa to ZRESULT.
endloop.
Regards,
Mansi. -
How to find function modules used in maintenance table views
Hi,
How do I find the function modules used in maintenance table views?
I'm using SM30 and trying to open the custom table but there is an error message saying CREATE DATA PROCESSING FUNCTION MODULE.
Thanks.
Kathhi
in se80 select functon group and put your table function group name there and click display. it will show you the function modules used for that tables.
Regards
Madhu -
Hi, Bapi or function module to update RBCO table from an internal table.
I have a requirement to update RBCO table from an internal table. is there any Bapi or function module or any other method other than update, modify statements.
Moderator message: Welcome to SCN!
Moderator message: please do more research before asking, show what you have done yourself when asking.
[Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
[Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
Edited by: Thomas Zloch on Jul 12, 2011 12:28 PMI don't know if any FM exists for your requirement. But you may like to copy it into a custom table and modify it according to your enterprise needs.
-
Any Bapi or function Module to update standard table
Can u Plz let me know , is there any bapi or function module to update few fields of a standard table using an internable.
I don't know if any FM exists for your requirement. But you may like to copy it into a custom table and modify it according to your enterprise needs.
-
Function Module Extraction from KONV Table taking lot of time for extractio
Hi
I have a requirement wherein i need to get records from KONV Table (Conditions (Transaction Data) ). i need the data corresponding to Application (KAPPL) = 'F'.
For this i had written one function module but it is taking lot of time (@ 2.5 hrs) for fetching records as there are large number of records in KONV Table.
I am pasting the Function Module code for reference.
<b>kindly guide me as to how the extraction performance can be improved.</b>
<b>Function Module Code:</b>
FUNCTION ZBW_SHPMNT_COND.
""Local interface:
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SBIWA_S_INTERFACE-REQUNR
*" VALUE(I_ISOURCE) TYPE SBIWA_S_INTERFACE-ISOURCE OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SBIWA_S_INTERFACE-MAXSIZE OPTIONAL
*" VALUE(I_INITFLAG) TYPE SBIWA_S_INTERFACE-INITFLAG OPTIONAL
*" VALUE(I_UPDMODE) TYPE SBIWA_S_INTERFACE-UPDMODE OPTIONAL
*" VALUE(I_DATAPAKID) TYPE SBIWA_S_INTERFACE-DATAPAKID OPTIONAL
*" VALUE(I_PRIVATE_MODE) OPTIONAL
*" VALUE(I_CALLMODE) LIKE ROARCHD200-CALLMODE OPTIONAL
*" TABLES
*" I_T_SELECT TYPE SBIWA_T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SBIWA_T_FIELDS OPTIONAL
*" E_T_DATA STRUCTURE ZBW_SHPMNT_COND OPTIONAL
*" E_T_SOURCE_STRUCTURE_NAME OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
The input parameter I_DATAPAKID is not supported yet !
TABLES: KONV.
Auxiliary Selection criteria structure
DATA: l_s_select TYPE sbiwa_s_select.
Maximum number of lines for DB table
STATICS: l_maxsize TYPE sbiwa_s_interface-maxsize.
Maximum number of lines for DB table
STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
counter
S_COUNTER_DATAPAKID LIKE SY-TABIX,
cursor
S_CURSOR TYPE CURSOR.
Select ranges
RANGES: L_R_KNUMV FOR KONV-KNUMV,
L_R_KSCHL FOR KONV-KSCHL,
L_R_KDATU FOR KONV-KDATU.
Declaring internal tables
DATA : I_KONV LIKE KONV OCCURS 0 WITH HEADER LINE.
DATA : Begin of I_KONV occurs 0,
MANDT LIKE konv-mandt,
KNUMV LIKE konv-knumv,
KPOSN LIKE konv-kposn,
STUNR LIKE konv-stunr,
ZAEHK LIKE konv-zaehk,
KAPPL LIKE konv-kappl,
KSCHL LIKE konv-kschl,
KDATU LIKE konv-kdatu,
KBETR LIKE konv-kbetr,
WAERS LIKE konv-waers,
END OF I_KONV.
Initialization mode (first call by SAPI) or data transfer mode
(following calls) ?
IF i_initflag = sbiwa_c_flag_on.
Initialization: check input parameters
buffer input parameters
prepare data selection
The input parameter I_DATAPAKID is not supported yet !
Invalid second initialization call -> error exit
IF NOT g_flag_interface_initialized IS INITIAL.
IF
1 = 2.
MESSAGE e008(r3).
ENDIF.
log_write 'E' "message type
'R3' "message class
'008' "message number
' ' "message variable 1
' '. "message variable 2
RAISE error_passed_to_mess_handler.
ENDIF.
Check InfoSource validity
CASE i_isource.
WHEN 'X'.
WHEN 'Y'.
WHEN 'Z'.
WHEN OTHERS.
IF 1 = 2. MESSAGE e009(r3). ENDIF.
log_write 'E' "message type
'R3' "message class
'009' "message number
i_isource "message variable 1
' '. "message variable 2
RAISE error_passed_to_mess_handler.
ENDCASE.
Check for supported update mode
CASE i_updmode.
For full upload
WHEN 'F'.
WHEN 'D'.
WHEN OTHERS.
IF 1 = 2. MESSAGE e011(r3). ENDIF.
log_write 'E' "message type
'R3' "message class
'011' "message number
i_updmode "message variable 1
' '. "message variable 2
RAISE error_passed_to_mess_handler.
ENDCASE.
APPEND LINES OF i_t_select TO g_t_select.
Fill parameter buffer for data extraction calls
g_s_interface-requnr = i_requnr.
g_s_interface-isource = i_isource.
g_s_interface-maxsize = i_maxsize.
g_s_interface-initflag = i_initflag.
g_s_interface-updmode = i_updmode.
g_s_interface-datapakid = i_datapakid.
g_flag_interface_initialized = sbiwa_c_flag_on.
Fill field list table for an optimized select statement
(in case that there is no 1:1 relation between InfoSource fields
and database table fields this may be far from beeing trivial)
APPEND LINES OF i_t_fields TO g_t_fields.
Interpretation of date selection for generic extraktion
CALL FUNCTION 'RSA3_DATE_RANGE_CONVERT'
TABLES
i_t_select = g_t_select.
ELSE. "Initialization mode or data extraction ?
CASE g_s_interface-updmode.
WHEN 'F' OR 'C' OR 'I'.
First data package -> OPEN CURSOR
IF g_counter_datapakid = 0.
L_MAXSIZE = G_S_INTERFACE-MAXSIZE.
LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'KNUMV'.
MOVE-CORRESPONDING l_s_select TO l_r_knumv.
APPEND l_r_knumv.
ENDLOOP.
LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'KSCHL'.
MOVE-CORRESPONDING l_s_select TO l_r_kschl.
APPEND l_r_kschl.
ENDLOOP.
Loop AT g_t_select INTO l_s_select WHERE fieldnm = 'KDATU'.
MOVE-CORRESPONDING l_s_select TO l_r_kdatu.
APPEND l_r_kdatu.
ENDLOOP.
*In case of full upload
Fill field list table for an optimized select statement
(in case that there is no 1:1 relation between InfoSource fields
and database table fields this may be far from beeing trivial)
APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.
OPEN CURSOR G_CURSOR FOR
SELECT MANDT
KNUMV
KPOSN
STUNR
ZAEHK
KAPPL
KSCHL
KDATU
KBETR
WAERS
FROM KONV
WHERE KNUMV IN l_r_knumv
AND KSCHL IN l_r_kschl
AND KDATU IN l_r_kdatu
AND KAPPL EQ 'F'.
ENDIF.
Refresh I_KONV.
FETCH NEXT CURSOR G_CURSOR
APPENDING CORRESPONDING FIELDS OF TABLE I_KONV
PACKAGE SIZE S_S_IF-MAXSIZE.
IF SY-SUBRC <> 0.
CLOSE CURSOR G_CURSOR.
RAISE NO_MORE_DATA.
ENDIF.
LOOP AT I_KONV.
IF I_KONV-KAPPL EQ 'F'.
CLEAR :E_T_DATA.
E_T_DATA-MANDT = I_KONV-MANDT.
E_T_DATA-KNUMV = I_KONV-KNUMV.
E_T_DATA-KPOSN = I_KONV-KPOSN.
E_T_DATA-STUNR = I_KONV-STUNR.
E_T_DATA-ZAEHK = I_KONV-ZAEHK.
E_T_DATA-KAPPL = I_KONV-KAPPL.
E_T_DATA-KSCHL = I_KONV-KSCHL.
E_T_DATA-KDATU = I_KONV-KDATU.
E_T_DATA-KBETR = I_KONV-KBETR.
E_T_DATA-WAERS = I_KONV-WAERS.
APPEND E_T_DATA.
ENDIF.
ENDLOOP.
g_counter_datapakid = g_counter_datapakid + 1.
ENDIF.
ENDFUNCTION.
Thanks in Advance
Regards
Swapnil.Hi,
one option to investigate is to select the data with a condition on KNUMV (primary IDX).
Since shipment costs are store in VFKP I would investigate if all your F condition records are used in this table (field VFKP-KNUMV).
If this is the case then something like
SELECT *
FROM KONV
WHERE KNUMV IN (SELECT DISTINCT KNUMV FROM VFKP)
or
SELECT DISTINCT KNUMV
INTO CORRESPONDING FIELD OF <itab>
FROM VFKP
and then
SELECT *
FROM KONV
FOR ALL ENTRIES IN <itab>
WHERE...
will definitively speed it up.
hope this helps....
Olivier -
Linking Function Module to R/3 table in Crystal Reports
Hi Experts,
I am creating a report wherin I am linking a function module to a R/3 table. When I try to preview this report, I am getting "Failed to retrieve data from database" and then"Invalid Argument Provided".
If I exclude either FM or Table from report, both return data to the report.
It is Crystal Reports 2008
SAPGUI 720
CRDB OpenSQL dll is 12.3.0.601
Thank you
IMSHi all,
This issue is apparently fixed by applying FP3.1.
Will do so and update the post here.
Cheers
IMS -
Function Module to Download Internal table in EXCEL
Hi All,
I need a Function Module to download the Internal table to Excel File.
I Have used SAP_CONVERT_TO_XLS_FORMAT,
but this function modules are using GUI_Download indirectly.
I dont want to use GUI_DOWNLOAD as i am going to call this Function Module in Portal.
So pls anybody has this type of function module.
Thanks & Regards,
Dhruv ShahHello Dhruv.
In Agreement with Deniz.
It is required to Export the query as an excel file.
[SAP HELP Library - Standard Reference - Exporting as a CSV File / MS Excel 2000 File|http://help.sap.com/saphelp_nw04/helpdata/en/d2/11a28fc26d4042a6d230a9783152f2/content.htm]
[SDN - Reference - Error in "Export to Microsoft Excel" from Portal|Error in "Export to Microsoft Excel" from Portal;
Hope this works out well.
Good Luck & Regards.
Harsh Dave -
How to create function module to update z tables?
Hi,
I am new to ABAP. I checked the forum but did not find relevant solutions.
I have 2 z tables - ZFLIGHT and ZCUSTOMER. I have a few entries in each table.
I want to write a report to update the entries in the table using function modules. For that I have created a function module - zflight_fm and also a function group- zflight_fg and assigned the function group to the Fm. I do not know how to proceed further, what to put as import, export parameters, tables, changing etc. Further I want exceptions to handle the successful update of the entries.
Thanks and regards,
SmruthiSteps:
1) Changing --->a) Zflight TYPE ZFLIGHT(DDIC Ref) OR Zflight TYPE ANY TABLE
b) ZCustomer TYPE ZFLIGHT(DDIC Ref) OR ZCustomer TYPE ANY TABLE
2) Execptions:
a) Upload_failed_Flight
b) Upload_Failed_Customer
3) Exporting ---> a) Information what rows are uploaded
Source Code:
Insert Zflight from Zflight(changing parameter).
If insert failed
RAISE Upload_failed_Flight.
endif.
Insert ZCustomer from ZCustomer(changing parameter).
If insert failed
RAISE Upload_failed_Customer.
endif.
Regards,
Gurpreet
Maybe you are looking for
-
SSRS 2008 R2 is extremely slow. The query runs in less than a second in the dataset designer but if you try to view the report it takes over 10 minutes. I have read this is a bug in SSRS 2008 R2. We installed the most recent patches and service pa
-
Modification to SAP Logon Cannot be written to INI file
Hi, When i am trying to create a New Item in SAP logon it is giving an error "Modification to SAP logon could not be Written to INI file Check permission for file 'C:\Windows'. The problem is that, this is showing even when i m logged in as "XXXADM".
-
Problem getting ServletConfig in ManagedBean in JSF Portal environment
I am working on a portal application in Weblogic Workshop 8.1 SP4 using JSF.I am having problems in getting the ServletConfig in managed Bean class.I have been able to convert PortletRequest to HttpServletRequest and now i want to get the ServletConf
-
please help problem with importing a file error output "there was an error decompressing audio or video"
-
OK-brand new iMac and have it hooked up to a HP Laserjet 3055 (about 6 years old)-I can print, but can't scan. I went to driver update on HP site, updated there, it seems to not want to download the HP update provided by Apple-Am I missing something,