Fetching the data from memory means, we may get a requirement that we need to submit any report with return option.In those cases we need to get the out put of that particular report. At that time, we can use the following piece of code in our program, that will retrieve the data from memory and stored in the internal table.
SUBMIT <>
USING SELECTION-SET <>
EXPORTING LIST TO MEMORY
AND RETURN.
Step 1:
We can use List_from_memory Function module to fetch the data from memory:
*Import the data into one internal table
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = y_i_abaplist
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc NE 0.
ENDIF.
Step2 :
Now we need to convert it into internal format. That data from above function module is in ascii format.
*Convert to ASCII format
IF NOT y_i_abaplist[] IS INITIAL.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = y_i_ascilist
listobject = y_i_abaplist
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc = 0.
ENDIF.
ENDIF.
ENDFORM. " y_f_liste
In the out put internal we will get the out put of internal table y_i_abaplist.
Have a good day.... :)
Thank U.
Vamsi.
Creating Search Helps by vams
Search Helps :
- Search Helps are nothing but, F4 helps in SAP system.
- Search helps are two types :
a) Elementary Search Helps
and b)
Elementary Search Helps :
GoTo T.Code SE11, Click the radio button Search Help and enter the name and create.
Provide description.
Enter the data Source name i.e., iether table or view.
In the fields section, enter all the required fields along with SPOS field.
Once every thing is over activate it and test at there only.
Now we will get the required search option on the particular field.
Thanks and Regards
Vamsi.
Wroking With Filed Symbols
Many People affraid in writing the code with field symbols.
It's very simple. Field symbols are directly point to memory. So, If we modified the data in the field symbols it will directly effect to the memory.
Syntax : FIELD-SYMBOLS :TYPE .
Use ASSIGNIG statement to use field symbols.
Eg:
Declaration:
TYPES : BEGIN OF ty_itab,
A type N,
B type i,
C type i,
D type i,
END OF ty_itab.
FIELD-SYMBOLS : < wa > type ty_itab.
data : itab type standrad table of ty_itab.
now we can use this in the program.
Requirement is to calculate the value of d value from the itab table.
d = b + c.
LOOP AT itab ASSIGNING < wa >.
< wa >-d = < wa >-b + < wa >-c.
*Here no need to write modify statement. Beacuse < wa >is a field symbol and it is pointing to memory of itab. If you modified < wa >, It automatically effected to the internal table itab.
ENDLOOP.
It's very simple. Field symbols are directly point to memory. So, If we modified the data in the field symbols it will directly effect to the memory.
Syntax : FIELD-SYMBOLS :
Use ASSIGNIG statement to use field symbols.
Eg:
Declaration:
TYPES : BEGIN OF ty_itab,
A type N,
B type i,
C type i,
D type i,
END OF ty_itab.
FIELD-SYMBOLS : < wa > type ty_itab.
data : itab type standrad table of ty_itab.
now we can use this in the program.
Requirement is to calculate the value of d value from the itab table.
d = b + c.
LOOP AT itab ASSIGNING < wa >.
< wa >-d = < wa >-b + < wa >-c.
*Here no need to write modify statement. Beacuse < wa >is a field symbol and it is pointing to memory of itab. If you modified < wa >, It automatically effected to the internal table itab.
ENDLOOP.
Subscribe to:
Posts (Atom)