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: 
Read only

How to create dynamic strcture and accepting runtime value in work area

Former Member
0 Likes
491

Hi,

I am using RFC_READ_TABLE for joining more than table and written select query but into clause work area value is passed but it is short dump is displaying with too few many fields in into clause .work area WA need some casting type conversion which accepts the some run time value and should have some structure for it.how to create dynamic structure?

Hi,

I am using RFC_READ_TABLE for joining more than table and written select query but into clause work area value is passed but it is short dump is displaying with too few many fields in into clause .work area WA need some casting type conversion which accepts the some run time value and should have some structure for it.how to create dynamic structure?

2 REPLIES 2
Read only

Former Member
0 Likes
459

hi

good

go through this and use in your report accordingly.

If you are trying to read some information from SAP and you can't find the right BAPI then RFC_READ_TABLE can do the job for you.

RFC_READ_TABLE is powerful RFC it gives you the access to all tables and views in SAP. I basically used RFC_READ_TABLE for Material Master Search application on the Intranet.

Now you may say there are lots of BAPI for this functionality. You are right but I had to work around the BAPI to get Prices (Moving Average Price) and it just did not work very well. Because of the nature of the application I had to use RFC_READ_TABLE because then I can use powerful SQL expression for searching. RFC_READ_TABLE give you the ability to code the where clause which is quite enough.

I have included part of the code use in asp page to read ENT1027 for Mgroup and M description & number but without object creation. The other part of the code reads MBEW for price & quantity.

Code

lt;%

'#######################Diming the Structures

Call BAPIRFC.DimAs("Rfc_Read_Table", "FIELDS", MaterialSelection_RS)

Call BAPIRFC.DimAs("Rfc_Read_Table", "OPTIONS", Selection_RS)

'###################################################################

'########################Search Type########################

' C contanis

' S Start with

' E Ends with

if searchtype = "C" then

FormatedSearch_Keyword = "%" & Search_Keyword & "%"

elseif searchtype = "S" then

FormatedSearch_Keyword = Search_Keyword & "%"

else searchtype = "E" then

FormatedSearch_Keyword = "%" & Search_Keyword

end if

'##################################

'################# Flaged for deletion Materials #####################

if showdeleted = "No" then

Selection_RS.AddNew Array("TEXT"),Array("LVORM <> 'X' AND")

end if

'#####################################################################

'############## users can search three material group ################

'############## GROUPS: OFFICESUP TECOMHARD TECOMSOFT ###############

'##USER STILL CAN NAROW THEIR SEARCH BY SELECTING ON OF THREE#########

if MGroup = "ALL" then

Selection_RS.AddNew Array("TEXT"),Array("MATKL IN ('OFFICESUP','TECOMHARD','TECOMSOFT')")

else

Selection_RS.AddNew Array("TEXT"),Array("MATKL = '"& MGroup &"' and ")

end if

'######################################################################

'#######################ADDING SEARCH KEYWORD TO STRUCTURE##############

if not Search_Keyword = "" then

Selection_RS.AddNew Array("TEXT"),Array(" MAKTG LIKE '" & FormatedSearch_Keyword & "'")

end if

Selection_RS.Update

'###################################################################

'#######################ADD RETURNED FIELDS#########################

MaterialSelection_RS.AddNew array("FIELDNAME","OFFSET","LENGTH","TYPE","FIELDTEXT"),array("MATNR","000000","000000" ,"","")

MaterialSelection_RS.AddNew array("FIELDNAME","OFFSET","LENGTH","TYPE","FIELDTEXT"),array("MATKL","000000","000000" ,"","")

MaterialSelection_RS.AddNew array("FIELDNAME","OFFSET","LENGTH","TYPE","FIELDTEXT"),array("MAKTG","000000","000000" ,"","")

MaterialSelection_RS.Update

call BAPIRFC.Rfc_Read_Table("ENT1027", Material_RS, MaterialSelection_RS, Selection_RS, "~", "", "0", "0")

If Err.Number > 0 then

Response.Write "Error:" & "<BR>"

Response.Write " Err.number...... " & Err.Number & "<BR>"

Response.Write " Err.Description. " & Err.Description & "<BR>"

end if

'###########LOOP THROUGH RECORDSET

if not Material_RS is nothing then

do while not Material_RS.eof

loop

end if

%>

thanks

mrutyun^

Read only

Former Member
0 Likes
459

Hi,

Instead of Work area, it will be simple and preice , if you use field symbols. So, instead of all work area stuff use sields symbols, which supports the Runtime concept and short dump will be avoided. After assign into FS again you can pass it into internal table or Work area.

Thanks

Manju