Function module - Urgent
Hi Friends,
I have a statement as below in one function module :
SELECT a~matnr
INTO TABLE t_mast
FROM mast AS a
INNER JOIN stko AS k
ON astlnr EQ kstlnr
AND astlal EQ kstlal
WHERE a~werks eq plant
AND a~stlal eq alt
AND k~datuv EQ date .
Import parameters are : Plant , Alt and Date.
Here the problem is while I am executing the f/m it is giving the correct values only if input all the input parameters Plant,Alt and Date.If I give Plant and Alt as blank then it is not giving any values from the table.
Could you please telme the resolution for this.
Regards,
Vishnu.
If I am not
You can overcome from this problem by using the RANGES.
Like:
ranges: r_alt for mast-stlal,
r_date for stko-datuv,
r_plant for mast-werks.
if not alt is initial.
r_alt-sign = 'I'.
r_alt-option = 'EQ'.
r_alt-low = alt.
append r_alt.
endif.
if not date is initial.
r_date-sign = 'I'.
r_date-option = 'EQ'.
r_date-low = date.
append r_date.
endif.
if not plant is initial.
r_plant-sign = 'I'.
r_plant-option = 'EQ'.
r_plant-low = plant.
append r_plant.
endif.
SELECT a~matnr
INTO TABLE t_mast
FROM mast AS a
INNER JOIN stko AS k
ON a~stlnr EQ k~stlnr
AND a~stlal EQ k~stlal
WHERE a~werks in r_plant
AND a~stlal in r_alt
AND k~datuv in r_date.
Regards,
Naimesh Patel
Similar Messages
-
Hi,
I need to create a Function Module where this FM should send a document as attachment to the internet mail id , example [email protected]
Please help me out.
Thanks,
Pavan.Hi,
Will a prog. be fine for sending a mail to xternal mail id??
Mail with attachments: SO_NEW_DOCUMENT_ATT_SEND_API1
Mail without attachments: SO_NEW_DOCUMENT_SEND_API1
For Understanding the Function Module
SO_OBJECT_Send:
http://www.thespot4sap.com/articles/SAP_Mail_Understanding_SO_Object_Send.asp
Try this:
REPORT zsendemail .
PARAMETERS: psubject(40) type c default 'Testing',
p_email(40) type c default '[email protected]'.
data: it_packing_list like sopcklsti1 occurs 0 with header line,
it_contents like solisti1 occurs 0 with header line,
it_receivers like somlreci1 occurs 0 with header line,
it_attachment like solisti1 occurs 0 with header line,
gd_cnt type i,
gd_sent_all(1) type c,
gd_doc_data like sodocchgi1,
gd_error type sy-subrc.
data: it_message type standard table of SOLISTI1 initial size 0
with header line.
*START-OF-SELECTION.
START-OF-SELECTION.
Perform populate_message_table.
*Send email message, although is not sent from SAP until mail send
*program has been executed(rsconn01)
PERFORM send_email_message.
*Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
*& Form POPULATE_MESSAGE_TABLE
* Adds text to email text table
form populate_message_table.
Append 'Line1' to it_message.
Append 'Line2' to it_message.
Append 'Line3' to it_message.
Append 'Test- 1' to it_message.
endform. " POPULATE_MESSAGE_TABLE
*& Form SEND_EMAIL_MESSAGE
* Send email message
form send_email_message.
* Fill the document data.
gd_doc_data-doc_size = 1.
* Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = psubject.
gd_doc_data-sensitivty = 'F'.
* Describe the body of the message
* Information about structure of data tables
clear it_packing_list.
refresh it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
describe table it_message lines it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
append it_packing_list.
* Add the recipients email address
clear it_receivers.
refresh it_receivers.
it_receivers-receiver = p_email.
it_receivers-rec_type = 'U'.
append it_receivers.
* Call the FM to post the message to SAPMAIL
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_txt = it_message
receivers = it_receivers
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
* Store function module return code
gd_error = sy-subrc.
* Get it_receivers return code
loop at it_receivers.
endloop.
endform. " SEND_EMAIL_MESSAGE
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
* Instructs mail send program for SAPCONNECT to send email.
form initiate_mail_execute_program.
wait up to 2 seconds.
if gd_error eq 0.
submit rsconn01 with mode = 'INT'
with output = 'X'
and return.
endif.
endform. " INITIATE_MAIL_EXECUTE_PROGRAM
Regards,
Anjali -
Problem in Logical Databse Call via Function Module - Urgent
Hi Experts,
To use the Logical Database(LDB) in the function module(Custom) I am using the function module - LDB_PROCESS. But I didn't get any output. I am attaching the code. Please Help me in this.
DATA : W_LDBNAME LIKE TRDIR-LDBNAME.
DATA : IT_CALLBACK LIKE TABLE OF LDBCB WITH HEADER LINE,
IT_SELECTIONS LIKE TABLE OF RSPARAMS WITH HEADER LINE,
IT_PERNR TYPE TABLE OF PERNR WITH HEADER LINE.
MOVE 'PNP' TO W_LDBNAME.
IT_CALLBACK-LDBNODE = 'PERNR'.
IT_CALLBACK-GET = 'X'.
IT_CALLBACK-CB_PROG = SY-CPROG.
IT_CALLBACK-CB_FORM = 'CALLBACK_PERNR'.
APPEND IT_CALLBACK.
CLEAR IT_CALLBACK.
IT_SELECTIONS-KIND = 'S'.
IT_SELECTIONS-SELNAME = 'PNPPERNR'.
IT_SELECTIONS-SIGN = 'I'.
IT_SELECTIONS-OPTION = 'EQ'.
IT_SELECTIONS-LOW = '100178'.
APPEND IT_SELECTIONS.
CLEAR IT_SELECTIONS.
CALL FUNCTION 'LDB_PROCESS'
EXPORTING
LDBNAME = W_LDBNAME
VARIANT =
EXPRESSIONS =
FIELD_SELECTION =
DYN_NODE_TYPES =
TABLES
CALLBACK = IT_CALLBACK
SELECTIONS = IT_SELECTIONS
EXCEPTIONS
LDB_NOT_REENTRANT = 1
LDB_INCORRECT = 2
LDB_ALREADY_RUNNING = 3
LDB_ERROR = 4
LDB_SELECTIONS_ERROR = 5
LDB_SELECTIONS_NOT_ACCEPTED = 6
VARIANT_NOT_EXISTENT = 7
VARIANT_OBSOLETE = 8
VARIANT_ERROR = 9
FREE_SELECTIONS_ERROR = 10
CALLBACK_NO_EVENT = 11
CALLBACK_NODE_DUPLICATE = 12
CALLBACK_NO_PROGRAM = 13
CALLBACK_NO_CBFORM = 14
DYN_NODE_NO_TYPE = 15
DYN_NODE_INVALID_TYPE = 16
OTHERS = 17.
IF SY-SUBRC <> 0.
MESSAGE I039(ZABA) WITH SY-SUBRC.
ENDIF.
LOOP AT IT_PERNR.
message i039(zaba) with 'Inside loop'.
WRITE : / IT_PERNR-PERNR, IT_PERNR-BUKRS.
ENDLOOP.
*& Form CALLBACK_PERNR
text
-->L_LDBNAME text
-->L_IT_PAYROLL text
-->TYPE text
-->PAY99_REULT text
-->L_EVT text
-->L_CHK text
FORM CALLBACK_PERNR USING L_LDBNAME LIKE TRDIR-LDBNAME
L_IT_PERNR LIKE PERNR
L_EVT type C
L_CHK type C.
message i039(zaba) with 'Inside Callback'.
WRITE : / L_IT_PERNR-PERNR,
L_IT_PERNR-BUKRS.
MOVE-CORRESPONDING L_IT_PERNR TO IT_PERNR.
APPEND IT_PERNR.
CLEAR IT_PERNR.
ENDFORM. "CALLBACK_PERNR
Thanks in advance
Arul Jothi.Hi,
I think Arul commented the 'it_selections' while trying out.. I couldn't get the fm work for PNP.. it worked fine with the FI LDBs.. just didn't seem to like the PNP..
Regards,
Suresh Datti -
Need code for a function module- Urgent
Hi friends,
I have a requirement where I am giving material description as an import parameter in the function module. ( Material description could be a wild search -- say - Mat* ) I want a sub routine in the function module which should get all the materials from the database ( mara or makt..not sure ) for the user entered Material description.
I want this particular code to be written using a sub-routine using formal parameters inside this fm . Could any one send me the code for this.
Thanks in advance,
Vishnu.Hi Vishvanath,,
Please find the below code.
DATA : BEGIN OF itab OCCURS 0,
matnr LIKE makt-MATNR,
MAKTX LIKE makt-MAKTX,
END OF itab.
DATA : BEGIN OF itab1 OCCURS 0,
matnr LIKE makt-MATNR,
MAKTX LIKE makt-MAKTX,
END OF itab1.
data : a(5) type c value 'TEST'.
perform mat_no using a.
form mat_no using p_a.
data : lv_temp(4) type c.
select matnr maktx from makt into table itab.
loop at itab.
lv_temp = itab-maktx+0(4).
if lv_temp = p_a.
move itab to itab1.
APPEND ITAB1.
endif.
endloop.
loop at itab1.
write :/ itab1.
endloop.
endform. " mat_no
Thanks.
Amjad. -
USE of Function module-- urgent
hi,
can any one explain the use of "OPEN_FI_PERFORM_00002050_P "
thnxhi,
go to se37,
and give fm name,
display,
and then u can see function module documentation.
reward points if helpful. -
ABOUT FUNCTION MODULE (urgent)
hi ,
is any one know about below function module.
CUST_ACCT_STMT_REQUEST_LITE
we schedule customer account statement in th background.
we want to add some functionality.
if any one know anything then it will be appreciated.
thans,
jackHi,
I am giving the Function Modules list link, from there you can findout which is suitable for your application:
http://sap-img.com/abap/function-list.htm
Regards,
Bhaskar -
Deleted function module--urgent
Hi all,
By mistake i deleted a z* function module. From version management when i cannot get the function module back. when i press the retrieve button i got an error message saying " deleted function module cannot be recovered".
So please help me in recovering the function module.
Thanks in advance
Regards
SreeHi Srinivas,
I am checking old programs that are going to be copied to new upgrade version... one of them calls a FM that no longer exist, I guess that it was deleted...
I am looking for a way to find a deleted FM (if it was deleted), I just have the FM name, but I don't have the function group.
I guess that without it, it isn't possible to retrieve any old version, if there is one, is it?
Maybe looking in a table? looking for any change request (by the way, my user do not have authorization for SE03).
Regards.
José Gabriel. -
Re:Function modules: urgent
Hi,
Iam copying the standard function module, i have copied the function group also but the includes, subroutines are not getting copied, already my team created function group , the same function group name i gave, any one can help me in this issue
Thanks in advanceHi
Go to se84 Tcode in the left side pane select Program Library and in that select Function Groups, then in the right side pane give ur Function group name and execute, then click the check box of ur function group name and in the menu select Function Groups - Copy and then give the new Function Group name which should with either Z or Y, then it will ask u whether to copy the Function modules or not, click on ok. The Function Modules belong to that Function Group gets copied into ur new Function Group.
Regards
Haritha. -
Urgent: Problems in Generic Extraction by Function Module
Hi BW Gurus,
I am new to SDN and also new to generic extraction using function module. My requirement is to extract long text(142 char) from CRM to BW as the text is not stored in database table I used function module read_text with in another ZXXX function module copy of (RSAX_BIW_GET_DATA_SIMPLE). In my extract structure I used GUID(char,32), Langu, long text(142 char) and 2 placeholders. Text can be extracted by passing STXH table fields(Tdname, Tdid, Tdobject, Tdspars) to read_text as parameters and i also need to use CRMD_ORDERADM_H field GUID(32 char) to compare 1st 32 chars of tdname(70 char) with Guid to select Guids and loop thru this Guids and for each Guid i need to append lines of text to e_t_data but as i donot know ABAP i unable to write the code for this. Through my friends help i wrote code when i check in RSA3 it is displaying the text but when i replicate into BW and load into data target in monitor the status is red with records initially but afterwards it will be red status again with 0 from 0 records for initial load again.when i check on job logs the errors i have are:
The background job has created a job log file of 2Gb size and it is currently on a infinite loop writing entries into the SAP System Log that it cannot write to the Job log file due to Error 22 for write/read access to a file this is because of the datasource i have created. Please find my Function module and if anyone would please correct FM and send me that will be really great.I appreciate it in advance.
MY Function Module is:
FUNCTION Z_CRMORDERH_STR_TXT.
""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 YCRM_TEXT_STR OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
***" EXCEPTIONS NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
Tables: CRMD_ORDERADM_H, STXH.
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.
data: i_crmtext type standard table of TLINE .
types: begin of xsreph ,
GUID type CRMD_ORDERADM_H-guid,
end of xsreph.
data: i_guid type standard table of xsreph.
data: I_TEXT type STXH-TDNAME.
data: xempl like YCRM_TEXT_STR occurs 0 with header line.
data: t_tab like dd03l-tabname.
Select ranges
ranges: l_r_guid for CRMD_ORDERADM_H-guid.
l_r_connid for sflight-connid.
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 'yCRM_TEXT'. " for S_SREPH1
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.
we will do our selection based on what is in the p table for the
infoobject
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 = 'GUID'.
MOVE-CORRESPONDING L_S_SELECT TO L_R_GUID.
APPEND L_R_GUID.
ENDLOOP.
case i_dsource.
when 'YCRM_TEXT'. " for S_SREPH1
t_tab = 'CRMD_ORDERADM_H'.
endcase.
select GUID
from (t_tab)
into table i_guid where PROCESS_TYPE = 'ZACI' and ( OBJECT_ID < '0000000042').
select tdname from stxh into i_text where tdobject = 'TEXT'.
if sy-subrc ne 0.
message e009(r3).
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
'No master data found'. "message variable 2
raise error_passed_to_mess_handler.
endif.
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 CRMD_ORDERADM_H
where GUID in L_R_GUID .
ENDIF.
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.
as we are doing this only once can use the select statement.
***data: crmtext like tline occurs 0 with header line.
**data: i_crmtext type standard table of TLINE.
**data: i_guid type standard table of xsreph.
data: l_guid type THEAD-TDNAME.
data: st_guid type xsreph.
data: st_crmtext type TLINE.
data: lan type THEAD-TDSPRAS.
lan = 'E'.
loop at i_guid into st_guid.
l_guid = st_guid-guid.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'A002'
LANGUAGE = lan
NAME = l_guid
OBJECT = 'CRM_ORDERH'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
LINES = i_crmtext.
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
e_t_data-guid = l_guid.
loop at i_crmtext into st_crmtext.
move lan to e_t_data-langu.
move st_crmtext-tdline to e_t_data-description.
append e_t_data.
endif.
endloop.
clear: st_guid,l_guid.
refresh: i_crmtext.
endloop.
S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
endif.
ENDFUNCTION.
please Gurus as I donot know ABAP i appreciate if anyone would write a FM based on requirement and send me that will be really great this is my request. I gurantee of award points for good answers.
Regards
KishoreHi,
The statement <b>RAISE NO_MORE_DATA</b> should be active (uncommented) in your code. Otherwise, the infinte loop occurs.
See also, the Siggi's blog:
/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
BTW, was it your thread here:
Re: Urgent: problems in extracting Long Text
Best regards,
Eugene -
Very urgent help needed in activating a function module
Hello experts.
I had a standard report and i copied into an z report. i need to change some field output , and that field is there in a standard function module.so i copied that fun module into z fun module and stored in a new fun group. Now it is showing the error in the z fun module. include in the fun module is giving the error stating that it is not existing. please help me in coping the standard fun module correctly . please its very urgent.Hi,
You should not copy a Function module alone, as it will have some dependant INLCUDES and global data in TOP include of the function group.
SO if you want the function module copy the entire Function Group into Z function group.
Regards,
Sesh -
Urgent: Problems in Generic Deltas by Function Module
Hi BW Experts,
My requirement is to extract text from CRM to BW using Zfunction module, copy of RSAX_BIW_GET_SIMPLE_DATA
which works fine for full loads but the problem arises only when i go for generic deltas. My code in FM for Deltas is:
LOOP AT s_s_if-t_select INTO l_s_select.
CASE l_s_select-fieldnm.
WHEN 'ZDATE'.
s_date_from = l_s_select-low.
s_date_to = l_s_select-high.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
IF s_date_from IS INITIAL.
s_date_from = '20060401'.
ENDIF.
IF s_date_to IS INITIAL.
s_date_to = '99991231'.
ENDIF.
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT * FROM STXH
WHERE TDOBJECT = 'CRM_ORDERH'
AND TDID = 'A002'
AND TDSPRAS = sy-langu
and TDLDATE between s_date_from and s_date_to
or tdfdate between s_date_from and s_date_to.
ENDIF.
FETCH NEXT CURSOR S_CURSOR
APPENDING CORRESPONDING FIELDS
OF TABLE wa_stxh
PACKAGE SIZE S_S_IF-MAXSIZE.
TDFDATE is creation date and TDLDATE is changed on
My extract structure contains Zdate(TDLDATE), Ztext1,2,3, Key field and langu in RSO2 I have selected calday in generic delta and Zdate as field Nm and upper limit as 1 and lower limit as space in settings and new status for changed records button.
Did I missed something because when i check in RSA7 i didnot see any changed records under totals column and i tried to load without it into BW than i didnot received single record evenafter changes.Would anyone suggest me the good solution for it I appreciate it in advance. I have seen lot of posts in SDN but I didnot find this type of secenario anywhere.
Thanks in advance
Regards
KishoreKishore,
go through the thread... which i provided for Generic DS using function for CRM Texts.
Re: Urgent: Extraction through function module
Any questions please let me know. If you have any questions update the thread with your mail id.
Replace the code with ...
LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'ZDATE'.
MOVE-CORRESPONDING L_S_SELECT TO L_R_TDLDATE.
APPEND L_R_TDLDATE.
ENDLOOP.
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT * FROM STXH
WHERE TDOBJECT = <Text Object>
AND TDID = <Text ID >
AND TDSPRAS = sy-langu
AND (TDLDATE IN L_R_TDLDATE
or TDFDATE IN L_R_TDLDATE).
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 wa_stxh
PACKAGE SIZE S_S_IF-MAXSIZE.
L_R_TDLDATE will be calculted by the system. Internally, system will save the Last Delta date(you need to enable this field for Generic delta).
all the best.
Regards,
Nagesh Ganisetti. -
Doubt in function module...Urgent!!
hii all
I want to find the difference between sy-datum and BLDAT and have to get only the days value...
for eg...
sydatum(28.11.2007) - bldat(24.11.2007)= Days(4)
4 must the result... so i used the function module C14B_DIFF_BT_2_DATES..
but im unable to get the result...
my code is.....
*& Report ZAGE1
REPORT ZAGE1.
type-pools : slis,icon.
tables : bsid,kna1,knvv.
data : d_fieldcat type slis_t_fieldcat_alv,
d_fieldcat_wa type slis_fieldcat_alv.
data : begin of itab_bsid occurs 0,
kunnr like bsid-kunnr,
bukrs like bsid-bukrs,
bldat like bsid-bldat,
waers like bsid-waers,
belnr like bsid-belnr,
end of itab_bsid.
data : begin of itab_kna1 occurs 0,
kunnr like kna1-kunnr,
end of itab_kna1.
data : begin of itab_knvv occurs 0,
kunnr like knvv-kunnr,
zterm like knvv-zterm,
end of itab_knvv.
data : begin of itab_key occurs 0,
kunnr like bsid-kunnr,
bukrs like bsid-bukrs,
bldat like bsid-bldat,
waers like bsid-waers,
belnr like bsid-belnr,
zterm like knvv-zterm,
due type i,
end of itab_key.
selection-screen : begin of block blk1 with frame title text-001.
parameters : p_cc like bsid-bukrs.
selection-screen : end of block blk1.
select distinct kunnr bukrs bldat waers belnr from bsid into corresponding fields of table itab_bsid where bukrs = p_cc.
if not itab_bsid[] is initial.
select kunnr from kna1 into corresponding fields of table itab_kna1 for all entries in itab_bsid where kunnr = itab_bsid-kunnr.
if not itab_kna1[] is initial.
select kunnr zterm from knvv into corresponding fields of table itab_knvv for all entries in itab_kna1 where kunnr = itab_kna1-kunnr.
endif.
endif.
loop at itab_bsid.
itab_key-kunnr = itab_bsid-kunnr.
itab_key-bukrs = itab_bsid-bukrs.
itab_key-bldat = itab_bsid-bldat.
itab_key-waers = itab_bsid-waers.
itab_key-belnr = itab_bsid-belnr.
append itab_key.
clear itab_key.
endloop.
sort itab_key by kunnr.
loop at itab_key.
read table itab_knvv with key kunnr = itab_key-kunnr.
if sy-subrc = 0.
itab_key-zterm = itab_knvv-zterm.
modify itab_key transporting zterm.
endif.
endloop.
d_fieldcat_wa-fieldname = 'KUNNR'.
d_fieldcat_wa-seltext_l = 'CUSTOMER'.
d_fieldcat_wa-col_pos = 1.
append d_fieldcat_wa to d_fieldcat.
clear d_fieldcat_wa.
d_fieldcat_wa-fieldname = 'BUKRS'.
d_fieldcat_wa-seltext_l = 'COMPANY CODE'.
d_fieldcat_wa-col_pos = 2.
append d_fieldcat_wa to d_fieldcat.
clear d_fieldcat_wa.
d_fieldcat_wa-fieldname = 'WAERS'.
d_fieldcat_wa-seltext_l = 'CURRENCY'.
d_fieldcat_wa-col_pos = 3.
append d_fieldcat_wa to d_fieldcat.
clear d_fieldcat_wa.
d_fieldcat_wa-fieldname = 'BLDAT'.
d_fieldcat_wa-seltext_l = 'DOCUMENT DATE'.
d_fieldcat_wa-col_pos = 4.
append d_fieldcat_wa to d_fieldcat.
clear d_fieldcat_wa.
d_fieldcat_wa-fieldname = 'BELNR'.
d_fieldcat_wa-seltext_l = 'DOCUMENT NO'.
d_fieldcat_wa-col_pos = 5.
append d_fieldcat_wa to d_fieldcat.
clear d_fieldcat_wa.
d_fieldcat_wa-fieldname = 'ZTERM'.
d_fieldcat_wa-seltext_l = 'PAYMENT TERMS'.
d_fieldcat_wa-col_pos = 6.
append d_fieldcat_wa to d_fieldcat.
clear d_fieldcat_wa.
*data : due type i.
loop at itab_key.
CALL FUNCTION 'C14B_DIFF_BT_2_DATES'
EXPORTING
I_DATE_FROM = itab_key-bldat
I_DATE_TO = sy-datum
IMPORTING
E_DAYS = itab_key-due
E_MONTHS = months
E_YEARS = years
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
append itab_key.
endloop.
d_fieldcat_wa-fieldname = 'DUE'.
d_fieldcat_wa-seltext_l = 'DUE DATE'.
d_fieldcat_wa-col_pos = 7.
append d_fieldcat_wa to d_fieldcat.
clear d_fieldcat_wa.
data : gd_repid like sy-repid.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = gd_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = d_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = itab_key[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Urgent plz help me....!!
Regards
AshaCheck the following code for subtract years/months/date from particular date:
DATA: EDAYS LIKE VTBBEWE-ATAGE,
EMONTHS LIKE VTBBEWE-ATAGE,
EYEARS LIKE VTBBEWE-ATAGE.
PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
exporting
i_date_from = FROMDATE
i_date_to = TODATE
I_FLG_SEPARATE = ' '
IMPORTING
E_DAYS = EDAYS
E_MONTHS = EMONTHS
E_YEARS = EYEARS.
WRITE:/ 'Difference in Days ', EDAYS.
WRITE:/ 'Difference in Months ', EMONTHS.
WRITE:/ 'Difference in Years ', EYEARS.
INITIALIZATION.
FROMDATE = SY-DATUM - 60.
For difference between two dates.
data : date1 like sy-datum,
date2 like sy-datum,
diff(10 ) type c.
date1 = '20071003'.
date2 = '20071104' .
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
I_DATUM_BIS = date1
I_DATUM_VON = date2
I_KZ_EXCL_VON = '0'
I_KZ_INCL_BIS = '0'
I_KZ_ULT_BIS = ' '
I_KZ_ULT_VON = ' '
I_STGMETH = '0'
I_SZBMETH = '1'
IMPORTING
E_TAGE = diff
EXCEPTIONS
DAYS_METHOD_NOT_DEFINED = 1
OTHERS = 2
IF SY-SUBRC <> 0 .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF . -
Need a Function Module for fetching the prior date-Urgent!!
Hi All,
I need a function module which will give the prior date with respect to the no: of days days that are entered as input.
Can anyone please help me to fing one function module which acts as the above.
Required very urgently!!!
Thanks and Regards,
NeethuHi Neethu,
Please run the report 'ZRECTIFY_FM_DOCUMENTS' in your system.
Before running the report, create the following selection texts for the parameters/select-options as given below:
P_BUKRS: Company code
S_GJAHR: Fiscal year
S_BELNR: FI document no.
P_TEST: Test run
For More information please refer <b>SAP Note: 309619</b>
Best Regards,
Johnny. -
I'm very new tp SAP ABAP, how to create a function module..V.URGENT
hi folks,
I'm very new to sap abap.
I want to create a function module.
the following is my requirement.
by passing(eporting parameters to funtion module from pgm point of view) a field, i want to get(importing parameters from the funtion module, from pgm point of view) some 7 fields(of various tables).
please also tell me how can code an inner join for tables 5 tables(a,b,c,d,e). i'm joining a on b, b on c, c on d,the problem here is that i can not join d on e as there are no common fields in d and e.
can i join e and c or b, there are no common fields even in a and e.
please tell me the solution as soon as possible, this very important and urgent deliverable.
thanks in advanceHere is link for creating function modules
<a href="http://help.sap.com/saphelp_47x200/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/frameset.htm">Creating Function Modules</a>
Regds
Manohar -
Update Equipment BOM using Function module (very urgent)
Hi All,
I am an ABAPER and trying to update equipemnt BOM.
I want to update equipment BOM using a function module. I am currently using 'CSAI_BOM_MAINTAIN' function module. But i am not able to update the Equipment BOM. After function call the sy-subrc value is 0, even though the BOM is not updated.
Please help its very urgent.
Kind Regards,
Sharat.Hi Sharat,
I am facing the same problem. Could you please let me know what might be the reason.
Plz mail me at [email protected]
Plz update this section once u have mailed the answer.
Thanks a lot in advance.
Regards,
Himanshu
Maybe you are looking for
-
Unable To Build iOS App Using Native Extension
I’m trying to create a native extension for iOS and use that extension as part of an IPA app for iOS I create from a SWF file using the ADT tool (i.e. the normal use-case for iOS). Note: I have already successfully created the native extension and AP
-
Error messages in iTunes!
So, after the last iTunes update everything went pear shaped.... I ended up having to restore my 3GS (without being able to back it up first!) and had to remove and reinstall iTunes 3 times. Everything now finally seems to be working again (no thanks
-
Hi, can someone help please - my iPhone hasn't been backed up since early August, now I can't seem to get it to back up to iCloud. I have 9GB of space, I have left it plugged in etc for 11hrs, but keep getting the same message " iPhone backup could n
-
Change font of a portion of text in ring menu
Hi, I would like to change the font of a portion of a text in a ring menu but it seems that it's more complicated than expected. I tried to adapt this (http://digital.ni.com/public.nsf/allkb/6BD344ACA4DEE20A8625692700737E16) to my purpose. Here is m
-
Build Cancelled due to Language Code
My build is canceling during the initial compiler phase stating " Language cods for 'English' and 'English-2' must differ " Please advise! Heather