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

reg:Logic Urgent

Former Member
0 Likes
1,239

hi all,,

I want to add in this programm following conditions.

If contains attachments and documents header text(bkpf-bktxt)that documetnts only can disply . how to give logic update me.

START-OF-SELECTION.

SELECT bukrs

belnr

gjahr

bldat

blart

bktxt

FROM bkpf

INTO CORRESPONDING FIELDS OF TABLE itab

WHERE bukrs IN bukrs

AND belnr IN belnr

AND gjahr IN gjahr.

IF sy-subrc <> 0.

MESSAGE e001(00) WITH 'no data found!'.

ENDIF.

LOOP AT itab.

CLEAR wa.

CONCATENATE itab-bukrs

itab-belnr

itab-gjahr

INTO g_instance.

SELECT SINGLE *

FROM srgbtbrel

INTO wa

WHERE instid_a = g_instance.

IF sy-subrc = 0.

flag1 = 'X'.

g_attachment = 'Contains Attach.'.

CONVERT TIME STAMP wa-utctime

TIME ZONE tzone

INTO DATE bdate TIME btime.

ELSE.

Flag2 = 'X'.

g_attachment = 'No Attachment'.

ENDIF.

rgrds

JK

hi all,,

I want to add in this programm following conditions.

If contains attachments and documents header text(bkpf-bktxt)that documetnts only can disply . how to give logic update me.

START-OF-SELECTION.

SELECT bukrs

belnr

gjahr

bldat

blart

bktxt

FROM bkpf

INTO CORRESPONDING FIELDS OF TABLE itab

WHERE bukrs IN bukrs

AND belnr IN belnr

AND gjahr IN gjahr.

IF sy-subrc <> 0.

MESSAGE e001(00) WITH 'no data found!'.

ENDIF.

LOOP AT itab.

CLEAR wa.

CONCATENATE itab-bukrs

itab-belnr

itab-gjahr

INTO g_instance.

SELECT SINGLE *

FROM srgbtbrel

INTO wa

WHERE instid_a = g_instance.

IF sy-subrc = 0.

flag1 = 'X'.

g_attachment = 'Contains Attach.'.

CONVERT TIME STAMP wa-utctime

TIME ZONE tzone

INTO DATE bdate TIME btime.

ELSE.

Flag2 = 'X'.

g_attachment = 'No Attachment'.

ENDIF.

rgrds

JK

12 REPLIES 12
Read only

Former Member
0 Likes
1,209

hi,

loop at itab1.

if itab1-bktxt is not initial.

append itab1 to itab2.

endif.

endloop.

end-of-selection.

loop at itab2.

write:itab2-XXy....

endloop.

regards,

keerthi

Read only

0 Likes
1,209

HI ,

Tq for reply,'

plz see the follwoing programm.

&----


*& Report Z2GFR_TEST799 *

*& *

&----


*& *

*& *

&----


REPORT Z2GFR_TEST799 NO STANDARD PAGE HEADING .

TABLES: bkpf.

DATA: BEGIN OF itab OCCURS 0,

bukrs TYPE bkpf-bukrs,

belnr TYPE bkpf-belnr,

bktxt TYPE bkpf-bktxt,

gjahr TYPE bkpf-gjahr,

bldat TYPE bkpf-bldat,

blart TYPE bkpf-blart,

END OF itab.

data : flag1(1),

flag2(2).

DATA: wa TYPE srgbtbrel,

bdate TYPE bkpf-budat,

btime TYPE sy-uzeit,

tzone TYPE ttzz-tzone VALUE 'UTC+1'.

DATA: g_instance LIKE srgbtbrel-instid_a.

DATA: g_attachment(20) TYPE c.

SELECT-OPTIONS: bukrs FOR bkpf-bukrs,

belnr FOR bkpf-belnr,

gjahr FOR bkpf-gjahr OBLIGATORY DEFAULT sy-datum(4).

PARAMETERS : p_att TYPE c RADIOBUTTON GROUP ra1,

p_nat TYPE c RADIOBUTTON GROUP ra1,

p_nwt TYPE c RADIOBUTTON GROUP ra1.

START-OF-SELECTION.

SELECT bukrs

belnr

gjahr

bldat

blart

bktxt

FROM bkpf

INTO CORRESPONDING FIELDS OF TABLE itab

WHERE bukrs IN bukrs

AND belnr IN belnr

AND gjahr IN gjahr.

IF sy-subrc <> 0.

MESSAGE e001(00) WITH 'no data found!'.

ENDIF.

LOOP AT itab.

CLEAR wa.

CONCATENATE itab-bukrs

itab-belnr

itab-gjahr

INTO g_instance.

SELECT SINGLE *

FROM srgbtbrel

INTO wa

WHERE instid_a = g_instance.

IF sy-subrc = 0.

flag1 = 'X'.

g_attachment = 'Contains Attach.'.

ELSE.

Flag2 = 'X'.

g_attachment = 'No Attachment'.

ENDIF.

FORMAT COLOR 2 ON.

IF p_att EQ 'X'.

if flag1 = 'X' and itab-bktxt is not initial.

WRITE : /2 itab-bldat ,

15 itab-bukrs,

30 itab-belnr,

45 itab-bktxt,

75 g_attachment,

95 sy-uname,

105 itab-blart.

endif.

ELSEIF p_nat EQ 'X'.

if flag1 = 'X' and itab-bktxt is initial.

WRITE : /2 itab-bldat ,

15 itab-bukrs,

30 itab-belnr,

45 itab-bktxt,

75 g_attachment,

95 sy-uname,

105 itab-blart.

endif.

ELSEIF p_nwt EQ 'X'.

if flag2 = 'X' and itab-bktxt(1) = '@'.

WRITE : /2 itab-bldat ,

15 itab-bukrs,

30 itab-belnr,

45 itab-bktxt,

75 g_attachment,

95 sy-uname,

105 itab-blart.

endif.

ENDIF.

ENDLOOP.

TOP-OF-PAGE.

FORMAT COLOR 1 ON.

WRITE:/2 'Doc Date:'(t01),

15 'Comany Code:',

30 'Doc No:',

45 'Header Text:',

75 'Status:',

95 'User Name:',

105 'Doc Type:'.

AT LINE-SELECTION.

SET PARAMETER ID 'BUK' FIELD itab-bukrs.

SET PARAMETER ID 'BLN' FIELD itab-belnr.

SET PARAMETER ID 'GJR' FIELD itab-gjahr.

1. suppose 100 documents there in that 20 records having attachments inthat 10 having header text(means 10 records having attachments and header text) that records only need to disply.

2.with attachments without header text

3.without attachments with header text(with @ is starting symbol) only disply

plz update this.

rgrds

JK

Read only

0 Likes
1,209
IF p_att EQ 'X'.
if flag1 = 'X' 
and itab-bktxt is not initial.
WRITE : /2 itab-bldat ,
15 itab-bukrs,
30 itab-belnr,
45 itab-bktxt,
75 g_attachment,
95 sy-uname,
105 itab-blart.
endif.
ELSEIF p_nat EQ 'X'.
if flag1 = 'X' 
and itab-bktxt is initial.
WRITE : /2 itab-bldat ,
15 itab-bukrs,
30 itab-belnr,
45 itab-bktxt,
75 g_attachment,
95 sy-uname,
105 itab-blart.
endif.

ELSEIF p_nwt EQ 'X'.
if flag2 = 'X'

<b>and itab-bktxt CA '@'.</b> if starting symbol then

and itab-bktxt(1) = '@'.

WRITE : /2 itab-bldat ,
15 itab-bukrs,
30 itab-belnr,
45 itab-bktxt,
75 g_attachment,
95 sy-uname,
105 itab-blart.
endif.
ENDIF.

ENDLOOP.

I hope this will work. Debug and see what is happening.

Let me know if u need ny further help.

Read only

0 Likes
1,209

HI judith,

its not working:

i need following output.

1.suppose we have 100 documents inthat 100 20 documents having attachments inthat 20 10 documents having attachments(means having attachments and document header text) that records only need to disply.

2. attachments without header text(means remaining 10 documents)need to disply.

hope u understand my requirement.

regards

JK

Read only

0 Likes
1,209

Hey got it but u need to check <b>itab-bktxt = ' '.</b>

<b>if flag1 = 'X' and

NOT itab-bktxt is initial.</b>

chaneg teh above code.

Because by looking into the code it seems to be correct, but u have to debug and see for each scenario. Whether the btxt is balnk or not? So taht u can change it accordingly.

So please debug and see u will get the answer.

Only a minor mistake is there.

Read only

0 Likes
1,209

HI,

itab=-bktxt showing follwing

200020002000200020002000200020002000200020002000200020002000200020

Read only

0 Likes
1,209

hi same result showing

regards

JK

Read only

0 Likes
1,209

Make sure the code u r using to retieve and check whether attachements are theer is correct.

Also make sure this concatenate is correct.

CONCATENATE itab-bukrs
itab-belnr
itab-gjahr
INTO g_instance.

SELECT SINGLE *
FROM srgbtbrel
INTO wa
WHERE instid_a = g_instance.
IF sy-subrc = 0.
flag1 = 'X'.
g_attachment = 'Contains Attach.'.

Text field u can get anything.

Let me know in debugging which is retrieving wrong value?

Read only

0 Likes
1,209

in bktxt=320030003000360030003600300039002D0048004B004F004200480020002000200020002000200020002000200020002000 getting like this.

upto attachment program working

rgrds

JK

Read only

0 Likes
1,209

Hi,

Whatever may be the value u get in the bktxt, u have to do a check whethere it is blank or having some value right?

Then y ur worying about the value.

Ur coding should check if it is balnk or contains any value?

The total length of BXTXT is 25 char.

U can check whether itab-bxtxt EQ SPACE

OR itab-bxtxt NE SPACE.

Read only

Former Member
0 Likes
1,209

Hi Jana,

Hope u want only those records to be displayed from the internal table "itab" where itab-bktxt is not initial.

Try this logic...

DELETE itab[] WHERE bktxt EQ space.

Regards

Avi...

Read only

Former Member
0 Likes
1,209

Hi,

Declare an extra field Attachment(for G_INSTANCE) in ITAB.

Declare another Internal table ITAB1 (in the place of 'wa' in your program) with the key fields like BUKRS, GJAHR and BELNR and fetch the g_instance ino it.

Loop the ITAB and modify the ITAb with the ITAB1 g_INStance by reading it with the key fields of ITAb.

Now ITAB consists of both text and Instance.

Check if both are there then write to output.

Hope you understood.

Regards,

Anji