Info Spoke-ABAP Code Modification
Hi,
The below code is used as a customer exit variable Which give te YEAR TO DATE value on a KF.
Could you please mofify this,That output will be year to date value & to eliminate '0' values and have to use it in Infospokes
OUT PUT: If i use this on a sales Qty KF,The user enters the week so that it has to display sales qty againist dept starting from the year to the selected week and also should display only values that are NON Zero
I need to use this in info spoke
WHEN 'ZYTD'.
CLEAR l_s_range.
wdate = ww_date.
weekno = '01'.
SELECT SINGLE * FROM /bic/pycalday_w
WHERE /bic/ycalday_w = wdate
AND objvers = 'A'.
thisweek = /bic/pycalday_w-/bic/ylwk_w.
CONCATENATE thisweek(4) weekno INTO firstweek.
l_s_range-low = firstweek.
l_s_range-high = thisweek.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range.
Thanks
I think there is some problem with your ABAP program.
Have you used OPEN DATASET statement, if so check if you have mentioned file path etc correctly.
Can you try debugging the code.
Hope this helps.
Similar Messages
-
ABAP Code Modification for Command Tickets
Hi Experts
Modification to processing of Command Orders & Tickets
We require a modification to the processing being performed on sales data originating from the Command Concrete system and potentially from other systems yet to come online (e.g. Reddies Cement plant).
The Sap process involved is
ZINT_INBOUND_POLLING and within that,
ZINT_CSTPORD_ROUTINES.
The problem
Currently there is an assumption that every sales order (and its deliveries) will include a product which is made to order, i.e. for which a production order will be required.
In ZINT_CSTPORD_ROUTINES, a check is made to identify the production order linked to the sales order. If there is no such production order (usually because of the customeru2019s credit status) then processing of the ticket is terminated.
This assumption would fall down if an order was to be raised (in Command) on which there is no concrete material. For example, if we sold a bag of pigment or a screed to a customer. In this case the item would be sold from stock and there would be no need for a production order
The solution
In the routine which checks for the existence of a production order, modify the code as follows:
Inspect each item on the sales order
If (and only if) there is at least one item with a category of u201CZTACu201D then check for a production order, otherwise process the order in the usual manner.
The following Coding of programs are below.
Report: ZINT_INBOUND_POLLING
Description: REDDIES Interfaces: Polling Job for Inbound Interfaces
This report is a general file polling and distribution job for
inbound interfaces. Interfaces are identified by their assigned ID
and type values (refer to table ZINT_ADMIN). The polling job can be
run only for a single interface. This restriction has been implemented
for performance reasons. Dependent interfaces should be set up as
separate, dependent jobs in SM37.
For an interface to be triggered by this report, it must have:
1. Administrative parameters entered in table ZINT_ADMIN.
2. Other parameters (eg. organisational data such as plant or store)
entered in table ZINT_PARAM.
3. An interface-specific function module created in accordance with
the inbound interface template (ZINT_INBOUND_INTERFACE).
4. An interface-specific directory structure. This structure must
be reflected in the directory parameters of table ZINT_ADMIN.
Note that the directory names supplied in ZINT_ADMIN must exactly
match those used for the actual directories.
This job is designed to run as a periodic background job, but can
also be run on-line when required.
On each execution, the program performs the following tasks:
1. Validate all selection parameters.
2. Read interface administration and other parameters.
3. Check the inbound directory to see if there are any new files.
4. If there is a new file.
4.1 Read the data and update the interface log.
4.2 Archive the data and update the interface log.
4.3 Call the interface function module, sending data and parameters.
4.4 Log any messages returned from the function module.
5. Exit.
Please document all changes to this job carefully and clearly. Major
additions to functionality should be put in new, parameterised form
routines wherever possible to sustain maintainablility of the code.
Change History:
Date User Request Description
07/02/2006 EDWG WG1K902600 Original program.
20.07.2007 ROBS Changes to handle error messages better.
report zint_inbound_polling line-size 170
line-count 58(2)
message-id zz
no standard page heading.
Global Data Declarations
include zint_interface_data.
data: begin of tbl_messages occurs 0,
line(132) type c,
end of tbl_messages.
--Field Symbols--
field-symbols: <function>.
--Global Variables--
Selection Screen
--Interface Mode--
RJS Start >>>
selection-screen begin of block b1 with frame title t_mode.
parameters: p_upl radiobutton group p1.
selection-screen skip 1.
select-options: s_intid for zint_intid-zint_id
matchcode object zint_intid,
s_intty for zint_intty-zint_ty
matchcode object zint_intty.
selection-screen uline.
parameters: p_pro radiobutton group p1.
selection-screen skip 1.
RJS End <<<
Interface ID
parameters: p_intid like zint_intid-zint_id
matchcode object zint_intid.
Interface type
parameters: p_intty like zint_intty-zint_ty
matchcode object zint_intty
default 'I'.
IDOC group or set
parameters: p_intis type zint_is.
select-options: s_datum for zint_data-created_on.
selection-screen skip 1.
parameters: p_dlgrp as checkbox default c_false.
data: p_alone(1) type c value 'X'.
selection-screen skip 1.
Interface parameter set and sequence number.
parameters: p_intsi like zint_param-zint_si,
p_intsq type zint_sq default '001' no-display.
selection-screen uline.
parameters: p_apsrv radiobutton group r1,
p_pc radiobutton group r1.
selection-screen skip 1.
parameters: p_nowar as checkbox default c_true.
selection-screen end of block b1.
Event Processing
--IDOC Set Values--
at selection-screen on value-request for p_intis.
Display a selectable list of parameter sets
perform select_idoc_set using p_intid
p_intty
changing p_intis
v_rtcod.
if v_rtcod ne c_noerr.
Problem displaying parameter lists
message i000 with 'Unable to display IDOC set values.'
'Please enter an interface ID and type.'.
endif.
--Parameter Set Values-----
at selection-screen on value-request for p_intsi.
Display a selectable list of parameter sets
perform select_parameter_set using p_intid
p_intty
changing p_intsi
v_rtcod.
if v_rtcod ne c_noerr.
Problem displaying parameter lists
message i000 with 'Unable to display parameter list values.'
'Please enter an interface ID and type.'.
endif.
--Check Interface Admin.---
at selection-screen on: p_intty, p_intid.
perform validate_interface_admin using p_intid
p_intty
changing v_rtcod.
if v_rtcod ne c_noerr.
No administration parameters exist for interface
message e001 with p_intid p_intty.
endif.
--Validate Parameter Set---
at selection-screen on p_intsi.
perform validate_interface_param using p_intid
p_intty
p_intsi
changing v_rtcod.
if v_rtcod ne c_noerr.
Parameter set does not exist for interface
message e002 with p_intsi p_intid p_intty.
endif.
Initialisation
initialization.
perform set_screen_texts.
Start of Selection
start-of-selection.
RJS Start >>>
refresh: tbl_totals, tbl_messages.
UPLOAD INBOUND DATA ---------------------
if p_upl = 'X'.
perform upload_data.
PROCESS NEW or ERRORS -------------------
else. " p_pro = 'X'.
perform process_data.
endif.
RJS End <<<
End of Selection
end-of-selection.
Write the log file to the specified directory
read table t_ibfil index 1.
perform write_log_file tables t_ldata
using s_admin-zint_lg
t_ibfil-filename
p_apsrv
changing v_rtcod.
if v_rtcod ne c_noerr.
Error writing to log file
message i000 with 'Could not write to log file for interface'
s_admin-zint_id '/' s_admin-zint_ty.
endif.
RJS Start >>>
Write out Messages and totals
if p_pro = 'X'. " Processing Data
describe table tbl_messages lines sy-tfill.
if sy-tfill = 0.
write:/ 'Processing Complete. Use ZSTA to analyse'.
else.
loop at tbl_messages.
write:/ tbl_messages-line.
endloop.
endif.
else. " Uploading Data
format color col_total.
uline.
write:/ 'Upload Details:', 132 space.
uline.
format color off.
describe table tbl_totals lines sy-tfill.
if sy-tfill = 0.
write:/ '0 Records Processed'.
endif.
loop at tbl_totals.
write:/ 'Interface ID:', tbl_totals-zint_id,
' Type:', tbl_totals-zint_ty,
' Command Date:', tbl_totals-created_on,
' Records Processed:', tbl_totals-count.
endloop.
uline.
message s999(b1) with 'Data Upload Completed'
'- Please see full Results uing trans ZSTA'.
endif.
RJS End <<<
Form Routines
include zint_interface_routines.
*& Form upload_data
text
form upload_data.
data: lt_admin type standard table of zint_admin with header line.
data: l_message(80) type c.
select * from zint_admin into table lt_admin
where zint_id in s_intid
and zint_ty in s_intty.
loop at lt_admin.
refresh t_idata.
refresh t_ibfil.
Progress Message
concatenate 'Reading Inbound data files in'
lt_admin-zint_ib
into l_message separated by space.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = l_message.
Check for a new inbound file and read its data.
perform read_inbound_data tables t_idata
t_ibfil
using lt_admin-zint_ib
p_apsrv
changing v_rtcod.
if v_rtcod ne c_noerr and
v_rtcod ne 7 and " RJS- no files found
lt_admin-zint_ib ne space.
Write an error to the log
perform write_log_entry
tables t_ldata
using 'E'
'ZINT_INBOUND_POLLING'
'READ_INBOUND_DATA'
'Problem reading inbound interface file.'
p_nowar space.
exit.
endif.
Exit if there is no data.
describe table t_idata lines v_fldsz.
check v_fldsz gt 0.
Write inbound data to a database table, for later access
perform write_data tables t_idata
using lt_admin-zint_id
lt_admin-zint_ty
lt_admin-zint_fm
lt_admin-zint_ib.
Move the inbound file to the archive directory
perform archive_inbound_data tables t_ibfil
using p_apsrv
lt_admin-zint_ar
lt_admin-zint_ib
changing v_rtcod.
if v_rtcod ne c_noerr.
Write an error to the log if unable to move file
perform write_log_entry
tables t_ldata
using 'E'
'ZINT_INBOUND_POLLING'
'ARCHIVE_INBOUND_DATA'
'Problem archiving inbound interface file.'
p_nowar space.
endif.
endloop.
endform. "upload_data
*& Form process_data
text
form process_data.
data: lt_idata type standard table of x_idata with header line.
data: s_idata type x_idata,
l_last_status(3) type c.
data: l_message(80) type c,
l_status(3) type c,
l_lines(5) type c,
l_date(10) type c.
Validate input parameters
if p_intid = space
or p_intty = space
or p_intsi = space.
message e999(b1) with 'Mandatory fields must be filled'.
endif.
Read the interface administration parameters
perform get_admin_parameters using p_intid
p_intty
changing s_admin
v_rtcod.
if v_rtcod ne c_noerr.
Write an error to the log
perform write_log_entry
tables t_ldata
using 'E'
'ZINT_INBOUND_POLLING'
'GET_ADMIN_PARAMETERS'
'No admin. parameters for interface. Check ZINT_ADMIN'
p_nowar space.
endif.
Read the other interface parameters (if required)
if p_intsi ne space.
perform get_other_parameters tables t_param
using p_intid
p_intty
p_intsi
changing v_rtcod.
if v_rtcod ne c_noerr.
Write an error to the log
perform write_log_entry
tables t_ldata
using 'E'
'ZINT_INBOUND_POLLING'
'GET_OTHER_PARAMETERS'
'No org. parameters for interface. Check ZINT_ADMIN'
p_nowar space.
endif.
endif.
Read any Error records for reprocessing - if none, read New data
perform read_data tables t_zint_data
changing v_rtcod.
clear l_status.
loop at t_zint_data.
Create subset of all records, per Command Date
at new created_on.
refresh t_idata.
clear l_lines.
endat.
at new key_val.
add 1 to l_lines.
endat.
append t_zint_data-raw_data to t_idata.
Process one date at a time
at end of created_on.
Progress Message:
write t_zint_data-created_on to l_date dd/mm/yyyy.
concatenate 'Processing' l_lines 'records for'
p_intid '/' p_intty '/' p_intsi 'Created:'
l_date
into l_message separated by space.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = l_message.
Process the incoming data
assign s_admin-zint_fm to <function>.
call function <function>
exporting
i_zint_id = p_intid
i_zint_ty = p_intty
i_zint_si = p_intsi
i_zint_is = p_intis
i_zint_dl = p_dlgrp
i_zint_as = p_apsrv
i_zint_al = p_alone
i_zint_nw = p_nowar
i_zint_sq = p_intsq
tables
t_zint_mslog = t_ldata
t_zint_idata = t_idata
t_zint_param = t_param
changing
c_zint_rc = v_rtcod
exceptions
no_such_interface = 1
invalid_parameter_set = 2
data_table_empty = 3
invalid_idoc_group = 4.
case sy-subrc.
--No Such Interface--
when 1.
perform write_log_entry
tables t_ldata
using 'E' 'ZINT_INBOUND_POLLING' <function>
'Interface does not exist in ZINT_ADMIN.'
p_nowar space.
--Invalid Parameter Set----
when 2.
perform write_log_entry
tables t_ldata
using 'E' 'ZINT_INBOUND_POLLING' <function>
'Invalid parameter set for interface. Check ZINT_PARAM'
p_nowar space.
--Data Table Empty--
when 3.
perform write_log_entry
tables t_ldata
using 'E' 'ZINT_INBOUND_POLLING' <function>
'No inbound data. Check directory as per ZINT_ADMIN'
p_nowar space.
--Invalid IDOC group--
when 4.
perform write_log_entry
tables t_ldata
using 'E' 'ZINT_INBOUND_POLLING' <function>
'Invalid IDOC group. Check ZINT_ADMIN.'
p_nowar space.
--Others--
when others.
endcase.
Now store messages not related to a specific key
loop at t_ldata into s_ldata where key_val = space.
move s_ldata-messg to tbl_messages-line.
append tbl_messages.
endloop.
refresh t_ldata.
If data for last date had errors, then stop processing further dates
clear l_last_status.
select status from zint_data into l_last_status
where zint_id = p_intid
and zint_ty = p_intty
and key_val = t_zint_data-key_val.
endselect.
if l_last_status = 'ERR'.
concatenate 'Processing Halted - Errors for Date' l_date
into l_message separated by space.
message s999(b1) with 'ZINT_INBOUND_POLLING' <function>
l_message.
exit.
endif.
endat.
endloop.
endform. "process_data
*& Form set_screen_texts
Assign values to the selection screen titles.
form set_screen_texts .
t_mode = 'Run Mode'. " RJS
endform. " set_screen_texts
RJS Start >>>
*& Form write_data
Save the Inbound data to table ZINT_DATA, for later processing
-->PT_IDATA text
-->PV_ID text
-->PV_TY text
-->PV_FM
-->PV_IB
form write_data tables pt_idata structure zint_idata
using pv_id
pv_ty
pv_fm
pv_ib.
data: l_key_val like zint_data-key_val,
l_seq like zint_data-sequence,
l_created_on like zint_data-created_on,
l_counter type i.
data: lt_zint_data type standard table of zint_data with header line.
get time.
clear l_created_on.
refresh lt_zint_data.
loop at pt_idata.
clear lt_zint_data.
lt_zint_data-zint_id = pv_id.
lt_zint_data-zint_ty = pv_ty.
lt_zint_data-status = 'NEW'.
Derive both the "Key" value (KEY_VAL) and the
"Command Data Date" value (CREATED_ON) to store on the Data table
case pv_fm.
when 'ZINT_INBOUND_INTERFACE_CSSORDR'.
if pt_idata-zint_re(2) = '01'.
perform get_command_order_key using pt_idata-zint_re
l_key_val
l_created_on.
endif.
when 'ZINT_INBOUND_INTERFACE_CSTPORD'.
if pt_idata-zint_re(2) = '01'.
perform get_prod_order_key using pt_idata-zint_re
l_key_val
l_created_on.
endif.
when 'ZINT_INBOUND_INTERFACE_CSTGISS'.
perform get_sales_order_key using pt_idata-zint_re
l_key_val.
endcase.
lt_zint_data-created_on = l_created_on.
lt_zint_data-key_val = l_key_val.
lt_zint_data-length = strlen( pt_idata-zint_re ).
lt_zint_data-raw_data = pt_idata-zint_re.
append lt_zint_data.
endloop.
Setup the sequence number for each key value
loop at lt_zint_data.
at new key_val.
clear l_seq.
endat.
add 1 to l_seq.
lt_zint_data-sequence = l_seq.
modify lt_zint_data.
endloop.
Check for existing data with this same key
clear l_counter.
select count(*) from zint_data into l_counter
for all entries in lt_zint_data
where zint_id = lt_zint_data-zint_id
and zint_ty = lt_zint_data-zint_ty
and created_on = lt_zint_data-created_on
and key_val = lt_zint_data-key_val
and sequence = lt_zint_data-sequence.
Found duplicate data?
if l_counter > 0.
Yes: so remove these records from the input table
loop at lt_zint_data.
clear l_counter.
select count(*) from zint_data into l_counter
where zint_id = lt_zint_data-zint_id
and zint_ty = lt_zint_data-zint_ty
and created_on = lt_zint_data-created_on
and key_val = lt_zint_data-key_val
and sequence = lt_zint_data-sequence.
if l_counter > 0.
delete lt_zint_data.
endif.
endloop.
message i999(b1) with 'Data already exists in SAP! Directory:' pv_ib
'Key:' lt_zint_data-key_val.
endif.
Now save whatever is not a duplicate
loop at lt_zint_data.
Store new data records
insert zint_data from lt_zint_data.
and Store totals for reporting
tbl_totals-zint_id = lt_zint_data-zint_id.
tbl_totals-zint_ty = lt_zint_data-zint_ty.
tbl_totals-created_on = lt_zint_data-created_on.
tbl_totals-count = 1.
collect tbl_totals.
endloop.
endform. "write_data
*& Form get_command_order_key
Extract Command Order from raw data
-->L_LINE text
-->L_KEY text
form get_command_order_key using l_line l_key l_date.
data: l_orddate type d,
l_order(12) type n,
l_data(3000) type c,
l_shortorder(5) type n.
l_data = l_line.
perform extract_field(saplzint_csord)
using l_data
changing l_data
l_orddate.
perform extract_field(saplzint_csord)
using l_data
changing l_data
l_order.
l_shortorder = l_order.
if l_order le 9999.
concatenate l_orddate+2(6) '-'
l_shortorder
into l_key.
else.
concatenate l_orddate+2(6)
l_shortorder
into l_key.
endif.
l_date = l_orddate.
endform. "get_command_order_key
*& Form get_prod_order_key
Extract Commant Ticket number from raw data
-->L_LINE text
-->L_KEY text
form get_prod_order_key using l_line l_key l_date.
data: l_ticketdate type d,
l_data(3000) type c,
l_ticket(10) type n.
l_data = l_line.
perform extract_field(saplzint_cstik)
using l_data
changing l_data
l_ticketdate.
perform extract_field(saplzint_cstik)
using l_data
changing l_data
l_ticket.
l_key = l_ticket.
l_date = l_ticketdate.
endform. "get_prod_order_key
*& Form get_sales_order_key
text
-->L_LINE text
-->L_KEY text
form get_sales_order_key using l_line l_key.
l_key = l_line(10).
endform. "get_sales_order_key
*& Form read_data
Read data from custom table
-->PT_ZINT_DATA text
-->P_STATUS text
form read_data tables pt_zint_data structure zint_data
changing p_rtcod.
data: lt_zint_data type standard table of zint_data with header line.
data: l_found_rec(1) type c.
clear p_rtcod.
refresh: pt_zint_data, lt_zint_data.
Read stored data in date/time order
select * from zint_data into table lt_zint_data
where zint_id = p_intid
and zint_ty = p_intty
and status in ('ERR','NEW')
and created_on in s_datum
order by created_on key_val sequence.
Always ensure any existing Error records are re-processed first.
loop at lt_zint_data where status = 'ERR'.
move lt_zint_data to pt_zint_data.
append pt_zint_data.
Store totals for reporting
tbl_totals-zint_id = p_intid.
tbl_totals-zint_ty = p_intty.
tbl_totals-created_on = lt_zint_data-created_on.
tbl_totals-count = 1.
collect tbl_totals.
endloop.
Loop through the NEW records - add to list if no other errors
loop at lt_zint_data where status = 'NEW'.
l_found_rec = 'N'.
loop at pt_zint_data where status = 'ERR'
and created_on <> lt_zint_data-created_on.
l_found_rec = 'Y'.
exit.
endloop.
Found no errors for another date - so add NEW data
if l_found_rec = 'N'.
move lt_zint_data to pt_zint_data.
append pt_zint_data.
Store totals for reporting
tbl_totals-zint_id = p_intid.
tbl_totals-zint_ty = p_intty.
tbl_totals-created_on = lt_zint_data-created_on.
tbl_totals-count = 1.
collect tbl_totals.
endif.
endloop.
endform. "read_data
UNDER THIS THERE IS BELOW PROGRAM
*& Include ZINT_CSTPORD_ROUTINES *
Report: ZINT_CSTPORD_ROUTINES
Description: REDDIES Interfaces: COMMAND-SAP Interface Forms (Tickets)
Routines fpr the COMMAND-SAP production order interface. Note: some
of the code in this file has been directly copied from the original
interface (ZPPU_COMMAND_PRODUCTION, Jason Moore, Extend). This has
been done for two reasons: (1) the code works and (2) to save time.
Change History:
Date User Request Description
13/02/2006 EDWG WG1K902600 Original program.
*& Form process_inbound_data
Create prod. orders from ticket data extracted from the COMMAND
system. Note that large portions of the code in this routine
have been copied from the retired ZPPU_COMMAND_PRODUCTION
interface program. This was done (1) because the old code works
and (2) to save development time.
-->T_ZINT_IDATA Internal table of interface data
-->T_ZINT_PARAM Internal table of interface parameters
-->T_ZINT_MSLOG Internal table of messages
-->P_ZINT_ID Interface ID
-->P_ZINT_TY Inteface type
-->P_ZINT_IS IDOC group for interface
-->P_ZINT_DL Flag: delete IDOC group when complete
-->P_ZINT_AL Flag: run in standalone mode
-->P_ZINT_NW Flag: do not log warning messages
-->P_ZINT_SQ Interface sequence number
<--P_ZINT_RC Return code (<>0=>error)
form process_inbound_data tables t_zint_idata structure zint_idata
t_zint_param structure zint_param
t_zint_mslog structure zint_mslog
using p_zint_id type zint_id
p_zint_ty type zint_ty
p_zint_is type zint_is
p_zint_dl type zint_dl
p_zint_al type zint_al
p_zint_nw type zint_nw
p_zint_sq type zint_sq
changing p_zint_rc type zint_rc.
data: lva_partner(10) type n,
lva_cmdord(12) type n,
lva_prodmat(18) type n,
lva_filemat(18) type n,
lva_prodord(12) type n,
lwa_file type ty_file,
lva_type(2) type c,
lva_satsur type c,
lva_mincart type c,
lva_text(200) type c,
lva_counter type i,
bblines type i,
lva_shortorder(5) type n,
lva_loggr like marc-loggr,
lva_saleord like vbkd-vbeln,
lva_linkindex like sy-tabix,
lva_xabln like likp-xabln,
lva_vbeln like likp-vbeln,
l_vbfa like vbfa,
lva_igmng like caufv-igmng,
lva_gamng like caufv-gamng,
lva_qdiff like caufv-gamng,
lva_ltxa1 like afru-ltxa1,
lva_aufnr like afru-aufnr,
lva_wemng like afpo-wemng,
lva_psmng like afpo-psmng,
lva_rsnum like resb-rsnum,
lva_rspos like resb-rspos,
lHi ,
Modify your code like this .
DATA: YEARS TYPE TFMATAGE,
MONTHS TYPE TFMATAGE.
*declare the variable as type Char
DATA: Y_NUM(4) TYPE c,
M_NUM(2) TYPE c.
IF NOT SOURCE_FIELDS-/BIC/ZDOB IS INITIAL.
CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
EXPORTING
I_DATE_FROM = SOURCE_FIELDS-/BIC/ZDOB
I_DATE_TO = SY-DATUM
I_FLG_SEPARATE = 'X'
IMPORTING
E_MONTHS = MONTHS
E_YEARS = YEARS.
Y_NUM = YEARS.
M_NUM = MONTHS.
CONCATENATE Y_NUM '.' M_NUM INTO RESULT.
This will solve your problem.
MM -
How to extract data from info cube into an internal table using ABAP code
HI
Can Anyone plz suggest me
How to extract data from info cube into an internal table using ABAP code like BAPI's or function modules.
Thankx in advance
regds
AJAYHI Dinesh,
Thankq for ur reply
but i ahve already tried to use the function module.
When I try to Use the function module RSDRI_INFOPOV_READ
I get an information message "ERROR GENERATION TEST FRAME".
can U plz tell me what could be the problem
Bye
AJAY -
Sample ABAP code for userexits, and calling bapi's
Hi,
Can someone please send me sample ABAP code
1) to do extractor enhancement using user exit.
2) ABAP program to call BAPI to read live cache order series data in SNP and write to Idocs through some ports.
3) ABAP routine to generate file name (based on date/country)in the infopackage to upload flatfiles.
Thank you very much in advance and appreciate any help.
Regards
Prasadhai ,
check this code...
*& Tables
tables : tstc, "SAP Transaction Codes
tadir, "Directory of Repository Objects
modsapt, "SAP Enhancements - Short Texts
modact, "Modifications
trdir, "System table TRDIR
tfdir, "Function Module
enlfdir, "Additional Attributes for Function Modules
tstct. "Transaction Code Texts
*& Variables
data : jtab like tadir occurs 0 with header line.
data : field1(30).
data : v_devclass like tadir-devclass.
*& Selection Screen Parameters
selection-screen begin of block a01 with frame title text-001.
selection-screen skip.
parameters : p_tcode like tstc-tcode obligatory.
selection-screen skip.
selection-screen end of block a01.
*& Start of main program
start-of-selection.
Validate Transaction Code
select single * from tstc
where tcode eq p_tcode.
Find Repository Objects for transaction code
if sy-subrc eq 0.
select single * from tadir
where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = tstc-pgmna.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
select single * from trdir
where name = tstc-pgmna.
if trdir-subc eq 'F'.
select single * from tfdir
where pname = tstc-pgmna.
select single * from enlfdir
where funcname = tfdir-funcname.
select single * from tadir
where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name = enlfdir-area.
move : tadir-devclass to v_devclass.
endif.
endif.
Find SAP Modifactions
select * from tadir
into table jtab
where pgmid = 'R3TR'
and object = 'SMOD'
and devclass = v_devclass.
select single * from tstct
where sprsl eq sy-langu
and tcode eq p_tcode.
format color col_positive intensified off.
write:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
skip.
if not jtab[] is initial.
write:/(95) sy-uline.
format color col_heading intensified on.
write:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
write:/(95) sy-uline.
loop at jtab.
select single * from modsapt
where sprsl = sy-langu and
name = jtab-obj_name.
format color col_normal intensified off.
write:/1 sy-vline,
2 jtab-obj_name hotspot on,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
endloop.
write:/(95) sy-uline.
describe table jtab.
skip.
format color col_total intensified on.
write:/ 'No of Exits:' , sy-tfill.
else.
format color col_negative intensified on.
write:/(95) 'No User Exit exists'.
endif.
else.
format color col_negative intensified on.
write:/(95) 'Transaction Code Does Not Exist'.
endif.
Take the user to SMOD for the Exit that was selected.
at line-selection.
get cursor field field1.
check field1(4) eq 'JTAB'.
set parameter id 'MON' field sy-lisel+1(10).
call transaction 'SMOD' and skip first screen. -
Hi
For FIGL_4 there is both open items and closed items. i want to filter only Open Items Accounting doc no's records for Customers,Vendors,GL account at info package level.
There are 3 ODS's in BW side for Open items Customers,Vendors,GL accounts. i want to filter open items based on these 3 ODS's Active data table.But i am getting error when i execute the request in Info Package.
*Error Message "For sel. field 'BELNR ', no selection with SIGN = ' '; OPTION ' ' allowed RSM1 607 *
Below is the Info package Routine code
program conversion_routine.
Type pools used by conversion program
type-pools: rsarc, rsarr, rssm.
tables: rssdlrange.
Global code used by conversion rules
$$ begin of global - insert your declaration only below this line -
TABLES: ...
TABLES: /BIC/AZOCFFIGL00,/BIC/AZOCFBSID00,/BIC/AZOCFBSIS00
,/BIC/AZOCFBSIK00.
DATA: ...
TYPES : BEGIN OF TY_ZOCFBSID,
/BIC/ZMCFADCNO LIKE /BIC/AZOCFBSID00-/BIC/ZMCFADCNO,
END OF TY_ZOCFBSID.
TYPES : BEGIN OF TY_ZOCFBSIS,
/BIC/ZMCFADCNO LIKE /BIC/AZOCFBSIS00-/BIC/ZMCFADCNO,
END OF TY_ZOCFBSIS.
TYPES : BEGIN OF TY_ZOCFBSIK,
/BIC/ZMCFADCNO LIKE /BIC/AZOCFBSIK00-/BIC/ZMCFADCNO,
END OF TY_ZOCFBSIK.
DATA : TB_ZOCFBSIS TYPE TABLE OF TY_ZOCFBSIS WITH HEADER LINE,
WA_ZOCFBSIS TYPE TY_ZOCFBSIS.
DATA : TB_ZOCFBSID TYPE TABLE OF TY_ZOCFBSID WITH HEADER LINE,
WA_ZOCFBSID TYPE TY_ZOCFBSID.
DATA : TB_ZOCFBSIK TYPE TABLE OF TY_ZOCFBSIK WITH HEADER LINE,
WA_ZOCFBSIK TYPE TY_ZOCFBSIK,
FLAG TYPE I.
$$ end of global - insert your declaration only before this line -
InfoObject = ZMCFADCNO
Fieldname = BELNR
data type = CHAR
length = 000010
convexit = ALPHA
form compute_BELNR
tables l_t_range structure rssdlrange
using p_infopackage type rslogdpid
p_fieldname type rsfnm
changing p_subrc like sy-subrc.
Insert source code to current selection field
$$ begin of routine - insert your code only below this line -
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'BELNR'.
l_idx = sy-tabix.
SELECT
/BIC/ZMCFADCNO
FROM /BIC/AZOCFBSID00
INTO TABLE TB_ZOCFBSID.
SELECT
/BIC/ZMCFADCNO
FROM /BIC/AZOCFBSIK00
INTO TABLE TB_ZOCFBSIK.
SELECT
/BIC/ZMCFADCNO
FROM /BIC/AZOCFBSIS00
INTO TABLE TB_ZOCFBSIS.
LOOP AT TB_ZOCFBSID INTO WA_ZOCFBSID.
l_t_range-sign = 'I'.
l_t_range-option = 'EQ'.
l_t_range-low = WA_ZOCFBSID-/BIC/ZMCFADCNO.
Append l_t_range.
CLEAR l_t_range.
ENDLOOP.
LOOP AT TB_ZOCFBSIK INTO WA_ZOCFBSIK.
l_t_range-sign = 'I'.
l_t_range-option = 'EQ'.
l_t_range-low = WA_ZOCFBSIK-/BIC/ZMCFADCNO.
Append l_t_range.
CLEAR l_t_range.
ENDLOOP.
LOOP AT TB_ZOCFBSIS INTO WA_ZOCFBSIK.
l_t_range-sign = 'I'.
l_t_range-option = 'EQ'.
l_t_range-low = WA_ZOCFBSIS-/BIC/ZMCFADCNO.
Append l_t_range.
CLEAR l_t_range.
ENDLOOP.
modify l_t_range index l_idx.
p_subrc = 0.
$$ end of routine - insert your code only before this line -
Edited by: AtulMohan Mishra on Dec 27, 2010 1:11 PMHi
Now i am facing an error during data extraction from Source system
error message in BW system "Error occurred in the data selection " Data Package 1 : arrived in BW ; Processing : 2nd processing step not yet finished
when i checked in SM37 (R3 system) i found the job has been cancelled and Log of this job says
"Asynchronous sending of InfoIDOCs 2 in task 0001 (0 parallel tasks) DATASOURCE = 0FI_GL_4
ABAP/4 processor: SAPSQL_WHERE_CANT_SCAN
Job cancelled "
it seems to me the Problem in Routine at Info Package level.
My Requirement is to fetch only those Accounting Doc. No. RECORDS from 0FI_GL_4 data source which are present in Active data table of BSID,BSIK,BSIS ODS's.
So i want to put logic at Info Package routine .
1) fetch all Accounting Doc. No. from Active data table of BSID,BSIK,BSIS Ods's and Match those Accounting Doc. No.'s with the 0FI_GL_4 data source Accounting Doc. No's.if a Accounting Doc. No. match with 0FI_GL_4 data source Accounting Doc no then that corresponding record from 0FI_GL_4 will go to the ODS
Regards
Atul -
ABAP CODE TO POPULATE LOGICAL SOURCE SYSTEM
Hi Friends please help me with the below
1. Requirement : to Populate The system Date , Source System
in BI for Each load request.
1 Solution: I thought of writing the Start Routine for this but it is giving me error
syntax Error: END METHOD MISSING?????
2. Also I have requirement to populate 0sourcsys source system id, can any body help how to populate that.
Thanks
Poonam Roy
ABAP Code.
I have the End Method. what more to do.
METHOD start_routine.
*=== Segments ===
FIELD-SYMBOLS:
<SOURCE_FIELDS> TYPE tys_SC_1.
DATA:
MONITOR_REC TYPE rstmonitor.
$$ begin of routine - insert your code only below this line -
... "insert your code here
FORM STARTROUTINE
USING G_S_MINFO TYPE RSSM_S_MINFO
CHANGING DATAPAK type TRANSTRU
ABORT LIKE SY-SUBRC.
DATA: ZLOAD_DAT LIKE SY-DATUM
ZZSOURSYS TYPE RSLOGSYS
IF G_S_MINFO-DATAPAKID=1
SOURCE_FIELDS-ZLOAD_DAT = SY-DATE.
SOURCE_FIELDS-ZZSOURSYS = G_S_MINFO-LOGSYS.
ENDIF.
ABORT = 0.
ENDFORM.
ENDMETHOD.
ENDCLASS.
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
raise exception type CX_RSROUT_ABORT.
$$ end of routine - insert your code only before this line -
ENDMETHOD.You have to write the code (<b>in BI/BW</b>) in the transfer rule (<b>between Datasource transfer structure and infosource/info object</b>)
There the FORM begin with
[code]USING RECORD_NO LIKE SY-TABIX
TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE
G_S_MINFO TYPE RSSM_S_MINFO
CHANGING RESULT TYPE /BI0/OIPERSON
G_T_ERRORLOG TYPE rssm_t_errorlog_int
RETURNCODE LIKE SY-SUBRC
ABORT LIKE SY-SUBRC. set ABORT <> 0 to cancel datapackag[/code]
GS_MIN_INFO structure RSSM_S_MINFO contains information on the request being processed.
<i>G_S_MINFO. This passes technical information about the data load request,
such as requesting user, request date and time, update mode, the handling of
duplicate records, error handling flags, parallel processing flags, and what data
targets to update.</i>
If tou want to use start-routine for optimization reasons and fill an empty field in transfer structure, the structure G_S_MINFO is available too.
[code]USING G_S_MINFO TYPE RSSM_S_MINFO
CHANGING DATAPAK type TAB_TRANSTRU
G_T_ERRORLOG TYPE rssm_t_errorlog_int
ABORT LIKE SY-SUBRC. set ABORT <> 0 to cancel datapackage[/code]
And stay in FORM between limits :
[code]$$ begin of routine
$$ end of routine[/code]
Update RESULT in first case, and field(s) of DATAPAK in second case.
[code]RESULT = G_S_MINFO-LOGSYS.[/code] or
[code]LOOP AT DATAPAK INTO l_s_datapak_line.
l_s_datapak_line-zzsourcsys = G_S_MINFO-LOGSYS.
MODIFY DATAPAK FROM l_s_datapak_line.
ENDLOOP.[/code]
Regards -
Convert ABAP code in start routine/update rule to transform. start routine
Dear BW ABAPers,
I have created a custom purchasing info cube (YCP_PURC1) based on 0CP_PURC1 standard cube. I would like to convert this new data flow to BI7 (from 3.x), and convert the standard update rule to transformation. I would need to rewrite the below start routine from the standard update rule to a start routine ABAP code in the newly created transformation / start routine. My ABAP knowledge is limited. Will you please help?
*this is the start routine from the update rule. As a side note, the data source is 2LIS_02_SCL.
LOOP AT SOURCE_PACKAGE.
IF ( SOURCE_PACKAGE-cppvlc EQ 0
AND SOURCE_PACKAGE-cppvoc EQ 0
AND SOURCE_PACKAGE-cpquaou EQ 0 ).
DELETE SOURCE_PACKAGE.
CONTINUE.
ENDIF.
no_scl is initial ( e.g. for good receipts, billing)
value has to be set depending on storno
IF SOURCE_PACKAGE-no_scl IS INITIAL.
IF SOURCE_PACKAGE-storno = 'X'.
SOURCE_PACKAGE-no_scl = -1.
ELSE.
SOURCE_PACKAGE-no_scl = 1.
ENDIF.
MODIFY SOURCE_PACKAGE.
ENDIF.
ENDLOOP.
if abort is not equal zero, the update process will be canceled
ABORT = 0.
Many thanks and look forward to your kind feedback.
Kind regards,
CsabaDear All, Durgesh,
thanks to you all for your valuable input. Mainly the ABAP part was more interesting for me.
Durgesh, thanks for your input, it was useful. I just had to change the info objects to data source fields and add the lines before the loop:
DATA: I_PACKAGE TYPE TYT_SC_1.
FIELD-SYMBOLS <i_package> TYPE tys_sc_1.
I_PACKAGE[] = SOURCE_PACKAGE[].
LOOP AT SOURCE_PACKAGE assigning <i_package>.
IF ( <i_package>-BWGEO EQ 0
AND <i_package>-BWGEOO EQ 0
AND <i_package>-BWMNG EQ 0 ).
DELETE SOURCE_PACKAGE index sy-tabix.
CONTINUE.
ENDIF.
no_scl is initial ( e.g. for good receipts, billing)
value has to be set depending on storno
IF <i_package>-NOSCL IS INITIAL.
IF <i_package>-ROCANCEL = 'X'.
<i_package>-NOSCL = -1.
ELSE.
<i_package>-NOSCL = 1.
ENDIF.
ENDIF.
ENDLOOP.
Points have been assigned accordingly.
Thanks,
Csaba -
Can I use OLAP variable in ABAP Code of infoobject filter
I have 0FISCPER infoobject in filter section of info-package while loading data.
Below OLAP varaibles has below dynamic values that are being calculated at run time.
0P_PRFP2 - (Current fiscal period - 2) ex: 2010010
0P_PRFP1 - (Current fiscal period - 1) ex: 2010011
0FPER - (Current fiscal period ) ex: 2010012
I want to write ABAP CODE FOR using filter values from 0P_PRFP2 to 0FPER. (Last 3 fiscal periods - ex: 2010010 to 2010012).
how to use above standard OLAP variables in ABAP CODE to assign l_t_range (low or high).try this using ABAP routine option (6)
DATA: curryear(4) type N,
currperiod(2) type N,
prevper1(2) type N,
prevyear1(4) type N,
prevper2(2) type N,
prevyear2(4) type N,
prevfiscperYr1(7) type N,
prevfiscperYr2(7) type N,
prevfiscper1(3) type N,
prevfiscper2(3) type N,
w_length1 type i,
w_length2 type i.
curryear = SY-DATUM+0(4).
currperiod = SY-DATUM+4(2).
If currperiod EQ '01'.
prevyear1 = curryear - 1.
prevper1 = '12'.
prevyear2 = curryear - 1.
prevper2 = '11'.
elseif currperiod EQ '02'.
prevyear1 = curryear.
prevper1 = '01'.
prevyear2 = curryear - 1.
prevper2 = '12'.
else.
prevyear1 = curryear.
prevper1 = currperiod - 1.
prevyear2 = curryear.
prevper2 = currperiod - 2.
endif.
w_length1 = STRLEN( prevper1 ).
If w_length1 = 1.
concatenate '0' prevper1 into prevper1.
Endif.
w_length2 = STRLEN( prevper1 ).
If w_length2 = 1.
concatenate '0' prevper2 into prevper2.
Endif.
concatenate '0' prevper1 into prevfiscper1.
concatenate '0' prevper2 into prevfiscper2.
concatenate prevyear1 prevfiscper1 into prevfiscperYr1.
concatenate prevyear2 prevfiscper2 into prevfiscperYr2.
l_t_range-low = prevfiscperYr2.
l_t_range-high = prevfiscperYr1.
* modify l_t_range index l_idx from l_t_range.
l_t_range-sign = 'I'.
l_t_range-option = 'BT'.
modify l_t_range index l_idx. -
Code modification...urgent
hi experts,
i am new to enhancement and modifications.
can anybody tell me
1.is the term modification and code modification one and the
same?or different?if so,
2.what is code modification?
3.how do u do code modification?
4.adv. and disadv. of code modifications?
i appreciate if u provide links also.
thanks in advance.Hi
Explicit Enhancement Options
There are two types of explicit enhancement options: Source code enhancements with source code plug-ins and BAdIs:
Explicit enhancement options of the source code enhancement type allow you to insert source code plug-ins. These are lines of code that are executed if the source code enhancement option is inserted in the code with the Enhancement Point command. Source code enhancement options with the Enhancement Section command behave the same, except that the source code plug-in replaces the section in the original code. Therefore, you are not only able to enhance the original code, but can also flag specific code sections (as enhancement sections) so that other developers can replace these sections with other code without making modifications.
Business Add-Ins (BAdIs) are hangers for object plug-ins. A BAdI definition comprises an interface with methods. BAdIs are enhanced by classes that implement the BAdI interface. If you instantiate a BAdI and then call its methods, you can, among other things, specify which method implementations are to be carried out on the basis of filter values. In other words, a BAdI method call is a dynamic method call with a specified interface, for which it is not determined until runtime which method implementations are to take place.
In the case of source code enhancements, the definition and call coincide. You define BAdIs once in the BAdI Builder and can then call them at different points in the various compilation units.
Implicit Enhancement Options
Implicit enhancement options are fixed points in compilation units that is, points that remain intact even if the code is changed. This is important for the following reason: If the location of an enhancement is moved, you have to check manually after an upgrade whether the enhancement is still at the correct point and replace it if necessary. The following are implicit enhancement options at which enhancements can always be inserted:
You can always insert source code plug-ins before the first and the after the last line of includes, methods, reports, and function modules.
You can always add further optional parameters to function modules.
For global classes, there are different permanent, implicit options for enhancements: You can insert additional attributes or methods, and you can add optional parameters to existing methods
Customer-Specific Modification and Enhancement Possibilities
Use
The following documentation provides an overview of the customer-specific modification and enhancement possibilities in the IS-H System. Note that to implement enhancements, you require ABAP programming knowledge.
Features
The IS-H system provides the following technical possibilities for customer-specific modifications and enhancements
Business Add-Ins (BAdIs)
If default code (standard procedure defined by SAP) exists for the BAdI, please note it will be overwritten when you implement the BAdI. You can, if required, re-use the default code in your implementation.
As of SAP NetWeaver 2004, the enhancement concept of the ABAP Workbench (Enhancement Framework) is available for BAdIs. Note that SAP Patient Management contains BAdIs that use the Enhancement Framework as well as the classic BAdIs.
Customer Exits (transaction SMOD)
If SAP delivers sample code for the customer exit, you can access it when implementing the exit by choosing Goto ® Sample Code. You can re-use the sample code using Copy&Paste
User Exits from the IS-H Implementation Guide: Basic Settings ® Configuration/Systems/Events ® Display SAP User Exits.
To implement the IS-H user exits, copy the function module delivered by SAP into a customer-specific function group. The name of the function module delivered by SAP is specified in the table you call in the IS-H Implementation Guide by choosing the path specified to the left here.
Once youve copied the source code, you can modify this copy to meet your needs. Note that you must not modify the interface of your own function module.
Now enter the name youve chosen for the function module in the customer table. You access this table by choosing Basic Settings ® Configuration/Systems/Events ® Configure Customer User Exits.
If it is helpful rewards points.
Regards
Pratap.M -
IF condition to execute ABAP code; VBAK-VSBED; VBPA-KUNNR; XVBPA/YVBPA
Hi All!
I need some help. I have to change the MV45AFZZ, the FORM USEREXIT_MOVE_FIELD_TO_VBAK. The user exit should write the VBAK-VSBED (shipping condition) from the KNVV-VSBED for the VBPA-KUNNR, PARVW=WE (the ship-to-party partner). The user exit should also permit the modification of VBAK-VSBED directly from VA01 or VA02 (even if the ship-to-party remain the same).
I write down the ABAP code but I need to write a condition in order to execute the modification of VBAK-VSBED:
1. in VA01, for the first time;
2. in VA01 and VA02 if I change the ship-to-party partner.
Now, if I want to change VBAK-VSBED without modifying the ship-to-party, I can not. The user exit overwrite the VBAK-VSBED for the ship-to-party.
The code is:
READ TABLE xvbpa WITH KEY parvw = 'WE' .
IF SY-SUBRC = 0.
SELECT SINGLE * FROM knvv WHERE kunnr EQ xvbpa-kunnr and
vkorg EQ xvbak-vkorg and
vtweg EQ xvbak-vtweg and
spart EQ xvbak-spart .
vbak-vsbed = knvv-vsbed.
ENDIF.
Any help will be appreciate.
Florina C.Hi,
try this example:
*Table YVBPA should always be filled, when executing VA02, but if it is not, you
*can simple select the Sales Partner from VBPA(in va02 scenario it would be in *DB aldready)
if sy-tcode = 'VA01'.
READ TABLE xvbpa WITH KEY parvw = 'WE' .
IF SY-SUBRC = 0.
SELECT SINGLE * FROM knvv
WHERE kunnr EQ xvbpa-kunnr and
vkorg EQ xvbak-vkorg and
vtweg EQ xvbak-vtweg and
spart EQ xvbak-spart .
vbak-vsbed = knvv-vsbed.
ENDIF.
else if tcode = 'VA02'.
if YVBPA[] is initial.
select single * from vbpa
where vbeln = vbak-vbeln and parvw = 'WE'.
if sy-subrc = 0.
partner_before_change = vbpa-kunnr.
endif.
else.
READ TABLE yvbpa WITH KEY parvw = 'WE' .
if sy-subrc = 0.
partner_before_change = yvbpa-kunnr.
endif.
endif.
READ TABLE xvbpa WITH KEY parvw = 'WE' .
IF SY-SUBRC = 0 and
xvbpa-kunnr <> partner_before_change.
SELECT SINGLE * FROM knvv
WHERE kunnr EQ xvbpa-kunnr and
vkorg EQ xvbak-vkorg and
vtweg EQ xvbak-vtweg and
spart EQ xvbak-spart .
vbak-vsbed = knvv-vsbed.
endif.
endif.
Best Regards, -
How to insert abap code in LSMW generated program?
hi,
i m working on LSMW for loading data in SAP
i would like to insert abap code into the generated program....
it's because i have 1 BKPF segment (header data), 2 BSEG segments, but i cannot define rules by customizing for the second BSEG segment(LSMW doesn't permitt).
i already tried to insert code directly into the program, but obviously it disapears at each time i generate the program.
i saw that apparently a code insertion has already be made into this program and the subject of this insertion is to define rules for the second BSEG (exactly what i want to do....) and this modification doesn't disapear at new prog generation.....
Any idea ?Hi
Why dont you use the FORM provided by LSMW
To use this please do the following
1.Goto option <b>Maintain Field Mapping and Conversion Rules</b>
2.Goto menu <b>EXTRAS->LAYOUT->Form Routines</b>
Here you will now get many options like
Global Data
Begin of Transaction
Begin of Processing
Begin of Record
like wise the End of these also.
Please put a breakpoint and check where you want to insert your code.
Note:
This is only for the Conversion Program and does not affect the main program used to update the Standard Tables
Hi , I was reading your earlier post .. It seems that you have worked on EMIGALL. Consider a similar situation, it is like writing the code in the events till CALL01...
Thanks
DOminic
Message was edited by: Dominic Pappaly -
Hi Guys,
Below you find some ABAP code that will get a lot of product and price information. A csv file is then created and put in a folder.
The program exports csv columns like this: ProductID;ProductName;PurchasePrice;Price;PriceVAT;Category;Brand;EAN
The only thing I would want is to adjust the code so that it does exactly the same, but only exports three columns: ProductID;PriceVAT;Stock
I would guess that it's not a very big modification, but my knowledge of ABAP is very low. So I hope you guys can help me out here
Here's the code: [catalog_abap_code|http://www.storylinedesign.be/catalog_abap_code.txt]
Cheers,
Jimmyanyone?
-
Structure of abap code in fi module
Hi all
I joined like fresher could you help me how to write the abap code
structure of the abap codeCHECK THIS
I HOPE IT WILL HELP YOU.
*& Report ZDTK_FI_CRDB
*& DESCRIPTION : CREDIT DEBIT NOTE FOR CUSTOMER OR VENDOR.
REPORT ZDTK_FI_CRDB NO STANDARD PAGE HEADING
LINE-COUNT 65(5)
LINE-SIZE 80
MESSAGE-ID ZTAR_FI
*& STRUCTURE DECLARATION
TYPES : BEGIN OF TY_ADDR,
BUKRS TYPE BUKRS, "COMPANY CODE
LIFNR TYPE LIFNR, "VENDOR NO
KUNNR TYPE KUNNR, "CUSTOMJER NO
NAME1 TYPE NAME1, "NAME1
NAME2 TYPE NAME2, "NAME2
ORT01 TYPE ORT01, "CITY
ORT02 TYPE ORT02,
PSTLZ TYPE PSTLZ, "POSTAL CODE
STRAS TYPE STRAS, "STREET
ADRNR TYPE ADRNR, "ADDRESS NO
TELF1 TYPE TELF1, "TELEFHONE NO
TELF2 TYPE TELF2, "TELEFHONE NO 2
TELFX TYPE TELFX, "FAX
END OF TY_ADDR,
BEGIN OF TY_LFA1,
KUNNR TYPE KUNNR, "CUSTOMJER NO
NAME1 TYPE NAME1, "NAME1
NAME2 TYPE NAME2, "NAME2
ORT01 TYPE ORT01, "CITY
ORT02 TYPE ORT02,
PSTLZ TYPE PSTLZ, "POSTAL CODE
STRAS TYPE STRAS, "STREET
ADRNR TYPE ADRNR, "ADDRESS NO
TELF1 TYPE TELF1, "TELEFHONE NO
TELF2 TYPE TELF2, "TELEFHONE NO 2
TELFX TYPE TELFX, "FAX
END OF TY_LFA1,
BEGIN OF TY_DOCM,
GJAHR TYPE GJAHR,
BELNR TYPE BELNR_D,
BUDAT TYPE BUDAT,
BLDAT TYPE BLDAT,
BLART TYPE BLART,
BSCHL TYPE BSCHL,
SHKZG TYPE SHKZG,
XBLNR TYPE XBLNR,
DMBTR TYPE DMBTR,
SGTXT TYPE SGTXT,
REBZG TYPE REBZG,
REBZJ TYPE REBZJ,
KUNNR TYPE KUNNR,
LIFNR TYPE LIFNR,
END OF TY_DOCM.
*& TABLE DECLARATION
DATA : T_ADDR TYPE STANDARD TABLE OF TY_ADDR,
*& WORK AREA DECLARATION
W_ADDR TYPE TY_ADDR,
W_DOCM TYPE TY_DOCM,
W_LFA1 TYPE TY_LFA1,
*& GLOBLE VARIABLE DECLARATION
G_KUNNR TYPE KUNNR,
G_LIFNR TYPE LIFNR,
DCAMT TYPE DMBTR.
*& INITIALIZATION
INITIALIZATION.
CLEAR :
*REFRESH :
*& SELECTION SCREEN DECLARATION
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP 1.
PARAMETERS : S_BUKRS TYPE BSID-BUKRS OBLIGATORY DEFAULT '1000'.
PARAMETERS : S_BELNR TYPE BELNR_D OBLIGATORY DEFAULT '1600000070'.
PARAMETERS : S_GJAHR TYPE GJAHR OBLIGATORY DEFAULT '2008'.
PARAMETERS : ASON TYPE BUDAT OBLIGATORY DEFAULT SY-DATUM.
PARAMETERS : S_KUNNR TYPE KUNNR MODIF ID GP1.
PARAMETERS : S_LIFNR TYPE LIFNR MODIF ID GP2.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN : END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS R1 RADIOBUTTON GROUP RAO DEFAULT 'X' USER-COMMAND hit.
SELECTION-SCREEN COMMENT (50) TEXT-003 FOR FIELD R1.
PARAMETERS R2 RADIOBUTTON GROUP RAO.
SELECTION-SCREEN COMMENT (50) TEXT-004 FOR FIELD R2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK B2.
*SELECTION-SCREEN: BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-005.
*SELECTION-SCREEN SKIP 1.
*SELECTION-SCREEN BEGIN OF LINE.
*PARAMETERS R3 RADIOBUTTON GROUP RAJ DEFAULT 'X' USER-COMMAND hit.
*SELECTION-SCREEN COMMENT (50) TEXT-006 FOR FIELD R1.
*PARAMETERS R4 RADIOBUTTON GROUP RAJ.
*SELECTION-SCREEN COMMENT (50) TEXT-007 FOR FIELD R2.
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN SKIP 1.
*SELECTION-SCREEN : END OF BLOCK B3.
*& AT SELECTION SCREEN
AT SELECTION-SCREEN.
PERFORM VALIDATE_SELECTION.
*& AT SELECTION SCREEN OUTPUT
AT SELECTION-SCREEN OUTPUT.
PERFORM SCREEN_OUTPUT.
*& START OF SELECTION
START-OF-SELECTION.
IF R1 = 'X'.
PERFORM GET_DOCUMENT_L.
ELSEIF R2 = 'X'.
PERFORM GET_DOCUMENT_K.
ENDIF.
*& END OF SELECTION
END-OF-SELECTION.
PERFORM DISPLAY.
*& TOP OF PAGE
*TOP-OF-PAGE.
PERFORM PAGE_HEADER.
*& Form VALIDATE_SELECTION
text
form VALIDATE_SELECTION .
DATA : L_BUKRS TYPE BSID-BUKRS.
SELECT SINGLE BUKRS FROM KNB1
INTO L_BUKRS
WHERE BUKRS = S_BUKRS.
*IF SY-SUBRC <> 0.
*MESSAGE E001.
*LEAVE LIST-PROCESSING.
*ENDIF.
DATA : L_KUNNR TYPE BSID-KUNNR.
SELECT SINGLE KUNNR FROM BSID
INTO L_KUNNR
WHERE KUNNR = S_KUNNR.
*IF SY-SUBRC <> 0.
*MESSAGE E002.
*LEAVE LIST-PROCESSING.
*ENDIF.
endform. " VALIDATE_SELECTION
*& Form SCREEN_OUTPUT
text
form SCREEN_OUTPUT .
IF R1 = 'X'.
LOOP AT SCREEN.
if screen-group1 = 'GP1'.
SCREEN-active = '0'.
*SCREEN-INTENSIFIED = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-group1 = 'GP2'.
SCREEN-active = '0'.
*SCREEN-INTENSIFIED = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
endform. " SCREEN_OUTPUT
*& Form GET_DOCUMENT_L
text
FORM GET_DOCUMENT_L .
DATA : MESSG(60).
SELECT SINGLE BUKRS
LIFNR
GJAHR
BELNR
BUDAT
BLDAT
BLART
BSCHL
SHKZG
DMBTR
SGTXT
REBZG
REBZJ FROM BSIK
INTO CORRESPONDING FIELDS OF W_DOCM
WHERE BUKRS = S_BUKRS AND
GJAHR = S_GJAHR AND
BELNR = S_BELNR.
SELECT SINGLE DMBTR FROM BSIK INTO DCAMT
WHERE BELNR = W_DOCM-REBZG AND
GJAHR = W_DOCM-REBZJ.
IF NOT W_DOCM IS INITIAL.
PERFORM GET_LFA1.
ELSE.
SELECT SINGLE BUKRS
LIFNR
GJAHR
BELNR
BUDAT
BLDAT
BLART
BSCHL
SHKZG
DMBTR
SGTXT
REBZG
REBZJ FROM BSAK
INTO CORRESPONDING FIELDS OF W_DOCM
WHERE BUKRS = S_BUKRS AND
GJAHR = S_GJAHR AND
BELNR = S_BELNR.
SELECT SINGLE DMBTR FROM BSAK INTO DCAMT
WHERE BELNR = W_DOCM-REBZG AND
GJAHR = W_DOCM-REBZJ.
IF NOT W_DOCM IS INITIAL.
PERFORM GET_LFA1.
ELSE.
CONCATENATE 'THERE IS NO DOCUMENT NO' S_BELNR S_GJAHR 'FOR VENDOR' INTO MESSG
SEPARATED BY SPACE.
MESSAGE I011 WITH MESSG.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ENDFORM. " GET_DOCUMENT_L
*& Form GET_LFA1
text
FORM GET_LFA1 .
SELECT SINGLE LIFNR
NAME1
NAME2
ORT01
ORT02
PSTLZ
STRAS
ADRNR
TELF1
TELF2
TELFX FROM LFA1 INTO CORRESPONDING FIELDS OF W_ADDR
WHERE LIFNR = W_DOCM-LIFNR.
ENDFORM. " GET_LFA1
*& Form GET_DOCUMENT_K
text
FORM GET_DOCUMENT_K .
DATA : MESSG(60).
SELECT SINGLE BUKRS
KUNNR
LIFNR
GJAHR
BELNR
BUDAT
BLDAT
BLART
BSCHL
SHKZG
DMBTR
SGTXT
REBZG
REBZJ FROM BSID
INTO CORRESPONDING FIELDS OF W_DOCM
WHERE BUKRS = S_BUKRS AND
GJAHR = S_GJAHR AND
BELNR = S_BELNR.
SELECT SINGLE DMBTR FROM BSID INTO DCAMT
WHERE BELNR = W_DOCM-REBZG AND
GJAHR = W_DOCM-REBZJ.
IF NOT W_DOCM IS INITIAL.
PERFORM GET_KNA1.
ELSE.
SELECT SINGLE BUKRS
KUNNR
LIFNR
GJAHR
BELNR
BUDAT
BLDAT
BLART
BSCHL
SHKZG
DMBTR
SGTXT
REBZG
REBZJ FROM BSAD
INTO CORRESPONDING FIELDS OF W_DOCM
WHERE BUKRS = S_BUKRS AND
GJAHR = S_GJAHR AND
BELNR = S_BELNR.
SELECT SINGLE DMBTR FROM BSAD INTO DCAMT
WHERE BELNR = W_DOCM-REBZG AND
GJAHR = W_DOCM-REBZJ.
IF NOT W_DOCM IS INITIAL.
PERFORM GET_KNA1.
ELSE.
CONCATENATE 'THERE IS NO DOCUMENT NO' S_BELNR S_GJAHR 'FOR CUSTOMER' INTO MESSG
SEPARATED BY SPACE.
MESSAGE I011 WITH MESSG.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ENDFORM. " GET_DOCUMENT_K
*& Form GET_KNA1
text
FORM GET_KNA1 .
SELECT SINGLE KUNNR
NAME1
NAME2
ORT01
ORT02
PSTLZ
STRAS
ADRNR
TELF1
TELF2
TELFX FROM KNA1 INTO CORRESPONDING FIELDS OF W_ADDR
WHERE KUNNR = W_DOCM-KUNNR.
ENDFORM. " GET_KNA1
*& Form DISPLAY
text
FORM DISPLAY .
LONG TEXT *************************
*DATA : BEGIN OF inline OCCURS 0,
*END OF inline.
*TYPES: BEGIN OF TY_LONGT,
tdformat TYPE tdformat,
tdline TYPE tdline,
END OF TY_LONGT.
*DATA : TLONGT TYPE STANDARD TABLE OF TY_LONGT,
WLONGT TYPE TY_LONGT.
DATA: BEGIN OF DTEXT OCCURS 50.
*DATA: MATNR LIKE PBIM-MATNR.
INCLUDE STRUCTURE TLINE.
DATA: END OF DTEXT.
DATA: BEGIN OF HTEXT.
INCLUDE STRUCTURE THEAD.
DATA: END OF HTEXT.
DATA: BEGIN OF LTEXT OCCURS 50.
INCLUDE STRUCTURE TLINE.
DATA: END OF LTEXT.
DATA: TNAME LIKE THEAD-TDNAME.
CONCATENATE S_BUKRS W_DOCM-BELNR S_GJAHR '002' INTO TNAME.
*SEPARATED BY SPACE.
DATA : W_STXL TYPE STXL.
SELECT SINGLE * FROM STXL INTO W_STXL
WHERE TDNAME = TNAME.
IF NOT W_STXL IS INITIAL.
*SELECT * FROM PBIM WHERE WERKS IN S_WERKS.
*MOVE PBIM-BDZEI TO TNAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = W_STXL-TDID
LANGUAGE = W_STXL-TDSPRAS
NAME = TNAME
OBJECT = W_STXL-TDOBJECT
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER = HTEXT
TABLES
LINES = LTEXT
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT LTEXT.
IF LTEXT-TDLINE NE ''.
MOVE LTEXT-TDLINE TO DTEXT-TDLINE.
APPEND DTEXT.
ENDIF.
ENDLOOP.
ENDIF.
LONG TEXT *************************
CUSTOMER / VENDOR NO *************************
DATA : CUVE(10).
IF R1 = 'X'.
CUVE = W_ADDR-LIFNR.
ELSEIF R2 = 'X'.
CUVE = W_ADDR-KUNNR.
ENDIF.
CUSTOMER / VENDOR NO *************************
CR / DR DATA *************************
IF DCAMT IS INITIAL.
SELECT SINGLE DMBTR FROM BSIS INTO DCAMT
WHERE BELNR = W_DOCM-REBZG AND
GJAHR = W_DOCM-REBZJ .
( KOART = 'D' OR KOART = 'K' ).
ENDIF.
CR / DR DATA *************************
DATA: CNAME TYPE BUTXT.
SELECT SINGLE BUTXT FROM T001 INTO CNAME
WHERE BUKRS = S_BUKRS.
DATA : NAME(60),
STREET(60),
TELFX(60).
CONCATENATE W_ADDR-NAME1 W_ADDR-NAME2 INTO NAME
SEPARATED BY SPACE.
CONCATENATE W_ADDR-ORT01 W_ADDR-ORT02 'POSTAL CODE :' W_ADDR-PSTLZ INTO STREET
SEPARATED BY SPACE.
CONCATENATE 'Tel No.:' W_ADDR-TELF1 W_ADDR-TELF2 'FAX :' W_ADDR-TELFX INTO TELFX
SEPARATED BY SPACE.
DATA : CRDB(20),
CRDBA(16),
BALC TYPE DMBTR.
IF W_DOCM-SHKZG = 'S'.
CRDB = 'Debit Note No. :'.
CRDBA = 'DEBIT'.
BALC = DCAMT + W_DOCM-DMBTR.
ELSEIF W_DOCM-SHKZG = 'H'.
CRDB = 'Credit Note No. :'.
CRDBA = 'CREDIT'.
BALC = DCAMT - W_DOCM-DMBTR.
ENDIF.
SKIP 5.
*FORMAT INVERSE.
ULINE 03(77).
WRITE : 03 SY-VLINE, 80 '|',
/03 SY-VLINE, NAME, 54 'Party No.:' COLOR 7, CUVE COLOR 7, 80 '|',
/03 SY-VLINE, W_ADDR-STRAS, 80 '|',
/03 SY-VLINE, STREET, 80 '|',
/03 SY-VLINE, TELFX, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 05 CNAME COLOR 2, 80 '|',
/03 SY-VLINE, 36 CRDB RIGHT-JUSTIFIED, 59 W_DOCM-BELNR, 71 W_DOCM-GJAHR, 80 '|',
/03 SY-VLINE, 58 'DATE :', W_DOCM-BUDAT, 80 '|',
/03 SY-VLINE, 80 '|'. ULINE 03(77).
WRITE : /03 SY-VLINE, 80 '|'.
IF NOT DTEXT IS INITIAL.
LOOP AT DTEXT.
WRITE : /03 SY-VLINE, 05 DTEXT-TDLINE COLOR 1, 80 '|'.
ENDLOOP.
ELSEIF W_DOCM-SGTXT NE ''.
WRITE : /03 SY-VLINE, 05 W_DOCM-SGTXT COLOR 1, 80 '|'.
ELSE.
WRITE : /03 SY-VLINE, 80 '|'.
ENDIF.
WRITE : /03 SY-VLINE, 80 '|',
*WRITE : /03 SY-VLINE, TNAME, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 08 'WORKING OF INTEREST CALCULATION AS ON ' COLOR 4,
47 ASON COLOR 4, ' [ 360 DAYS BASIS ]' COLOR 4, 80 '|',
/03 SY-VLINE, 80 '|'. ULINE 03(77).
WRITE : /03 SY-VLINE, 11 'DATE', 23 'INVOICE', 41 CRDBA, 55 'BALANCE', 64 'DAYS', 70 'INTEREST', 80 '|',
/03 SY-VLINE, 23 ' AMOUNT', 41 'AMOUNT', 55' AMOUNT', 70 ' @ 8.00% ', 80 '|',
/03 SY-VLINE, 80 '|'. ULINE 03(77).
WRITE : /03 SY-VLINE, 80 '|',
/03 SY-VLINE, 06 W_DOCM-BUDAT, 15 DCAMT, 32 W_DOCM-DMBTR, 47 BALC, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|'. ULINE 03(77).
WRITE : /03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 10 'PREPARED BY', 35 'ACCOUNTANT', 60 'MANAGER', 80 '|',
/03 SY-VLINE, 80 '|',
/03 SY-VLINE, 80 '|'. ULINE 03(77).
ENDFORM. " DISPLAY -
What are the acceptable Sap methods/steps to change standard SAP/Abap code?
To you Sap experts:
Can you point me to Sap document that lists the acceptable methods to follow when modifing SAP standard (abap code). We are on release 4..7.
I assume there is a best practice guide if you have to modify standard Sap code of what to do and don't do. Ex:. Field exit, CMOD, SMOD... Thanks for assistance.Hi,
You can implement your own logic using User Exits (which includes function module exits, screen exits, field exits and menu exits), Badi's, Enhancement points and Business Transaction, Events.
Thanks,
Srinivasa Rada -
Hi,
Please help me with quick ABAP code in APD transformation.
This is the requirement:
When ever /BI0/OIG_QVV010 is zero , /BIC/OIZENDUSER value should be blank.
Here is the code template needs modification:
REPORT RSAN_WB_ROUTINE_TEMP_REPORT .
TYPES: BEGIN OF y_source_fields ,
KYF_0001 TYPE /BI0/OIG_QVV010 ,
KYF_0001_UNIT TYPE MEINS ,
CALMONTH TYPE /BI0/OICALMONTH ,
MATERIAL TYPE /BI0/OIMATERIAL ,
/BIC/ZENDUSER TYPE /BIC/OIZENDUSER ,
END OF y_source_fields .
TYPES: yt_source_fields TYPE STANDARD TABLE OF y_source_fields .
TYPES: BEGIN OF y_target_fields ,
KYF_0001 TYPE /BI0/OIG_QVV010 ,
KYF_0001_UNIT TYPE /BI0/OIG_UVV010 ,
CALMONTH TYPE /BI0/OICALMONTH ,
MATERIAL TYPE /BI0/OIMATERIAL ,
/BIC/ZENDUSER TYPE /BIC/OIZENDUSER ,
END OF y_target_fields .
TYPES: yt_target_fields TYPE STANDARD TABLE OF y_target_fields .
*---- Begin of type definitions -
*TYPES: ...
*---- End of type definitions -
FORM compute_data_transformation
USING it_source TYPE yt_source_fields
ir_context TYPE REF TO if_rsan_rt_routine_context
EXPORTING et_target TYPE yt_target_fields .
*---- Begin of transformation code -
DATA: ls_source TYPE y_source_fields,
ls_target TYPE y_target_fields.
LOOP AT it_source INTO ls_source.
MOVE-CORRESPONDING ls_source TO ls_target.
APPEND ls_target TO et_target.
ENDLOOP.
*---- End of transformation code -How about this?
LOOP AT it_source INTO ls_source.
IF ls_source-kyf_0001 EQ 0.
CLEAR ls_source-/bic/zenduser.
ENDIF.
MOVE-CORRESPONDING ls_source TO ls_target.
APPEND ls_target TO et_target.
ENDLOOP.
Maybe you are looking for
-
How do I select text in a PDF document?
I have a text-based PDF document, but I can only select text by restarting the reader. Once I select "Take a Snapshot" I can't select text anymore. How do I switch back to select text? I tried right-clicking on the document but I don't see any "selec
-
Error when installing WebLogic Server 10.3 in silent mode.
I get the error below when trying to install a fresh copy of WebLogic Server 10.3 on Linux and Windows XP. 2009-05-01 19:50:09,941 INFO [readSilentXML] com.bea.plateng.wizard.installer.common.parsers.TemplateParser - Silent xml file processed success
-
Sun C 5.9 Build13_0 2006/01/06 fails to compile stdlib.h
On both IA-32 and AMD64, c89 fails to compile a single-line test file containing #include <stdlib.h> "/usr/include/stdlib.h", line 537: long long not allowed in Xc mode "/usr/include/stdlib.h", line 537: invalid type combination I suggest that the "n
-
Material Classification Data extraction fron ECC
Hello Experts, We are trying to extract material classification data from ECC 6.0 to MDM 7.1 using mdmgx T-Code. We are using the standard SAP list of tables which is uploaded in MDMGX. On performing 'Start Extraction' it gives us the following error
-
Business service invoquing a simple servlet
Hi all, I'm working with ALSB 2.6. I have a servlet that receive 2 simple parameters (GET or POST) and gives back a string "OK" or "KO". I create a new business service that invoque this servlet, select Messaging Service; text - text; transport http