Bapi or FM to Create Or Update multidimensional freight conditions for different scale id for different conditions
Hello all,
I want to create or update multidimensional freight conditions for different scale id for different conditions.
I cound not find any Bapi or FM for this. I uesd BDC for this but i can not rely on it.
If any one have other solution than IDOC then suggest me.
Any BAPI or FM available then suggest me.
Hi Gowri Rao,
Can you please tell me, what values do you pass in table 'IT_PRICING_CONDITIONS'?
Regards,
Pratik
Similar Messages
-
BAPI to create and update scheduling agreement (type LZM) in ECC
Hi,
We have a requirement to create and update scheduling agreement of type LZM in ECC from an external system.
Is there a BAPI available for this in ECC 6.0 which can be used?
The integration is using PI.
Regards,
SrivatsanHello,
Please use the T-code "SE93" and then click on Display option after entering the T-code. After entering into the detail screen of the T-code, you shall find option to click on OBJECT LIST and then enter into the Function Group. Now enter the T-code and then click on function module and a list of function module will be displayed in referrence to the T-code.
For your easy reference i have also mentioned the flow.
SE93 --> Use tcode (eg. VA01) > display> Object list ---> Function Groups --> Tcode ---> Function module.
Regards,
Sarthak -
Problem in creating and updating of material by the use of bapi and bdc
Hello All,
I am using bapi (BAPI_MATERIAL_SAVEDATA ) and than bdc to create and update classification data of material.
I am facing a problem.
1) firstly I am creating material by the use of bapi and than after creation i want to update classification data for taht perticular material .
2) To update classification data i am using bdc . while at the time of updating material through bdc system showing me error that material is currently locked by user (my login name ).
Please suggest what to do.
Tkank you
With Regards
Shantanu ModiWhen u update/create data it takes sometime to commit. So after using BAPI
give 10 minutes wait in ur program before updating classification data.
you can write like
wait up to 20 seconds.
and update the classification. -
BAPI or FM to create/update variant configuration
Is there a BAPI or FM to create/update variant configuraion?
There is one for sales order BAPI_SALESORDER_CREATEFRONDAT1 to create VC while creating SALES order.
How do you do create VC while creating PO?
Thanks.HI,
There are two different Function Modules used to create service product and material product in CRM system.
CRMXIF_PRODUCT_MATERIAL_SAVE for creating product of type material
and CRMXIF_PRODUCT_SERVICE_SAVE for creating product of type service.
Regards,
PP -
BAPI for COSS and COSP Table to Create and Update
Hi,
Is there a BAPI for COSS and COSP for creating and/or updating these tables?
Thankshi ,
u dont have any bapis for updatign specific tables
bapis are generally used for updating a transaction i mean number of tables
where is the use of the tables u can search bapis in transaction bapi
and where are the tables used i guess in fi/co so u can search under them
regards
afzal -
What is BAPI?How to create a BAPI? Difference b/w BAPI and BDC
Hi all,
Can some one help me regarding...
What is an BAPI?where it is used?
How to create a BAPI?
What is the difference between BAPI and BDC Program?
Iam in Initial stage regarding BAPI concept.
Please respond me soon.
Thanks,
LeeHI,
Here it is:
BAPI Programming Guide
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
BAPI User Guide
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
http://techrepublic.com.com/5100-6329-1051160.html#
http://www.sap-img.com/bapi.htm
http://www.sap-img.com/abap/bapi-conventions.htm
http://www.sappoint.com/abap/bapiintro.pdf
http://ifr.sap.com/catalog/query.asp
STEP BY STEP for BAPI
http://sap-img.com/abap/bapi-step-by-step-guidance.htm
<b>DIFFERENCE between BAPI and BDC</b>
BDC is traditional way of coding the transactions for uploading the legacy data, Sap is changing all transactions to Object oriented programming. Since BAPI is Object based and supports all the new transactions it is preffered over BDC. More over BAPI's process data faster than BDC.
BAPI is a SAP-supplied function module with a defined interface, which allows you to interact with various business objects. SAP guarantees the integrity of your database for anything updated using a BAPI. BDC is a method of driving screens programatically, for updating SAP data. BAPIs are generally faster than BDCs.
A BAPI is faster because it is updating the DB "directly". Whereas BDC with call
transaction goes through the whole screen sequence like any user would do, simply put, fills screens.
However - there is not always a BAPI for a particular transaction and not all functions that are performed by a transaction can be done by a BAPI. BDCs produce error sessions which can be processed by the user, while BAPIs don't.
First choose the BAPI ,if there is no BAPI go for BDC.
why BAPI first not BDC.
SAP comes up with Change in Version, so each and every time they will change the screens/number etc.
so you have to change your BDC programs accordingly.
and also Most of the Latest versions transactions are Enjoy Transaction. they will not support BDC's in Background.
But Using BAPI's No such disadvantages.
A BAPI is faster because it is updating the DB "directly" through ABAP code.
A BDC with call transaction goes through the whole screen sequence like any user would do, simply put, it is filling screens.
Actually it depends on your requirement but BAPI is more effective as it is standard function module to update SAP databases rather than BDC.
using bdc over bapi has advantages and also disadvantages
advantages:
1. using bdc we can upload data into database tables using 2 ways
1. foreground -
means that user interaction is there for each and every record.
2. back ground -
no user interaction and tasks are done automatically.
using these two options is one of the greatest advantage over bapi.
2. in bdc call transaction method we can control the display of screen resolution which is not possible with bapi's
3. bdc is generally used for transferring of large amount of data than bapi's
4.session method of bdc allows us to place data directly in application server and then finally transfered into sap database tables
disadvantages:
1.bdc is only used for sap to sap system data transferring
2. bapis's generally works more faster than bdc's
3. using bapis we can connect to remote systems and also to non sap systems.
if useful reward some points.
A BAPI is a method of a SAP Business Object. BAPI enables SAP and third party applications to interact and integrate
with each other at the Business Object / Process level.
Check this link to know more about BAPI.
http://www.sapgenie.com/abap/bapi/example.htm
http://sappoint.com/abap/
Batch Data Communication (BDC) is the oldest batch interfacing technique that SAP provided since the early versions of R/3. BDC is not a
typical integration tool, in the sense that, it can be only be used for uploading data into R/3 and so it is not bi-directional.
BDC works on the principle of simulating user input for transactional screen, via an ABAP program. Typically the input comes in the form
of a flat file. The ABAP program reads this file and formats the input data screen by screen into an internal table (BDCDATA). The
transaction is then started using this internal table as the input and executed in the background.
In Call Transaction, the transactions are triggered at the time of processing itself and so the ABAP program must do the error handling.
It can also be used for real-time interfaces and custom error handling & logging features. .
To know more about BDC,
check the link.
http://sappoint.com/abap/
Main differences are...
In case of bdc data transfer takes place from flat file into sap system ie the file existing in sap system to sap sytem
where is bapi's r remotly enabled function modules which are assigned to some business objects n used to transfer the data between different business partners who are using different systems other than sap.
not only that...
when you plan to upgrade your system version then bdc willnot support those upgradations where as bapi's will support.
<b><REMOVED BY MODERATOR></b>
Manish
Message was edited by:
Alvaro Tejada Galindo -
FM to create and update SCD vi01
Hi,
I am trying to create Shipment cost document (vi01) using the standard function modules. I followed this forum and could able to create vi01 using below stepsin sequence..
SD_SCD_REFOBJ_READ
SD_SCD_INITIALIZESD_SCD_ITEMS_CREATE
SD_SCD_ITEM_PRICING_COMPLETE
SD_SCD_ITEM_AMOUNT_ADJUST
SD_SCD_ITEM_CHANGE
SD_SCD_CHANGE
SD_SCDS_CHECK_COMPLETE
SD_SCDS_SAVE
SD_SCD_TYPE_DETERMINE
However, using the shipment number I need to update the Condition tab in T.code: vi01 with Pricing data, populating Condition types and values, calculate them and display the Net value, then save and transfer the Cost document. Can anyone suggest me, how can i achieve this?
even thought the used the following fn modules and passed l the values are not fetched from
SD_SCD_ITEM_PRICING_COMPLETE,
SD_SCD_ITEM_AMOUNT_ADJUST
SD_SCD_ITEM_CHANGE
i tried these tables
komv-kschl = Condition Type
komv-kawrt = condition base value
komv-kbetr = rate
komv-waers = currency key
konv-knumv = doc condition
Can anyone help me?Hello Sirisha Kotnana
Check the below link :-
[BAPI or FM to create SCD (VI01)|BAPI or FM to create SCD (VI01)]
This answered.
In addition to your question You need to get the current data before updating the conditions using SD_SCD_ITEM_AMOUNT_ADJUST.
First get the current data and then find out / Investigate what needs to passed to the FM SD_SCD_ITEM_AMOUNT_ADJUST.
This will solve your problem.
Thanks,
Greetson -
Create or Update Business Partner in CRM ?
Dear Folks ,
Scenario is to Create or update Business partner in CRM from thirdparty system via PI
It would be great if you could clarify the following
Hope we have BAPI to create and Update Business partner in CRM system but my question is
1. Can we use any predelivered PI content - Message Interfaces - as proxies ( Server proxies ) to create BP from system ?
2. Same interface will work for Update as well ?
IF so what is that content ? where to find for our PI System ?
3. Can we use the same way for Client proxies as well when we want to update the business partner ?
4. What are the inbound and outbound Message Interfaces are available ?
Any help will be highly appreciated
Thanks.,
ShivaHi Ravi ,
I think that i am not described my question properly , Say i have CRM system where i have to create BP for this input comes from external system (forget about the system ) , Here i want to use Proxy (Server proxy ) which helps me create Business partner in CRM system .
Here my question is If sap delivers the Inbound interface ( where server proxy already generated by SAP) , which i will use to create BP ?
Can we do in this way ?
Thanks
Shiva -
BAPI or FM to create Vendor Master
I need a BAPI or FM/API to create a vendor master. Yes I know, there is BAPI_VENDOR_CREATE but it does not allow you to import any data. Is there a BAPI/FM/API that creates a vendor master while allowing you to import data (like BAPI_MATERIAL_SAVEDATA for materials).
Thanks,
DavisRefer to the following and award points if useful.BAPI is like using standard function modules.We will populate the parameters and handle errors from that.See the code below which is vendor debit posting.You can get an idea by the following code.
See the start of selection if this is confusing to you and understand the usage
TABLES
TABLES: VBAK,
ADR6,
TRDYSE01CM.
INCLUDE
INCLUDE ZZUTI_STD_HEADER_FOOTER. "Standard header and footer
TYPES DECLARATION
TYPES:
BEGIN OF T_CRMEMO,
VBELN TYPE VBAK-VBELN,
POSNR TYPE VBAP-POSNR,
ERDAT TYPE VBAK-ERDAT,
AUART TYPE VBAK-AUART,
AUGRU TYPE VBAK-AUGRU,
WAERK TYPE VBAK-WAERK,
VKORG TYPE VBAK-VKORG,
VTWEG TYPE VBAK-VTWEG,
SPART TYPE VBAK-SPART,
VDATU TYPE VBAK-VDATU,
BSTNK TYPE VBAK-BSTNK,
BSARK TYPE VBAK-BSARK,
BSTDK TYPE VBAK-BSTDK,
AEDAT TYPE VBAK-AEDAT,
BUKRS_VF TYPE VBAK-BUKRS_VF,
MATNR TYPE VBAP-MATNR,
ZMENG TYPE VBAP-ZMENG,
ZIEME TYPE VBAP-ZIEME,
END OF T_CRMEMO,
BEGIN OF T_CRMEMO_CHANGE,
VBELN(90) TYPE C,
POSNR TYPE VBAP-POSNR,
ERDAT TYPE VBAK-ERDAT,
AUART TYPE VBAK-AUART,
AUGRU TYPE VBAK-AUGRU,
WAERK TYPE VBAK-WAERK,
VKORG TYPE VBAK-VKORG,
VTWEG TYPE VBAK-VTWEG,
SPART TYPE VBAK-SPART,
VDATU TYPE VBAK-VDATU,
BSTNK TYPE VBAK-BSTNK,
BSARK TYPE VBAK-BSARK,
BSTDK TYPE VBAK-BSTDK,
AEDAT TYPE VBAK-AEDAT,
BUKRS_VF TYPE VBAK-BUKRS_VF,
MATNR TYPE VBAP-MATNR,
ZMENG TYPE VBAP-ZMENG,
ZIEME TYPE VBAP-ZIEME,
END OF T_CRMEMO_CHANGE,
BEGIN OF T_MVKE,
MATNR TYPE MVKE-MATNR,
VKORG TYPE MVKE-VKORG,
VTWEG TYPE MVKE-VTWEG,
MTPOS TYPE MVKE-MTPOS,
END OF T_MVKE,
BEGIN OF T_ORDERS,
VBELV TYPE VBFA-VBELV,
POSNV TYPE VBFA-POSNV,
VBELN TYPE VBFA-VBELN,
POSNN TYPE VBFA-POSNN,
VBTYP_N TYPE VBFA-VBTYP_N,
END OF T_ORDERS,
BEGIN OF T_EKPO,
EBELN TYPE EKKO-EBELN,
EBELP TYPE EKPO-EBELP,
WAERS TYPE EKKO-WAERS,
MENGE TYPE EKPO-MENGE,
MEINS TYPE EKPO-MEINS,
NETPR TYPE EKPO-NETPR,
PEINH TYPE EKPO-PEINH,
mwskz TYPE EKPO-mwskz,
TXJCD TYPE EKPO-TXJCD,
END OF T_EKPO,
BEGIN OF T_EKBE,
EBELN TYPE EKBE-EBELN,
EBELP TYPE EKBE-EBELP,
ZEKKN TYPE EKBE-ZEKKN,
VGABE TYPE EKBE-VGABE,
GJAHR TYPE EKBE-GJAHR,
BELNR TYPE EKBE-BELNR,
BUZEI TYPE EKBE-BUZEI,
END OF T_EKBE,
BEGIN OF T_RBKP,
BELNR TYPE RBKP-BELNR,
GJAHR TYPE RBKP-GJAHR,
BLDAT TYPE RBKP-BLDAT,
BUDAT TYPE RBKP-BUDAT,
XBLNR TYPE RBKP-XBLNR,
LIFNR TYPE RBKP-LIFNR,
RMWWR TYPE RBKP-RMWWR,
WMWST1 TYPE RBKP-WMWST1,
XRECH TYPE RBKP-XRECH,
STBLG TYPE RBKP-STBLG,
END OF T_RBKP,
BEGIN OF T_CDHDR,
OBJECTCLAS TYPE CDHDR-OBJECTCLAS,
OBJECTID TYPE CDHDR-OBJECTID,
CHANGENR TYPE CDHDR-CHANGENR,
UDATE TYPE CDHDR-UDATE,
UTIME TYPE CDHDR-UTIME,
END OF T_CDHDR,
BEGIN OF T_CDPOS,
OBJECTCLAS TYPE CDHDR-OBJECTCLAS,
OBJECTID TYPE CDHDR-OBJECTID,
CHANGENR TYPE CDHDR-CHANGENR,
TABNAME TYPE CDPOS-TABNAME,
TABKEY TYPE CDPOS-TABKEY,
FNAME TYPE CDPOS-FNAME,
CHNGIND TYPE CDPOS-CHNGIND,
VALUE_NEW TYPE CDPOS-VALUE_NEW,
VALUE_OLD TYPE CDPOS-VALUE_OLD,
END OF T_CDPOS,
BEGIN OF T_CHANGE_DOCS,
OBJECTCLAS TYPE CDHDR-OBJECTCLAS,
OBJECTID TYPE CDHDR-OBJECTID,
CHANGENR TYPE CDHDR-CHANGENR,
UDATE TYPE CDHDR-UDATE,
UTIME TYPE CDHDR-UTIME,
TABNAME TYPE CDPOS-TABNAME,
TABKEY TYPE CDPOS-TABKEY,
FNAME TYPE CDPOS-FNAME,
CHNGIND TYPE CDPOS-CHNGIND,
VALUE_NEW TYPE CDPOS-VALUE_NEW,
VALUE_OLD TYPE CDPOS-VALUE_OLD,
END OF T_CHANGE_DOCS,
BEGIN OF T_SUCCESS,
crmemo TYPE VBAK-vbeln,
cmemo TYPE VBAK-vbeln,
orders TYPE VBAK-vbeln,
po TYPE VBAK-vbeln,
miro_no TYPE VBAK-vbeln,
text(20) TYPE C,
END OF T_SUCCESS,
BEGIN OF T_ERROR,
crmemo TYPE VBAK-vbeln,
cmemo TYPE VBAK-vbeln,
orders TYPE VBAK-vbeln,
po TYPE VBAK-vbeln,
miro_no TYPE VBAK-vbeln,
text(100) TYPE C,
END OF T_ERROR.
WORKAREA DECLARATION
DATA:
WA_CRMEMO TYPE T_CRMEMO,
WA_CRMEMO_CHANGE TYPE T_CRMEMO_CHANGE,
WA_MVKE TYPE T_MVKE,
WA_ORDERS TYPE T_ORDERS,
WA_CMEMO TYPE T_ORDERS,
WA_PO TYPE T_ORDERS,
WA_EKPO TYPE T_EKPO,
WA_EKBE TYPE T_EKBE,
WA_EKBE_TEMP TYPE T_EKBE,
WA_RBKP TYPE T_RBKP,
WA_RBKP_TMP TYPE T_RBKP,
WA_CDHDR TYPE T_CDHDR,
WA_CDPOS TYPE T_CDPOS,
WA_CHANGE_DOCS TYPE T_CHANGE_DOCS,
WA_CRMEMO_MR8M TYPE T_CRMEMO,
WA_SUCCESS TYPE T_SUCCESS,
WA_ERROR TYPE T_ERROR,
WA_SUCCESS_MR8M TYPE T_SUCCESS,
WA_ERROR_MR8M TYPE T_ERROR.
*--Work area for all the internal tables used for Sending Mail
DATA :
WA_OBJPACK TYPE SOPCKLSTI1,
WA_OBJHEAD TYPE SOLISTI1,
WA_OBJBIN TYPE SOLISTI1,
WA_OBJTXT TYPE SOLISTI1,
WA_RECLIST TYPE SOMLRECI1 .
DATA:
*-- Structure to hold Invoice Header Data
x_docheader LIKE bapi_incinv_create_header,
*-- Structure to hold Reversal Posting Data
x_rev_post LIKE BAPI_INCINV_FLD.
INTERNAL TAABLE DECLARATION
DATA:
IT_CRMEMO TYPE STANDARD TABLE OF T_CRMEMO WITH HEADER LINE,
IT_CRMEMO_CHANGE TYPE STANDARD TABLE OF T_CRMEMO_CHANGE WITH HEADER LINE,
IT_MVKE TYPE STANDARD TABLE OF T_MVKE WITH HEADER LINE,
IT_CRMEMO_MIRO TYPE STANDARD TABLE OF T_CRMEMO WITH HEADER LINE,
IT_CRMEMO_MR8M TYPE STANDARD TABLE OF T_CRMEMO WITH HEADER LINE,
IT_ORDERS TYPE STANDARD TABLE OF T_ORDERS WITH HEADER LINE,
IT_CMEMO TYPE STANDARD TABLE OF T_ORDERS WITH HEADER LINE,
IT_PO TYPE STANDARD TABLE OF T_ORDERS WITH HEADER LINE,
IT_EKPO TYPE STANDARD TABLE OF T_EKPO WITH HEADER LINE,
IT_EKBE TYPE STANDARD TABLE OF T_EKBE WITH HEADER LINE,
IT_EKBE_TEMP TYPE STANDARD TABLE OF T_EKBE WITH HEADER LINE,
IT_RBKP TYPE STANDARD TABLE OF T_RBKP WITH HEADER LINE,
IT_CDHDR TYPE STANDARD TABLE OF T_CDHDR WITH HEADER LINE,
IT_CDPOS TYPE STANDARD TABLE OF T_CDPOS WITH HEADER LINE,
IT_CHANGE_DOCS TYPE STANDARD TABLE OF T_CHANGE_DOCS WITH HEADER LINE,
IT_SUCCESS TYPE STANDARD TABLE OF T_SUCCESS WITH HEADER LINE,
IT_ERROR TYPE STANDARD TABLE OF T_ERROR WITH HEADER LINE,
IT_SUCCESS_MR8M TYPE STANDARD TABLE OF T_SUCCESS WITH HEADER LINE,
IT_ERROR_MR8M TYPE STANDARD TABLE OF T_ERROR WITH HEADER LINE.
*-- Internal table to hold Invoice Item Data
DATA:BEGIN OF it_itemdata OCCURS 0.
INCLUDE STRUCTURE bapi_incinv_create_item.
DATA:END OF it_itemdata.
*-- Internal table to hold Invoice Acct Assignment Data
DATA:BEGIN OF it_ACCOUNTingdata OCCURS 0.
INCLUDE STRUCTURE BAPI_INCINV_CREATE_ACCOUNT.
DATA:END OF it_accountingdata.
*-- Internal table to hold BAPI return data
DATA: BEGIN OF it_return OCCURS 0.
INCLUDE STRUCTURE bapiret2. "Return Parameter.
DATA: END OF it_return.
*-- Internal table to hold BAPI return data
DATA: BEGIN OF it_return_mr8m OCCURS 0.
INCLUDE STRUCTURE bapiret2. "Return Parameter.
DATA: END OF it_return_mr8m.
*--MAIL related Internal tables
DATA: X_DOC_CHNG TYPE SODOCCHGI1, " document attributes
IT_OBJPACK TYPE STANDARD TABLE OF SOPCKLSTI1, " attachment table
IT_OBJHEAD TYPE STANDARD TABLE OF SOLISTI1, " object header table
IT_OBJBIN TYPE STANDARD TABLE OF SOLISTI1, " binary table
IT_OBJTXT TYPE STANDARD TABLE OF SOLISTI1, " object text
IT_RECLIST TYPE STANDARD TABLE OF SOMLRECI1, " mail recipients
it_compressed_list TYPE STANDARD TABLE OF SOLI,
it_pdf_list TYPE STANDARD TABLE OF TLINE,
it_pdf TYPE tline OCCURS 10 WITH HEADER LINE,
it_html TYPE solisti1 OCCURS 10 WITH HEADER LINE,
*-- Internal table for MIME data (in CHAR format)
it_temp TYPE bapiqcmime OCCURS 10 WITH HEADER LINE,
*-- Internal table for storing data
it_mime(255) TYPE c OCCURS 10 WITH HEADER LINE.
GLOBAL VARIABLES *
DATA: V_PGM_ID TYPE SY-REPID, " Program id
v_zterm TYPE lfb1-zterm, " Payment Terms
v_text(75) TYPE c, " To store error or success text
v_itemno(6) TYPE n, " To Increment Item No. for BAPI
v_docnr LIKE bapi_incinv_fld-inv_doc_no, " For MIRO document number
v_year1 LIKE bapi_incinv_fld-fisc_year, " For MIRO Fiscal year
v_spono type TSP01-RQIDENT, " For Spool No.
v_type type SOODK-OBJTP, " For Spool Type
V_CRMEMO_QTY TYPE VBAP-ZMENG, " For CR Memo Qty.
V_LINE_AMOUNT TYPE EKPO-NETPR, " For CR Memo Item Qty.
V_GROSSAMT TYPE EKPO-NETPR, " For CR Memo Grand Qty.
v_tax_per(3) type n, " For CR Memo Tax amount %
v_tax_amt TYPE EKPO-NETPR, " For CR Memo Tax amount
v_flag(1) type c, " Flag to process fruther
v_tot_s_mr8m TYPE i, " For MR8M Success Records
v_tot_e_mr8m TYPE i, " For MR8M Error Records
V_DATE TYPE SY-DATUM, " For Sel. Screen Date
V_DATE2(10) TYPE C, " For EMail Date
V_TIME(10) TYPE C, " For EMail Time
V_TIME2(10) TYPE C, " For EMail Time
V_INFO(100) TYPE C, " For EMail Body Text
V_TABLE_LINES TYPE SY-TABIX, " To Increment Email Count
V_TEXT2 TYPE STRING , " For EMail Id text
v_lines TYPE i, " To Store PDF Lines
v_temp(500) TYPE c, " To Convert to 255 char format
v_offset TYPE p, " To Convert to 255 char format
v_lineslen TYPE i, " To Convert to 255 char format
v_mimelen TYPE i, " To Convert to 255 char format
v_tabix type sy-tabix. " To Convert to 255 char format
CONSTANTS *
CONSTANTS:
C_X(1) TYPE C VALUE 'X', " Constant X or Flag
C_E(1) TYPE C VALUE 'E', " For Error check
c_v(1) TYPE C VALUE 'V', " For PO Docs
c_o(1) TYPE C VALUE 'O', " For Order Docs
c_c(1) TYPE C VALUE 'C', " For Credit Memo Docs
c_k(1) TYPE C VALUE 'K', " For CR Memo Docs
c_u(1) TYPE C VALUE 'U', " For Change tables Update
c_ali(3) TYPE C VALUE 'ALI', " For ALI Format
c_vbak(4) TYPE C VALUE 'VBAK', " For Change docs table
C_01(2) TYPE C VALUE '01', " For Serial No. & Reversal Reason
C_02(2) TYPE C VALUE '02', " For Reversal Reason
c_blart TYPE bkpf-blart VALUE 'RE', " Document type
C_MTPOS TYPE MVKE-MTPOS VALUE 'BANS', " Item Category group
C_AUGRU(5) TYPE C VALUE 'AUGRU', " Reason Code
C_0000500205(10) TYPE C VALUE '0000500205', " GL Account #
C_VERKBELEG(9) TYPE C VALUE 'VERKBELEG'. " For Object Class
*-- Horizontal tab & line feed constants
CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.
CONSTANTS:
C_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
C_CR_LF TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF .
SELECTION SCREEN
*-- Select Optons
SELECTION-SCREEN: BEGIN OF BLOCK B01 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_AUART FOR VBAK-AUART OBLIGATORY NO INTERVALS,
" Sales Document Type
S_AUGRU FOR VBAK-AUGRU OBLIGATORY NO INTERVALS,
" Order reason
S_ERDAT FOR VBAK-ERDAT OBLIGATORY.
" Date on which the record was created
SELECTION-SCREEN: END OF BLOCK B01.
*-- Mail Sending Options
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.
PARAMETERS:P_EMAIL AS CHECKBOX DEFAULT SPACE USER-COMMAND V_COM .
PARAMETERS : P_MODE TYPE SO_ESCAPE default 'U' MODIF ID US1.
SELECT-OPTIONS: S_EMAIL FOR ADR6-SMTP_ADDR
NO INTERVALS MODIF ID US2.
SELECT-OPTIONS: S_EMAIL FOR TRDYSE01CM-USERNAME
NO INTERVALS MODIF ID US2.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: COMMENT 55(40) TEXT-019 MODIF ID US2.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
WORK AREA for SELECT-OPTIONS
DATA : X_EMAIL LIKE S_EMAIL. "Work area for EMAIL select-options
INITIALIZATION
INITIALIZATION.
*-- Default values for Sales Document Type
CLEAR S_AUART[].
S_AUART-SIGN = 'I'.
S_AUART-OPTION = 'EQ'.
S_AUART-LOW = 'CR'.
APPEND S_AUART.
CLEAR S_AUART.
*-- Default values for Date on which the record was created
V_DATE = ( SY-DATUM - 1 ).
CLEAR S_ERDAT[].
S_ERDAT-SIGN = 'I'.
S_ERDAT-OPTION = 'EQ'.
S_ERDAT-LOW = SY-DATUM.
S_ERDAT-HIGH = SY-DATUM.
APPEND S_ERDAT.
CLEAR S_ERDAT.
TOP OF PAGE *
TOP-OF-PAGE.
*-- Displaying standard header.
PERFORM std_top_of_page USING sy-title.
A T S E L E C T I O N S C R E E N O U T P U T
*-- For modifying the selection screen layout
AT SELECTION-SCREEN OUTPUT.
PERFORM F_MODIFY_SCREEN.
AT SELECTION SCREEN. *
AT SELECTION-SCREEN.
*-- Subroutine to Validate selection screen fields
PERFORM f_validate.
START-OF-SELECTION *
*START-OF-SELECTION.*
**-- Fetch the Credit Memo Requests documents*
*PERFORM F_GET_CREDIT_MEMO_REQUEST.*
*IF NOT IT_CRMEMO[] IS INITIAL.*
**-- Fetch Item Category Group*
*PERFORM F_GET_MVKE_DOCS.*
**-- Fetch Sales Order documents, PO Documents and Credit Memos*
*PERFORM F_GET_SO_PO_DOCS.*
*ENDIF.*
**-- If Credit memo request internal table have an change records then*
fetch the change documents from CDHDR and CDPOS*
*IF NOT IT_CRMEMO_CHANGE[] IS INITIAL.*
**-- Fetch Change Documents for CR Memos from CDHDR and CDPOS tables*
*PERFORM F_GET_CHANGED_DOCS.*
*ENDIF.*
**-- Fetch Purchasing Document Item Details*
*IF NOT IT_PO[] IS INITIAL.*
*PERFORM F_GET_EKPO.*
*ENDIF.*
**-- Fetch MIRO Vendor based on the PO Details*
IF NOT IT_EKPO[] IS INITIAL.
PERFORM F_GET_VENDOR.
ENDIF.
END-OF-SELECTION *
if v_flag is initial.
*-- Process Vendor Debit Postings
PERFORM F_PROCESS_MIRO.
*-- Process Reversal Postings of Vendor Automatic Debits using TCODE MR8M
PERFORM F_PROCESS_MR8M.
*-- Send mail,if user enters Email id's and Email Mode is not initial
IF P_EMAIL = C_X AND P_MODE IS NOT INITIAL AND S_EMAIL[] IS NOT INITIAL.
*-- Get spool id
perform f_spool_id.
*-- EMail Logic
PERFORM F_MAIL_LOGIC.
ENDIF.
*-- display the EMail RSCONN01 and Sussess and Error records of MIRO and MR8M
perform f_display_report.
else.
*-- Else exit the process
exit.
endif.
*& Form F_MODIFY_SCREEN
A Form routine to modify the screen
FORM F_MODIFY_SCREEN .
*-- To Modify Mail Sending Options
LOOP AT SCREEN.
IF P_EMAIL = C_X.
IF SCREEN-GROUP1 = 'US1' .
SCREEN-INVISIBLE = 0.
SCREEN-ACTIVE = 1.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
IF SCREEN-GROUP2 = 'US2' .
SCREEN-INVISIBLE = 0.
SCREEN-ACTIVE = 1.
MODIFY SCREEN.
ENDIF.
ELSEIF P_EMAIL = SPACE.
IF SCREEN-GROUP1 = 'US1' .
SCREEN-INVISIBLE = 1.
SCREEN-ACTIVE = 0.
MODIFY SCREEN.
ENDIF.
IF SCREEN-GROUP1 = 'US2' .
SCREEN-INVISIBLE = 1.
SCREEN-ACTIVE = 0.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " F_MODIFY_SCREEN
*& Form f_validate
Validation of Selection-Screen Inputs
FORM f_validate .
*-- Validate Sales Document Type
if not s_AUART[] is initial.
select AUART
into s_AUART-low
from TVAK up to 1 rows
where AUART in s_AUART.
endselect.
if sy-subrc 0.
message E000 with 'Invalid Sales Document Type'(e01) .
endif.
ENDIF.
*-- Validate Order reason (reason for the business transaction)
if not s_AUGRU[] is initial.
select AUGRU
into s_AUGRU-low
from TVAU up to 1 rows
where AUGRU in s_AUGRU.
endselect.
if sy-subrc 0.
message E000 with 'Invalid Order reason'(e02) .
endif.
endif.
ENDFORM. " f_validate
*& Form F_GET_CREDIT_MEMO_REQUEST
Fetch Credit memo requests from VBAK & VBAP
FORM F_GET_CREDIT_MEMO_REQUEST .
SELECT A~VBELN
B~POSNR
A~ERDAT
A~AUART
A~AUGRU
A~WAERK
A~VKORG
A~VTWEG
A~SPART
A~VDATU
A~BSTNK
A~BSARK
A~BSTDK
A~AEDAT
A~BUKRS_VF
B~MATNR
B~ZMENG
B~ZIEME
INTO TABLE IT_CRMEMO
FROM ( VBAK AS A
INNER JOIN VBAP AS B ON AVBELN = BVBELN )
WHERE ( A~ERDAT IN S_ERDAT
OR A~AEDAT IN S_ERDAT )
AND A~AUART IN S_AUART.
IF SY-SUBRC = 0.
SORT IT_CRMEMO BY VBELN POSNR.
ELSE.
MESSAGE I000 WITH 'No Credit Memo Request selected'(002).
v_flag = C_X.
stop.
ENDIF.
ENDFORM. " F_GET_CREDIT_MEMO_REQUEST
*& Form F_GET_MVKE_DOCS
Fetch Sales Data for Material
FORM F_GET_MVKE_DOCS .
DATA: LV_TABIX TYPE SY-TABIX.
*-- Fetch Sales Data for Material
SELECT MATNR " Material Number
VKORG " Sales Organization
VTWEG " Distribution Channel
MTPOS " Item category group from material master
FROM MVKE " Sales Data for Material
INTO TABLE IT_MVKE
FOR ALL ENTRIES IN IT_CRMEMO
WHERE MATNR = IT_CRMEMO-MATNR
AND VKORG = IT_CRMEMO-VKORG
AND VTWEG = IT_CRMEMO-VTWEG.
IF SY-SUBRC = 0.
SORT IT_MVKE BY MATNR VKORG VTWEG MTPOS.
ENDIF.
*-- Validate Item category group if MVKE-MTOPS 'BANS' then ignore CM Request line item
LOOP AT IT_CRMEMO INTO WA_CRMEMO.
LV_TABIX = SY-TABIX.
READ TABLE IT_MVKE INTO WA_MVKE WITH KEY MATNR = WA_CRMEMO-MATNR
VKORG = WA_CRMEMO-VKORG
VTWEG = WA_CRMEMO-VTWEG
MTPOS = C_MTPOS
BINARY SEARCH.
IF SY-SUBRC 0.
DELETE IT_CRMEMO INDEX LV_TABIX. " Delete CR memo records
ELSE.
*-- Else check for credit memo request change date is not initial, and
append those records to IT_CRMEMO_CHANGE internal table to retrive
change documents
IF NOT WA_CRMEMO-AEDAT IS INITIAL.
WA_CRMEMO_CHANGE-VBELN = WA_CRMEMO-VBELN.
WA_CRMEMO_CHANGE-POSNR = WA_CRMEMO-POSNR.
WA_CRMEMO_CHANGE-ERDAT = WA_CRMEMO-ERDAT.
WA_CRMEMO_CHANGE-AUART = WA_CRMEMO-AUART.
WA_CRMEMO_CHANGE-AUGRU = WA_CRMEMO-AUGRU.
WA_CRMEMO_CHANGE-WAERK = WA_CRMEMO-WAERK.
WA_CRMEMO_CHANGE-VKORG = WA_CRMEMO-VKORG.
WA_CRMEMO_CHANGE-VTWEG = WA_CRMEMO-VTWEG.
WA_CRMEMO_CHANGE-SPART = WA_CRMEMO-SPART.
WA_CRMEMO_CHANGE-VDATU = WA_CRMEMO-VDATU.
WA_CRMEMO_CHANGE-BSTNK = WA_CRMEMO-BSTNK.
WA_CRMEMO_CHANGE-BSARK = WA_CRMEMO-BSARK.
WA_CRMEMO_CHANGE-BSTDK = WA_CRMEMO-BSTDK.
WA_CRMEMO_CHANGE-AEDAT = WA_CRMEMO-AEDAT.
WA_CRMEMO_CHANGE-BUKRS_VF = WA_CRMEMO-BUKRS_VF.
WA_CRMEMO_CHANGE-MATNR = WA_CRMEMO-MATNR.
WA_CRMEMO_CHANGE-ZMENG = WA_CRMEMO-ZMENG.
WA_CRMEMO_CHANGE-ZIEME = WA_CRMEMO-ZIEME.
APPEND WA_CRMEMO_CHANGE TO IT_CRMEMO_CHANGE.
CLEAR WA_CRMEMO_CHANGE.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " F_GET_MVKE_DOCS
*& Form F_GET_SO_PO_DOCS
Fetch the Sales Order documents, PO documents, & Credit Memo
FORM F_GET_SO_PO_DOCS.
*-- Fetch Preceding sales orders based on the credit memo request
SELECT VBELV
POSNV
VBELN
POSNN
VBTYP_N
FROM VBFA
INTO TABLE IT_ORDERS
FOR ALL ENTRIES IN IT_CRMEMO
WHERE VBELN = IT_CRMEMO-VBELN
AND POSNN = IT_CRMEMO-POSNR
AND VBTYP_N = C_K
AND VBTYP_V = C_C.
IF SY-SUBRC = 0.
SORT IT_ORDERS BY VBELV POSNV.
*-- Fetch Subsequent PO documents & Credit Memo based on the sales orders
SELECT VBELV
POSNV
VBELN
POSNN
VBTYP_N
FROM VBFA
INTO TABLE IT_PO
FOR ALL ENTRIES IN IT_ORDERS
WHERE VBELV = IT_ORDERS-VBELV
AND POSNV = IT_ORDERS-POSNV
AND VBTYP_N IN (C_V,C_O)
AND VBTYP_V = C_C.
IF SY-SUBRC = 0.
SORT IT_PO BY VBTYP_N.
*-- Copy the IT_PO internal table contents to IT_CMEMO internal table
IT_CMEMO[] = IT_PO[].
*-- Delete PO documents from IT_CMEMO internal table
DELETE IT_CMEMO WHERE VBTYP_N = C_V.
SORT IT_CMEMO BY VBELN POSNN.
IF IT_CMEMO[] IS INITIAL.
MESSAGE I000 WITH 'No Credit Memo are available for CM Request'(003).
v_flag = c_x.
stop.
ENDIF.
*-- Delete Credit Memo documents from IT_PO internal table
DELETE IT_PO WHERE VBTYP_N = C_O.
SORT IT_PO BY VBELN POSNN.
ENDIF.
ENDIF.
ENDFORM. " F_GET_SO_PO_DOCS
*& Form F_GET_CHANGED_DOCS
Fetch Change Documents for CR Memos from CDHDR and CDPOS tables
FORM F_GET_CHANGED_DOCS .
*-- Fetch Change Documents for CR Memos from CDHDR
SELECT OBJECTCLAS
OBJECTID
CHANGENR
UDATE
UTIME
FROM CDHDR
INTO TABLE IT_CDHDR
FOR ALL ENTRIES IN IT_CRMEMO_CHANGE
WHERE OBJECTCLAS = C_VERKBELEG
AND OBJECTID = IT_CRMEMO_CHANGE-VBELN
AND UDATE = IT_CRMEMO_CHANGE-AEDAT
IF SY-SUBRC = 0.
SORT IT_CDHDR BY OBJECTCLAS OBJECTID CHANGENR.
*-- Fetch Change Documents for CR Memos from CDPOS
SELECT OBJECTCLAS
OBJECTID
CHANGENR
TABNAME
TABKEY
FNAME
CHNGIND
VALUE_NEW
VALUE_OLD
FROM CDPOS
INTO TABLE IT_CDPOS
FOR ALL ENTRIES IN IT_CDHDR
WHERE OBJECTCLAS = C_VERKBELEG
AND OBJECTID = IT_CDHDR-OBJECTID
AND CHANGENR = IT_CDHDR-CHANGENR
AND TABNAME = C_VBAK
AND FNAME = C_AUGRU
AND CHNGIND = C_U.
IF SY-SUBRC = 0.
SORT IT_CDPOS BY OBJECTCLAS OBJECTID CHANGENR.
ENDIF.
ENDIF.
ENDFORM. " F_GET_CHANGED_DOCS
*& Form F_GET_EKPO
Fetch Purchasing Document Item Details
FORM F_GET_EKPO .
*-- Fetch Purchasing Document Item Details
SELECT A~EBELN
B~EBELP
A~WAERS
B~MENGE
B~MEINS
B~NETPR
B~PEINH
B~mwskz
B~TXJCD
INTO TABLE IT_EKPO
FROM ( EKKO AS A
INNER JOIN EKPO AS B ON AEBELN = BEBELN )
FOR ALL ENTRIES IN IT_PO
WHERE A~EBELN = IT_PO-VBELN
AND B~EBELP = IT_PO-POSNN+1(5).
IF SY-SUBRC = 0.
SORT IT_EKPO BY EBELN EBELP.
ENDIF.
ENDFORM. " F_GET_EKPO
*& Form F_GET_VENDOR
Fetch MIRO Vendor details based on the PO Details
FORM F_GET_VENDOR .
DATA: LV_TABIX TYPE SY-TABIX.
*-- Fetch History per Purchasing Document records for all the PO records
SELECT EBELN
EBELP
ZEKKN
VGABE
GJAHR
BELNR
BUZEI
FROM EKBE
INTO TABLE IT_EKBE
FOR ALL ENTRIES IN IT_EKPO
WHERE EBELN = IT_EKPO-EBELN
AND EBELP = IT_EKPO-EBELP
AND VGABE = '2'.
and STBLG = space.
IF SY-SUBRC = 0.
SORT IT_EKBE BY BELNR GJAHR.
*-- Fetch the vendor details based on table IT_EKBE internal table
SELECT BELNR
GJAHR
BLDAT
BUDAT
XBLNR
LIFNR
RMWWR
WMWST1
XRECH
STBLG
FROM RBKP
INTO TABLE IT_RBKP
FOR ALL ENTRIES IN IT_EKBE
WHERE BELNR = IT_EKBE-BELNR
AND GJAHR = IT_EKBE-GJAHR.
IF SY-SUBRC = 0.
SORT IT_RBKP BY BELNR GJAHR.
ENDIF.
ENDIF.
*-- Sort PO History documents based on PO # and PO Item
SORT IT_EKBE BY EBELN EBELP.
*-- Copy the PO History documents into IT_EKBE_TEMP internal table
IT_EKBE_TEMP[] = IT_EKBE[].
*-- Delete PO History documents from IT_EKBE_TEMP internal table
comparing with IT_RBKP where (STBLG) Reversal document number
is initial
LOOP AT IT_EKBE_TEMP INTO WA_EKBE_TEMP.
LV_TABIX = SY-TABIX.
READ TABLE IT_RBKP INTO WA_RBKP WITH KEY BELNR = WA_EKBE_TEMP-BELNR
GJAHR = WA_EKBE_TEMP-GJAHR
XRECH = SPACE
STBLG = SPACE.
IF SY-SUBRC 0.
DELETE IT_EKBE_TEMP INDEX LV_TABIX.
ENDIF.
CLEAR: WA_EKBE_TEMP, WA_RBKP.
ENDLOOP.
ENDFORM. " F_GET_VENDOR
*& Form F_PROCESS_MIRO
Process MIRO
FORM F_PROCESS_MIRO .
DATA:
lv_itemno TYPE i,
lv_tabix type sy-index,
lc_check(1) TYPE c VALUE 'X',
V_FILL_ITEM,
lv_rbkp_bldat type sy-datum.
clear : it_itemdata, it_accountingdata, IT_CRMEMO_MIRO, IT_CRMEMO_MR8M.
refresh : it_itemdata, it_accountingdata, IT_CRMEMO_MIRO, IT_CRMEMO_MR8M.
*-- Copy all the CR Memo Docs and delete order reason not in S_AUGRU
IT_CRMEMO_MR8M[] = IT_CRMEMO[].
*-- Delete Reversal postings which are not in S_AUGRU
DELETE IT_CRMEMO_MR8M WHERE AUGRU IN S_AUGRU.
*-- Delete Reversal postings where AEDAT is initial
DELETE IT_CRMEMO_MR8M where aedat is initial.
*-- Delete order reason which are not in S_AUGRU
DELETE IT_CRMEMO WHERE AUGRU NOT IN S_AUGRU.
*-- Loop through the credit memo request records
LOOP AT IT_CRMEMO INTO WA_CRMEMO.
lv_tabix = sy-tabix.
*-- If credit memo request change date is not initial then
send change date (AEDAT) to lv_rbkp_bldat
if not WA_CRMEMO-aedat is initial.
lv_rbkp_bldat = WA_CRMEMO-aedat.
else.
*-- If credit memo request change date is initial then
send create date (ERDAT) to lv_rbkp_bldat
lv_rbkp_bldat = WA_CRMEMO-erdat.
endif.
READ TABLE IT_ORDERS INTO WA_ORDERS WITH KEY VBELN = WA_CRMEMO-VBELN
POSNN = WA_CRMEMO-POSNR.
IF SY-SUBRC = 0.
READ TABLE IT_PO INTO WA_PO WITH KEY VBELV = WA_ORDERS-VBELV
POSNV = WA_ORDERS-POSNV.
IF SY-SUBRC = 0.
READ TABLE IT_EKPO INTO WA_EKPO WITH KEY EBELN = WA_PO-VBELN
EBELP = WA_PO-POSNN.
IF SY-SUBRC = 0.
*-- Read IT_EKBE_TEMP internal table which contains records which are not reversed
READ TABLE IT_EKBE_TEMP INTO WA_EKBE_TEMP WITH KEY EBELN = WA_EKPO-EBELN
EBELP = WA_EKPO-EBELP.
IF SY-SUBRC = 0.
*-- Read IT_RBKP internal table with XRECH (Indicator: post invoice) = 'X' ,
check for invoice records for the correspnding CR Memo records
READ TABLE IT_RBKP INTO WA_RBKP WITH KEY BELNR = WA_EKBE_TEMP-BELNR
GJAHR = WA_EKBE_TEMP-GJAHR
XRECH = C_X.
IF SY-SUBRC = 0.
*-- Read IT_RBKP internal table with XRECH (Indicator: post invoice) = SPACE,
and document date = CR Memo creation date
and reference document number = PO number
READ TABLE IT_RBKP INTO WA_RBKP_TMP WITH KEY BELNR = WA_EKBE_TEMP-BELNR
GJAHR = WA_EKBE_TEMP-GJAHR
BLDAT = WA_CRMEMO-ERDAT
XRECH = ' '
XBLNR+0(10) = WA_EKBE_TEMP-ebeln.
STBLG = SPACE.
IF SY-SUBRC = 0.
CONTINUE.
ELSE.
*-- Quantity Conversion (Get the Credit Memo Quantity by passing CMR unit per one PO unit)
perform f_quantity_conv.
*-- Filling the Line items data
*-- Incrementing the item no
lv_itemno = lv_itemno + 1.
v_itemno = lv_itemno.
it_itemdata-invoice_doc_item = v_itemno.
it_itemdata-po_number = WA_ekPO-ebeln.
it_itemdata-po_item = WA_EKPO-EBELP.
it_itemdata-tax_code = WA_ekpo-mwskz.
it_itemdata-TAXJURCODE = WA_ekpo-TXJCD.
*-- Converting SAP amount to BAPI format by passing line item amount and currency
PERFORM f_currency_amount_sap_to_bapi USING WA_EKPO-waers
V_LINE_AMOUNT
CHANGING it_itemdata-item_amount .
it_itemdata-quantity = ( WA_CRMEMO-ZMENG * V_CRMEMO_QTY ).
it_itemdata-po_unit = WA_EKPO-MEINS.
APPEND it_itemdata.
*-- Populate Account Assignment data
IT_ACCOUNTINGDATA-INVOICE_DOC_ITEM = v_itemno.
IT_ACCOUNTINGDATA-XUNPL = space.
IT_ACCOUNTINGDATA-SERIAL_NO = C_01.
IT_ACCOUNTINGDATA-TAX_CODE = it_itemdata-tax_code.
IT_ACCOUNTINGDATA-TAXJURCODE = it_itemdata-TAXJURCODE.
IT_ACCOUNTINGDATA-ITEM_AMOUNT = it_itemdata-item_amount.
IT_ACCOUNTINGDATA-QUANTITY = it_itemdata-quantity.
IT_ACCOUNTINGDATA-PO_UNIT = it_itemdata-po_unit.
IT_ACCOUNTINGDATA-GL_ACCOUNT = C_0000500205.
append IT_ACCOUNTINGDATA.
clear IT_ACCOUNTINGDATA.
CLEAR it_itemdata.
endif.
endif.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*-- At end of each credit memo request fill the header details of BAPI FM and
*-- post the BAPI
AT END OF VBELN.
read table it_crmemo into wa_crmemo index lv_tabix.
*-- Populate the document Header
*-- Getting the header data for invoice
x_docheader-invoice_ind = space.
x_docheader-doc_type = c_blart.
x_docheader-doc_date = lv_rbkp_bldat.
x_docheader-pstng_date = lv_rbkp_bldat.
x_docheader-ref_doc_no = WA_RBKP-XBLNR.
x_docheader-comp_code = WA_CRMEMO-BUKRS_VF.
x_docheader-CURRENCY = WA_CRMEMO-WAERK.
x_docheader-calc_tax_ind = lc_check.
*-- Logic to find the Tax %
v_tax_per = ( WA_RBKP-WMWST1 / ( WA_RBKP-RMWWR - WA_RBKP-WMWST1 ) ) * 100.
v_tax_amt = ( V_GROSSAMT * v_tax_per ) / 100.
V_GROSSAMT = ( V_GROSSAMT + v_tax_amt ).
x_docheader-gross_amount = V_GROSSAMT.
CLEAR:v_docnr, v_year1.
*-- Calling BAPI to create PO invoice document
CHECK NOT IT_ITEMDATA[] IS INITIAL.
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
EXPORTING
headerdata = x_docheader
IMPORTING
invoicedocnumber = v_docnr
fiscalyear = v_year1
TABLES
itemdata = it_itemdata[]
ACCOUNTingDATA = it_ACCOUNTingDATA[]
GLACCOUNTDATA =
taxdata =
return = it_return.
*-- Commit work
IF NOT v_docnr IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
*-- Move the data to Success Internal Table
wa_success-crmemo = wa_crmemo-vbeln.
wa_success-cmemo = wa_cmemo-vbeln.
wa_success-orders = wa_orders-vbelv.
wa_success-po = wa_po-vbeln.
wa_success-miro_no = v_docnr.
wa_success-text = 'MIRO is Posted'.
append wa_success TO it_success.
clear wa_success.
ENDIF.
*-- Read the values in the table IT_RETURN.
CLEAR it_return.
READ TABLE it_return INDEX 1.
If message type is error then roll back the work
IF it_return-type = C_E.
*-- Roll back
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
*-- Move the data to Error Internal Table
wa_error-crmemo = wa_crmemo-vbeln.
wa_error-cmemo = wa_cmemo-vbeln.
wa_error-orders = wa_orders-vbelv.
wa_error-po = wa_po-vbeln.
wa_error-text = it_return-MESSAGE.
append wa_error TO it_error.
clear wa_error.
ENDIF.
refresh: it_return, it_itemdata, it_accountingdata.
clear: V_GROSSAMT, it_return, it_itemdata, wa_crmemo, wa_orders, wa_po,
wa_ekpo, WA_EKBE_TEMP, wa_rbkp, wa_rbkp_tmp, v_docnr, v_year1, WA_SUCCESS,
WA_ERROR, it_accountingdata, v_tax_per, v_tax_amt, V_FILL_ITEM, lv_rbkp_bldat.
ENDAT.
ENDLOOP.
ENDFORM. " F_PROCESS_MIRO
*& Form f_quantity_conv
Quantity Conversion
FORM f_quantity_conv .
*-- Quantity Conversion (Get the Credit Memo Quantity by passing CMR unit per one PO unit)
CLEAR: V_LINE_AMOUNT, V_CRMEMO_QTY.
call function 'MC_UNIT_CONVERSION'
EXPORTING
MATNR = WA_CRMEMO-MATNR
nach_meins = WA_EKPO-MEINS
von_meins = WA_CRMEMO-ZIEME
IMPORTING
UMREF = V_CRMEMO_QTY
EXCEPTIONS
CONVERSION_NOT_FOUND = 1
MATERIAL_NOT_FOUND = 2
NACH_MEINS_MISSING = 3
OVERFLOW = 4
VON_MEINS_MISSING = 5
OTHERS = 6.
if sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
V_LINE_AMOUNT = ( V_CRMEMO_QTY * WA_CRMEMO-ZMENG * WA_EKPO-peinh * WA_EKPO-NETPR ).
V_GROSSAMT = V_GROSSAMT + V_LINE_AMOUNT.
ENDIF.
ENDFORM. " f_quantity_conv
*& Form f_currency_amount_sap_to_bapi
SAP Amount to BAPI Amount
FORM f_currency_amount_sap_to_bapi USING p_waers
p_kbetr
CHANGING p_amt_doccur.
DATA : lv_waers LIKE tcurc-waers,
lv_sapamount LIKE bapicurr-bapicurr,
lv_bapi_amount LIKE bapicurr-bapicurr.
lv_waers = p_waers.
lv_sapamount = p_kbetr.
CALL FUNCTION 'CURRENCY_AMOUNT_SAP_TO_BAPI'
EXPORTING
currency = lv_waers
sap_amount = lv_sapamount
IMPORTING
bapi_amount = lv_bapi_amount.
p_amt_doccur = lv_bapi_amount. -
BAPI or RFC to create material
Hi folks,
Could any one tell me, if there is any BAPI or RFC to create Material in Material master....if so pls tel me the name and how to use the BAPI...thanks in advance,
santosh.HI CHECK OU THIS PROGRAM
*& Report ZBAPI_MATERIAL_SAVEDATA
**& AUTHOR *
*& PURPOSE : THIS REPORT USES BAPI MATERIAL SAVE DATA TO UPDATE AND CREATE
*& THE MATERIAL
REPORT ZBAPI_MATERIAL_SAVEDATA NO STANDARD PAGE HEADING MESSAGE-ID (ZHNC).
TYPES:BEGIN OF TY_MAT,
MATERIAL(4),
IND_SECTOR(1),
MATL_TYPE(4),
BASIC_VIEW(1),*
SALES_VIEW(1),*
PURCHASE_VIEW(1),*
STORAGE_VIEW(1),*
MATL_GROUP(9),
BASE_UOM(3),
BASE_UOM_ISO(3),
MATL_GROUP1(1),*
BASE_UOM1(1),*
BASE_UOM_ISO1(1),*
PLANT(4),
DEL_FLAG(1),
PUR_GROUP(3),
BASE_QTY(13),
PLANT2(4),*
DEL_FLAG5(1),*
PUR_GROUP1(1),*
BASE_QTY1(1),*
PLANT3(4),*
STGE_LOC(4),
MRP_IND(1),
PLANT4(4),*
STGE_LOC1(4),*
MRP_IND1(1),*
SALES_ORG(4),
DISTR_CHAN(2),
DEL_FLAG1(1),
MIN_ORDER(13),
SALES_ORG1(4),*
DISTR_CHAN1(2),*
DEL_FLAG2(1),*
MIN_ORDER1(1),*
LANGU(2),
MATL_DESC(40),
END OF TY_MAT.
DATA: IT_DATA TYPE TABLE OF TY_MAT,
WA_DATA LIKE LINE OF IT_DATA.
*decalraing flag
data: v_flag value ''.
*DECLARING WORK AREAs TO BE PASSED TO THE FUNCTION MODULE.
DATA: BAPI_HEAD LIKE BAPIMATHEAD,
BAPI_CLIENTDATA LIKE BAPI_MARA,
BAPI_CLIENTDATAX LIKE BAPI_MARAX,
BAPI_PLANTDATA LIKE BAPI_MARC,
BAPI_PLANTDATAX LIKE BAPI_MARCX,
BAPI_STORAGELOCATIONDATA LIKE BAPI_MARD,
BAPI_STORAGELOCATIONDATAX LIKE BAPI_MARDX,
BAPI_SALESDATA LIKE BAPI_MVKE,
BAPI_SALESDATAX LIKE BAPI_MVKEX,
BAPI_MAKT LIKE BAPI_MAKT,
BAPI_RETURN LIKE BAPIRET2.
*INTERNAL TABLE TO HOLD THE MATERIAL DESCRIPTION
DATA: BEGIN OF IT_MAKT OCCURS 0.
INCLUDE STRUCTURE BAPI_MAKT.
DATA END OF IT_MAKT.
DATA:BEGIN OF IT_RET OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA END OF IT_RET.
*INTERNAL TABLE TO HOLD HEADER DATA
DATA: IT_EXCEL TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
*SELECTION-SCREEN ELEMENTS
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETER: FNAME TYPE RLGRAP-FILENAME OBLIGATORY DEFAULT 'C:\Documents and Settings\Administrator\Desktop\MATMAS.XLS' .
PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,
P_BEGROW TYPE I DEFAULT 1 NO-DISPLAY,
P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,
P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK B1.
*DECLARATION OF EXCELAL TABLE
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FNAME.
PERFORM F_GET_FILE USING FNAME.
START-OF-SELECTION.
PERFORM F_XLS_ITAB USING FNAME
CHANGING IT_EXCEL.
PERFORM F_MOVE_DATA.
perform F_GET_DATA.
*& Form F_GET_FILE
text*
-->P_FNAME text*
<--P_SY_SUBRC text*
FORM F_GET_FILE USING P_FNAME LIKE FNAME.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '*
STATIC = ' '*
MASK = ' '*
CHANGING
FILE_NAME = P_FNAME
EXCEPTIONS*
MASK_TOO_LONG = 1*
OTHERS = 2*
IF SY-SUBRC <> 0.
MESSAGE E006(ZHNC).
ENDIF.
ENDFORM. " F_GET_FILE
*& Form F_XLS_ITAB
text*
-->P_FNAME text*
<--P_IT_EXCEL text*
FORM F_XLS_ITAB USING P_FNAME
CHANGING P_IT_EXCEL.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = FNAME
I_BEGIN_COL = P_BEGCOL
I_BEGIN_ROW = P_BEGROW
I_END_COL = P_ENDCOL
I_END_ROW = P_ENDROW
TABLES
INTERN = IT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO*
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.*
ENDIF.
ENDFORM. " F_XLS_ITAB
*& Form F_MOVE_DATA
text*
--> p1 text*
<-- p2 text*
FORM F_MOVE_DATA .
DATA : LV_INDEX TYPE I.
FIELD-SYMBOLS <FS>.
*--- Sorting the internal table
SORT IT_EXCEL BY ROW COL.
CLEAR IT_EXCEL.
LOOP AT IT_EXCEL.
MOVE IT_EXCEL-COL TO LV_INDEX.
*--- Assigning the each record to an internal table row
ASSIGN COMPONENT LV_INDEX OF STRUCTURE WA_DATA TO <FS>.
*--- Asigning the field value to a field symbol
MOVE IT_EXCEL-VALUE TO <FS>.
AT END OF ROW.
APPEND WA_DATA TO IT_DATA.
CLEAR WA_DATA.
ENDAT.
ENDLOOP.
ENDFORM. " F_MOVE_DATA
*& Form F_GET_DATA
text*
--> p1 text*
<-- p2 text*
FORM F_GET_DATA .
LOOP AT IT_DATA INTO WA_DATA.
MOVE-CORRESPONDING WA_DATA TO BAPI_HEAD.
BAPI_HEAD-BASIC_VIEW ='X'.
BAPI_HEAD-SALES_VIEW ='X'.
BAPI_HEAD-PURCHASE_VIEW ='X'.
BAPI_HEAD-STORAGE_VIEW ='X'.
MOVE-CORRESPONDING WA_DATA TO BAPI_CLIENTDATA.
BAPI_CLIENTDATAX-MATL_GROUP = 'X'.
BAPI_CLIENTDATAX-BASE_UOM = 'X'.
BAPI_CLIENTDATAX-BASE_UOM_ISO = 'X'.
MOVE-CORRESPONDING WA_DATA TO BAPI_PLANTDATA.
BAPI_PLANTDATAX-PLANT = BAPI_PLANTDATA-PLANT.
BAPI_PLANTDATAX-DEL_FLAG = 'X'.
BAPI_PLANTDATAX-PUR_GROUP = 'X'.
BAPI_PLANTDATAX-BASE_QTY = 'X'.
MOVE-CORRESPONDING WA_DATA TO BAPI_STORAGELOCATIONDATA.
BAPI_STORAGELOCATIONDATA-PLANT = BAPI_PLANTDATA-PLANT.
BAPI_STORAGELOCATIONDATAX-PLANT = BAPI_STORAGELOCATIONDATA-PLANT.
BAPI_STORAGELOCATIONDATAX-STGE_LOC = BAPI_STORAGELOCATIONDATA-STGE_LOC.
BAPI_STORAGELOCATIONDATAX-MRP_IND = 'X'.
MOVE-CORRESPONDING WA_DATA TO BAPI_SALESDATA.
BAPI_SALESDATAX-SALES_ORG = BAPI_SALESDATA-SALES_ORG.
BAPI_SALESDATAX-DISTR_CHAN = BAPI_SALESDATA-DISTR_CHAN.
BAPI_SALESDATAX-DEL_FLAG = BAPI_SALESDATA-DEL_FLAG.
BAPI_SALESDATAX-MIN_ORDER = 'X'.
REFRESH IT_MAKT.
IT_MAKT-LANGU = WA_DATA-LANGU.
IT_MAKT-MATL_DESC = WA_DATA-MATL_DESC.
APPEND IT_MAKT.
CLEAR IT_RET.
REFRESH IT_RET.
PERFORM F_CALL_BAPI.
READ TABLE IT_RET WITH KEY TYPE = 'S'.
IF SY-SUBRC EQ 0.
PERFORM F_BAPI_COMMIT.
WRITE:/ 'MATERIAL CREATED OR UPDATED SUCESSFULLY WITH MATERIAL NO',WA_DATA-MATERIAL.
ELSE.
MESSAGE E000(ZHNC) WITH 'ERROR IN CREATING THE MATERIAL'.
*WRITE: / 'ERROR IN CREATIN MATERIAL',IT_RET-MESSAGE.
*PERFORM F_DOWNLOAD.
ENDIF.
*ENDIF.
ENDLOOP.
ENDFORM. " F_GET_DATA
*& Form F_CALL_BAPI
text*
--> p1 text*
<-- p2 text*
FORM F_CALL_BAPI .
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = BAPI_HEAD
CLIENTDATA = BAPI_CLIENTDATA
CLIENTDATAX = BAPI_CLIENTDATAX
PLANTDATA = BAPI_PLANTDATA
PLANTDATAX = BAPI_PLANTDATAX
STORAGELOCATIONDATA = BAPI_STORAGELOCATIONDATA
STORAGELOCATIONDATAX = BAPI_STORAGELOCATIONDATAX
SALESDATA = BAPI_SALESDATA
SALESDATAX = BAPI_SALESDATAX
IMPORTING
RETURN = IT_RET
TABLES
MATERIALDESCRIPTION = IT_MAKT
UNITSOFMEASURE =*
UNITSOFMEASUREX =*
INTERNATIONALARTNOS =*
MATERIALLONGTEXT =*
TAXCLASSIFICATIONS =*
RETURNMESSAGES =*
PRTDATA =*
PRTDATAX =*
EXTENSIONIN =*
EXTENSIONINX =*
APPEND IT_RET.
ENDFORM. " F_CALL_BAPI
*& Form F_BAPI_COMMIT
text*
--> p1 text*
<-- p2 text*
FORM F_BAPI_COMMIT .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING*
WAIT =*
IMPORTING*
RETURN =*
ENDFORM. " F_BAPI_COMMIT
IF U WANT THE EXCEL FILE I CAN SEND U
PLZ REWARD POINTS TO HELP ANSWERS -
Bapi's or Fun Modules to update vendor related tables
Hi All,
Can any one tell me the Bapi's or funtion modules to update,create or modify vendor related tables without using any call transaction.
Best answers will be rewarded nicely.
Regards,
praveen.Hi
Did below code work for you?
If not the best way to manage Vendor information for UPDATING and CREATING check below class
VMD_EI_API
Which you just use methods INITIALISE and MAINTAIN with the populated structures of vendor tables.
Regards
Tumelo Modise -
i want to create an update page using dreamweaver and record set, i succeded but it only updates the database with user id of 1. even if i login as another user with id of 3, it keeps updating the user with id of 1.please help me, a lost. below is my code:
<?php require_once('Connections/conn_login.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
if (($strUsers == "") && true) {
$isValid = true;
return $isValid;
$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE login SET username=%s, pwd=%s, `role`=%s, firstname=%s, lastname=%s, country=%s WHERE userID=%s",
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['pwd'], "text"),
GetSQLValueString($_POST['role'], "text"),
GetSQLValueString($_POST['firstname'], "int"),
GetSQLValueString($_POST['lastname'], "int"),
GetSQLValueString($_POST['country'], "int"),
GetSQLValueString($_POST['id1'], "int"));
mysql_select_db($database_conn_login, $conn_login);
$Result1 = mysql_query($updateSQL, $conn_login) or die(mysql_error());
$updateGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $updateGoTo));
$colname_Recordset1 = "-1";
if (isset($_GET['userID'])) {
$colname_Recordset1 = $_GET['userID'];
$_SESSION['userID'] = $_GET['userID'];
$colname_Recordset1 = "-1";
if (isset($_GET[''])) {
$colname_Recordset1 = $_GET[''];
mysql_select_db($database_conn_login, $conn_login);
$query_Recordset1 = sprintf("SELECT userID, username, pwd, `role`, firstname, lastname FROM login WHERE userID = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $conn_login) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Scuba2u</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include('headerScuba2u.php'); ?>
<div id="main">
<div id="left">
<h1>Registration Form</h1>
<fieldset>
<legend>Register for our website</legend>
<form action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST">
<p>
<label for="firstname">First Name</label>
<input name="firstname" type="text" id="firstname" size="30" maxlength="40" />
</p>
<p>Last Name
<label for="lastname"></label>
<input name="lastname" type="text" id="lastname" size="30" maxlength="40" />
</p>
<p>Country
<input name="country" type="text" id="country" size="30" maxlength="30" />
</p>
<p>Email
<label for="email"></label>
<input name="email" type="text" id="email" size="60" maxlength="60" />
</p>
<p>Password
<label for="pwd"></label>
<input name="pwd" type="password" id="pwd" size="10" maxlength="10" />
</p>
<p>
<input name="role" type="hidden" id="role" value="guest" />
<input name="id1" type="hidden" id="id1" value="<?php echo $row_Recordset1['userID']; ?>" />
<input type="submit" name="submit" id="submit" value="Register" />
</p>
<input type="hidden" name="MM_update" value="form1" />
</form>
</fieldset>
</div>
</div>
<?php include('footerScuba2u.php'); ?>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>Temporarily change your id1 field from a hidden field to a text field so you can see if it is being set correctly for the logged in user.
-
How to use a single page for create and update mode.
Hi,
I need to develop a single page to be used for both create and update modes.
I am going to use a variable MODE
and i will set this in the emp summary page.
Based on the button clicked by the user i have to render the JSF page.
For tis if the user selects a perticular and cliks on update thn i will pass the empno to the next.
so there in the next i will appy a ViewCreiteria on my View Obj to fetch only that row so that only that emp will be displayed ion update mode.
This is working fione for me.
So now the issue is
when the user clicks on CreatEmp button.
i need to enable my VO for insert operations.
for this i wrote the code like this in the beforePhase event
FacesContext ctx = FacesContext.getCurrentInstance();
ValueBinding valBinding = ctx.getApplication().createValueBinding("#{data}");
BindingContext bContext = (BindingContext) valBinding.getValue(ctx);
DCDataControl dcControl = bContext.findDataControl("DataControl");
Application app = ctx.getApplication();
ApplicationModule am = (ApplicationModule) dcControl.getDataProvider();
System.out.println("After Appmodule initiation");
// get the VO reference and initiate the query
System.out.println("Before Page VO initiation");
PrismDmPageSectionViewImpl vo = (ViewImpl)am.findViewObject("View");
//ViewRowImpl row = (ViewRowImpl) vo.createRow();
/* TO CREATE AN EMPTY ROW*/
Row row=vo.createRow();
System.out.println("New Row is created");
//vo.createKey(row);
vo.insertRow(row);
vo.setCurrentRow(row);
By doing this a new empty page is rendered.
But when i fill up the values and click on ok.. i am getting the error like this..
JBO-27023: Failed to validate all rows in a transaction.
JBO-27027: Missing mandatory attributes for a row with key null of type View3
JBO-27014: Attribute Id in View3 is required
JBO-27014: Attribute PageeId in View3 is required
Please point me out where i am missing.
ThanksHi,
In my opinion you are over complicating things.
This is what I do for using the sme page as both create and update without all this code.
1) Create a browse page containing a an adf table with a select one component bound to your view object.
2) Create an additional edit page containing only an edit form containing fields of your view object that your users must enter in order to add or edit rows.
3) Link the pages in the JSF diagram with an "edit" navigation case from browse to edit page and a "return" navigation case from edit to browse (make sure that redirect option is NOT set on both cases)
4) Remove the submit button from the edit page and add two application module bindings for the commit and rollback operations as command buttons in the form footer facet. Make sure that both buttons has an action of return and that their disabled property is set to false. You will probably change their labels to ok and cancel respectively.
5) Drop a create action for your view object from the data control palette inside your page as a command button and set the action property to edit also.
3) Set the action property of the view button to edit
This should basically work without any code from your part. -- at least it does so for me -- if you like to make it a bit more funcy you may add am action listener inside your buttons and set a requeScope variable for example #{requestScope.editing} to true or false depending on the button clicked. Then add a title to your page with a value like #{requestScope.editing == true ? 'Editing record' : 'Adding a new record'}..
Hope that helps.
Thanassis -
Is it still possible to downgrade from ios 6 to ios 5.1.1 on my ipod touch 4th gen as of Sept.24? Also, if I use a backup created AFTER updating to ios 6, when I restore/downgrade to ios 5.1.1, does it become ios 6 again because of the version of ios 6 that I created the backup on?
There has never been a legit way to downgrade.
It will always restore to the latest available software. -
OAM notification exception in OIM 11.1.1.5 during create or update
Hello experts,
We keep getting below exceptions in backend during create or update user. I have also read "Exception During User Create Or Update In Oim Logs [ID 1438746.1]" in oracle support that it's a bug and fixed in BP02. We successfully applied the same recently. But still we are getting the below exception at backend. Is there anything else we need to do to overcome below.
Your input at the earliest would be helpful.
<OAM Notification Logger> <BEA-000000> <Error sending notifications java.lang.NullPointerException>
java.lang.NullPointerException
at oracle.iam.sso.oam.impl.OAMNotificationProvider.sendUserUpdatedNotification(OAMNotificationProvider.java:107)
at oracle.iam.sso.eventhandlers.RoleGrantNotificationHandler.execute(RoleGrantNotificationHandler.java:117)
at oracle.iam.sso.eventhandlers.RoleGrantNotificationHandler.execute(RoleGrantNotificationHandler.java:78)
at oracle.iam.platform.kernel.impl.OrchProcessData.runPostProcessEvents(OrchProcessData.java:1168)
at oracle.iam.platform.kernel.impl.OrchProcessData.runEvents(OrchProcessData.java:710)
at oracle.iam.platform.kernel.impl.OrchProcessData.executeEvents(OrchProcessData.java:227)
at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.resumeProcess(OrchestrationEngineImpl.java:744)
at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.resumeChildProcess(OrchestrationEngineImpl.java:826)
at oracle.iam.platform.kernel.impl.OrchProcessData.handleAdditionalChanges(OrchProcessData.java:537)
at oracle.iam.platform.kernel.impl.OrchProcessData.runEvents(OrchProcessData.java:802)
Thanks
DKi see this
facesContext.getViewRoot().getViewId() = /login.jspxare you using the facesContext in your bean or something.. where are you using this..
is ur bean compiling in the first place.. if the class is not there.. then you would get this error at compile time itself..
Maybe you are looking for
-
Yo, Apple SysAdmins!!!! iTunes stuck in forever loop.
Answer your pagers. Answer your phones. Pay attention to the ASAP emails from the systems. iTunes Terms & Conditions page is stuck in a loop. Here I am, trying to spend money, and the system is hosed. This is the one part of Apple support I find very
-
Exporting a view to a flat file
Hi all, Running Oracle 9i on Windows. We have a stored procedure which runs a number of packages and populates a view called v$logmnr_contents. We woudl like to export the contents of the view to a flat file so that it can be transferred over to anot
-
I don't want to start a discussion I just want to install...
I am sooooooo p****d off with Adobe. They have forced me to type my problem into a form three times and each time I press submit it disappears and I have to join/sign into/whatever their 'community'. My problem is that trying to install Flash/Reader
-
GUI - How do i merge two diffrent layout managers into one tab?
Hello I want to create a cellphone, and when you click a button it will be displayed in a textfield the buttons are in a grid layout (4,3) and the textfield is in a border layout (NORTH) I have the layouts in two seperate tabs, but how do i merge two
-
ISync with Samsung SPH-800 Instinct cell phone on Sprint service
Anyone have an idea how to sync the Instinct with iMac using OS X 10.5.6, or MacBook using 10.4.11?