07-28-2015 12:50 PM
I am working on dialog programing like when enter product num it display entire record for that particular product.
for this i created one screen with product num and display button when click on display button 2nd screen wil display with product details in modal dialog box.
so every thing was completed but in modal dialog box only fields label getting displayed like product name product manf date etc but no data populationg from product table.
in 2nd screen in module status output i wrote like this to populate data from product table ztabprod.
select SINGLE prodid prodname from ztabprod into ztabprod where empid = zprodtab-prodidid.
but when click on display on 1st screen containg prod id 2nd scren displaying modal dialog box popup only with field lables but no data populating.
please let me know how to pulate data? any wrong in select single?
08-06-2015 10:23 PM
With the select statement you are using
SINGLE prodid prodname from ztabprod into ztabprod where empid = zprodtab-prodidid.
The values will be populated from database to internal table, but then from internal table you need to assign the values to your screen field like if your screen field name in 2nd screen are sf_prodid sf_prodname
then do the below
Loop at ztabprod into <Workarea>
sf_prodid = <Workarea>-prodid.
sf_prodname =<Workarea>-prodname.
Endloop.
Hope this will solve your issue.
Thanks
Gejo john
08-09-2015 12:13 PM
Hi John
Thank u for ur reply. yes ii have applied ur inputs. but not getting output.
may be order missed.I am little bit new to this. can u check once and correct me even if it looks silly mistake for u . here i am giving details how i did. no syntax errors but data not populating in dialog box. when i use loop at itab into wa. getting error as into clause error. so i wrote simply loop at itab as shown below. please chk and correct me
in program i create like this.
TABLES: ztabprod
TYPES: prodid type ztabprod-prodid,
name type ztabprod-name.
Start-of-selection.
call screen 0100.
As u told i have assigned 2nd screen filed name
ztabprod-prodid, ztabprod-name.
in 2nd screen status i have written code like this
select SINGLE prodid name from ztabprod INTO ZTABPROD where prodid = ztabprod-prodid.
Loop at ztabprod.
ztabprod-prodid =ztabprod-prodid.
ztabprod-name = ztabprod-name
write : / ztabprod-prodid, ztabprod-name.
Endloop.
08-09-2015 8:20 PM
hi,
ztabprod looks like a work area as you have defined with TABLES statement.
Therefore you cannot use loop at ztabprod.
Also you can debug and check the values at runtime.
08-10-2015 12:56 AM
Loop at ztabprod.
ztabprod-prodid =ztabprod-prodid.
ztabprod-name = ztabprod-name
IF You are using table with header lines then no need to pass values again into same work area.
write : / ztabprod-prodid, ztabprod-name.
Endloop.
Get rid of programming practice of using table with header lines and confusing yourself.
If you use table and Work area declared separately then SAP compiler judge code error properly.
And please always use pretty printer and allow Indentation in pretty print settings.
That way code is more readable.