cancel
Showing results for 
Search instead for 
Did you mean: 

smartforms problem

Former Member
0 Kudos

Hi,

i have developed a form with zprogram for driver program. I am having trouble in displaying the fields which i wanted to populate in the form

My primary key is vttk-tknum (transportation number)

and my select statements are like this

BEGIN OF SLK OCCURS 0

INCLUDE STRUCTURE VTRLK.

END OF SLK.

SELECT VBELN FROM VBAK

INTO (VBAK-VBELN)

WHERE VBELN = SLK-VBELN.

SELECT SINGLE NAME1

STREET

HOUSE_NUM1

STR_SUPPL1

CITY1

POST_CODE1

COUNTRY

FROM ADRC

INTO (ADRC-NAME1, ADRC-STREET, ADRC-HOUSE_NUM1, ADRC-STR_SUPPL1, ADRC-CITY1, ADRC-POST_CODE1, ADRC-COUNTRY)

WHERE ADDRNUMBER = SLK-ADDRNUMBER.

SELECT SINGLE NAME1

LAND1

ORT01

REGIO

STRAS

FROM KNA1

INTO (KNA1-NAME1,KNA1-LAND1,KNA1-ORT01,KNA1-REGIO,KNA1-STRAS)

WHERE KUNNR = SLK-KUNNR.

can some one help me in this ?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I don't understand your problem. Are your Select statements retrieving any data?

Have you tried something like this:

SELECT SINGLE NAME1
STREET
HOUSE_NUM1
STR_SUPPL1
CITY1
POST_CODE1
COUNTRY
FROM ADRC
INTO CORRESPONDING FIELDS OF TABLE ADRC
WHERE ADDRNUMBER = SLK-ADDRNUMBER.

Is there anything in SLK?

Former Member
0 Kudos

slk is vtrlk of type vtrlk structure.

whenever i give primary key in reference to slk its not populating anything.

Former Member
0 Kudos

Is there data in SLK?

Please see the above code using "INTO CORRESPONDING FIELDS OF TABLE"

Former Member
0 Kudos

even i tried that one, its not giving me any values.

and also i am unsure about my insert fields in form, should they refer to internal table fields or can i give sap table fields?

Former Member
0 Kudos

I would recommend using internal tables.

Have you debugged your selects? Is there a value in SLK-VBELN first of all?

Former Member
0 Kudos

yes there is a value slk-vbeln,

but i am not sure how to find whether there are any values in slk. can u help me with this

Former Member
0 Kudos

Ok, here's what I would do. Put a break point on your first Select statement.

When you reach the breakpoint. Check to see that SLK-VBELN has a value.

Hit F5 to execute the Select statement and look at SY-SUBRC or look at VBAK to see if the Select retrieved anything.

If nothing is retrieved, go to SE16 for VBAK and see if there is a record for the SLK-VBELN.

Former Member
0 Kudos

can u please tell me, in my smartform can i insert field as &kna1-name1& or do i need to use internal table.

also suppose i am just populating some fields in smart form if insert field in text and have that table defined in form interface is sufficient or do i need to declare something in global data?

Former Member
0 Kudos

I always use internal tables, so I'm not sure if &kna1-name1& will work (it should work though).

Defining the table in the interface is sufficient.

However, since it is a table without a header line, you either need to loop through the table, or if there is only one record in the table then add a Program Lines node and READ TABLE itab INTO wa_itab INDEX 1.

Former Member
0 Kudos

Actually I think this may be your problem.

You probably have tables without header lines, so you need to either LOOP at the table into a workarea or READ the table into a workarea and then print the workarea-fieldname.

Former Member
0 Kudos

Hi

i didnt understand the problem.

What is the input of your zprogram? vttk/tknum?

And what structures you need to fill?

What is the signature of your generated function/module in samrtforms?

Thanks

Former Member
0 Kudos

yes vttk-tknum is the input

i need to fill kna1, adrc, t001w, knvk, lips, likp, vbak fields

Former Member
0 Kudos

My fields

adrc-name1, adrc-street, adrc-house_num1, adrc-city1, adrc-country

vbak-vbeln

knvk-namev, knvk-name1

kna1-name1, kna1-mcod2, kna1-mcod3

lips-charg, lips-/cwm/pikme

likp-lddat, likp-lfdat