cancel
Showing results for 
Search instead for 
Did you mean: 

RSEG table fields SPGRP and SPGRM are not populating for invoice having both values as 'X'.

Former Member
0 Kudos
617

Hi Seniors,

I have written a query on RSEG table but fields SPGRP and SPGRM are not populating in structure not even in variables for the invoice which have both the values for SPGRP and SPGRM as 'X'. Means for invoice which are blocked by both price and quantity. this query in written in a method of Bussiness Object ZBUS2081 and is release.

Please guide me to solve this puzzle.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

raymond_giuseppi
Active Contributor

More information required?

Former Member
0 Kudos

SELECT SINGLE EBELN SPGRP SPGRM

    INTO (lv_ebeln,lv_spgrp,lv_spgrm) FROM RSEG

    WHERE BELNR = BELNR AND GJAHR = GJAHR.

      IF SY-SUBRC = 0.

         SELECT SINGLE EKORG EKGRP INTO (LV_EKORG,LV_EKGRP)

         FROM EKKO WHERE EBELN = lv_EBELN.

             IF SY-SUBRC = 0.

*                pblock = ls_rseg-spgrp.

*                qblock = ls_rseg-spgrm.

                IF lv_SPGRP IS NOT INITIAL.

                    LV_BLOCKTYP = 'P'.

                 Select single * from ZDT_EMAIL_INV

                 into ZDT_EMAIL_INV_P where ZZ_PURCH_ORG = LV_EKORG

                 and ZZ_PURCH_GROUP = LV_EKGRP

                 and ZZ_BLOCK_TYP = LV_BLOCKTYP.

                endif.

                IF Lv_SPGRM IS NOT INITIAL.

                    LV_BLOCKTYP = 'Q'.

                 Select single * from ZDT_EMAIL_INV

                 into ZDT_EMAIL_INV_Q where ZZ_PURCH_ORG = LV_EKORG

                 and ZZ_PURCH_GROUP = LV_EKGRP

                 and ZZ_BLOCK_TYP = LV_BLOCKTYP.

               ENDIF.

        ENDIF.

    ENDIF.

Above is the code for fetching recipients based on Flag Fields but flag fields SPGRP and SPGRM are not populating from RSEG.

raymond_giuseppi
Active Contributor
0 Kudos

You forgot BUZEI field, so only one item is randomly read from invoice, if you look for records in error (e.g. from RBKP_BLOCKED) and don't already know item number add some criteria like in following sample:


    SELECT ebeln ebelp spgrp spgrm ...

      INTO (lv_ebeln, lv_ebelp, lv_spgrp, lv_spgrm, ...)

      FROM rseg

          WHERE belnr = rbkp-belnr

            AND gjahr = rbkp-gjahr

            AND ( spgrg NE space

               OR spgrm NE space

               OR spgrp NE space

               OR spgrc NE space

               OR spgrs NE space

               OR spgrt NE space

               OR spgrq NE space

               OR spgrext NE space ).

      " ...

    ENDSELECT.

Regards,

Raymond

Former Member
0 Kudos

Thanks,

Your logic worked. Thank you so much for the help.

Regards,

Bhoomika.

Answers (0)