Skip to Content

Not Allowed to Make Delivery & Invoice Without Tracker ID

Hi All,

if @object_type = '13' and @transaction_type in (N'A', N'U')
begin
if exists (select * from inv1 a
inner join oinv b on a.DocEntry = b.DocEntry
inner join oitm c on a.ItemCode = c.ItemCode
inner join OITB d on c.ItmsGrpCod = d.ItmsGrpCod
where a.DocEntry = @list_of_cols_val_tab_del
and ( c.ItmsGrpCod in('188','110') or c.ItemCode in('FBT04168', 'FBT04169', 'FBT04171', 'FBT04170'))
and Isnull(b.TrackNo,'')='')
Begin SET @error = 10101-01 SET @error_message = N'Tracker No is missing'
End
End

I need to some updation's in above query, please update with below details.

Find the attachment.dathulworkssap-community14-3-195.jpg

1. I want to block while adding two item groups in Delivery & Invoice , nd 4 item Numbers in Invoice without mention 'Tracker ID'.

* Item Group Code - '188 & 110'

* Item Number - 'FBT04168, FBT04169, FBT04171, FBT04170'

2. Please reply with 2 different query's

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Mar 14 at 08:11 PM

    Hi Atul,

    Since I don't have the TrackID field at Delivery Lines, you need to replace a.TrackNo with actual field name at your side.

    Try the below queries after replacing proper field name for Tack ID

    Query-1 for Invoice:

    IF @object_type='13' AND @transaction_type IN (N'A', N'U')
    	BEGIN
            IF EXISTS (SELECT *
                       FROM INV1 a
                            INNER JOIN OINV b ON a.DocEntry=b.DocEntry
                            INNER JOIN OITM c ON a.ItemCode=c.ItemCode
                            INNER JOIN OITB d ON c.ItmsGrpCod=d.ItmsGrpCod
                       WHERE a.DocEntry=@list_of_cols_val_tab_del
                             AND(c.ItmsGrpCod IN ('188', '110')
                                 OR c.ItemCode IN ('FBT04168', 'FBT04169', 'FBT04171', 'FBT04170'))
                             AND ISNULL(a.TrackNo, '')='')
    		BEGIN
                SET @error=10101-01;
                SET @error_message=N'Tracker No is missing';
            END;
        END;
    

    Query-2 for Delivery:

    IF @object_type='15' AND @transaction_type IN (N'A', N'U')
    	BEGIN
            IF EXISTS (SELECT *
                       FROM dbo.DLN1 a
                            INNER JOIN dbo.ODLN b ON a.DocEntry=b.DocEntry
                            INNER JOIN dbo.OITM c ON a.ItemCode=c.ItemCode
                            INNER JOIN dbo.OITB d ON c.ItmsGrpCod=d.ItmsGrpCod
                       WHERE a.DocEntry=@list_of_cols_val_tab_del
                             AND c.ItmsGrpCod IN ('188', '110')
                             AND ISNULL(a.TrackNo, '')='')
    		BEGIN
                SET @error=10101-01;
                SET @error_message=N'Tracker No is missing';
            END;
        END;
    

    Regards,

    Bala

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 14 at 04:34 PM

    Hello

    Similar thread on below link. Invest a little bit of effort. The answer was there in earlier thread raised by you

    https://answers.sap.com/questions/12629387/not-allowed-to-add-document.html

    Thanks

    D.D

    Add comment
    10|10000 characters needed characters exceeded

    • It's not reflecting Document. I am trying this in Test Database - SBO.TransactionNotifications, I dnt knw why its not effecting.

      Please provide the path

      Thanks