Help on GE -Functional Module
Hi ,
i am wrote FM based on RSAX_BIW_GETDATA_SIMPLE.
once i run on RSA3 , it will go to the Dump.
Plz check my code and tell me where i am wrong ....
i assign points...
code ....
FUNCTION ZXBWMM_PRSTATUSCR.
""Local Interface:
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR
*" VALUE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
*" VALUE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
*" VALUE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY OPTIONAL
*" VALUE(I_REMOTE_CALL) TYPE SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
*" TABLES
*" I_T_SELECT TYPE SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
*" E_T_DATA STRUCTURE ZVSAPR OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
Example: DataSource for table SFLIGHT
TABLES: SFLIGHT.
TABLES: EBAN , CDPOS , CDHDR , ZVSAPR.
TYPES : BEGIN OF TY_OBJDATE ,
OBJECTID TYPE EBAN-BANFN,
VALUE_NEW TYPE CDPOS-VALUE_NEW,
ZZVALUE TYPE eban-preis,
UDATE TYPE CDHDR-UDATE,
END OF TY_OBJDATE.
data : int_cdhdr type table of cdhdr with header line,
int_cdpos type table of cdpos with HEADER LINE,
INT_OBJDATE TYPE TABLE OF TY_OBJDATE WITH HEADER LINE.
DATA: int_pr1 TYPE TABLE OF ZVSAPR WITH HEADER LINE.
Auxiliary Selection criteria structure
DATA: L_S_SELECT TYPE SRSC_S_SELECT.
Maximum number of lines for DB table
STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
counter
S_COUNTER_DATAPAKID LIKE SY-TABIX,
cursor
S_CURSOR TYPE CURSOR.
Select ranges
RANGES: L_R_CARRID FOR SFLIGHT-CARRID,
L_R_CONNID FOR SFLIGHT-CONNID.
RANGES : ra_BANFN FOR E_T_DATA-BANFN.
Initialization mode (first call by SAPI) or data transfer mode
(following calls) ?
IF I_INITFLAG = SBIWA_C_FLAG_ON.
Initialization: check input parameters
buffer input parameters
prepare data selection
Check DataSource validity
CASE I_DSOURCE.
WHEN 'ZPRSTATUSCR'.
WHEN OTHERS.
IF 1 = 2. MESSAGE E009(R3). ENDIF.
this is a typical log call. Please write every error message like this
LOG_WRITE 'E' "message type
'R3' "message class
'009' "message number
I_DSOURCE "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
ENDCASE.
APPEND LINES OF I_T_SELECT TO S_S_IF-T_SELECT.
Fill parameter buffer for data extraction calls
S_S_IF-REQUNR = I_REQUNR.
S_S_IF-DSOURCE = I_DSOURCE.
S_S_IF-MAXSIZE = I_MAXSIZE.
Fill field list table for an optimized select statement
(in case that there is no 1:1 relation between InfoSource fields
and database table fields this may be far from beeing trivial)
APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.
ELSE. "Initialization mode or data extraction ?
Data transfer: First Call OPEN CURSOR + FETCH
Following Calls FETCH only
First data package -> OPEN CURSOR
IF S_COUNTER_DATAPAKID = 0.
Fill range tables BW will only pass down simple selection criteria
of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.
LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CARRID'.
MOVE-CORRESPONDING L_S_SELECT TO L_R_CARRID.
APPEND L_R_CARRID.
ENDLOOP.
LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CONNID'.
MOVE-CORRESPONDING L_S_SELECT TO L_R_CONNID.
APPEND L_R_CONNID.
ENDLOOP.
Determine number of database records to be read per FETCH statement
from input parameter I_MAXSIZE. If there is a one to one relation
between DataSource table lines and database entries, this is trivial.
In other cases, it may be impossible and some estimated value has to
be determined.
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT
WHERE CARRID IN L_R_CARRID AND
CONNID IN L_R_CONNID.
select * from cdhdr into table int_cdhdr where OBJECTCLAS = 'BANF' AND TCODE IN ('ME52N','ME54N').
SELECT * FROM CDPOS INTO TABLE INT_CDPOS
FOR ALL ENTRIES IN INT_CDHDR
WHERE OBJECTCLAS = INT_CDHDR-OBJECTCLAS
AND CHANGENR = INT_CDHDR-CHANGENR
AND TABNAME = 'EBAN'
AND FNAME = 'FRGKZ'
AND VALUE_NEW = '2'.
SELECT * FROM CDPOS APPENDING TABLE INT_CDPOS
FOR ALL ENTRIES IN INT_CDHDR
WHERE OBJECTCLAS = INT_CDHDR-OBJECTCLAS
AND CHANGENR = INT_CDHDR-CHANGENR
AND TABNAME = 'EBAN'
AND FNAME = 'LOEKZ'
AND VALUE_NEW = 'X'.
LOOP AT INT_CDPOS.
READ TABLE INT_CDHDR WITH KEY OBJECTID = INT_CDPOS-OBJECTID CHANGENR = INT_CDPOS-CHANGENR.
IF SY-SUBRC = 0.
INT_OBJDATE-OBJECTID = INT_CDPOS-OBJECTID.
INT_OBJDATE-VALUE_NEW = INT_CDPOS-VALUE_NEW.
INT_OBJDATE-UDATE = INT_CDHDR-UDATE.
APPEND INT_OBJDATE.
ENDIF.
ENDLOOP.
SELECT * FROM EBAN
INTO CORRESPONDING FIELDS OF TABLE INT_PR1
FOR ALL ENTRIES IN INT_OBJDATE
WHERE BAnfn = int_objdate-objectid.
*ZZPRREL
LOOP AT INT_PR1.
ON CHANGE OF INT_PR1-BANFN.
READ TABLE int_objdate with KEY objectid = int_pr1-banfn.
INT_PR1-udate = int_objdate-udate.
IF int_objdate-VALUE_NEW = '2'.
int_pr1-ZZPRREL = 'R'.
ENDIF.
ENDON.
READ TABLE int_objdate with KEY objectid = int_pr1-banfn.
IF int_objdate-VALUE_NEW = 'X'.
int_pr1-ZZPRREL = 'D'.
ENDIF.
IF eban-peinh is INITIAL.
eban-peinh = 1.
ENDIF.
int_pr1-ZZVALUE = ( INT_PR1-preis / eban-peinh ) * 8.
MODIFY INT_PR1.
ENDLOOP.
if int_pr1 is not initial.
refresh E_T_DATA.
endif.
LOOP AT int_pr1.
E_T_DATA-BANFN = int_pr1-banfn.
E_T_DATA-BNFPO = int_pr1-bnfpo.
E_T_DATA-BSART = int_pr1-BSART.
E_T_DATA-LOEKZ = int_pr1-loekz.
E_T_DATA-FRGKZ = int_pr1-frgkz.
E_T_DATA-MATNR = int_pr1-matnr.
E_T_DATA-TXZ01 = int_pr1-txz01.
E_T_DATA-MENGE = int_pr1-menge.
E_T_DATA-MEINS = int_pr1-meins.
E_T_DATA-LFDAT = int_pr1-lfdat.
E_T_DATA-ZZVALUE = int_pr1-zzvalue.
E_T_DATA-WAERS = int_pr1-waers.
E_T_DATA-EKGRP = int_pr1-ekgrp.
E_T_DATA-WERKS = int_pr1-werks.
E_T_DATA-LGORT = int_pr1-lgort.
E_T_DATA-AFNAM = int_pr1-afnam.
E_T_DATA-UDATE = int_pr1-udate.
E_T_DATA-ZZPRREL = int_pr1-zzprrel.
APPEND E_T_DATA.
CLEAR E_T_DATA.
ENDLOOP.
ENDIF. "First data package ?
Fetch records into interface table.
named E_T_'Name of extract structure'.
FETCH NEXT CURSOR S_CURSOR
APPENDING CORRESPONDING FIELDS
OF TABLE E_T_DATA
PACKAGE SIZE S_S_IF-MAXSIZE.
IF SY-SUBRC <> 0.
CLOSE CURSOR S_CURSOR.
RAISE NO_MORE_DATA.
ENDIF.
S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
ENDIF. "Initialization mode or data extraction ?
ENDFUNCTION.
Regards,
PSR.
Hi ,
can u share ur experience for correcting this error .
and how can i define deleta for this data sources ...
the delta is based on the Udate field ( calander day ) ...
i assign points....
Regards,
PSR
Similar Messages
-
How to call a Search help in a function module?
Hi Experts,
I am a novice to ABAP, I am working on search helps. My requirement is to call a search help in a function module.
Can anyone please throw some light on this.
Any inputs will be helpful.
Thanks,
Amitayes you can do that..
in side the source code ..
write the select statement according to requirement and pass the internal table to below function moduel and return field to yor help field..
call the below fm inside the function module..
'POPUP_WITH_TABLE_DISPLAY' or 'REUSE_ALV_POPUP_TO_SELECT'
see the sample code...
FUNCTION Z_MFG_PLANTS_F4 .
"*"Local Interface:
" IMPORTING
" REFERENCE(W_WERKS) TYPE WERKS OPTIONAL
" IMPORTING
" REFERENCE(W_MATNR) TYPE MANTR OPTIONAL
Alv popup display
DATA : gc_selfield TYPE slis_selfield,
gt_fieldcat_drd TYPE slis_t_fieldcat_alv WITH HEADER LINE.
p_werks = W_WERKS.
data : begin of t_marc occurs 0,
werks type werks,
matnr type matnr,
end of t_marc
select matnr werks from marc into table t_marc where werks = p_werks.
IF t_disp[] IS NOT INITIAL.
gt_fieldcat_drd-seltext_m = 'Material'.
gt_fieldcat_drd-fieldname = 'MATNR'.
APPEND gt_fieldcat_drd.
CLEAR : gt_fieldcat_drd.
gt_fieldcat_drd-seltext_m = 'WERKS'.
gt_fieldcat_drd-fieldname = ''WERKS'.
APPEND gt_fieldcat_drd.
CLEAR : gt_fieldcat_drd.
Allow the user to select the required plant
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = 'Material Selection for Plant'
i_selection = 'X'
i_screen_start_column = 5
i_screen_start_line = 5
i_screen_end_column = 70
i_screen_end_line = 20
i_tabname = 'T_MARC'
it_fieldcat = gt_fieldcat_drd[]
IMPORTING
es_selfield = gc_selfield
TABLES
t_outtab = t_MARC
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc 0.
ENDIF.
READ TABLE t_MARC INDEX gc_selfield-tabindex.
IF sy-subrc = 0.
w_matnr = t_matnr-matnr.
ENDIF.
ENDIF.
ENDFUNCTION.
rgrds,
Shweta -
Help in IDOC_INPUT_ORDERS Function module
Hi,
I am writing a program to generate an IDOC using IDOC_INPUT_ORDERS Function module .
But I am a little confused as to what has to be passed as input_method,mass_processing which are the import parameters of this function-module .
If anyone has a sample code program using function module IDOC_INPUT_ORDERS , please could you share it with me .
Regards,
Sushanth H.S.Hi Sushanth,
IDOC_INPUT_ORDERS is a posting program.
This program uploads the idic to the database table.
Thatis it converts the idoc format to the SAP format.
I have created a sample posting program.
Please go through it.
*& Report Z_FI_UTIL_EXCEL2GL_POSTING *
REPORT Z_FI_UTIL_EXCEL2GL_POSTING.
include <icon>.
*/ =================================================================== *
CONSTANTS: on VALUE 'X',
off VALUE ' ',
tabx TYPE X VALUE '09',
c_e1bpache08 TYPE edilsegtyp VALUE 'E1BPACHE08',
c_e1bpacgl08 TYPE edilsegtyp VALUE 'E1BPACGL08',
c_e1bpaccr08 TYPE edilsegtyp VALUE 'E1BPACCR08'.
TYPES: BEGIN OF t_tab_index,
from TYPE i,
to TYPE i,
END OF t_tab_index.
data : tab type c.
DATA:
e1bpache08 LIKE e1bpache08,
e1bpacgl08 LIKE e1bpacgl08,
e1bpaccr08 LIKE e1bpaccr08.
DATA: g_subrc TYPE subrc.
DATA: g_file TYPE string.
DATA: g_segname TYPE edilsegtyp.
DATA: g_sdata TYPE edi_sdata.
DATA: g_first_doc.
DATA: i_dataf TYPE char2000 OCCURS 900 WITH HEADER LINE,
i_dataf_doc TYPE char2000 OCCURS 50 WITH HEADER LINE.
DATA: g_tab_index TYPE t_tab_index OCCURS 100 WITH HEADER LINE.
DATA: i_accountgl TYPE bapiacgl08 OCCURS 100 WITH HEADER LINE,
i_curramnt TYPE bapiaccr08 OCCURS 100 WITH HEADER LINE,
i_return TYPE bapiret2 OCCURS 10 WITH HEADER LINE,
g_docheader TYPE bapiache08.
*/ ======================== SELECTION ================================ *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
PARAMETERS: excelf TYPE file_name LOWER CASE
DEFAULT 'C:\my_excel_file.txt'.
SELECTION-SCREEN END OF BLOCK b1.
*/ =========================== CORE ================================== *
START-OF-SELECTION.
*/ Call text File with GUI_UPLOAD
g_file = excelf.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = g_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = i_dataf
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
IF sy-subrc <> 0.
write: / Text-032.
stop.
ENDIF.
*/ Initialisation
write tabx to tab. " required as of ABAP 610 split cannot
*/ have mixed char and byte types
CLEAR g_tab_index.
REFRESH g_tab_index.
*/ how to process several doc : detecting docs in i_dataf
g_first_doc = on.
LOOP AT i_dataf.
CLEAR: g_segname, g_sdata.
SPLIT i_dataf AT tab INTO g_segname g_sdata.
CHECK: g_segname = c_e1bpache08,
sy-tabix > 1.
*/ 1st document
IF g_first_doc = on.
g_tab_index-from = 1.
g_tab_index-to = sy-tabix - 1.
APPEND g_tab_index.
*/ Next Documents
ELSE.
g_tab_index-from = g_tab_index-to + 1.
g_tab_index-to = sy-tabix - 1.
APPEND g_tab_index.
ENDIF.
g_first_doc = off.
ENDLOOP.
*/ Last doc.
g_tab_index-from = g_tab_index-to + 1.
g_tab_index-to = sy-tfill.
APPEND g_tab_index.
*/ Process documents.
loop at g_tab_index.
clear i_dataf_doc.
refresh i_dataf_doc.
append lines of i_dataf from g_tab_index-from
to g_tab_index-to
to i_dataf_doc.
perform process_document.
endloop.
END-OF-SELECTION.
*/ =========================== ROUTINES ============================== *
FORM process_document *
FORM process_document.
*/ Clearing Memory
CLEAR: g_docheader, i_accountgl, i_curramnt, i_return, g_subrc.
REFRESH: i_accountgl, i_curramnt, i_return.
*/ Checking i_dataf_doc
*/ Mapping dataf => Bapi structures & internal tables
CLEAR g_subrc.
CATCH SYSTEM-EXCEPTIONS conversion_errors = 1.
LOOP AT i_dataf_doc.
CLEAR g_sdata.
SPLIT i_dataf_doc AT tab INTO g_segname g_sdata.
CASE g_segname.
*/ HEADER
WHEN c_e1bpache08.
PERFORM do_split_ache08.
MOVE-CORRESPONDING e1bpache08 TO g_docheader.
IF e1bpache08-doc_date IS INITIAL.
CLEAR g_docheader-doc_date.
ENDIF.
IF e1bpache08-pstng_date IS INITIAL.
CLEAR g_docheader-pstng_date.
ENDIF.
IF e1bpache08-trans_date IS INITIAL.
CLEAR g_docheader-trans_date.
ENDIF.
*/ Account GL
WHEN c_e1bpacgl08.
PERFORM do_split_acgl08.
MOVE-CORRESPONDING e1bpacgl08 TO i_accountgl.
IF e1bpacgl08-pstng_date IS INITIAL.
CLEAR i_accountgl-pstng_date.
ENDIF.
APPEND i_accountgl.
*/ Account Currency & Amounts
WHEN c_e1bpaccr08.
PERFORM do_split_accr08.
MOVE-CORRESPONDING e1bpaccr08 TO i_curramnt.
APPEND i_curramnt.
*/ kick the line if segment name not filled
WHEN space.
*/ Other names => Bad file structure !
WHEN OTHERS.
g_subrc = 2.
ENDCASE.
ENDLOOP. " i_dataf_doc
ENDCATCH.
*/ erreur d'affectation
IF sy-subrc = 1 OR
NOT g_subrc IS INITIAL.
perform message_output using on.
exit.
ENDIF.
*/ Calling the BAPI
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
documentheader = g_docheader
IMPORTING
OBJ_TYPE =
OBJ_KEY =
OBJ_SYS =
TABLES
accountgl = i_accountgl
currencyamount = i_curramnt
return = i_return
EXTENSION1 =
LOOP AT i_return WHERE type CA 'AE'.
g_subrc = 1.
EXIT.
ENDLOOP.
IF NOT g_subrc IS INITIAL.
perform message_output using on.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
perform message_output using off.
ENDIF.
ENDFORM.
*& Form do_split_ACHE08
text
--> p1 text
<-- p2 text
FORM do_split_ache08.
CLEAR e1bpache08.
SPLIT g_sdata AT tab INTO
e1bpache08-obj_type
e1bpache08-obj_key
e1bpache08-obj_sys
e1bpache08-username
e1bpache08-header_txt
e1bpache08-obj_key_r
e1bpache08-comp_code
e1bpache08-ac_doc_no
e1bpache08-fisc_year
e1bpache08-doc_date
e1bpache08-pstng_date
e1bpache08-trans_date
e1bpache08-fis_period
e1bpache08-doc_type
e1bpache08-ref_doc_no
e1bpache08-compo_acc
e1bpache08-reason_rev
ENDFORM. " do_split_ACHE08
*& Form do_split_ACGL08
text
--> p1 text
<-- p2 text
FORM do_split_acgl08.
CLEAR e1bpacgl08.
SPLIT g_sdata AT tab INTO
e1bpacgl08-itemno_acc
e1bpacgl08-gl_account
e1bpacgl08-comp_code
e1bpacgl08-pstng_date
e1bpacgl08-doc_type
e1bpacgl08-ac_doc_no
e1bpacgl08-fisc_year
e1bpacgl08-fis_period
e1bpacgl08-stat_con
e1bpacgl08-ref_key_1
e1bpacgl08-ref_key_2
e1bpacgl08-ref_key_3
e1bpacgl08-customer
e1bpacgl08-vendor_no
e1bpacgl08-alloc_nmbr
e1bpacgl08-item_text
e1bpacgl08-bus_area
e1bpacgl08-costcenter
e1bpacgl08-acttype
e1bpacgl08-orderid
e1bpacgl08-orig_group
e1bpacgl08-cost_obj
e1bpacgl08-profit_ctr
e1bpacgl08-part_prctr
e1bpacgl08-wbs_element
e1bpacgl08-network
e1bpacgl08-routing_no
e1bpacgl08-order_itno
ENDFORM. " do_split_ACGL08
*& Form do_split_ACCR08
text
--> p1 text
<-- p2 text
FORM do_split_accr08.
data: l_filler(100).
CLEAR e1bpaccr08.
SPLIT g_sdata AT tab INTO
e1bpaccr08-itemno_acc
e1bpaccr08-curr_type
e1bpaccr08-currency
e1bpaccr08-currency_iso
e1bpaccr08-amt_doccur
e1bpaccr08-exch_rate
e1bpaccr08-exch_rate_v
l_filler
ENDFORM. " do_split_ACCR08
*& Form message_output
text
--> p1 text
<-- p2 text
FORM message_output using if_error.
data: l_message(200),
l_return type i.
format color 1.
skip.
write: / text-020, g_tab_index-from,
text-021, g_tab_index-to.
skip.
if if_error = on.
write: / icon_red_light as icon, text-030 color 6.
else.
write: / icon_green_light as icon, text-031 color 5.
endif.
describe table i_return lines l_return.
if l_return is initial.
write: / text-032.
endif.
loop at i_return.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = i_return-id
LANG = sy-langu
NO = i_return-number
V1 = i_return-MESSAGE_V1
V2 = i_return-MESSAGE_V2
V3 = i_return-MESSAGE_V3
V4 = i_return-MESSAGE_V4
IMPORTING
MSG = l_message
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
check sy-subrc = 0.
write: / l_message.
endloop.
ENDFORM. " message_output
Tell me ur mailid. I will sen u more.
<b>Please reward if helpful.</b> -
Help on ABAP Function Module (Unit 1)
Hello ABAP Experts,
I need help with the below mentioned lesson plan. I donot have source code for The ABAP Function Module - BC401_GET_SEP_STRING. For the Source Code Solution in the Lesson Plan to work, I need the source code for the above mentioned function module.
The Lesson Plan with Solution is posted below:
Exercise 1
Unit: Data Types and Data Objects in Detail
Topic: Defining Data Types and Data Objects
Basic Statements
Processing Character Strings
At the conclusion of these exercises, you will be able to:
u2022 Define structure types locally in the program
u2022 Define elementary and complex data objects
u2022 Split strings
u2022 Use conversion rules
u2022 Display the contents of data objects in lists
In this exercise, you will use a template to create a program that receives a single data record from the database table SFLIGHT in form of a character string. The program will split the this character string into its components and display it formatted in a list.
Because the focus of this exercise is not on the transfer of data as a character string, we will use a function module that will provide us with the required database. This will simulate actual cases, such as data transfer from an external system.
Program: ZBC401_##_SPLIT_STRING
Template: SAPBC401_DTOT_SPLIT_STRING
Model solution: SAPBC401_DTOS_SPLIT_STRING
is your two-digit group number
1-1 Copy the program, SAPBC401_DTOT_SPLIT_STRING and give it the new name ZBC401_##_SPLIT_STRING.
1-2 Familiarize yourself with the main body of the program. Pay special attention to the content of the data object datastring after the function module call. Use the Debugger to do this, and/or display the character string in a list. (The function module itself is here seen as a black box. For this exercise, it is not necessary to understand its construction.)
1-3 To be able to split the character string into its components you must first remove the ## characters. Remove the two leading separators from the character string first. Then copy the initial part up to the closing separators to the auxiliary variable set_string. For this, set_string has to be defined appropriately.
1-4 Now use the separators to split the contents of the auxiliary variable set_string into the structure wa_flight_c. The latter is typed with the local program structure type st_flight_c. You still have to comment out the components of this structure type and assign them an appropriate type.
1-5 As a test, display the fields of the structure, wa_flight_c in a list.
1-6 In the list displayed in exercise 1-5, you should have observed that some of the fields were displayed without formatting u2013 for example, the PRICE field. Your next step is to change this.
To do this, convert the data you have extracted by copying it to data objects with suitable types. Also, not all components of wa_flight_c are to be displayed.
For this purpose, a structure wa_flight has already been defined. It is typed with the structure type st_flight. You must comment out the components of st_flight and find appropriate types for these components for the formatting. Then copy the identically-named components of the character-type structure wa_flight_c to the fields of the structure wa_flight.
Display the contents of the structure wa_flight in a list. Use the appropriate formatting options for the WRITE statement for the fldate and price components.
Data Types and Data Objects in Detail Solution 1
Unit: Data Types and Data Objects in Detail
Topic: Defining Data Types and Data Objects
Basic Statements
Processing Character Strings
REPORT sapbc401_dtos_split_string.
TYPES:
BEGIN OF st_flight_c,
mandt(3) TYPE c,
carrid(3) TYPE c,
connid(4) TYPE n,
fldate(8) TYPE n,
price(20) TYPE c,
currency(5) TYPE c,
planetype(10) TYPE c,
seatsmax(10) TYPE n,
seatsocc(10) TYPE n,
paymentsum(22) TYPE c,
seatsmax_b(10) TYPE n,
seatsocc_b(10) TYPE n,
seatsmax_f(10) TYPE n,
seatsocc_f(10) TYPE n,
END OF st_flight_c,
BEGIN OF st_flight,
carrid(3) TYPE c,
connid(4) TYPE n,
fldate TYPE d,
price(9) TYPE p DECIMALS 2,
currency(5) TYPE c,
planetype(10) TYPE c,
seatsmax TYPE i,
seatsocc TYPE i,
END OF st_flight.
DATA:
datastring TYPE string,
set_string TYPE string,
wa_flight_c TYPE st_flight_c,
wa_flight TYPE st_flight.
START-OF-SELECTION.
CALL FUNCTION 'BC401_GET_SEP_STRING'
EXPORTING
IM_NUMBER = '1'
IM_TABLE_NAME = 'SFLIGHT'
IM_SEPARATOR = '#'
IM_UNIQUE = 'X'
IMPORTING
ex_string = datastring
EXCEPTIONS
no_data = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE a038(bc401).
ENDIF.
SHIFT datastring BY 2 PLACES.
FIND '##' IN datastring.
IF sy-subrc <> 0.
MESSAGE a702(bc401).
ENDIF.
SPLIT datastring AT '##' INTO set_string datastring.
SPLIT set_string AT '#' INTO
wa_flight_c-mandt
wa_flight_c-carrid
wa_flight_c-connid
wa_flight_c-fldate
wa_flight_c-price
wa_flight_c-currency
wa_flight_c-planetype
wa_flight_c-seatsmax
wa_flight_c-seatsocc
wa_flight_c-paymentsum
wa_flight_c-seatsmax_b
wa_flight_c-seatsocc_b
wa_flight_c-seatsmax_f
wa_flight_c-seatsocc_f.
MOVE-CORRESPONDING wa_flight_c TO wa_flight.
WRITE: /
wa_flight-carrid,
wa_flight-connid,
wa_flight-fldate DD/MM/YYYY,
wa_flight-price CURRENCY wa_flight-currency,
wa_flight-currency,
wa_flight-planetype,
wa_flight-seatsmax,
wa_flight-seatsocc.this FM is to get one element value from the XML
if you want to convert the whole XML use FM SMUM_XML_PARSE
Regards
Raja
Kindly close your previous threads and assing points.
Re: Creation of SIMPLE TRANSFORMATIO(ST)for deserialisation of XML ->ABAP data. -
Help in ABAP function module coding.
Hi,
i am having trouble coding the program where i have to select a number from the table and add one to it to create a new record back to the table. example, i've select 1 from the table, i need the program to be able to return 2 and create a new record back into the table and the next time i generate the program, i will select 2 and create a 3 into the table. It needed to be a custom function module as i need to call it in another function module which would concatenate the generated number with some words..
i'm very new to abap programing...so could anyone please provide a detailed on how i could code it...
THANKS alot in advance!!!!Hi Lessy,
i have done the same requirement where my sequence number will automatically get incremented by 1 as new record cames for update.as already discussed you have to cretae the numebr range and call the number range by function module 'Number_get_next'.
PFB the code which will definitely help you.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = '01' " specify this number this is
*the same when you cretae numberrange have specified.
OBJECT = 'ZSEQNUM' " This the number range
*i have created
IMPORTING
NUMBER = wa_msg-seqnr
EXCEPTIONS
INTERVAL_NOT_FOUND = 1
NUMBER_RANGE_NOT_INTERN = 2
OBJECT_NOT_FOUND = 3
QUANTITY_IS_0 = 4
QUANTITY_IS_NOT_1 = 5
INTERVAL_OVERFLOW = 6
BUFFER_OVERFLOW = 7
OTHERS = 8.
modify lt_message FROM wa_msg TRANSPORTING seqnr.
to cretete number range.
goto transaction SNRO
enter the name,short text, give the number length domain (char10 or what ever is your domain)
click on number range and cretae interval.
give the number , from number and to number.
this number you have to give in FM also (i have given '01').
hope this will help you.for any problem revert back
thanks
Tanmaya
Code Formatted by: Alvaro Tejada Galindo on Jan 13, 2010 4:16 PM
Edited by: Rob Burbank on Jan 13, 2010 5:20 PM -
Need help for the Function Module 'PFL_GET_PARAMETER_INFO'
Hi Experts,
The FM 'PFL_GET_PARAMETER_INFO' returns the value for Profile Parameters for a system .
The inputs required for this FM are :
1. Parameter name : ( eg . login/min_password_lng etc. )
2 . Parameter Type
I am not sure about what the value of Parameter Type should be .
Its a mandatory field.
I have tried to search but could not find anything.
Can you please help me on this?
Thanks in Advance,
Harshit Rungta
Edited by: harshit rungta on May 27, 2011 8:15 AMWhat exactly is the use-case for this?
Many developers "c-call" the params and neglect this feature of the type - also whether it is static or dynamic. Some params are even dynamic as system profiles in one direction but static as instance parameters in the other direction when changing the value.
As you cannot create your own system profile parameters, I do not see the use-case for why you are wanting to check it in advance, because the application APIs should do this.
What you are possibly looking for is function module SUSR_GENERATE_PASSWORD in this case. It will respect "the rules" in the params.
Do not use the legacy function RSEC_GENERATE_PASSWORD directly.
Cheers,
Julius -
Help with bapi / Function module
Can anybody please provide me a sample source code or example on how to use the function module BAPI_BILLINGDOC_CREATEMULTIPLE for creating billing document?
Thanks in advance,
Krishenhi
hope the following helps u to know what is to be passsed.
1. Required entries :
BILLING_DATA_IN-SALESORG
BILLING_DATA_IN-DISTR_CHAN
BILLING_DATA_IN-DIVISION
BILLING_DATA_IN-DOC_TYPE
BILLING_DATA_IN-ORDBILLTYP
BILLING_DATA_IN-SOLD_TO
BILLING_DATA_IN-ITEM_CATEG
BILLING_DATA_IN-REQ_QTY
BILLING_DATA_IN-SALES_UNIT
BILLING_DATA_IN-CURRENCY
If a material is billed for which a material master needs to be
determined (BILLING_DATA_IN-NO_MATMAST = ' '), you must make the
following entries :
BILLING_DATA_IN-PLANT
BILLING_DATA_IN-MATERIAL
If, on the other hand, a material is billed for which no material
master is to be determined (BILLING_DATA_IN_NO_MATMAST = 'X'), you
must make the following entries :
BILLING_DATA_IN-COUNTRY
BILLING_DATA_IN-MATERIAL
BILLING_DATA_IN-TAXCL_1MAT
2. COMMIT control :
In the update run (TESTRUN = ' ') the update is carried out by
COMMIT
WORK as part of the method available. -
Hi again forum:
I have a program and i need to pass basic functionality to a set of funtion module.
I have a description of a internal table in the program, that i need to use in the function-module
Example:
PROGRAM
" In the top of the program i declared.
"This the actual version
TYPES: BEGIN OF t1
END OF t1.
DATA: it_some TYPE STANDARD TABLE of t1 with header line.
SELECT *
FROM
INTO TABLE it_some.
FUNCTION MODULE
Now in the new version i need to declare an output paramter of type t1 in the exports parameters of the function ZMY_FUNCTION, and t1 is an internal_table, what can i do forum ?..
The thing is that how can i declare an export parameter that is not know?
please help
Thanks
Joshuahi,
we can pass internal table to FM by using CHANGING or TABLE options.
regards,
AshokReddy. -
Hi Gurus,
I have to connect two table through function module in ECC side.
Both table contains some field.
I am not much familiar with ABAP.
So PLease give some demo coding for this.
Coding to connect two tables by function module.
Thanks.
Saurabh JainHi,
Please find the sample code.Here I am extracting data from three tables.
SELECT
a~vbeln
a~MATNR
a~CHARG
a~POSNR
a~SPART
a~ERDAT
a~AEDAT
a~KWMENG
a~PSTYV
c~KUNNR
c~VKGRP
c~VKBUR
c~VTWEG
c~VKORG
c~BUKRS
c~VKGRP
FROM((VBAP AS a INNER JOIN VBPA AS b
ON avbeln = bvbeln
AND aposnr = bposnr)INNER JOIN VBAK AS c ON cvbeln = bvbeln
AND cposnr = bposnr).
Modify in the way you want and Just include these codes into the Funtion module you create.
I Hope it my help you.
Regards,
Prem -
Search help(f4) for function module input
can we create a serch help for function module input giving process
Hello basichodary,
You can encapsulate the function module within a program. Include the search help in a parameter statement in the calling program and pass the parameter to the function module. For example, suppose you want to have field i_carrid to have a search help. Use the following code.
report call_function_module.
parameters p_carrid type s_carr_id matchcode object demo_f4_de.
call function 'FUNCTION_MODULE'
exporting
i_carrid = p_carrid
Kind Regards,
Rae Ellen Woytowiez -
Please help with some function module
Dear All,
We are trying to get data for excise duties based eg. BED, ECS, SECESS in the PO printout. Can anyone please suggest any function module through which excise duty can be calculated. For condition types other than ED we are using function module CALCULATE_TAX_ITEM. Please help.
Thanks and regards,
AtanuDear All,
We are trying to get data for excise duties based eg. BED, ECS, SECESS in the PO printout. Can anyone please suggest any function module through which excise duty can be calculated. For condition types other than ED we are using function module CALCULATE_TAX_ITEM. Please help.
Thanks and regards,
Atanu -
Please help with 'Pricing' function module
Hi!
I am trying to use function module 'Pricing' but the table it_komv is still empty even after calling. I am basically trying to print some free of charge items on invoice sapscript and hence I am using 'Pricing' function in the print program. I am passing the below parameters. Please tell me whatelse I need to pass/not to pass.
wa_komk-mandt = sy-mandt.
wa_komk-kalsm = vbdkr-kalsm.
wa_komk-kappl = 'V'.
wa_komk-waerk = vbdkr-waerk.
wa_komk-knumv = vbdkr-knumv.
wa_komk-knuma = vbdkr-knuma.
wa_komk-vbtyp = vbdkr-vbtyp.
wa_komk-land1 = vbdkr-land1.
wa_komk-vkorg = vbdkr-vkorg.
wa_komk-vtweg = vbdkr-vtweg.
wa_komk-spart = vbdkr-spart.
wa_komk-prsdt = vbdkr-erdat.
wa_komk-kurst = vbdkr-kurst.
wa_komk-kurrf = vbdkr-kurrf.
wa_komk-kurrf_dat = vbdkr-kurrf_dat.
wa_komp-kposn = vbdpr-posnr.
wa_komp-kursk = vbdpr-kursk.
wa_komp-kursk_dat = vbdpr-kursk_dat.
wa_komp-werks = vbdpr-werks.
CALL FUNCTION 'PRICING'
EXPORTING
CALCULATION_TYPE = 'A'
comm_head_i = wa_komk
comm_item_i = wa_komp
PRELIMINARY = ' '
NO_CALCULATION = ' '
IMPORTING
comm_head_e = wa_komk
comm_item_e = wa_komp
TABLES
tkomv = it_komv
SVBAP =
CHANGING
REBATE_DETERMINED = ' '
Thanks a lot!Hi,
Check this example..
tables: vbdkr.
data: s_komk type KOMK.
data: s_komp type komp.
data: t_komv like KOMV occurs 0 with header line.
data: t_komvd like komvd occurs 0 with header line.
Input
s_komk-mandt = sy-mandt.
s_komk-knumv = vbdkr-knumv.
CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
EXPORTING
comm_head_i = s_komk
comm_item_i = s_komp
tables
tkomv = t_komv
tkomvd = t_komvd
You can check the program RVADIN01 for a sample..
Hope this helps..
Thanks,
Naren -
Please help regarding the function module 'MESSAGE_TEXT_BUILD'
hii i am a new employee.
can anyone please explain wat the following code is doing
IF sy-subrc = 0.
l_mstring = t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH wa_messtab-msgv1 INTO l_mstring.
REPLACE '&2' WITH wa_messtab-msgv2 INTO l_mstring.
REPLACE '&3' WITH wa_messtab-msgv3 INTO l_mstring.
REPLACE '&4' WITH wa_messtab-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH wa_messtab-msgv1 INTO l_mstring.
REPLACE '&' WITH wa_messtab-msgv2 INTO l_mstring.
REPLACE '&' WITH wa_messtab-msgv3 INTO l_mstring.
REPLACE '&' WITH wa_messtab-msgv4 INTO l_mstring.
ENDIF.
CONDENSE l_mstring.
i am supposed to use a function module for it
i have got a function module.
but i am not understanding wat fields shd i put in it
the function module is
CALL FUNCTION <b>'MESSAGE_TEXT_BUILD'</b>
EXPORTING
msgid =
msgnr =
MSGV1 = ' '
MSGV2 = ' '
MSGV3 = ' '
MSGV4 = ' '
IMPORTING
MESSAGE_TEXT_OUTPUT =
can anyone tell wat shd i put on msgid ,msgnr and other fields.
[email protected]Hello,
Guid for unique identification assigned list
It think it will generate the one unique key in the program.
DATA: con_log_guid TYPE guid_16.
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_16 = con_log_guid.
WRITE con_log_guid .
Try this example it is generating a 16number id. -
Help regarding the Function Module GUID_CREATE
Hi Experts,
Can some one explain the functionality of GUID_CREATE function module.Thanks in advance.
With regards,
Srini...Hello,
Guid for unique identification assigned list
It think it will generate the one unique key in the program.
DATA: con_log_guid TYPE guid_16.
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_16 = con_log_guid.
WRITE con_log_guid .
Try this example it is generating a 16number id. -
Pls help in WEBDYNPRO Function Module 'RFC_START_PROGRAM' not found error
Dear Friends,
While i am calling one function module in webdynpro the follwing erroe is coming.
Error:-
Function Module 'RFC_START_PROGRAM' not found error
Code:-
CALL FUNCTION 'ZUPDATE' DESTINATION 'PCNCLNT300'
EXPORTING
im_material = item_matnr
im_vornr = item_vornr
im_sheet = item_sheet
IMPORTING
value = ZMESSAGE .Hi,
try declarig variable of type rfc_dest
data: lv_dest type rfc_dest.
call....
destination lv_dest
offcourse make sure your rfc destination has that name in sm59
and you have the corect authorizations to your user in the remote system
Are you btw sure that there is no screen action called inside
the function module? popup or something? because you cannot
call functions that have screen interaction like in sapgui
grtz,
Koen -
Need help in inbound function module !
What is the meaning of this in the inbound function module ?
WORK_RESULT = C_WF_RESULT_OK.
In my function module its showing some error !Might be a constant C_WF_RESULT_OK is assigned to
variable WORK_RESULT .
Please check if they are declared in the function module ..
Maybe you are looking for
-
Mac formatted ipod stuck in recovery mode when rescuing tunes onto a PC
Hi I have an ipod Nano (6gb) that is Mac formatted. I tried to recover the tunes from it to a PC desktop with Xplay. It started ok and then the ipod entered into recovery mode so it could be reformatted for Windows (I think itunes started doing it).
-
Running Final Cut Pro on 1280 X 720, 60 Hz, Millions
I just updated to Final Cut Pro Suite 2 but Final Cut Pro, Compressor, & DVD Studio Pro wont open with my display selected to 1280 X 720, 60 Hz, Millions. It demands that I have it set to 1024 X 768, 75 Hz, Millions, which looks like trash. Anyone ti
-
MORE A CRY FOR HELP THEN A QUESTION-THANKS! I'm having some diffucilites debugging errors produced by my binary search tree class. Spent alot of time trying correct them but just doesn't seem to be working for me :|!. I'm working with two main classe
-
Emailbody using SQL: Align Table with Headers
I have a requirement, Where I need to align header and table contents , as a part EMAIL body in HTML format. I'm getting the resultset from a table. Here is the output Rows in these Columns have following maximum length: Table Name :Maximum length of
-
Active Sync / Exchange - Deleting Emails when offline
I am running Activesync to connect to my Exchange server. All things work great, except for one issue. When I am offline (i.e. no cell service, in an airplane, etc.), I am unable to delete emails or move them to one of my folders. It only seems to le