Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

calling SAPF124 to z program

Former Member
0 Kudos
995

Hi experts,

I am calling the program SAPF124 to one function module using keyword SUBMIT and return.

while calling the program in function module it show the STD report out .. but it shouldn't show the std output , i just want to capture the message and send to the function as output. for that i have created the program in Z as ZSAPF124.

now i want to capture the message and want to pass it to function module i have used the

I have used the importing and exporting also

like

append fehlprot-text to it.

free memory id 'ABC'.

export it_log to memory id 'ABC'.

but i couldn capture the message .it shows the std output screen only

Thanks in advance

ajay

1 ACCEPTED SOLUTION

deepak_dhamat
Active Contributor
0 Kudos
744

Hi ,

Which message you want to Capture ?

regards

Deepak.

17 REPLIES 17

deepak_dhamat
Active Contributor
0 Kudos
745

Hi ,

Which message you want to Capture ?

regards

Deepak.

0 Kudos
744

Hi expert,

i just want to capture the error log message alone..

for example if ve executed the program SAPF124

the below message i want to capture in function module and display in the output.

Error Log

No clearing procedures were carried out

Thanks ,

Ajay.

0 Kudos
744

Hi ,

Check my previous Solution you will get all data .

just change name of report and parameter as per your requirment .

[Retrieving ALV grid from Submit statement|]

if any problem Revert ..

regards

Deepak.

0 Kudos
744

Hi deepak,

Hope you would ve wrongly understood my requirement.

Actually if i execute the program means i will get a output. in one screen.

I dont want that output. i just want to pass the value from that report to one function module like zsap_module

and i just want to show only the message not the values or the screen.

kindly advice me how to resolve this .

Regards,

AJay

0 Kudos
744

Hi ,

Shri What you have to do is , After executing Report using Submit , you need to get data from that report .

using that data you can pass on to other function module .

regards

Deepak.

744

Hi ,

This is What you want .

Just Copy this code in your ABAP REPORt and change company code and year will give Result .

DATA :lt_selscreen  TYPE TABLE OF rsparams WITH HEADER LINE .

lt_selscreen-SELname = 'BUKRX'.   " Company Code 
 lt_selscreen-sign = 'I'.
      lt_selscreen-option = 'EQ'.
      lt_selscreen-low = 'BFL'.
      append lt_selscreen.

      lt_selscreen-SELname = 'GJAHX'.  " Year  
 lt_selscreen-sign = 'I'.
      lt_selscreen-option = 'EQ'.
      lt_selscreen-low = '2011'.
      append lt_selscreen.



data : listtab        like abaplist occurs 1 .
data : txtlines(20000) type c occurs 0 with header line.
data : n     type int2 .
data : cnt   type i value 1 .
data : delimiter(1) value '|'.

submit SAPF124  WITH SELECTION-TABLE lt_selscreen with x_shblf = 'X'
                   exporting list to memory
                  and return .


call function 'LIST_FROM_MEMORY'
  tables
    listobject = listtab
  exceptions
    not_found  = 1
    others     = 2.

*if sy-subrc <> 0.
*
*endif.

call function 'LIST_TO_ASCI'
  tables
    listobject         = listtab
    listasci           = txtlines
  exceptions
    empty_list         = 1
    list_index_invalid = 2
    others             = 3.



describe table txtlines lines n .

data : final_message(40) type c,
       one_less type  i  .


 one_less = n - 1  .



loop at txtlines.


  if cnt =   one_less   .

    final_message  = txtlines .

  endif.

  cnt = cnt + 1 .
  clear txtlines .



  endloop.


write  : Final_message .

"Your Error log message will be in Final_mesage Varaible .

regards

deepak.

Edited by: Deepak Dhamat on Nov 27, 2011 10:48 AM

Edited by: Deepak Dhamat on Nov 27, 2011 10:54 AM

0 Kudos
744

Hi Deepak ,

Great. Really ur code helped me a lot.. Thanks a lot ji,, Can i get ur mobile no?

Thanks ,

Ajay

0 Kudos
744

Hi experts,

I have used ur code . if its test run i am able to fetch the message if its its production run means its not fetching any message from the database.

Just remove the tick mark from the test run n execute.

kindly check and guide me thanks in advance.

Reagrds,

Ajay.

0 Kudos
744

Hi ,

Check if there is some settings left in OB74

regards

Deepak.

0 Kudos
744

Hi ,

it is just message that it is not test run => After enter it will actually update database .

regards

deepak.

0 Kudos
744

Hi Deepak ,

I ve checked OB74 Setting .. but stil it remains the same.

Thanks,

Ajay

0 Kudos
744

Hi Deepak,

if its not test run ,. its production run. we need it to test in production run only . if i run production run means its not displaying any records,

Kindly help me to reslove this issue

Thanks ,

AJAY.

0 Kudos
744

hI ,

When you are running in Prduction : it is actually updating or Clearing Account .

what message it will be giving after executing report , it will be there .

You need to execute that and Check , There is no other option , Better Test the same in SANDBOX .

regards

Deepak.

0 Kudos
744

Hi deepak,

i Can understand ... i have one more doubt actually u ve hard coded the company code n year ..

For ma case i should pass the company code n year from outside... user ll give any company code or year.. so through function module i should give input to the program SAPF124.

Hope u understood my requirement now. Kindly help me to resolve this .

Thanks in advance. can i get ur mob no ?

Regards,

AJay.

0 Kudos
744

Hi Deepak,

Thanks a lot for spending your valuable time for me to solve this issue.

Greatfull thanks to u Deepak..

Regards,

Ajay.

744

Hi ,

There is no need of function module ,

You can pass those Company code and Year using parameter to ranges or directly to submit report .

parameters :    p_comp type  bseg-bukrs     ,
                     p_gjahr        type  bseg-gjahr .

**
 DATA :lt_selscreen  TYPE TABLE OF rsparams WITH HEADER LINE .

      lt_selscreen-SELname = 'BUKRX'.
      lt_selscreen-sign = 'I'.
      lt_selscreen-option = 'EQ'.
      lt_selscreen-low = p_comp.
      append lt_selscreen.

      lt_selscreen-SELname = 'GJAHX'.
      lt_selscreen-sign = 'I'.
      lt_selscreen-option = 'EQ'.
      lt_selscreen-low = p_gjahr.
      append lt_selscreen.

regards

Deepak.

0 Kudos
121

or pass directly the values to SAPF124 without using LT_SELSCREEN:

submit SAPF124  WITH x_shblf = 'X'
                WITH BUKRX = p_comp   " Company Code ('BFL')
                WITH GJAHX = p_gjahr  " Year ('2011')
                exporting list to memory
                and return.
*submit SAPF124  WITH SELECTION-TABLE lt_selscreen with x_shblf = 'X'