06-28-2007 8:13 PM
Hi,
My program should call MB5S, and catch the results of it to an internal table. Is this technically possible ? Once this is done, here is the remaining process. I have to look for shipments of these open POs and see if the shipments are paid. If they are paid then using MR11, those open POs needs to be cleared. I looking to automate this. I want to know are there any function modules(BAPI) which does this ? Your help is greatly appreciated.
Thank you,
Surya
06-28-2007 8:19 PM
Yes, it is possible, you would submit the program RM07MSAL using the SUBMIT statement. Of course, you can pass parameters to the SUBMITed program using the WITH extension as well. So then you retrieve the list from memory and convert to a format which you can understand, then you can parse the internal table as you need to.
report zrich_0001.
data: begin of listout occurs 0,
line(1024) type c,
end of listout.
*Submit the program
submit RM07MSAL
exporting list to memory
and return.
* Get list from memory and convert to ascii
perform retrieve_list_from_memory tables listout.
* Now you can parse it anyway you want.
loop at listout.
write:/ listout.
endloop.
************************************************************************
* RETRIEVE_LIST_FROM_MEMORY
************************************************************************
form retrieve_list_from_memory tables reportlines.
data: list like abaplist occurs 0 with header line.
data: txtlines(1024) type c occurs 0 with header line.
clear list. refresh list.
clear reportlines. refresh reportlines.
call function 'LIST_FROM_MEMORY'
tables
listobject = list
exceptions
not_found = 1
others = 2.
check sy-subrc = 0.
call function 'LIST_TO_ASCI'
tables
listobject = list
listasci = txtlines
exceptions
empty_list = 1
list_index_invalid = 2
others = 3.
check sy-subrc = 0.
reportlines[] = txtlines[].
call function 'LIST_FREE_MEMORY'.
endform.
Regards,
Rich HEilman
Message was edited by:
Rich Heilman
06-28-2007 8:25 PM
So in this example, I am running for this one material number(which you will need to supply your own) and getting the list back, then I am parsing the output and looking for the po numbers, knowing that they start on the left of the list, and of course checking against EKKO.
report zrich_0001.
data: begin of listout occurs 0,
line(1024) type c,
end of listout.
data: xekko type ekko,
ebeln type ekko-ebeln.
submit rm07msal
with matnr = '000000000040000692'
exporting list to memory
and return.
* Get list from memory and convert to ascii
perform retrieve_list_from_memory tables listout.
* Now you can parse it anyway you want.
loop at listout.
ebeln = listout+1(10).
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = ebeln
importing
output = ebeln.
select single * from ekko into xekko
where ebeln = ebeln.
if sy-subrc = 0.
write:/ 'Po Number', ebeln.
endif.
endloop.
************************************************************************
* RETRIEVE_LIST_FROM_MEMORY
************************************************************************
form retrieve_list_from_memory tables reportlines.
data: list like abaplist occurs 0 with header line.
data: txtlines(1024) type c occurs 0 with header line.
clear list. refresh list.
clear reportlines. refresh reportlines.
call function 'LIST_FROM_MEMORY'
tables
listobject = list
exceptions
not_found = 1
others = 2.
check sy-subrc = 0.
call function 'LIST_TO_ASCI'
tables
listobject = list
listasci = txtlines
exceptions
empty_list = 1
list_index_invalid = 2
others = 3.
check sy-subrc = 0.
reportlines[] = txtlines[].
call function 'LIST_FREE_MEMORY'.
endform.
Regards,
Rich Heilman
07-01-2007 2:47 PM
Hi Rich,
Thanks for your answer, It solves part of my problem. I have another question regarding SUBMIT statement. Suppose I am using SUBMIT statement in report1 and calling report2. I have an internal table in report1, I want to use it in report2. Is this possible ?
Thank you,
Surya.