‎2011 Dec 03 9:39 AM
Hi experts,
I am calling the SAPF124 program into function module .....i have the posting date as range
in function moduel i want to pass through range can anyone help me how to pass it
if its from and to range means i am able to pass it easily.
but if its range like 1 3 5 means i m unable to pass. kindly help me to sort out this issue.
Regards,
Ajay.
‎2011 Dec 03 1:22 PM
Hi Ajay,
Postdate is a SELECT-OPTION.
So you import whole range table into that in below format.
Take reference from below code.
DATA : z_budat TYPE RANGE OF budat,
wa_budat LIKE LINE OF z_budat.
clear wa_budat.
wa_budat-low = '20111001'.
wa_budat-sign = 'I'.
wa_budat-option = 'EQ'. <---pass 'EQ' here
APPEND wa_budat TO z_budat
clear wa_budat.
wa_budat-low = '20111003'.
wa_budat-sign = 'I'.
wa_budat-option = 'EQ'. <---pass 'EQ' here
APPEND wa_budat TO z_budat
clear wa_budat.
wa_budat-low = '20111005'.
wa_budat-sign = 'I'.
wa_budat-option = 'EQ'. <---pass 'EQ' here
APPEND wa_budat TO z_budat
clear wa_budat.
submit ZSAPF124 WITH BUKRX eq I_COMPCODE
WITH GJAHX eq I_YEAR
WITH POSTDATE IN z_buda <--pass date range here
WITH DOCNR EQ I_FORMAT-BELNR <---here also pass whole select option table or range table as per your requirrement
WITH KONTD eq I_KUNNR
with X_KUNNR eq I_KUNNR1
exporting list to memory
and return .Try this and let me know if you still face issues.
Imp- The looping which you are using. i think you are wrong there.
I dont see any use of looping while using submit statement.
You can import whole SELECT-OPTION table there.
BR,
Vijay
‎2011 Dec 03 10:10 AM
Hi Ajay,
Use below code for reference.
DATA : z_budat TYPE RANGE OF budat,
wa_budat LIKE LINE OF z_budat.
wa_budat-low = '20111001'.
wa_budat-sign = 'I'.
wa_budat-option = 'BT'.
wa_budat-high = '20111031'.
APPEND wa_budat TO z_budat
clear wa_budat.
SUBMIT Program WITH s_budat IN z_budat and return.BR,
Vijay
‎2011 Dec 03 10:21 AM
hi ,
wa_budat-low = '20111001'.
wa_budat-sign = 'I'.
wa_budat-option = 'BT'.
append wa_budat .
wa_budat-low = '20111003'.
wa_budat-sign = 'I'.
wa_budat-option = 'BT'.
append wa_budat .
wa_budat-low = '20111005'.
wa_budat-sign = 'I'.
wa_budat-option = 'BT'.
append wa_budat ." Just append in low value and pass it .
regards
Deepak.
‎2011 Dec 03 10:46 AM
Hi Vijay
In ma requirement i should pass the input from the function module
like
I_compcode
i_year
I_docnr
I_date
In this i should pass the range
regards,
Ajay
‎2011 Dec 03 10:49 AM
Hi,
If you want to pass three different value then use 'EQ' in option.
See below code.
DATA : z_budat TYPE RANGE OF budat,
wa_budat LIKE LINE OF z_budat.
clear wa_budat.
wa_budat-low = '20111001'.
wa_budat-sign = 'I'.
wa_budat-option = 'EQ'. <---pass 'EQ' here
APPEND wa_budat TO z_budat
clear wa_budat.
wa_budat-low = '20111003'.
wa_budat-sign = 'I'.
wa_budat-option = 'EQ'. <---pass 'EQ' here
APPEND wa_budat TO z_budat
clear wa_budat.
wa_budat-low = '20111005'.
wa_budat-sign = 'I'.
wa_budat-option = 'EQ'. <---pass 'EQ' here
APPEND wa_budat TO z_budat
clear wa_budat.BR,
Vijay
‎2011 Dec 03 10:58 AM
Hi Vijay,
I can understand your guidelines. i wanna know how to pass more values in function . In function module i can pass one value like
Import Paramter
Compcode : ABC
Year : 2011
Date : here i can give only one date as 03-12-2011
In this date i should pass many input ..
Kindly help me to resolve this issue
Regards
AJay
‎2011 Dec 03 11:01 AM
Hi ,
add one table in import parameters with date as one column .
pass it to function module in table format .
regards
Deepak.
‎2011 Dec 03 11:09 AM
Hi Deepak,
I have created one structure in input parameter but it will accept only one date only . so that i have added one structure in tables parameters , in which it will accept many input.
But while passing like
in this i have created date and document number in i_format structure.
but this is not working .
LOOP AT I_FORMAT[] into I_FORMAT.
submit ZSAPF124 WITH BUKRX eq I_COMPCODE
WITH GJAHX eq I_YEAR
WITH POSTDATE eq I_FORMAT-budat
WITH DOCNR EQ I_FORMAT-BELNR
WITH KONTD eq I_KUNNR
with X_KUNNR eq I_KUNNR1
exporting list to memory
and return .
ENDLOOP.
Edited by: srinivasan12345 on Dec 3, 2011 12:10 PM
‎2011 Dec 03 1:22 PM
Hi Ajay,
Postdate is a SELECT-OPTION.
So you import whole range table into that in below format.
Take reference from below code.
DATA : z_budat TYPE RANGE OF budat,
wa_budat LIKE LINE OF z_budat.
clear wa_budat.
wa_budat-low = '20111001'.
wa_budat-sign = 'I'.
wa_budat-option = 'EQ'. <---pass 'EQ' here
APPEND wa_budat TO z_budat
clear wa_budat.
wa_budat-low = '20111003'.
wa_budat-sign = 'I'.
wa_budat-option = 'EQ'. <---pass 'EQ' here
APPEND wa_budat TO z_budat
clear wa_budat.
wa_budat-low = '20111005'.
wa_budat-sign = 'I'.
wa_budat-option = 'EQ'. <---pass 'EQ' here
APPEND wa_budat TO z_budat
clear wa_budat.
submit ZSAPF124 WITH BUKRX eq I_COMPCODE
WITH GJAHX eq I_YEAR
WITH POSTDATE IN z_buda <--pass date range here
WITH DOCNR EQ I_FORMAT-BELNR <---here also pass whole select option table or range table as per your requirrement
WITH KONTD eq I_KUNNR
with X_KUNNR eq I_KUNNR1
exporting list to memory
and return .Try this and let me know if you still face issues.
Imp- The looping which you are using. i think you are wrong there.
I dont see any use of looping while using submit statement.
You can import whole SELECT-OPTION table there.
BR,
Vijay
‎2011 Dec 03 1:30 PM
Hi Vijay,
have a doubt in low you have hard coded the date but here we should not hard code it . user will give the document date
Kindly help me to over come this issue.
Regards,
Ajay.
‎2011 Dec 03 1:59 PM
Ajay,
For date what you declared in selection screen like have you using SELECT-OPTION or PARAMETERS.
BR,
Vijay
‎2011 Dec 03 2:08 PM
Hi Vijay
I have declared in Select options only ..
i have used the code which u ve suggested me but it shows the error in screen as
wrong type passing to the parameter .
Regards,
AJay
‎2011 Dec 03 2:22 PM
Hi Ajay,
Use in below way.
tables : BKPF.
SELECT-OPTIONS: s_postdate FOR bkpf-budat. <--declaration for date
SELECT-OPTIONS: s_docnr FOR bseg-belnr. <--declaration for belnr
submit ZSAPF124 WITH BUKRX eq I_COMPCODE
WITH GJAHX eq I_YEAR
WITH POSTDATE IN s_postdate <--pass date select option table
WITH DOCNR IN s_docnr <---here also pass whole select option table
WITH KONTD eq I_KUNNR
with X_KUNNR eq I_KUNNR1
exporting list to memory
and return .test above by passing only three dates in LOW in selection screen and see whether you are getting correct data or not.
BR,
Vijay
‎2011 Dec 03 2:25 PM
Hi Vinod,
Kindly help me to over come this issues.
DATA : z_belnr TYPE RANGE OF belnr_d,
wa_belnr LIKE LINE OF z_belnr.
I have declared the belnr in one structure with belnr field alone.
And i am passing the belnr value in tables parameter in Function module.so that it will fetch n number of entries
Passing the value from i_format structure to z_belnr, and then i am passing the z_belnr to the zprogram
This is wat ma requuirement .
LOOP AT I_FORMAT[] into I_FORMAT.
wa_belnr-low = I_FORMAT.
wa_belnr-sign = 'I'.
wa_belnr-option = 'EQ'.
APPEND wa_belnr TO z_belnr.
clear : wa_belnr,I_FORMAT.
ENDLOOP.
submit ZSAPF124 WITH BUKRX eq I_COMPCODE
WITH GJAHX eq I_YEAR
WITH DOCNR EQ z_belnr
WITH KONTD eq I_KUNNR
with X_KUNNR eq I_KUNNR1
exporting list to memory
and return .
If i pass this value means it shows some error as
Wrong type passing parameters to "DOCNR"
Regards,
Ajay.
‎2011 Dec 03 2:29 PM
Hi Vijay ..
I am extremely sorry for troubling You , We cant pass the select-options in function module rite?
I am getting this error.
Local SELECT-OPTIONS are not allowed (FORM routine or GET event is active). .
Regards,
AJay
9677013978
‎2011 Dec 03 2:34 PM
Hi Ajay,
We cant pass the select-options in function module rite?Can you explain me what is your scenario.
How you are executing this and where you are using this SUBMIT statement.
BR,
Vijay
‎2011 Dec 03 2:42 PM
Hi Vijay,
Actually i have created one functiopn module with
*Inputs :: -- input parameter*
I_COMPCODE LIKE BSEG-BUKRS
I_YEAR LIKE BSEG-GJAHR
I_DATE TYPE BKPF-BUDAT
I_KUNNR LIKE BSEG-KUNNR
I_KUNNR1 LIKE RFPDO-F123KUNN
IN tables
I_FORMAT LIKE ZASDD3(Belnr)
i am calling the zsapf124 in this function module
as below code .through function module i should pass the inputs to the program.
hope i have already attached ma code
DATA : z_belnr TYPE RANGE OF belnr_d,
wa_belnr LIKE LINE OF z_belnr.
LOOP AT I_FORMAT[] into I_FORMAT.
wa_belnr-low = I_FORMAT.
wa_belnr-sign = 'I'.
wa_belnr-option = 'EQ'.
APPEND wa_belnr TO z_belnr.
clear : wa_belnr,I_FORMAT.
ENDLOOP.
submit ZSAPF124 WITH BUKRX eq I_COMPCODE
WITH GJAHX eq I_YEAR
WITH DOCNR EQ z_belnr
WITH KONTD eq I_KUNNR
with X_KUNNR eq I_KUNNR1
exporting list to memory
and return .
Regards,
Ajay.
Edited by: srinivasan12345 on Dec 3, 2011 3:43 PM
‎2011 Dec 03 2:57 PM
submit ZSAPF124 WITH BUKRX eq I_COMPCODE
WITH GJAHX eq I_YEAR
WITH POSTDATE eq I_DATE
WITH DOCNR IN z_belnr <--in case of range use 'IN'
WITH KONTD eq I_KUNNR
with X_KUNNR eq I_KUNNR1
exporting list to memory
and return .Try with above changes.
‎2011 Dec 03 3:01 PM
Hi vijay ,,
Really u helped me a lot.. thank you much vijay ,
10000's of thanks for spending your valuable time for me..
Once again thanks for sparing your time for me to resolve this issue..
Keep in touch n teach me more vijay .
Take care,
Regards,
Ajay.