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

Smartform not getting called through driver program

Former Member
0 Likes
2,152

Hi All,

i have a smartform, in which i am facing a deep problem,

and the problem is that in my smartform i have created

it such that when more than two allotee  , then its corresponding

template should get called, but while i am debugging my smartform

it is skipping all the code lines written inside of smartforms.

Please tell me what can i do, to get it called .

12 REPLIES 12
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
2,013

Where have you written this code..? Please provide more details with debugging screen shot

Nabheet

Read only

0 Likes
2,013

Hi Nabheet,

thanks a lot for your reply, here is the screenshot in which the highlighted template

is made when the no of co-applicant is more than 2, for previous two co-applicant

the template named as template5 gets called, but when co-applicant is more than two

template 7 should get called,

But the problem is that i am not able to call template 7 and its related values.

attached is my smartform too, please tell me why it is not calling my template7 values.

Read only

0 Likes
2,013

Oi Shweta Pease show the %COMMAND3 code .

The template 7 must be below of command please see the hierarchy

Read only

0 Likes
2,013

BREAK ABAP ?

Can you try BREAK-POINT instead.

Read only

0 Likes
2,013

Hi,

this is the code under code5

BREAK ABAP.
select * from knvp into table it_knvp
        where kunnr eq p_kunnr1 and
        parvw in ('Z2','Z3','Z4','Z6','Z5').
select * from kna1 into table it_kna1
        for all entries in it_knvp
        where kunnr eq it_knvp-kunn2.
LOOP AT it_knvp into wa_knvp.
   CASE WA_KNVP-PARVW .
     WHEN  'Z4'.
       read table it_kna1 into wa_kna1 with key kunnr = wa_knvp-kunn2.
     WHEN 'Z5'.
       read table it_kna1 into wa_kna12 with key kunnr = wa_knvp-kunn2.
     WHEN 'Z6'.
       read table it_kna1 into wa_kna13 with key kunnr = wa_knvp-kunn2.

   ENDCASE.
ENDLOOP.
**************co-applicant 2****************************
*select single vbpa~kunnr vbpa~parvw
*       from vbpa
*       into corresponding fields of wa_ca2
*       where vbeln = vbeln
*       and parvw = 'Z4'.
*BREAK ABAP.
CLEAR: WA_CA2,
        WA_PA,
        WA_OA,
        WA_PRM,
        V_MOB,
        V_TL,
        V_BM,
        V_HM,
        V_PRRN,
        V_PACN,
        V_OACN.

*select single kna1~adrnr knvv~kdgrp knvk~adrnd knvk~adrnp_2
*                   from kna1
*                   inner join knvv on kna1~kunnr = knvv~kunnr
*                   inner join knvk on kna1~kunnr = knvk~kunnr
*                   into corresponding fields of wa_ca2
*                   where kna1~kunnr = wa_kna1-kunnr.
select single adrnr from kna1 into wa_ca2-adrnr where kunnr eq wa_kna1-kunnr.
select single kdgrp from knvv into wa_ca2-kdgrp where kunnr eq wa_kna1-kunnr.
select single adrnd from knvk into wa_ca2-adrnd where kunnr eq wa_kna1-kunnr.
select single adrnp_2 from knvk into wa_ca2-adrnp_2 where kunnr eq wa_kna1-kunnr.



*move wa_kna1-kunnr to wa_ca2-kunnr.
select * from adrc into corresponding fields of wa_pa
                     where adrc~addrnumber = wa_ca2-adrnr.
endselect.
select * from adrc into corresponding fields of wa_oa
                     where adrc~addrnumber = wa_ca2-adrnd.
endselect.
select * from adrc into corresponding fields of wa_prm
                     where adrc~addrnumber = wa_ca2-adrnp_2.
endselect.
select single tel_number into v_mob
            from adr2
            where adr2~addrnumber = wa_ca2-adrnr
            and r3_user = '3'.
select single tel_number into v_tl
            from adr2
            where adr2~addrnumber = wa_ca2-adrnr
            and r3_user = '1'.
select single tel_number into v_bm
            from adr2
            where adr2~addrnumber = wa_ca2-adrnd
            and r3_user = '1'.
select single tel_number into v_hm
            from adr2
            where adr2~addrnumber = wa_ca2-adrnp_2
            and r3_user = '1'.

select smtp_addr
           from adr6
           into wa_ca2-smtp_addr
           where adr6~addrnumber = wa_ca2-adrnr.
endselect.
clear:v_parn.
select bezei from t005u into v_parn
           where bland = wa_pa-region
           and land1 = wa_pa-country
           and spras = 'EN'.
endselect.
clear:v_oarn.
select bezei from t005u into v_oarn
           where bland = wa_oa-region
           and land1 = wa_oa-country
           and spras = 'EN'.
endselect.

select bezei from t005u into v_prrn
           where bland = wa_prm-region
           and land1 = wa_prm-country
           and spras = 'EN'.
endselect.

select landx from t005t into v_pacn
           where land1 = wa_pa-country
           and spras = 'EN'.
endselect.

select landx from t005t into v_oacn
           where land1 = wa_oa-country
           and spras = 'EN'.
endselect.

select landx from t005t into v_prcn
           where land1 = wa_prm-country
           and spras = 'EN'.
endselect.

select gbdat from knvk into wa_ca2-gbdat
           where kunnr = wa_ca2-kunnr.
endselect.

select ktext from t151t into wa_ca2-ktext
                               where t151t~kdgrp = wa_ca2-kdgrp
                               and spras = 'EN' .
endselect.

*
*---------WA3------------*
*select single vbpa~kunnr vbpa~parvw
*       from vbpa
*       into corresponding fields of wa_ca3
*       where vbeln = vbeln
*       and parvw = 'Z5'.
CLEAR: WA_CA3,
        WA_PA1,
        WA_OA1,
        WA_PRM1,
        V_MOB1,
        V_TL1,
        V_BM1,
        V_HM1,
        V_PRRN1,
        V_PACN1,
        V_OACN1.
**select kna1~adrnr knvv~kdgrp knvk~adrnd knvk~adrnp_2
**                   from kna1
**                   inner join knvv on kna1~kunnr = knvv~kunnr
**                   inner join knvk on kna1~kunnr = knvk~kunnr
**                   into corresponding fields of wa_ca3
**                   where kna1~kunnr = wa_kna12-kunnr.
**endselect.

BREAK ABAP.
select single adrnr from kna1 into wa_ca3-adrnr where kunnr eq wa_kna12-kunnr.
select single kdgrp from knvv into wa_ca3-kdgrp where kunnr eq wa_kna12-kunnr.
select single adrnd from knvk into wa_ca3-adrnd where kunnr eq wa_kna12-kunnr.
select single adrnp_2 from knvk into wa_ca3-adrnp_2 where kunnr eq wa_kna12-kunnr.

*move wa_kna12-kunnr to wa_ca3-kunnr.
select * from adrc into corresponding fields of wa_pa1
                     where adrc~addrnumber = wa_ca3-adrnr.
endselect.

select * from adrc into corresponding fields of wa_oa1
                     where adrc~addrnumber = wa_ca3-adrnd.
endselect.

select * from adrc into corresponding fields of wa_prm1
                     where adrc~addrnumber = wa_ca3-adrnp_2.
endselect.

select single tel_number into v_mob1
            from adr2
            where adr2~addrnumber = wa_ca3-adrnr
            and r3_user = '3'.

select single tel_number into v_tl1
            from adr2
            where adr2~addrnumber = wa_ca3-adrnr
            and r3_user = '1'.

select single tel_number into v_bm1
            from adr2
            where adr2~addrnumber = wa_ca3-adrnd
            and r3_user = '1'.

select single tel_number into v_hm1
            from adr2
            where adr2~addrnumber = wa_ca3-adrnp_2
            and r3_user = '1'.

select smtp_addr
           from adr6
           into wa_ca3-smtp_addr
           where adr6~addrnumber = wa_ca3-adrnr.
endselect.

select bezei from t005u into v_parn1
           where bland = wa_pa1-region
           and land1 = wa_pa1-country
           and spras = 'EN'.
endselect.

select bezei from t005u into v_oarn1
           where bland = wa_oa1-region
           and land1 = wa_oa1-country
           and spras = 'EN'.
endselect.

select bezei from t005u into v_prrn1
           where bland = wa_prm1-region
           and land1 = wa_prm1-country
           and spras = 'EN'.
endselect.

select landx from t005t into v_pacn1
           where land1 = wa_pa1-country
           and spras = 'EN'.
endselect.

select landx from t005t into v_oacn1
           where land1 = wa_oa1-country
           and spras = 'EN'.
endselect.

select landx from t005t into v_prcn1
           where land1 = wa_prm1-country
           and spras = 'EN'.
endselect.

select gbdat from knvk into wa_ca3-gbdat
           where kunnr = wa_ca3-kunnr.
endselect.

select ktext from t151t into wa_ca3-ktext
                               where t151t~kdgrp = wa_ca3-kdgrp
                               and spras = 'EN' .
endselect.

********---------WA4--------*
*select single vbpa~kunnr vbpa~parvw
*       from vbpa
*       into corresponding fields of wa_ca4
*       where vbeln = vbeln
*       and parvw = 'Z6'.
CLEAR: WA_CA4,
        WA_PA2,
        WA_OA2,
        WA_PRM2,
        V_MOB2,
        V_TL2,
        V_BM2,
        V_HM2,
        V_PRRN2,
        V_PACN2,
        V_OACN2.

***select kna1~adrnr knvv~kdgrp knvk~adrnd knvk~adrnp_2
***                   from kna1
***                   inner join knvv on kna1~kunnr = knvv~kunnr
***                   inner join knvk on kna1~kunnr = knvk~kunnr
***                   into corresponding fields of wa_ca4
***                   where kna1~kunnr = wa_kna13-kunnr.
***endselect.
***move wa_kna13-kunnr to wa_ca4-kunnr.


select single adrnr from kna1 into wa_ca4-adrnr where kunnr eq wa_kna13-kunnr.
select single kdgrp from knvv into wa_ca4-kdgrp where kunnr eq wa_kna13-kunnr.
select single adrnd from knvk into wa_ca4-adrnd where kunnr eq wa_kna13-kunnr.
select single adrnp_2 from knvk into wa_ca4-adrnp_2 where kunnr eq wa_kna13-kunnr.

select * from adrc into corresponding fields of wa_pa2
                     where adrc~addrnumber = wa_ca4-adrnr.
endselect.

select * from adrc into corresponding fields of wa_oa2
                     where adrc~addrnumber = wa_ca4-adrnd.
endselect.

select * from adrc into corresponding fields of wa_prm2
                     where adrc~addrnumber = wa_ca4-adrnp_2.
endselect.

select single tel_number into v_mob2
            from adr2
            where adr2~addrnumber = wa_ca4-adrnr
            and r3_user = '3'.

select single tel_number into v_tl2
            from adr2
            where adr2~addrnumber = wa_ca4-adrnr
            and r3_user = '1'.

select single tel_number into v_bm2
            from adr2
            where adr2~addrnumber = wa_ca4-adrnd
            and r3_user = '1'.

select single tel_number into v_hm2
            from adr2
            where adr2~addrnumber = wa_ca4-adrnp_2
            and r3_user = '1'.

select smtp_addr
           from adr6
           into wa_ca4-smtp_addr
           where adr6~addrnumber = wa_ca4-adrnr.
endselect.

select bezei from t005u into v_parn2
           where bland = wa_pa2-region
           and land1 = wa_pa2-country
           and spras = 'EN'.
endselect.

select bezei from t005u into v_oarn2
           where bland = wa_oa2-region
           and land1 = wa_oa2-country
           and spras = 'EN'.
endselect.

select bezei from t005u into v_prrn2
           where bland = wa_prm2-region
           and land1 = wa_prm2-country
           and spras = 'EN'.
endselect.

select landx from t005t into v_pacn2
           where land1 = wa_pa2-country
           and spras = 'EN'.
endselect.

select landx from t005t into v_oacn2
           where land1 = wa_oa2-country
           and spras = 'EN'.
endselect.

select landx from t005t into v_prcn2
           where land1 = wa_prm2-country
           and spras = 'EN'.
endselect.

select gbdat from knvk into wa_ca4-gbdat
           where kunnr = wa_ca4-kunnr.
endselect.

select ktext from t151t into wa_ca4-ktext
                               where t151t~kdgrp = wa_ca4-kdgrp
                               and spras = 'EN' .
endselect.



Read only

0 Likes
2,013

Hi http://scn.sap.com/people/nabheet.madan3,

suppose i have one template in which if there are 2 sets of data then these

2 sets of data will get displayed in this templates, but if the data is more than two

then for that i have created another template, and here i have given the condition that

WA_CA2-KUNNR <> INITIAL.

Now problem is here, if the data is more than two , my second template is not getting called

and while debugging, it just throws me out of debugger, and i came on my starting point

of selection screen. This is the main root cause, so please tell me what is the problem.

One more thing is that, while for second type of data, i have created another template

in which there is another template is calling if the values are again more than 2 , then

its respected template should get called.

Now again i have used the same variable to make condition, like as shown previous, i.e

WA_CA2-KUNNR <> INITIAL.

these values are cleared in programming for second time use.

Is it a problem at all ?

Read only

0 Likes
2,013

Hi Shweta

First of all do one thing put a break <user Name> in both the programming lines and check WA_CA2-KUNNR values before template is called.

Seconldy put a break point after smartform call and check what is the value of sy-subrc returned if not equal to 0 check what is the value in SYST. It may be formatting issue also

Why are you using template inside main window. You could have created a table and put this stuff in header

Nabheet

Read only

0 Likes
2,013

Insert a new CODE Node before the CODE5, where all you do is pass in WA_CA2-KUNNR and WA_CA3-KUNNR, and have a BREAK-POINT Statement. If the WA_CA2-KUNNR is INITIAL you'll never come to breakpoint in CODE5.

And what Nabheet said about Sy-subrc after Smartform call is very important - if the layout is broken (a Text is assigned to a non-existing Line and Column in a Template, for example), the Composer will terminate with error.

cheers

Janis

Read only

0 Likes
2,013

HI

Please try :

write WA_CA2 in  CODE IN PARAMETER IN  AND IN OUT AND SEE IF WORK.

Read only

0 Likes
2,013

I do not understand the functionality of command3%

The template have his condition then why use the command3%?

Read only

satyabrata_sahoo3
Contributor
0 Likes
2,013

How you are setting the break point? Put the static break point inside the code you have written. It must trigger.

Read only

Former Member
0 Likes
2,013

open the smartform in SMARFORMS Tcode Goto Environment and take the Function Module and Open the function module in SE80 and in ****F01 Include Search for code that is not triggering Put Break Point and then check. Please get back if you have any problem