BAPI_MATERIAL_MAINTAINDATA_RT for MARA 'Z' fields
Hi ,
I need to populate 'ZZ' fields which are appended to 'MARA' table using the BAPI function 'BAPI_MATERIAL_MAINTAINDATA_RT'. I see there are two parameters for custom fields. They are 'clientext' and 'clientextx'. I need to populate 40 custom fields which are appended to the MARA table. Say for example if I want to populate two custom fields. One is 'ZCOLOR' the value of which is black , the second one is 'ZFABRIC' , the value of which is 'COTTON'. If I want to populate this info using 'clientext' and 'clientextx' , how to do it. Please let me know if you guys have sample code.
Thanks
JC
Hello Gurus,
I recently used the Function Module EXIT_SAPL1001_003 mentioned above. And I found that in Unicode system there might be offset issues when assigning the value of a structure directly to another one if either of them had non-character like components (refer to this ABAP Keyword Documentation).
So I changed the SAP sample code for this function module a little.
* Sample code
* INCLUDE LXMGVF07 *
* Example2: Customer-specific data contains also numerical data types *
* Customer structure ZMARC has the following definition: *
* Field name Data type Length *
* ZZCUS1 CHAR 10 *
* ZZCUS2 DEC 3 -> numerical!!!! *
* ZZCUS3 CHAR 5 *
DATA: error_occured LIKE sy-datar.
DATA: BEGIN OF h_clientext_c, "Customer data in CHAR format
function LIKE bapie1marcextrt-function, "Key field
material LIKE bapie1marcextrt-material, "Key field
zzsccj1 LIKE zsmm_bcxx-zzsccj1,
zzpzwh LIKE zsmm_bcxx-zzpzwh,
zzjx LIKE zsmm_bcxx-zzjx,
zztssp LIKE zsmm_bcxx-zztssp,
zzybsp LIKE zsmm_bcxx-zzybsp,
zzpp LIKE zsmm_bcxx-zzpp,
zzsccj2 LIKE zsmm_bcxx-zzsccj2,
zzzgxj(14) TYPE c, "CURR 11, DEC 2
zzzgxj_waers LIKE zsmm_bcxx-zzzgxj_waers,
zzzgxj_peinh LIKE zsmm_bcxx-zzzgxj_peinh,
zzzgxj_bprme LIKE zsmm_bcxx-zzzgxj_bprme,
zzzdxj(14) TYPE c, "CURR 11, DEC 2
zzzdxj_waers LIKE zsmm_bcxx-zzzdxj_waers,
zzzdxj_peinh LIKE zsmm_bcxx-zzzdxj_peinh,
zzzdxj_bprme LIKE zsmm_bcxx-zzzdxj_bprme,
zzjmdsj(14) TYPE c, "CURR 11, DEC 2
zzjmdsj_waers LIKE zsmm_bcxx-zzjmdsj_waers,
zzjmdsj_peinh LIKE zsmm_bcxx-zzjmdsj_peinh,
zzjmdsj_bprme LIKE zsmm_bcxx-zzjmdsj_bprme,
zzypbx LIKE zsmm_bcxx-zzypbx,
zzgg LIKE zsmm_bcxx-zzgg,
zzbqdw LIKE zsmm_bcxx-zzbqdw,
zztym LIKE zsmm_bcxx-zztym,
END OF h_clientext_c.
DATA: BEGIN OF h_clientext, "Customer data in actual format
function LIKE bapie1marcextrt-function, "Key field
material LIKE bapie1marcextrt-material. "Key field
INCLUDE STRUCTURE zsmm_bcxx.
DATA: END OF h_clientext.
DATA: BEGIN OF h_clientextx, "Customer update information
function LIKE bapie1marcextrtx-function, "Key field
material LIKE bapie1marcextrtx-material, "Key field
zzsccj1 TYPE c,
zzpzwh TYPE c,
zzjx TYPE c,
zztssp TYPE c,
zzybsp TYPE c,
zzpp TYPE c,
zzsccj2 TYPE c,
zzzgxj TYPE c,
zzzgxj_waers TYPE c,
zzzgxj_peinh TYPE c,
zzzgxj_bprme TYPE c,
zzzdxj TYPE c,
zzzdxj_waers TYPE c,
zzzdxj_peinh TYPE c,
zzzdxj_bprme TYPE c,
zzjmdsj TYPE c,
zzjmdsj_waers TYPE c,
zzjmdsj_peinh TYPE c,
zzjmdsj_bprme TYPE c,
zzypbx TYPE c,
zzgg TYPE c,
zzbqdw TYPE c,
zztym TYPE c,
END OF h_clientextx.
CASE parameter_name.
WHEN c_parnam_clientext.
* Copy from unstructured BAPI format to structured CHAR format
h_clientext_c-zzsccj1 = f_clientext-field1+0(40).
h_clientext_c-zzpzwh = f_clientext-field1+40(25).
h_clientext_c-zzjx = f_clientext-field1+65(10).
h_clientext_c-zztssp = f_clientext-field1+75(10).
h_clientext_c-zzybsp = f_clientext-field1+85(2).
h_clientext_c-zzpp = f_clientext-field1+87(10).
h_clientext_c-zzsccj2 = f_clientext-field1+97(10).
h_clientext_c-zzzgxj = f_clientext-field1+107(14).
h_clientext_c-zzzgxj_waers = f_clientext-field1+121(5).
h_clientext_c-zzzgxj_peinh = f_clientext-field1+126(5).
h_clientext_c-zzzgxj_bprme = f_clientext-field1+131(3).
h_clientext_c-zzzdxj = f_clientext-field1+134(14).
h_clientext_c-zzzdxj_waers = f_clientext-field1+148(5).
h_clientext_c-zzzdxj_peinh = f_clientext-field1+153(5).
h_clientext_c-zzzdxj_bprme = f_clientext-field1+158(3).
h_clientext_c-zzjmdsj = f_clientext-field1+161(14).
h_clientext_c-zzjmdsj_waers = f_clientext-field1+175(5).
h_clientext_c-zzjmdsj_peinh = f_clientext-field1+180(5).
h_clientext_c-zzjmdsj_bprme = f_clientext-field1+188(3).
h_clientext_c-zzypbx = f_clientext-field1+191(1).
h_clientext_c-zzgg = f_clientext-field1+192(12).
h_clientext_c-zzbqdw = f_clientext-field1+204(3).
CONCATENATE f_clientext-field1+207(22)
f_clientext-field2+0(18)
INTO h_clientext_c-zztym.
* Copy from structured CHAR format to actual format
MOVE-CORRESPONDING h_clientext_c TO h_clientext.
h_clientextx = f_clientextx.
IF NOT h_clientextx-zzsccj1 IS INITIAL
OR NOT f_headdata-all_fields IS INITIAL.
* Corresponding data field is relevant for update
IF h_clientext-zzsccj1 IS INITIAL.
t_res_fields-feldname = 'MARA-ZZSCCJ1'.
APPEND t_res_fields.
ENDIF.
ELSE.
CLEAR h_clientext-zzsccj1.
ENDIF.
f_mara_ueb-zzsccj1 = h_clientext-zzsccj1.
IF NOT h_clientextx-zzpzwh IS INITIAL
OR NOT f_headdata-all_fields IS INITIAL.
* Corresponding data field is relevant for update
IF h_clientext-zzpzwh IS INITIAL.
t_res_fields-feldname = 'MARA-ZZPZWH'.
APPEND t_res_fields.
ENDIF.
ELSE.
CLEAR h_clientext-zzpzwh.
ENDIF.
f_mara_ueb-zzpzwh = h_clientext-zzpzwh.
ENDCASE.
* Example for raising an exception if an application error occurred
IF NOT error_occured IS INITIAL.
MESSAGE e544(mg) WITH parameter_name RAISING application_error.
ENDIF.
消息编辑者为:Arwen Liu
Similar Messages
-
View for MARA+MARC+MBEW
hi ,
currently i am selecting data joining MARA,MARC,MBEW . it is giving hudge performance problem .
ON MARA~MATNR EQ MARC~MATNR
INNER JOIN MBEW
ON MARC~MANDT EQ MBEW~MANDT
AND MARC~MATNR EQ MBEW~MATNR
AND MARC~WERKS EQ MBEW~BWKEY
does any body know any database view that i can use instead.
Please let me also know if there is any other way to enhance performance.hey buddy!!!
u r using joins, so u go better for views.
i mean create views using se11 . u can go for maintenance view
now wat happen is tat when u create the views the data gets fetched for only those fields which u have requested. which does not happen when u create joins.
so go for views
maybe tat will reduce ur performance prob.
Hope it will help you!!!
Thanks & Regards,
Punit Raval -
Dear Experts,
From MARA table field STAWN (Comm./imp. code EU ) is not updating in MARC table field STAWN (Comm./imp. code EU ) by MM02 Transaction
Is there any SAP standard functionality to over come above issue or needed ABAP coding for the same ????
Regards
HanumantDear All,
Thanks for your reply
I tried to update the the field after adding plant and other detail actually that field will be gray mode (display) and cannot update
my question i want to update MARC_STAWN field (Forign trade import) for my existing all material , those material MARA_STAWN (basic data 3 ) is also blank but system is allowing me to update in MARA_STAWN (basic data 3) but system will not update to MARC_STAWN (Forign trade import) field.
What is the best method to Coppy all MARA Stawn fields to the MARC Stawn field.
Regards
Hanumant. -
Restrict values for F4 on field in Selection-screen
Hi,
For f4 on particular field I am getting list of values. These values are fixed in Value Range of DOMAIN of that field. There are 26 values fixed for that DOMAIN. Now what I need is I need to restrict 26th value from displaying on F4 for that field in selection screen.
I tried doing it in AT SELECTION SCREEN OUTPUT event using F4_ON_VALUE REQUEST FM, fetching data and deleting 26th entry , but before i delete it, It shows all values in selection-screen.
Please any one guide me.
Thanks,
Vanitha PYou have to use AT SELECTION-SCREEN ON VALUE-REQUEST event.
Tables:mara.
TYPES :BEGIN OF gty_mtart,
mtart TYPE mara-mtart,
END OF gty_mtart.
DATA: gt_mtart TYPE STANDARD TABLE OF gty_mtart,
gtt_mtart TYPE gty_mtart.
DATA: gt_return_tab TYPE TABLE OF ddshretval,
gwa_return_tab TYPE ddshretval.
SELECT-OPTIONS:so_mtart FOR mara-mtart.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_mtart-low.
REFRESH gt_mtart.
gtt_mtart-mtart = 'Z01'.
APPEND gtt_mtart TO gt_mtart.
gtt_mtart-mtart = 'Z02'.
APPEND gtt_mtart TO gt_mtart.
gtt_mtart-mtart = 'Z03'.
APPEND gtt_mtart TO gt_mtart.
gtt_mtart-mtart = 'Z04'.
APPEND gtt_mtart TO gt_mtart.
gtt_mtart-mtart = 'Z05'.
APPEND gtt_mtart TO gt_mtart.
gtt_mtart-mtart = 'Z06'.
APPEND gtt_mtart TO gt_mtart.
gtt_mtart-mtart = 'Z90'.
APPEND gtt_mtart TO gt_mtart.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
retfield = 'SO_MTART-LOW'
* PVALKEY = ' '
* DYNPPROG = ' '
* DYNPNR = ' '
* DYNPROFIELD = ' '
value_org = 'S'
* MULTIPLE_CHOICE = ' '
* IMPORTING
* USER_RESET =
TABLES
value_tab = gt_mtart
* FIELD_TAB =
return_tab = gt_return_tab
* DYNPFLD_MAPPING =
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3
IF sy-subrc = 0 AND gt_return_tab IS NOT INITIAL.
CLEAR gwa_return_tab.
READ TABLE gt_return_tab INTO gwa_return_tab INDEX 1.
IF sy-subrc = 0 AND gwa_return_tab-fieldval IS NOT INITIAL.
so_mtart-low = gwa_return_tab-fieldval.
ENDIF.
ELSEIF sy-subrc <> 0.
REFRESH gt_return_tab. CLEAR: gwa_return_tab.
ENDIF. -
Dear all ,
Can you please suggest some BAPI's which will update the fields
External Material Group MARA -EXTWG
Gross Weight MARA -BRGEW
Net Weight MARA -NTGEW
Material Group 2 MARA -MVGR2
The existing BAPI's which i tried to find does not have fields to update External Material group.
Thanks in advance .
Regards,
Manmohan.It doesn't help for all the fields, but using BAPI_MATERIAL_SAVEDATA you should be able to populate all your Base Unit of Measure Weights (MARA) using the UNITSOFMEASURE structure. This is from the on-line help for this BAPI Structure:
Units of measure
Description
You use this structure to transfer the units of measure for the material.
For information on the meaning of the individual fields in the structure , see the corresponding data element documentation for the individual fields.
Both data on the base unit of measure and data on alternative units of measure is transferred in this structure. The base unit of measure is identified as the unit of measure defined in structure CLIENTDATA in field BASE_UOM (or BASE_UOM_ISO).
Notes
If an International Article Number (EAN) that does not yet exist in the system is transferred in field EAN_UPC, an entry in structure INTERNATIONALARTNOS must also be transferred for this new EAN. -
I have a question on Country of Origin (HERKL) field related to Material Master.
I understand that table MARC has HERKL field, which will be populated from material master view Foreign Trade: Import view/Export view of material master.
Table MARA also has HERKL field, but I not sure how this field will be populated. As MARA table meant for holding material/product genaral data, I did check for field HERKL under Basic view1/Basic View 2 of material mater, but end up with no luck.
1. How MARA-HERKL field will be populated?
2. Under what view of material master, MARA-HERKL can be located?
Your inputs in this regard highly appreciated.you can execute OMSR, then click the button to sort by field name. then click the button to position at field name and enter
MARA-HERKL
you will see that this field is not assigned to any field selection group, hence you cannot find it in any material master view.
you can execute SE11. enter MARA and then click display. find the field HERKL, double click the field, then click the where used button. SAP will give you info that the field is not used. -
Adding MARA-GROES field on SAPLMIGO screen 0200
Hi Gurus,
I would like to add additional field 'MARA-GROES' to the item screen of transaction MIGO / SAPLMIGO screen 0200 /. How can I do that ?
Thanks
StefanHi ,
You can create a custom field in MIGO as a subscreen ...which will be displayed as tabstrip......
Do in this way....
use the badi MB_MIGO_BADI
Create a program with the screen type sub-screen in SE80 and design the layout for the custom fields.
Declare the custom fields in a Z**TOP include.
--> Under the PBO method declare the program name and screen number
--> Under PAI method declare the field to u2018Xu2019.
--> Define E_force_change = 'X'. in pai
--> Under the line modify method declare a flag and set to u2018Xu2019 checking for material document number by which we can set the fields to be in display mode when we open MIGO for display of material document created after doing goods receipt.
--> Under the POST_DOCUMENT method write the code for the values of the line item. For these values to be available here in this method use the memory concept u201CExport to memory idu201D in the method LINE_MODIFY.
--> Under the POST_DOCUMENT method write the code for appending the value to Z table along with the values of the line item (In this case production order number, material, u2026u2026.). For these values to be available here in this method use the memory concept u201CExport to memory idu201D in the method LINE_MODIFY.
--> In order to make the fields to be in display mode during the display of material document, create a module under PBO and import the flag value and the production order number details in the method LINE_MODIFY and if that flag = u2018Xu2019, use
loop at screen.
endloop......concept
Thanks,
Shailaja Ainala. -
Mb51 - introducing MARA table fields
i need to introduce MARA table fields into the selection screen of mb51. for this i need to create entries in the standard table MMIM_REP_CUST, after applying the notes 215435. I have already applied notes 215043. i have maintained the entries in table maintenance generator. But then too the changes are not reflected because of the auto_repair subroutine. This subroutine states that when customized the table need to be commit to the database. Since i have not committed the work, all changes are getting roll back, giving me warning Auto_repair executed.
I have not informed by basis team regarding this. but i want to know this changes are not taken place due to commit operation not being done..
The notes are correctly implemented.
Please help.Hi Rani,
Just sort the table by the 3 fields. and see the table in debug.
DATA: BEGIN OF i_mara OCCURS 0,
matnr TYPE mara-matnr,
mbrsh TYPE mara-mbrsh,
brgew TYPE mara-brgew,
END OF i_mara.
SORT i_mara BY matnr mbrsh brgew.
Regards,
Venkat.O -
ALV Totals , Subtotals for a particular field in ALV Grid report
Hi,
I have an issue in ALV totals and subtotals.
Scenario is like this.
i have a vendor data to be pulled out of SAP and to be shown in the form of report.
i am populating all the data and doing do_sum based on Vendor ( has expansin & collapse option ) and display the number of reports .
Vendor -
100
Vendor1 -
1
Vendor2----
2.
Vendor100----
100.
but my problem is in the same report i have a date field .
if i have a five vendors created on 03/03/2008. in the same report for the date field having ( expansion & collapse ) , when i expand based on that date can i be able to sum up all the vendors created on 03/03/2008 and display in the same report along with the vendor count.
Let me know . Thank you in advance
Regards,
RyHi Roby,
Have a look at this sample code
It will help u,
REPORT ZIN_FI_AGEING
message-id zbdc
no standard page heading.
Title : For Ageing Details
Author :
Date : 22/11/2004
Transport/Correction Id :
Clarify case ID :
Application : FI
Program Type :
Frequency :
Purpose :
Comments :
Request No :
TABLES DELCARATIONS
Tables: zzgeinz9a, "Actual line item table
t001. "Plants/Branches
ALV TTPE DELCARATIONS
type-pools: slis.
*Type Declarations for Field Catalog
data : i_fldcat_head type slis_t_fieldcat_alv,
wa_fldcat_head type slis_fieldcat_alv.
*Type Declarations for ALV Events
data : i_events type slis_t_event,
wa_event like line of i_events.
*Type Declarations for Layout Design
data : wa_layout type slis_layout_alv.
*Type Declarations for Sorting Fields
data: it_sort type slis_sortinfo_alv occurs 0 with header line.
*Type Declarations for Displaying Images on Grid
data : i_comment type slis_t_listheader,
wa_comment type slis_listheader.
*Type Declarations for Grouping fields
data : wa_group type slis_sp_group_alv,
i_group type slis_t_sp_group_alv.
DATA DELCARATIONS
data: v_flag, "Status Flag
v_repid like sy-repid, "Program Name
p_year(4) type c, "Year
v_due_days type i. "To hold the due days
CONSTANTS DELCARATIONS
constants: c_x type c value 'X',
c_bukrs(4) type c value '0373'.
INTERNAL TABLES DELCARATIONS
*--Internal table to hold the required data
data: begin of it_final_vendor occurs 0,
rzzlifnr like zzgeinz9a-rzzlifnr, "Vendor
name1 like lfa1-name1, "Vendor Name
docnr like zzgeinz9a-DOCNR, "Accounting Doc No
refdocnr like zzgeinz9a-REFDOCNR, "Reference document no
belnr like bkpf-belnr, "FI Doc No
doc_date like bkpf-awkey, "Document Date
zbd1t like bsik-zbd1t, "Cash discount days 1
bldat like bkpf-bldat, "Document Date
due_date like bkpf-bldat, "Due Date
due_days type i, "Due Days
rzz_ebeln like zzgeinz9a-rzz_ebeln, "P.O. Ref No
not_due like zzgeinz9a-hsl, "Not Yet Due
hsl like zzgeinz9a-hsl, "local currency
found type c, "Existance Flag
end of it_final_vendor.
data: begin of it_final_vendor_temp occurs 0,
rzzlifnr like zzgeinz9a-rzzlifnr, "Vendor
name1 like lfa1-name1, "Vendor Name
belnr like bkpf-belnr, "FI Doc No
bldat like bkpf-bldat, "Document Date
rzz_ebeln like zzgeinz9a-rzz_ebeln, "P.O. Ref No
hsl like zzgeinz9a-hsl, "local currency
due_date like bkpf-bldat, "Due Date
due_days type i, "Due Days
not_due like zzgeinz9a-hsl, "Not Yet Due
buck_0_30 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_31_60 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_61_90 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_91_180 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_180 like zzgeinz9a-hsl, "Invoiceamt in localcurr
docnr like zzgeinz9a-DOCNR, "Accounting Doc No
refdocnr like zzgeinz9a-REFDOCNR, "Reference document no
doc_date like bkpf-awkey, "Document Date
found type c, "Existance Flag
end of it_final_vendor_temp.
data: begin of it_final_customer occurs 0,
rzzkunnr like zzgeinz9a-rzzkunnr, "Customer
name1 like kna1-name1, "Customer Name
docnr like zzgeinz9a-DOCNR, "Accounting Doc No
refdocnr like zzgeinz9a-REFDOCNR, "Reference document no
belnr like bkpf-belnr, "FI Doc No
doc_date like bkpf-awkey, "Document Date
zbd1t like bsik-zbd1t, "Cash discount days 1
bldat like bkpf-bldat, "Document Date
due_date like bkpf-bldat, "Due Date
due_days type i, "Due Days
rzz_ebeln like zzgeinz9a-rzz_ebeln, "P.O. Ref No
not_due like zzgeinz9a-hsl, "Not Yet Due
hsl like zzgeinz9a-hsl, "local currency
found type c, "Existance Flag
end of it_final_customer.
data: begin of it_final_customer_temp occurs 0,
rzzkunnr like zzgeinz9a-rzzkunnr, "Customer
name1 like kna1-name1, "Customer Name
belnr like bkpf-belnr, "FI Doc No
bldat like bkpf-bldat, "Document Date
rzz_ebeln like zzgeinz9a-rzz_ebeln, "P.O. Ref No
hsl like zzgeinz9a-hsl, "local currency
due_date like bkpf-bldat, "Due Date
due_days type i, "Due Days
not_due like zzgeinz9a-hsl, "Not Yet Due
buck_0_30 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_31_60 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_61_90 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_91_180 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_180 like zzgeinz9a-hsl, "Invoiceamt in localcurr
docnr like zzgeinz9a-DOCNR, "Accounting Doc No
refdocnr like zzgeinz9a-REFDOCNR, "Reference document no
doc_date like bkpf-awkey, "Document Date
found type c, "Existance Flag
end of it_final_customer_temp.
*--Internal Table to hold the Cash discount days 1 for Vendors
data: begin of it_final_bsik occurs 0,
belnr like bsik-belnr,
zbd1t like bsik-zbd1t,
end of it_final_bsik.
*--Internal Table to hold the Cash discount days 1 for Customers
data: begin of it_final_bsid occurs 0,
belnr like bsid-belnr,
zbd1t like bsid-zbd1t,
end of it_final_bsid.
INITIALIZATION
v_repid = sy-repid.
SELECTION SCREEN
selection-screen: begin of block b1 with frame title text-h01.
selection-screen skip.
select-options: s_vendor for zzgeinz9a-rzzlifnr modif id ven.
parameters: p_comp1 like t001-bukrs modif id ven.
parameters: p_rundt1 like bkpf-bldat modif id ven.
select-options: s_cust for zzgeinz9a-rzzkunnr modif id cst.
parameters: p_comp2 like t001-bukrs modif id cst.
parameters: p_rundt2 like bkpf-bldat modif id cst.
selection-screen skip.
selection-screen: begin of block b2 with frame title text-h02.
parameters : p_vendor radiobutton group gr1 default 'X'
user-command test,
p_cust radiobutton group gr1.
selection-screen: end of block b2.
selection-screen: end of block b1.
**************************AT Selection Screen OutPut ******************
at selection-screen output.
loop at screen.
if p_cust = 'X'.
if screen-group1 = 'VEN'.
screen-active = '0'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '0'.
endif.
elseif p_vendor = 'X'.
if screen-group1 = 'CST'.
screen-active = '0'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '0'.
endif.
endif.
modify screen.
endloop.
SELECTION SCREEN ON
at selection-screen on s_vendor.
*--Validating Vendor
if not s_vendor[] is initial.
perform validate_s_vendor.
endif.
at selection-screen on s_cust.
*--Validating Customer
if not s_cust[] is initial.
perform validate_s_cust.
endif.
at selection-screen on p_comp1.
*--Validating Company Code.
if not p_comp1 is initial.
perform validate_p_comp1.
endif.
at selection-screen on p_comp2.
*--Validating Company Code.
if not p_comp2 is initial.
perform validate_p_comp2.
endif.
START OF SELECTION
start-of-selection.
if p_vendor = 'X'.
perform get_vendor_data.
elseif p_cust = 'X'.
perform get_customer_data.
endif.
END OF SELECTION
end-of-selection.
if p_vendor = 'X'.
*--Generating the output for vendor
perform generate_field_catalog_vendor.
perform get_events_vendor.
perform generate_layout_vendor.
perform generate_sort_vendor.
perform generate_group_vendor.
perform disp_alv_grid_vendor.
elseif p_cust = 'X'.
*--Generating the output for customer
perform generate_field_catalog_cust.
perform get_events_customer.
perform generate_layout_customer.
perform generate_sort_customer.
perform generate_group_customer.
perform disp_alv_grid_customer.
endif.
*& Form validate_s_vendor
Validating the Vendor
form validate_s_vendor.
select rzzlifnr up to 1 rows
into (zzgeinz9a-rzzlifnr)
from zzgeinz9a
where rzzlifnr in s_vendor.
endselect.
if sy-subrc ne 0.
message e004 with 'Invalid Range of Vendor'(002)
s_vendor-low 'To'(006) s_vendor-high.
endif.
endform. " validate_s_vendor
*& Form validate_s_cust
Validating the Customer
form validate_s_cust.
select rzzkunnr up to 1 rows
into (zzgeinz9a-rzzkunnr)
from zzgeinz9a
where rzzkunnr in s_cust.
endselect.
if sy-subrc ne 0.
message e004 with 'Invalid Range of Customer'(005)
s_cust-low 'To'(006) s_cust-high.
endif.
endform. " validate_s_cust
*& Form validate_p_comp1
Validating the Company Code
form validate_p_comp1.
select single bukrs
into (t001-bukrs)
from t001
where bukrs eq p_comp1.
if sy-subrc ne 0.
message e004 with 'Company Code'(004) p_comp1 'Does not Exists'(003)
endif.
endform. " validate_p_comp1
*& Form validate_p_comp2
Validating the Company Code
form validate_p_comp2.
select single bukrs
into (t001-bukrs)
from t001
where bukrs eq p_comp2.
if sy-subrc ne 0.
message e004 with 'Company Code'(004) p_comp2 'Does not Exists'(003)
endif.
endform. " validate_p_comp2
*& Form get_vendor_data
Getting the Vendor Related Docs
form get_vendor_data.
select a~rzzlifnr
b~name1
a~docnr
a~refdocnr
a~rzz_ebeln
a~hsl
into corresponding fields of table it_final_vendor
from zzgeinz9a as a
inner join lfa1 as b
on arzzlifnr = blifnr
where rzzlifnr in s_vendor
and rbukrs eq p_comp1.
if sy-subrc eq 0.
v_flag = 'X'.
p_year = sy-datum+0(4).
perform get_doc_date using p_comp1
p_year.
perform move_records.
sort it_final_vendor by rzzlifnr.
perform generate_data.
else.
v_flag = space.
endif.
endform. " get_vendor_data
*& Form get_customer_data
Getting the Customer Related Docs
form get_customer_data.
select a~rzzkunnr
b~name1
a~docnr
a~refdocnr
a~rzz_ebeln
a~hsl
into corresponding fields of table it_final_customer
from zzgeinz9a as a
inner join kna1 as b
on arzzkunnr = bkunnr
where rzzkunnr in s_cust
and rbukrs eq p_comp2.
if sy-subrc eq 0.
v_flag = 'X'.
p_year = sy-datum+0(4).
perform get_doc_date_cust using p_comp2
p_year.
perform move_records_cust.
sort it_final_customer by rzzkunnr.
perform generate_data_cust.
else.
v_flag = space.
endif.
endform. " get_customer_data
*& Form get_doc_date
Getting the Document Date and FI Doc No
-->P_P_COMP1 Company Code
-->P_P_YEAR Fiscal Year
form get_doc_date using p_p_comp1
p_p_year.
loop at it_final_vendor.
concatenate it_final_vendor-refdocnr '*' into
it_final_vendor-doc_date.
modify it_final_vendor index sy-tabix.
endloop.
clear it_final_vendor.
data: v_doc_date(11) type c,
v_belnr like bkpf-belnr,
v_bldat like bkpf-bldat.
loop at it_final_vendor.
concatenate it_final_vendor-refdocnr '%' into v_doc_date.
select single belnr
bldat
into corresponding fields of it_final_vendor
from bkpf
where bukrs eq p_p_comp1
and gjahr eq p_p_year
and awkey like v_doc_date.
modify it_final_vendor.
endloop.
clear:it_final_vendor.
endform. " get_doc_date
*& Form move_records
Moving records to final internal table
form move_records.
*--Checking the existance of belnr in bsik
clear it_final_vendor.
select belnr
zbd1t
into table it_final_bsik
from bsik
for all entries in it_final_vendor
where belnr eq it_final_vendor-belnr
and bukrs eq c_bukrs.
clear it_final_bsik.
loop at it_final_vendor.
read table it_final_bsik with key belnr = it_final_vendor-belnr.
if sy-subrc eq 0.
it_final_vendor-zbd1t = it_final_bsik-zbd1t.
it_final_vendor-due_date = it_final_vendor-bldat +
it_final_bsik-zbd1t.
it_final_vendor-found = 'X'.
modify it_final_vendor.
endif.
endloop.
endform. " move_records
*& Form generate_data
Segregating the records based on due_date
form generate_data.
delete it_final_vendor[] where found ne 'X'.
sort it_final_vendor by belnr.
loop at it_final_vendor.
if it_final_vendor-due_date > p_rundt1.
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-not_due.
elseif it_final_vendor-due_date < p_rundt1.
it_final_vendor-due_days = p_rundt1 - it_final_vendor-DUE_DATE.
endif.
*--filling 0-30 bucket.
if it_final_vendor-due_days ge 0 AND it_final_vendor-due_days le 30.
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_0_30.
*--filling 31-60 bucket.
elseif it_final_vendor-due_days ge 31 AND it_final_vendor-due_days le 60
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_31_60.
*--filling 61-90 bucket.
elseif it_final_vendor-due_days ge 61 AND it_final_vendor-due_days le 90
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_61_90.
*--filling 91-180 bucket.
elseif it_final_vendor-due_days ge 91 AND it_final_vendor-due_days
le 180.
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_91_180.
*--filling 180 bucket.
elseif it_final_vendor-due_days gt 180.
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_180.
endif.
append it_final_vendor_temp.
clear it_final_vendor_temp.
endloop.
endform. " generate_data
*& Form DISP_ALV_GRID_VENDOR
Displaying the output in grid For Vendor
form DISP_ALV_GRID_VENDOR.
*--Generating the OUTPUT GRID FOR VENDOR
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 = wa_layout
IT_FIELDCAT = i_fldcat_head
IT_EXCLUDING =
IT_SPECIAL_GROUPS = i_group
IT_SORT = it_sort[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = i_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 = it_final_vendor_temp
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
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. " DISP_ALV_GRID
*& Form get_doc_date_cust
text
-->P_P_COMP2 Company Code
-->P_P_YEAR Fiscal Year
form get_doc_date_cust using p_p_comp2
p_p_year.
loop at it_final_customer.
concatenate it_final_customer-refdocnr '*' into
it_final_customer-doc_date.
modify it_final_customer index sy-tabix.
endloop.
clear it_final_customer.
data: v_doc_date(11) type c,
v_belnr like bkpf-belnr,
v_bldat like bkpf-bldat.
loop at it_final_customer.
concatenate it_final_customer-refdocnr '%' into v_doc_date.
select single belnr
bldat
into corresponding fields of it_final_customer
from bkpf
where bukrs eq p_p_comp2
and gjahr eq p_p_year
and awkey like v_doc_date.
modify it_final_customer.
endloop.
clear:it_final_customer.
endform. " get_doc_date_cust
*& Form move_records_cust
Moving Customer Data to Final Internal Table
form move_records_cust.
*--Checking the existance of belnr in bsid
select belnr
zbd1t
into table it_final_bsid
from bsid
for all entries in it_final_customer
where belnr eq it_final_customer-belnr
and bukrs eq c_bukrs.
clear it_final_bsid.
loop at it_final_customer.
read table it_final_bsid with key belnr = it_final_customer-belnr.
if sy-subrc eq 0.
it_final_customer-zbd1t = it_final_bsid-zbd1t.
it_final_customer-due_date = it_final_customer-bldat +
it_final_bsid-zbd1t.
it_final_customer-found = 'X'.
modify it_final_customer.
endif.
endloop.
endform. " move_records_cust
*& Form generate_data_cust
Generating the Customer Output
form generate_data_cust.
delete it_final_customer[] where found ne 'X'.
sort it_final_customer by belnr.
loop at it_final_customer.
if it_final_customer-due_date > p_rundt2.
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-not_due.
elseif it_final_customer-due_date < p_rundt2.
it_final_customer-due_days = p_rundt2 - it_final_customer-DUE_DATE.
endif.
*--filling 0-30 bucket.
if it_final_customer-due_days ge 0 AND it_final_customer-due_days le 30
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_0_30.
*--filling 31-60 bucket.
elseif it_final_customer-due_days ge 31 AND it_final_customer-due_days
le 60
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_31_60.
*--filling 61-90 bucket.
elseif it_final_customer-due_days ge 61 AND it_final_customer-due_days
le 90
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_61_90.
*--filling 91-180 bucket.
elseif it_final_customer-due_days ge 91 AND
it_final_customer-due_days
le 180.
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_91_180.
*--filling 180 bucket.
elseif it_final_customer-due_days gt 180.
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_180.
endif.
append it_final_customer_temp.
clear it_final_customer_temp.
endloop.
endform. " generate_data_cust
*& Form generate_field_catalog_vendor
Generating the Field Catalog for Vendor
form generate_field_catalog_vendor.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = v_repid
I_INTERNAL_TABNAME = 'IT_FINAL_VENDOR_TEMP'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = i_fldcat_head
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 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.
if not i_fldcat_head[] is initial.
loop at i_fldcat_head into wa_fldcat_head.
case wa_fldcat_head-fieldname.
when 'RZZLIFNR'.
wa_fldcat_head-col_pos = '1'.
wa_fldcat_head-ref_tabname = ' '.
wa_fldcat_head-seltext_m = 'Vendor No'(001).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
when 'NAME1'.
wa_fldcat_head-col_pos = '2'.
wa_fldcat_head-seltext_m = 'Vendor Name'(007).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '35'.
when 'BELNR'.
wa_fldcat_head-col_pos = '3'.
wa_fldcat_head-seltext_m = 'Invoice No'(008).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
wa_fldcat_head-KEY = ' '.
when 'BLDAT'.
wa_fldcat_head-col_pos = '4'.
wa_fldcat_head-seltext_m = 'Document Date'(009).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '13'.
wa_fldcat_head-ref_tabname = ' '.
when 'RZZ_EBELN'.
wa_fldcat_head-col_pos = '5'.
wa_fldcat_head-seltext_m = 'PO.Ref.No'(010).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '13'.
wa_fldcat_head-ref_tabname = ' '.
when 'HSL'.
wa_fldcat_head-col_pos = '6'.
wa_fldcat_head-seltext_m = 'Invoice Amount'(011).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'DUE_DATE'.
wa_fldcat_head-col_pos = '7'.
wa_fldcat_head-seltext_m = 'Due Date'(012).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
wa_fldcat_head-ref_tabname = ' '.
when 'DUE_DAYS'.
wa_fldcat_head-col_pos = '8'.
wa_fldcat_head-seltext_m = 'Due Days'(013).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '9'.
when 'NOT_DUE'.
wa_fldcat_head-col_pos = '9'.
wa_fldcat_head-seltext_m = 'Not Due'(014).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_0_30'.
wa_fldcat_head-col_pos = '10'.
wa_fldcat_head-seltext_m = '0 To 30'(015).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_31_60'.
wa_fldcat_head-col_pos = '11'.
wa_fldcat_head-seltext_m = '31 To 60'(016).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_61_90'.
wa_fldcat_head-col_pos = '12'.
wa_fldcat_head-seltext_m = '61 To 90'(017).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_91_180'.
wa_fldcat_head-col_pos = '13'.
wa_fldcat_head-seltext_m = '91 To 180'(018).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_180'.
wa_fldcat_head-col_pos = '14'.
wa_fldcat_head-seltext_m = 'Beyond 180'(019).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'DOCNR'.
wa_fldcat_head-no_out = 'X'.
when 'REFDOCNR'.
wa_fldcat_head-no_out = 'X'.
when 'DOC_DATE'.
wa_fldcat_head-no_out = 'X'.
when 'FOUND'.
wa_fldcat_head-no_out = 'X'.
endcase.
modify i_fldcat_head from wa_fldcat_head index sy-tabix.
endloop.
endif.
endform. " generate_field_catalog_vendor
*& Form get_events_vendor
Getting ALV Events
form get_events_vendor.
call function 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
importing
et_events = i_events
exceptions
list_type_wrong = 1
others = 2
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
if not i_events[] is initial.
read table i_events into wa_event with key name = 'TOP_OF_PAGE'(024)
wa_event-form = 'GENERATE_USERCOMMAND'.
modify i_events from wa_event index sy-tabix.
read table i_events into wa_event with key name = 'END_OF_LIST'(025)
wa_event-form = 'GENERATE_USERCOMMAND_FOOTER'.
modify i_events from wa_event index sy-tabix.
endif.
endform. " get_events_vendor
*& Form GENERATE_USERCOMMAND
Displaying Header-Text and Logo on Grid
form generate_usercommand .
clear i_comment[].
wa_comment-typ = 'H'.
wa_comment-info = 'Vendor Ageing Report'(026).
append wa_comment to i_comment.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_comment
i_logo = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID = 'X'
endform. " GENERATE_USERCOMMAND
*& Form GENERATE_USERCOMMAND_FOOTER
Displaying Footer-Text on Grid
form generate_usercommand_footer.
clear i_comment[].
clear wa_comment.
wa_comment-typ = 'S'.
wa_comment-key = 'GE-Betz'(027).
append wa_comment to i_comment.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_comment
I_LOGO = ''
i_end_of_list_grid = 'X'.
endform. " GENERATE_USERCOMMAND_FOOTER
*& Form generate_layout_vendor
Generating the ALV Layout
form generate_layout_vendor.
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'. "OPTIMIZING FIELD WIDTH
wa_layout-zebra = 'X'. "PUTTING ZEBRA COLORS
wa_layout-confirmation_prompt = 'X'. "DISPLAYS CONFIRMATION DIALOG
wa_layout-totals_text = 'Totals'(028). "DISPLAYS TOTALS TEXT
wa_layout-subtotals_text = 'Sub Totals'(029)."DISPLAYS SUBTOTALS TEXT
endform. " generate_layout_vendor
*& Form generate_sort_vendor
Sorting the Internal Table by Vendor
form generate_sort_vendor.
it_sort-fieldname = 'RZZLIFNR'.
it_sort-tabname = 'IT_FINAL_VENDOR_TEMP'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
append it_sort.
endform. " generate_sort_vendor
*& Form generate_group_vendor
Grouping the Data
form generate_group_vendor.
clear i_group.
wa_group-sp_group = 'A'.
wa_group-text = 'RZZLIFNR'.
append wa_group to i_group.
endform. " generate_group_vendor
*& Form GENERATE_FIELD_CATALOG_CUST
Generating Field Catalog for Customer
form GENERATE_FIELD_CATALOG_CUST.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = v_repid
I_INTERNAL_TABNAME = 'IT_FINAL_CUSTOMER_TEMP'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = i_fldcat_head
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 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.
if not i_fldcat_head[] is initial.
loop at i_fldcat_head into wa_fldcat_head.
case wa_fldcat_head-fieldname.
when 'RZZKUNNR'.
wa_fldcat_head-col_pos = '1'.
wa_fldcat_head-ref_tabname = ' '.
wa_fldcat_head-seltext_m = 'Customer No'(020).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
when 'NAME1'.
wa_fldcat_head-col_pos = '2'.
wa_fldcat_head-seltext_m = 'Customer Name'(021).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '35'.
when 'BELNR'.
wa_fldcat_head-col_pos = '3'.
wa_fldcat_head-seltext_m = 'Invoice No'(008).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
wa_fldcat_head-KEY = ' '.
when 'BLDAT'.
wa_fldcat_head-col_pos = '4'.
wa_fldcat_head-seltext_m = 'Document Date'(009).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '13'.
wa_fldcat_head-ref_tabname = ' '.
when 'RZZ_EBELN'.
wa_fldcat_head-col_pos = '5'.
wa_fldcat_head-seltext_m = 'PO.Ref.No'(010).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '13'.
wa_fldcat_head-ref_tabname = ' '.
when 'HSL'.
wa_fldcat_head-col_pos = '6'.
wa_fldcat_head-seltext_m = 'Invoice Amount'(011).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'DUE_DATE'.
wa_fldcat_head-col_pos = '7'.
wa_fldcat_head-seltext_m = 'Due Date'(012).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
wa_fldcat_head-ref_tabname = ' '.
when 'DUE_DAYS'.
wa_fldcat_head-col_pos = '8'.
wa_fldcat_head-seltext_m = 'Due Days'(013).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '9'.
when 'NOT_DUE'.
wa_fldcat_head-col_pos = '9'.
wa_fldcat_head-seltext_m = 'Not Due'(014).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_0_30'.
wa_fldcat_head-col_pos = '10'.
wa_fldcat_head-seltext_m = '0 To 30'(015).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_31_60'.
wa_fldcat_head-col_pos = '11'.
wa_fldcat_head-seltext_m = '31 To 60'(016).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_61_90'.
wa_fldcat_head-col_pos = '12'.
wa_fldcat_head-seltext_m = '61 To 90'(017).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_91_180'.
wa_fldcat_head-col_pos = '13'.
wa_fldcat_head-seltext_m = '91 To 180'(018).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_180'.
wa_fldcat_head-col_pos = '14'.
wa_fldcat_head-seltext_m = 'Beyond 180'(019).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'DOCNR'.
wa_fldcat_head-no_out = 'X'.
when 'REFDOCNR'.
wa_fldcat_head-no_out = 'X'.
when 'DOC_DATE'.
wa_fldcat_head-no_out = 'X'.
when 'FOUND'.
wa_fldcat_head-no_out = 'X'.
endcase.
modify i_fldcat_head from wa_fldcat_head index sy-tabix.
endloop.
endif.
endform. " GENERATE_FIELD_CATALOG_CUST
*& Form get_events_customer
Getting ALV Events
form get_events_customer.
call function 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
importing
et_events = i_events
exceptions
list_type_wrong = 1
others = 2
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
if not i_events[] is initial.
read table i_events into wa_event with key name = 'TOP_OF_PAGE'(024)
wa_event-form = 'GENERATE_USERCOMMAND_CUST'.
modify i_events from wa_event index sy-tabix.
read table i_events into wa_event with key na -
Issue in creating a dropdown for Industry sector field
Hello Gurus,
Am trying to create a dropdown for Indusry field. 3 dropdown should come up for Industry sector field namely primary,secondary and tertiary.Corresponding to the value selected in primary,data should come up in Secondary and corresponding to value selected in secondary ,data should up in tertiary.Am only able to fetch the value at first instance but corresponding values are not coming up secondary and tertiary.I have followed the procedure that had to be followed in order to make a field as dropdown.Can anyone Please help.
In get_v , i have added this code.
DATA: lt_ddlb TYPE bsp_wd_dropdown_table,
wa_ddlb LIKE LINE OF lt_ddlb.
DATA:
lr_entity1 TYPE REF TO if_bol_bo_property_access,
lv_index TYPE sytabix,
lr_collection TYPE REF TO cl_bsp_wd_collection_wrapper,
lv_high_ind_sector TYPE string,
lv_istype TYPE string.
CLEAR: wa_ddlb, lt_ddlb
lr_collection = me->GET_COLLECTION_WRAPPER( ).
lv_index = lr_collection->get_current_index( ).
IF lv_index = 1.
lr_entity1 ?= lr_collection->find( iv_index = lv_index ).
lv_high_ind_sector = lr_entity1->get_property_as_string( iv_attr_name = 'INDUSTRYSECTOR' ).
lv_istype = lr_entity1->get_property_as_string( iv_attr_name = 'INDUSTRYSECTORKEYSYSTEM ' ).
CLEAR: lv_high_ind_sector.
ELSE.
lv_index = lv_index - 1.
lr_entity1 ?= lr_collection->find( iv_index = lv_index ).
lv_high_ind_sector = lr_entity1->get_property_as_string( iv_attr_name = 'INDUSTRYSECTOR' ).
lv_istype = lr_entity1->get_property_as_string( iv_attr_name = 'INDUSTRYSECTORKEYSYSTEM ' ).
ENDIF.
SELECT aspras aind_sector atext INTO CORRESPONDING FIELDS OF TABLE GT_IND_SECTOR FROM tb038b AS a INNER JOIN tb038a AS b ON bistype = a~istype
AND bind_sector = aind_sector
AND b~istype = lv_istype*
AND b~father_sec = lv_high_ind_sector.
Loop at GT_IND_SECTOR into wa_ind_sector.
wa_ddlb-key = wa_ind_sector-ind_sector.
wa_ddlb-value = wa_ind_sector-text.
Append wa_ddlb to lt_ddlb.
endloop.
IF lt_ddlb IS NOT INITIAL.
INSERT INITIAL LINE INTO lt_ddlb INDEX 1.
ENDIF.
IF GR_DDLB_INDUSTRY_SEC IS NOT BOUND.
CREATE OBJECT GR_DDLB_INDUSTRY_SEC
EXPORTING
iv_source_type = 'T'.
IF sy-subrc = 0.
GR_DDLB_INDUSTRY_SEC->set_selection_table( it_selection_table = lt_ddlb ).
ENDIF.
ENDIF.
rv_valuehelp_descriptor = GR_DDLB_INDUSTRY_SEC.Hello,
Not sure I understood your requirement 100%, but kindly check the following thread where a question on How-to make dropdown list values dependent has already been answered:
How to link the first Drop down values witht the second Drop down Values
Regards,
Nicolas Busson.
PS: also it would be good to know your CRM version... because I thought this thread was posted in the WebClient forum, but it's not. -
What is the initial value for a numeric field ??
Can someone tell me what the INITIAL VALUE FOR A NUMERIC FIELD is ?? Thank you
Rod.Using the following...
class MyClass
int myvar1; // Default initial value
int myvar2 = 3; // Default initial value and default value
MyOtherClass myclass1; // Default initial value
void doit()
int mylocal1; // No value
MyOtherClass myclass2; // No value
All number member variables, like myvar1 start off with andefault initial value which is zero. For booleans this is false. Object reference variables, like myclass1, have a null value.
All local numeric variables are considered undefined. So mylocal1 and myclass2 are undefined. Before you can use them you must explicitly provide a value.
Finally note that myvar2 will have two values during class instantiation. Initially it will have a value of zero. Sometime later it will have the value of 3. (When that happens is very definitely outside the scope of what this forum covers. If you want to know then ask in the advanced forum.) -
Passing multiple values for a single field in URL to call sap Transaction
Hi All,
I need to pass multiple values for a single field to SAP transaction .
means if i have say a field "Date" which can contain more than one value, <b>but its not a range which has two fields</b> . How is it possible.
Let me know pls.
Regards,
Sirisha.R.S.Hi Satyajit,
I need to call a transaction with multiple values which gives me the report based on those values.
So I need to pass multiple values for a single parameter.
I hope u got it.
Regards,
Sirisha.R.S. -
To calculate average for a currency field in alv
Hi,
I have a requirement in which i need to find the average of a currency field in alv. For the particular field, i'm passing the value of DO_SUM = 'C' in thr field catalog(as suggested in many threads); but I'm not able to calculate the average. it still shows me summation when i click on summation button.
What could be the possible error??? Is there any other method we can do the same??
Thanks in Advance.
JaspreetHi
U can try this way.
*& Report Z_DEMO_JG
*& Display average in ALV report
REPORT z_demo_jg LINE-SIZE 80 LINE-COUNT 50
NO STANDARD PAGE HEADING.
TABLES: sflight.
TYPE-POOLS: slis.
* Data declaration
DATA: i_flight TYPE STANDARD TABLE OF sflight,
i_catalog TYPE slis_t_fieldcat_alv,
w_flight TYPE sflight,
w_catalog TYPE slis_fieldcat_alv.
DATA: v_repid TYPE syrepid.
* Selection screen
SELECT-OPTIONS: s_carrid FOR sflight-carrid.
START-OF-SELECTION.
* Fetch data from sflight table
SELECT *
FROM sflight
INTO TABLE i_flight
WHERE carrid IN s_carrid.
CHECK sy-subrc = 0.
v_repid = sy-repid.
* Build field catalog for ALV report
PERFORM build_catalog.
* Display ALV report
PERFORM display_report.
*& Form build_catalog
* Build field catalog for ALV report
* None
FORM build_catalog .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = i_catalog
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
* For average populate 'C' as value in
* field DO_SUM
w_catalog-do_sum = 'C'. " C = Average
* Modify record with new value
MODIFY i_catalog FROM w_catalog TRANSPORTING
do_sum WHERE fieldname = 'PRICE'.
ENDIF.
ENDFORM. " build_catalog
*& Form display_report
* Display ALV report
* None
FORM display_report .
IF i_catalog[] IS NOT INITIAL.
* Call ALV grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = i_catalog
TABLES
t_outtab = i_flight
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
ENDIF.
ENDIF.
ENDFORM. " display_report
Edited by: meetjoe on Sep 15, 2009 7:17 PM -
In VB Programming code -- How to access the formula for suppressing a field
In VB Programming code -- How to access the formula for suppressing a field
I am using Crystal Reports 2008 v1
Using VB code, I am attempting to modify a Crystal Report before exporting it into a PDF format and then displaying it on the Web.
My problem is that I am unable to access the formula used to dynamically suppress a field.
The following code is working:
mySections = rd.ReportDefinition.Sections
For Each mySection As CrystalDecisions.CrystalReports.Engine.Section In mySections
' myFieldToChange is a String set to the text of the field I need to adjust the Suppression
iloop = 0
For Each RecObj As CrystalDecisions.CrystalReports.Engine.ReportObject In mySection.ReportObjects
If mySection.ReportObjects.Item(iloop).Name.ToLower = myFieldToChange Then
myTextObject = CType(mySection.ReportObjects.Item(iloop), CrystalDecisions.CrystalReports.Engine.TextObject)
myTextObject.Text = "new field text goes here"
mySection.SectionFormat.EnableSuppress = True
' Here is where I want to change the formula for the Suppression
End if
iloop = iloop + 1
Next
Next
I can not find any reference to the actual suppression formula in the SDK help file.
Note, the EnableSuppress can be set to True for False, but if there is a formula for dynamic suppression, the True or False value is overwritten. The results of the formula determine the suppression.
Is there a way to reference this formula. I know that I can put on in using the Crystal Report Designer software, I need to modify this formula using VB code and the SDK.Hello, Mark;
If you are using the ReportDocument object you do not have access to the Conditional Suppression formula. You can get around it by using a formula field in the report for the supression and then using the FormulaField code to change it at runtime.
If you want to change the supression condition directly at runtime you need to use RAS and the ReportClientDocument.
Elaine -
How to provide hyperlink for a particular field in ALV
Hi,
How to provide hyperlink for a particular field in alv report.
Regards,
Ramu.Yes you can do that. using the fieldcatalog there is an option for that. give HOT_SPOT = 'X'. for the column you want.
wa_field-hotspot = 'X'.
REPORT ztest_alv.
TYPE-POOLS:slis.
DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
wa_field LIKE LINE OF it_fieldcat.
DATA: BEGIN OF it_likp OCCURS 0,
vbeln TYPE likp-vbeln,
END OF it_likp.
DATA: layout TYPE slis_layout_alv.
wa_field-fieldname = 'VBELN'.
wa_field-tabname = 'IT_LIKP'.
wa_field-hotspot = 'X'.
wa_field-outputlen = 10.
wa_field-no_zero = 'X'.
wa_field-seltext_l = 'Sales'.
APPEND wa_field TO it_fieldcat.
SELECT vbeln FROM likp
UP TO 10 ROWS
INTO TABLE it_likp.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_likp
EXCEPTIONS
program_error = 1.
*& Form user_Command
* text
* -->UCOMM text
* -->SELFIELD text
FORM user_command USING ucomm TYPE sy-ucomm
selfield TYPE slis_selfield.
CASE ucomm.
WHEN '&IC1'.
SET PARAMETER ID 'VL' FIELD selfield-value.
CALL TRANSACTION 'VL02N' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "user_Command
Maybe you are looking for
-
Import data from excel/csv file in web dynpro
Hi All, I need to populate a WD table by first importing a excel/CSV file thru web dynpro screen and then reading thru the file.Am using FileUpload element from NW04s. How can I read/import data from excel / csv file in web dynpro table context? Any
-
I have been using the E-print feature for the past 6+ months and suddenly last week it won't recognize the HP OfficeJet 6700 printer. It said something like try again or re-install, so I deleted out the printer, re-downloaded the software and now it
-
Count Number of WebService Client Calls
Hi erverybody, I want to write an Webservice that return a String, after a certain number of clients (MaxClients=20) have called the webservice. After the String has been returned, the Clients continue their work, but they have to wait until all the
-
Draft Folder in IMAP with Outlook 2010
Hi. I have three Outlook accounts (work related) that I recently converted to IMAP from POP. Everything seems to be working fine with the exception that I can't find a way of having the "Drafts" folder appear in the Folders List. There doesn't seem
-
The ON-100 has detected the network with the correct creds in place; however for some reason the 2960 Switch is showing where the 3560G should be. All devices are connected to the 3560G to take advantage of the gigabit ports, the only device that is