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

condition in smartform

Former Member
0 Likes
706

Hello gurus,

my requirment is i wanted to have the final value in DMBTR from BSEG table.

Here the condition i have implemented as

first of all when i entered value in AUGBL then the field BELNR  value is being fetch if BUZEI = 1

and then when BELNR is passed to bseg  with BSCHL =50 and QSSKZ =x2 then the final value DMBTR is fetch

So, heres the condition  as,

select bukrs

            belnr

            gjahr

            buzei

            augbl

            shkzg

            wrbtr

            qbshb

            zuonr

            hkont

            kunnr

            lifnr

            kzbtr

            skfbt

            ebeln

            xref1

            umskz

            mwskz

            sgtxt

            xauto

            qsskz

            qsshb

            dmbtr

          from bseg

        INTO table gt_bseg

        FOR ALL ENTRIES IN it_str

    where  augbl = it_str-augbl

          and  belnr = it_str-augbl

          and bukrs EQ it_str-bukrs

          and buzei = 1

              and qsskz = 'x2'

              and bschl = 50.


can u check it is correct or not?



where is my mistake?


what should i do?


pls help me



Regards,

Prathmesh Rane.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
681

You query will only fetch documents if AUGBL and BELNR are same.

From what i understood you need all documents against AUGBL  with BUZEI = 1 , QSSKZ = 'X2' , BSCHL = '50' (notice the '  ' around BUZEI & BSCHL value 50 )so,

remove condition and belnr = it_str-augbl from your select query then it will fetch all the required documents.

Finally your where conditions would be like this :

where augbl = it_str-augbl

and     bukrs = it_str-bukrs

and     buzei = '1'

and     qsskz = 'X2'

and     bschl = '50'.

+ As suggested above make x2 as X2.

5 REPLIES 5
Read only

thangam_perumal
Contributor
0 Likes
681

Hi Rane,

            Please check and qsskz = 'x2'   " the X should be in Capital letter.



Regards,

   Thangam.P

Read only

Former Member
0 Likes
682

You query will only fetch documents if AUGBL and BELNR are same.

From what i understood you need all documents against AUGBL  with BUZEI = 1 , QSSKZ = 'X2' , BSCHL = '50' (notice the '  ' around BUZEI & BSCHL value 50 )so,

remove condition and belnr = it_str-augbl from your select query then it will fetch all the required documents.

Finally your where conditions would be like this :

where augbl = it_str-augbl

and     bukrs = it_str-bukrs

and     buzei = '1'

and     qsskz = 'X2'

and     bschl = '50'.

+ As suggested above make x2 as X2.

Read only

0 Likes
681

HI ashish,

AUGBL AND BELNR both are not same

AUGBL is my clearing doc num

and belnr is reference num

So,

what shoul i do?

Read only

0 Likes
681

You will have to do this in 2 steps :

1. Get the list of relevant BELNRs.

You can do this using the same query and changing the where conditions as follows :

where augbl = it_str-augbl

  and  buzei = '1'

  and bukrs  = it_str-bukrs.

2 Once you have the list, use it to fetch the line items with BSCHL = '50' and QSSKZ = 'X2'.

     deckare a second table same type as gt_bseg. I have named it gt_bseg2 here.

     select fields same as in your query

          into table gt_bseg2

          from bseg

          for all entries in gt_bseg

          where belnr = gt_bseg-belnr

          and     bukrs = gt_bseg-bukrs

          and     gjahr  = gt_bseg-gjahr

          and     bschl = '50'

          and     qsskz = 'X2'.

Now you will have all the documents you require in second table ( gt_bseg2 here ) from which you can read DMBTR.

Read only

0 Likes
681

Hi Rane,

           Have you noticed that x is small?