Create Customer SD_CUSTOMER_MAINTAIN_ALL or CMD_EI_API
Hi,
I'm trying to create a function that makes it possible to create customers like in XD01.
I read in the forum that the function module SD_CUSTOMER_MAINTAIN_ALL shouldn't be used for that.
Is that correct?
I read also that I should use the Class CMD_EI_API with method MAINTAIN_BAPI. But when I try to create a customer I get the error: Mandatory partner role is missing for sales area 0003 01 05
Does anybody knwo what I'm missing in here?
Best regards,
Dennis
Dennis Junker wrote:>
> Hi,
>
> thanks for the reply. I found the mandantory partner functions and tried to add them.
> but I got now some other errors regarding invalid partners.
> I think the settings getting picked up by T770D regarding to the Account Group.
>
> But it is weird that I also get errors now with some "Requiered" Date Fields that can be left blank in XD01.
>
> The BAPI "BAPI_CUSTOMER_CREATEFROMDATA" doesn't support me with enough input I have to add and SD_CUSTOMER_MAINTAIN_ALL does not do any checks at all. But as CMD_EI_API causes a lot of trouble I might still go for the bapi and do reimplement the important checks myself.
>
> Or is there any better way to create the customers. The endpurpose is a small Web Dynpro application with just a few of the feilds from XD01.
Customer creation is always a pain in the neck when it comes to do that in background. You need to pass all the required fields to BAPI .
Let me tell you about the checks.... you can implement the BADI to do checks for you instead of doing on your own.
Yes, you need to pass the account group like is it one time cusotmer or there are some entries in table T077D (KNA1-KTOKD).
Let me know if you need any further help on this.
Similar Messages
-
Create customer date trough class cmd_ei_api - error in test run
Hi all,
I try to use class cmd_ei_api to create customer. It works fine but one thing is strange.
When I pass data with test run and customer is in a group with internal nummering system icrease number every time when i run program. Customer is not created ( that is good) but the assigned nummer is lost.
I tried to use method maintain_bapi and maintain.Problem occurs every time.
Do you have the same problem? Do you know solution of this problem?
regards,
JG
SAMPLE CODE:
report zcreate_customer.
data: wa_header type cmds_ei_header,
wa_central_data type cmds_ei_vmd_central_data,
wa_central_datax type cmds_ei_vmd_central_data_xflag,
wa_address type bapiad1vl,
wa_addressx type bapiad1vlx,
wa_tax_ind_st type cmds_ei_tax_ind,
wa_tax_ind type cmds_ei_cmd_tax_ind,
wa_bankdetail_st type cvis_ei_cvi_bankdetail,
wa_bankdetail type cvis_ei_bankdetail,
wa_company_code_st type cmds_ei_company,
wa_company_code type cmds_ei_cmd_company,
wa_functions_st type cmds_ei_functions,
wa_functions_t type CMDS_EI_FUNCTIONS_T,
wa_functions type cmds_ei_cmd_functions,
wa_sales_data_st type cmds_ei_sales,
wa_sales_data type cmds_ei_cmd_sales,
wa_customer type cmds_ei_extern,
wa_customers type cmds_ei_main,
wa_correct type cmds_ei_main,
wa_defective type cmds_ei_main,
wa_mes_correct type cvis_message,
wa_mes_error type cvis_message.
constants: c_update type c value 'M',
c_insert type c value 'I'.
PARAMETERS: p_test type c as CHECKBOX DEFAULT 'X'.
start-of-selection.
free: wa_customer, wa_company_code_st, wa_customer.
wa_address-name = 'CUSTOMER NAME'.
wa_address-city = 'CITY'.
wa_address-postl_cod1 = '28-500'.
wa_address-street = '1400 9TH ST W'.
wa_address-country = 'PL'.
wa_address-langu = 'L'.
wa_address-region = 'FL'.
wa_address-sort1 = 'SORT1'.
wa_address-sort2 = 'Sort2'.
Assign address data directly
wa_customer-central_data-address-postal-data = wa_address.
wa_addressx-name = 'X'.
wa_addressx-city = 'X'.
wa_addressx-postl_cod1 = 'X'.
wa_addressx-street = 'X'.
wa_addressx-country = 'X'.
wa_addressx-langu = 'X'.
wa_addressx-region = 'X'.
wa_addressx-sort1 = 'X'.
wa_addressx-sort2 = 'X'.
wa_customer-central_data-address-postal-datax = wa_addressx.
wa_customer-central_data-central-data-ktokd = 'OKRA'.
wa_customer-central_data-central-data-STCD1 = '8291004247'.
wa_company_code_st-task = c_insert.
wa_company_code_st-data_key-bukrs = '1000'.
wa_company_code_st-data-zuawa = '009'.
wa_company_code_st-data-akont = '0000201100'.
append wa_company_code_st to wa_company_code-company.
append wa_customer to wa_customers-customers.
call method cmd_ei_api=>maintain_bapi
EXPORTING
iv_test_run = p_test
iv_collect_messages = 'X'
is_master_data = wa_customers
IMPORTING
es_master_data_correct = wa_correct
es_message_correct = wa_mes_correct
es_master_data_defective = wa_defective
es_message_defective = wa_mes_error.
if wa_mes_error-is_error is initial and p_test is INITIAL.
commit work AND WAIT.
else.
ROLLBACK work.
endif.Hi experts, I am using cmd_ei_api to create customer. Each time when I create the customer, for the customer number KUNNR, first the method picks a new number from number range, if I don't supply one in program. Then it makes the necessary checks on customer data. If data check is success, customer is created and everything is okay. But if the check is failed, no customer gets created in the Data base, but the picked number is lost forever. Is there a way to avoid this?
The same happens, even when I ran it in Test Mode(iv_test_run = 'X'). A number is lost irrespective of whether the test run is success or not.
I tried supplying the customer number via the program. I this case also, I had to get a number from the Number Range and supply. As the Method validates whether the supplied number belongs to the right number range, I cannot use any dummy number(not even for a Test run). Also it validates whether a customer exists in KNA1 with the supplied number.
As a work around, now I am supplying the last number of the number range for the test run(which I have hard coded ~not a good practice!!). If this runs error free, I will pick a new number and creates the customer.
regards,
anish
sample code...
*-- Fill customer parameters to lwa_master_data
lwa_customer-header-object_instance-kunnr = '99999'.
* *** ~~
*-- Test Run with dummy customer no. for data check
IF lwa_master_data IS NOT INITIAL.
CALL METHOD cmd_ei_api=>maintain
EXPORTING
iv_test_run = 'X'
is_master_data = lwa_master_data
IMPORTING
es_error = lwa_es_error.
*-- Create customer if Test Run Succeeds.
IF lwa_es_error is INITIAL.
*-- Get new Customer Number
CALL METHOD cmd_ei_api=>get_number
EXPORTING
iv_ktokd = as_customer-ktokd
IMPORTING
ev_kunnr = lv_kunnr
es_error = lwa_getno_msg.
IF lv_kunnr is NOT INITIAL.
*-- Supply new customer number
CLEAR: lwa_master_data, lt_customer.
lwa_customer-header-object_instance-kunnr = lv_kunnr.
APPEND lwa_customer TO lt_customer.
CLEAR lwa_customer.
lwa_master_data-customers = lt_customer.
*-- Initialize Global and Current Customer Buffer
CALL METHOD cmd_ei_api=>initialize.
*-- Create Customer
CALL METHOD cmd_ei_api=>maintain
EXPORTING
iv_test_run = ''
is_master_data = lwa_master_data
IMPORTING
es_error = lwa_es_error.
*-- Proceed if no error with customer creation
IF lwa_es_error is INITIAL.
* ******************* * ******************* ~~ -
URGENT:Creating customer master using Sd_Customer_Maintain_all
hello all ,
I am creating customer master using SD_Customer_Maintain_All.I will be thankful if somebody Can tell me how to pass data to this function module.Better if somebody can provide code.
Thanks.
Sandeep.hello all ,
I am creating customer master using SD_Customer_Maintain_All.I will be thankful if somebody Can tell me how to pass data to this function module.Better if somebody can provide code.
Thanks.
Sandeep. -
How to create customer By using SD_CUSTOMER_MAINTAIN_ALL function module
Hello all,
I want to create customer By passing( T_CUST_HIER_IP - customer no, account group, company code, distribution channel, division, name1, search team, city, country).
using BAPI or function module I am using SD_CUSTOMER_MAINTAIN_ALL
LOOP AT T_CUST_HIER_IP INTO W_CUST_HIER_IP.
MOVE-CORRESPONDING W_CUST_HIER_IP TO W_KNA1.
MOVE-CORRESPONDING W_CUST_HIER_IP TO W_KNB1.
MOVE-CORRESPONDING W_CUST_HIER_IP TO W_KNVV.
CALL FUNCTION 'SD_CUSTOMER_MAINTAIN_ALL'
EXPORTING
I_KNA1 = W_KNA1
I_KNB1 = W_KNB1
I_KNVV = W_KNVV.
ENDLOOP
But it gives error SALES_AREA_NOT_VALID.Hi,
Check in TVKO and TVTA master tables, for Sales Area (Sales OrganizationDistribution ChannelDivision) is vaild or not..
If no entreis availble , it will raise the exception SALES_AREA_NOT_VALID.
-somesh
reward points if it is helpful -
BAPI create customer with search term 2?
Hi all,
I'm looking for a BAPI/FM, which can create customer master record with 'Search term 2' input field. Pls let me know the BAPI/FM name if you know.
Regards,
Hung.Hello Hung,
SD_CUSTOMER_MAINTAIN_ALL is used in standard during the maintenance of a consumer using the standard customer master data transaction XD01 & XD02.
It is not intended to be used out of the transaction and in no case it should be used out of its original context. Due to the specificity of the function module, out of the original context we may face limitations and data inconsistencies.
For the maintenance of customers, there is NO BAPI and NO direct function module.
There are some functions modules like the one above where the name is looking nice. But these should not be used.
Below ECC 2005 (6.00), the only solution was batch input and DEBMAS idocs. See [note 384462|https://service.sap.com/sap/support/notes/384462]
Starting with ECC 2005 (6.00) and above: a synchronisation tool has been introduce. See class CMD_EI_API and VMD_EI_API
Hope this helps
BR
Alain -
Bapi to create customer Master
Dear all,
As far i know there is no standard bapi to create a customer. There i s standard fm used her is SD_CUSTOMER_MAINTAIN_ALL. I tried to create customer master using this and making the function module as remote enabled. i tried to created a zbapi and use this fm inside of this. Please tell me if any idea on this.If any body knows please help me in this.
Regards,
Madhu.Dear Alain
Once again thanks for your reply. I passed customer no to extract data of a customer . But it is not extracting any data .
I am thinking to fill all the fields of the table by seeing hoe it is extracting the data . can you give me some idea on this .
DATA: ls_i_main TYPE cmds_ei_main,
ls_e_main TYPE cmds_ei_main,
lt_custs TYPE cmds_ei_extern_t,
ls_cust TYPE cmds_ei_extern,
ls_head TYPE cmds_ei_header,
ls_instance TYPE cmds_ei_instance.
CONSTANTS: lc_obj_task TYPE cmd_ei_object_task VALUE 'M'.
ls_instance-kunnr = '0000100001'.
ls_head-object_instance = ls_instance.
ls_head-object_task = lc_obj_task.
ls_cust-header = ls_head.
APPEND ls_cust TO lt_custs.
ls_e_main-customers = lt_custs.
CALL METHOD cmd_ei_api_extract=>get_data
EXPORTING
is_master_data = ls_e_main
IMPORTING
es_master_data = ls_i_main.
"es_error = pe_error.
Regards,
madhu.
Edited by: madhurao123 on Mar 31, 2010 1:17 PM -
Change Customer Master using CMD_EI_API MAINTAIN_BAPI Method
Hi Experts,
I am using CMD_EI_API=>MAINTAIN_BAPI method for Creating Customer through Custom program. The Creation of Customer Master is working fine.
I have another requirement i need to perform the following for the Customer Change
1 . Delete all Phone , Fax and SMTP entries from the table and create a new entries for Customer.
2 . Delete a Contact Person based on the information from the legacy system.
I am facing problem in the above two issues
ADR2, ADR3 and ADR6 entries are retrieved for customer.
this values are populated and passed to the method with Task as 'D' - delete.
there is no error message from the Method. when i call commit statement
1 . the address details are not getting deleted in the tables
2. if a contact person is deleted then i am getting a short dump while commit.
Please help me if you know the details of MAINTAIN_BAPI method whic can be used for the Deletion purpose.
Thanks,
Shrikanth RHi Experts
I'm having the same problem it looks like the method maintain_bapi does not commit the new values, I debuged it and found a call to a badi lr_badi_update but I could not find information about it.
Any help will be appreciate
Leo -
Need Function Module to create Customer Master
Hi,
I need to create customer master data (T-Code: XD01) include the company code data and sales area data.
Is there any function module that I can use? I tried to use BDC but since the screen is different for each account group, I'm thinking is there any FM that can use so that I do not need to create so much BDC.
Hope someone can use.
Thanks.hi there...
Please find below some of the BAPIs, Function Modules and Direct Input Programs for Customer Master.
RFBIDE00
BAPI_CUSTOMER_CREATEFROMDATA1
SD_CUSTOMER_MAINTAIN_ALL
hope it helps...
do reward if helpful or get bak if u hav further queries. -
. bapi to create customer
Hi All,
I am having problem finding a right bapi for create a customer.
I am using "bapi_customer_createfromdata1" to create a customer. Problem is i couldn't find a structure to pass sales org. data as well as partner functions.
Please help me. Feel free to ask me questions.
Thanks,
Diwakar.Hi,
The way is using multiple BAPI's.
bapi "bapi_customer_createfromdata1" is used to create customer with reference customer number and then send the information to bapi "sd_customer_maintain_all" for changing the the values.
Still having problem passing parameters.
When i am sending partner information(knvp) to "sd_customer_maintain_all", it is giving abap dump assertion_failed.
I tried to debug the program but i couldn't find the error.
values i passed to bapi sd_customer_maintain_all
internal table of type <b>fknvp</b>.
MANDT sy-mandt
KUNNR st_knvp-kunnr
VKORG st_knvp-vkorg
VTWEG st_knvp-vtweg
SPART st_knvp-spart
PARVW st_knvp-parvw
PARZA
KUNN2 st_knvp-sp_kunnr
LIFNR
PERNR
PARNR
KNREF
DEFPA
Appended line by line to the table.
Reward points if found helpful....
Cheers,
Venkoji Babu. -
Hi Gurus,
I have a requirement to create customer,i have used the following bapis but cudnt help o create.
but tried all the bapis like :
/SAPNEA/SMAPI_CUSTOMER_CREATE2
/SAPNEA/SMAPI_CUSTOMER_CREATE
BAPI_CUSTOMER_CREATEFROMDATA1
BAPI_CUSTOMER_CREATEFROMDATA
SD_CUSTOMER_MAINTAIN_ALL,
bapi_customer_create,
these are not suitable for my requiement.
i have to pass customer,address,control data,shipping and billing details of xd01.
please help me to sort out this problem.
thanks & regards,
sap8752.Hi,
Have u tried this FM
go for this /SAPNEA/SMAPI_CUSTOMER_CREATE
CALL FUNCTION 'BAPI_CUSTOMER_CREATEFROMDATA1'
EXPORTING
pi_personaldata = pi_personaldata
pi_opt_personaldata = pi_opt_personaldata
pi_companydata = pi_companydata
pi_opt_companydata = pi_opt_companydata
pi_consumeren = pi_consumeren
pi_copyreference = pi_copyreference
pi_credit_control_flag = pi_credit_control
IMPORTING
customerno = customer_code
return = return.
IF return IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = pi_wait_commit.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
For creation of classification data you can use below one
'BAPI_OBJCL_CREATE'. -
Bapi Bdc Combination to create customer
Dear all,
I want to create a customer master from external system. What are the standard bapis are there they re not suitable for my requirement. I approach it in the following way. I did a bdc for xd01 and trying to call it from a rfc fm which i prepared. But the data that i passes from this fm is not reaching my bdc program. If any body have a good idea on this please share your idea with me .
1) I created an import parameter in this i created a structure.
2) the same structure i declare with the same name in bdc report(se38).
The code in the fm is in this way
DATA:
t_cust TYPE zcust_table .(this is the structure name in my fm import tab)
EXPORT t_cust TO MEMORY ID 'TABLE'.
SUBMIT ZBDC_CUSTOMER AND RETURN.
3)
DATA :BEGIN OF zcust OCCURS 100 .
INCLUDE STRUCTURE zcust_table.
DATA:END OF ZCUST.
START-OF-SELECTION.
IMPORT t_cust FROM MEMORY ID 'TABLE'.(Thi is my decalration in se38 bdc program.)
when i executed my fm the value that given in fm is not reaching my table which i declared in bdc program.
Regards,
Madhu.Hi,
Populate all the customer details address details and personal details in KNA1 structure.
Populate Company code details in KNB1 structure.
Populate Sales area details in KNVV structure.
Populate dunning data in KNB5 table.
Populate Tax data in KNVI table
In all the structures other than customer number we have to fill all the primary key fields.
Call the SD_CUSTOMER_MAINTAIN_ALL function module to create customer as below.
Create Customer in SAP
CALL FUNCTION 'SD_CUSTOMER_MAINTAIN_ALL'
EXPORTING
i_kna1 = fs_kna1
i_knb1 = fs_knb1
i_knvv = fs_knvv
i_bapiaddr1 = fs_add1
i_bapiaddr2 = fs_add2
pi_postflag = c_true
IMPORTING
e_kunnr = w_kunnr
TABLES
t_xknb5 = t_knb5
t_xknvi = t_knvi
EXCEPTIONS
client_error = 1
kna1_incomplete = 2
knb1_incomplete = 3
knb5_incomplete = 4
knvv_incomplete = 5
kunnr_not_unique = 6
sales_area_not_unique = 7
sales_area_not_valid = 8
insert_update_conflict = 9
number_assignment_error = 10
number_not_in_range = 11
number_range_not_extern = 12
number_range_not_intern = 13
account_group_not_valid = 14
parnr_invalid = 15
bank_address_invalid = 16
tax_data_not_valid = 17
no_authority = 18
company_code_not_unique = 19
dunning_data_not_valid = 20
knb1_reference_invalid = 21
cam_error = 22
OTHERS = 23.
Check sysubrc to know the error .
Please let me know if you need any further details.
Regards
Madhu -
How to create Custom error message in SharePoint 2013
Hi,
I have created one document library.On uploading the same file SharePoint throws error as"server error.The same file exit".
But my requirement is not to show the SharePoint default message.I wanted to create custom message and show the pop up for the same file upload.
Is there any way to create any custom error page or can I manipulate SharePoint default error page?
Any help?
Thank youHi,
You can create an event receiver to set the validation error messages. One such post to redirect the custom error page is as follows
https://social.msdn.microsoft.com/Forums/office/en-US/2bc851f6-e04b-4550-b87f-9b874a290482/sharepoint-event-receivers-and-custom-error-messages?forum=sharepointdevelopmentlegacy
Create custom error page for SharePoint event receiver
Please mark it answered, if your problem resolved or helpful. -
I am planning to create custom defined DSO Object & Info cube
Hi ,
i am planning to create custom defined DSO Object & Info cube.what ratio i can calculate what is the keyfields & what are the data fields in DSO.How can i calculate.
2. how can i create suitable dimensions, suitable characterstics for dimensions.what ratio i can decide.
Thanks,
chandu.Hi Diego Garu,
Thanks for your fast response.i
VBELN VBAP 2LIS_11_VAITM 0DOC_NUMBER
POSNR VBAP 2LIS_11_VAITM 0S_ORD_ITEM
KUNNR VBAK 2LIS_11_VAHDR 0SOLD_TO
VBELN VBRP 2LIS_13_VDITM 0BILL_NUM
FKDAT VBRK 2LIS_13_VDHDR 0BILL_DATE
INCO1 VBRK 2LIS_13_VDHDR(INCO1FieldNot Available in Data Source) 0INCOTERMS
ZTERM VBRK 2LIS_13_VDHDR(Payment terms field Not Available in Data Source) 0UCPYTERMS
NETWR VBRP 2LIS_13_VDITM 0NETVAL_INV.
here data is coming from the multible tables.that why i am planning to create custom defined data source based on view. here how can i calucate dso is suitable or cube is suitable.
suppose dso is suitable how can i decide which on is the data field and which one is the key field.
how can i decide how many dimensions are needed here.and which chara are suitable for that dimensions.
Thanks ,
chandu. -
How to Created custom report for Ship not Billed (SD/FI)?
Hi all,
I am anticipating to write some abap reports..Here is one of them..
Anyone can help me with writing a Report , how to do 'Custom Report for shipped not Billed(SD/FI)' ..But since I am new to Abap , if you wish to reply, please use a little more detail and simple explanation, step by step so I can understand what is the idea, how it can be acheived...what kind of report should be used , techniques, tables etc...:)
Appreciate your help!
Regards,
BobyHi Boby,
You need to create custom transaction to achive these results.
you will have selection-screen ,it would be :
Date : Here date would be mandatory - Ranges Option
Customer - Optional field - Ranges
Order # Sales Order (Optional) Ranges
Invoice # - Invoice # (Optional) Ranges
You will get the data based on ur selection-screen criteria ...
First you will have customer order details from diffrent table
VBAK,
VBAP,
LIKP
LIPS
VBRK,
VBRP
KNA1,
VBFA Tables ( See the my sample program )
Output would be :
Customer # Custome Name Order # Delivery # Invoice # Netpr, Netquantity ,
Check the condition whether invoice table has VBRK-RFBSK = ''.
See the my sample program : This is sales report by monthly..
REPORT ZFDSALES_REPORT no standard page heading
message-id zwave.
Data Declaration Part
TYPE-POOLS
type-pools : slis.
Tables
tables : VBAK,
VBAP.
Internal table for VBAK Table
data : begin of i_vbak occurs 0,
vbeln like vbak-vbeln,
bstnk like vbak-bstnk,
vdatu like vbak-vdatu,
end of i_vbak.
Internal table for VBAP and MATNR
data : begin of i_vbap occurs 0,
vbeln like vbap-vbeln,
matnr like vbap-matnr,
kdmat like vbap-kdmat,
kwmeng like vbap-kwmeng,
netpr like vbap-netpr,
maktx like makt-maktx,
end of i_vbap.
Internal tables
data : begin of i_sales occurs 0,
vdatu like vbak-vdatu,
bstnk like vbak-bstnk,
matnr like vbap-matnr,
maktx like makt-maktx,
kdmat like vbap-kdmat,
kwmeng like vbap-kwmeng,
netpr like vbap-netpr,
end of i_sales.
Variable for ALV
data : v_repid like sy-repid,
gt_fieldcat type slis_t_fieldcat_alv.
Selection-screen
selection-screen : begin of block blk with frame title text-001.
select-options : s_vbeln for vbak-vbeln,
s_erdat for vbak-erdat,
s_ernam for vbak-ernam,
s_vdatu for vbak-vdatu obligatory,
s_BSTNK for vbak-BSTNK,
s_KUNNR for vbak-kunnr,
s_matnr for vbap-matnr,
s_KDMAT for vbap-KDMAT.
selection-screen : end of block blk.
Initilization
initialization.
v_repid = sy-repid.
S T A R T - O F - S E L E C T I O N ****************
start-of-selection.
Get the data from VBAK and VBAP Tables
perform get_vbak_vbap.
E N D - O F - S E L E C T I O N *****************
end-of-selection.
Display the data
perform dispolay_data.
*& Form get_vbak_vbap
Get the data from VBAK and VBAP Table
FORM get_vbak_vbap.
Get the data from VBAK Table
select vbeln bstnk vdatu from vbak into table i_vbak
where vbeln in s_vbeln
and bstnk in s_bstnk
and vdatu in s_vdatu
and kunnr in s_kunnr
and erdat in s_erdat
and ernam in s_ernam.
if sy-subrc ne 0.
message e000(zwave) with 'No data found for given selection'.
endif.
Get the data from VBAP Table
select avbeln amatnr akdmat akwmeng a~netpr
b~maktx into table i_vbap
from vbap as a inner join makt as b on bmatnr = amatnr
for all entries in i_vbak
where a~vbeln in s_vbeln
and a~kdmat in s_kdmat
and a~abgru = space
and a~matnr in s_matnr
and a~matnr ne '000000000000009999'
and a~matnr ne '000000000000004444'
and a~matnr ne '000000000000008888'
and a~matnr ne '000000000000001111'
and a~werks = '1000'
and b~spras = 'E'
and a~vbeln = i_vbak-vbeln.
if sy-subrc ne 0.
message e000(zwave) with 'No data found for given selection'.
endif.
sort i_vbak by vbeln.
sort i_vbap by vbeln matnr.
loop at i_vbap.
read table i_vbak with key vbeln = i_vbap-vbeln
binary search.
if sy-subrc eq 0.
i_sales-bstnk = i_vbak-bstnk.
i_sales-vdatu = i_vbak-vdatu.
i_sales-matnr = i_vbap-matnr.
i_sales-kdmat = i_vbap-kdmat.
i_sales-maktx = i_vbap-maktx.
i_sales-netpr = i_vbap-netpr.
i_sales-kwmeng = i_vbap-kwmeng.
append i_sales.
else.
continue.
endif.
clear : i_sales,
i_vbap,
i_vbak.
endloop.
sort i_sales by vdatu bstnk matnr.
refresh : i_vbap,
i_vbak.
ENDFORM. " get_vbak_vbap
*& Form dispolay_data
Display the data
FORM dispolay_data.
Fill the Fiedlcat
PERFORM fieldcat_init using gt_fieldcat[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = gt_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_sales
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
ENDFORM. " dispolay_data
*& Form fieldcat_init
text
-->P_GT_FIELDCAT[] text
FORM fieldcat_init USING e01_lt_fieldcat type slis_t_fieldcat_alv.
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
Delivery Date
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'VDATU'.
LS_FIELDCAT-OUTPUTLEN = 12.
LS_FIELDCAT-TABNAME = 'I_SALES'.
ls_fieldcat-seltext_L = 'Delivery Date'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Purchase Order #Material Description
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'BSTNK'.
LS_FIELDCAT-OUTPUTLEN = 25.
LS_FIELDCAT-TABNAME = 'I_SALES'.
ls_fieldcat-seltext_L = 'Purchase Order #'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Material
CLEAR LS_FIELDCAT.
LS_FIELDCAT-REF_FIELDNAME = 'MATNR'.
LS_FIELDCAT-REF_TABNAME = 'MARA'.
LS_FIELDCAT-FIELDNAME = 'MATNR'.
LS_FIELDCAT-TABNAME = 'I_SALES'.
ls_fieldcat-seltext_L = 'Material #'.
ls_fieldcat-seltext_M = 'Material #'.
ls_fieldcat-seltext_S = 'Material #'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Material Description
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MAKTX'.
LS_FIELDCAT-OUTPUTLEN = 40.
LS_FIELDCAT-TABNAME = 'I_SALES'.
ls_fieldcat-seltext_L = 'Material Description'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Customer Material #
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'KDMAT'.
LS_FIELDCAT-OUTPUTLEN = 35.
LS_FIELDCAT-TABNAME = 'I_SALES'.
ls_fieldcat-seltext_L = 'Customer material no.'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Quantity
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'KWMENG'.
LS_FIELDCAT-OUTPUTLEN = 15.
LS_FIELDCAT-TABNAME = 'I_SALES'.
ls_fieldcat-seltext_L = 'Quantity'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Net Price
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'NETPR'.
LS_FIELDCAT-OUTPUTLEN = 15.
LS_FIELDCAT-TABNAME = 'I_SALES'.
ls_fieldcat-seltext_L = 'Net Price'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
ENDFORM. " fieldcat_init
Reward Points if it is helpful
Thanks
Seshu -
How to create custom cloumns in report
Hi,
I want to create custom columns in the reports(columns which are not present in active subject area. Please help.
Thanks
ArpitaArpita,
You can create a calculated column using any Field (Presentation Column) in any Presentaion Table.
Eg: You want to calculate the difference between the Start and End Date of an Activity.
1. Simply Create a report on the Activities SA (Analytics or Real-time doe not matter here)
2. Add the required Coumns
3. To calculate the difference between the Start and End time.
- add the below fields from Activity
- Click the 'Fx' icon any field that you would like to display the calculated value in.
- Replace the existing formula in this field with TIMESTAMPDIFF(SQL_TSI_DAY, Activity."Created Date", Activity."Completed Date") - This is your calculated value
Activity ID Subject Created Date Completed Date Difference
AXXX-IHJ1W Prepare Proposal 10/31/2011 6:39:43 AM 11/18/2011 4:48:54 AM 18
For more details, I would suggest you look at the CRM On Demand Bookshelf or click the hlp link in CRM On Demand.
Hope this helps!
Thanks,
Royston
Maybe you are looking for
-
I can't use my free gift card about back to school
I buy a macbook pro online and get a free gift card. I have received the macbook and the gift card, but I can't use it. It shows its not valid. What can I do?
-
Video freezes every few seconds
My new iPad video playback freezes every few seconds. I have a decentish Internet speed (2.3MB) and have turned all apps off and even reset. Any ideas?
-
Wmode and dreamweaver browser safe script for active x
I usually don't use the javascript that dreamweaver generates for active content (AC_RunActiveContent.js) I've been using another javascriptcode, but at work I've been told to use the code from Dreamweaver. Some times I might use transparent Flash or
-
Nokia icon and cannot access outlook email
I have a nokia icon and cannot access outlook email through verizon cellular service but can access when connected to wi fi. I purchased the phone on June 15, 2014 and it worked fine until yesterday evening, July 29th when the verizon cellular stoppe
-
Hi I created a Session EJB in my ADF project but when I try to run a flow that calls the EJB I get the following error: Target URL -- http://127.0.0.1:7101/BrowseEditApp-ViewController-context-root/faces/adf.task-flow?adf.tfId=ejb-claims&adf.tfDoc=/W