Application Development 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: 

dialog programming- modal dialog box

former_member587342
Participant
0 Kudos

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?

4 REPLIES 4

Former Member
0 Kudos

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

0 Kudos

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.


0 Kudos

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.

0 Kudos

select SINGLE prodid  name  from ztabprod INTO TABLE ZTABPROD where prodid= ztabprod-prodid.


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.