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

URGENT code requirement 2

Former Member
0 Likes
318

Hi,

Urgently needed code for the below requirement

Compare records in i_net1 and i_net2 for schedule start and finish dates (SSAVD and SSEDD): For i_net1-aufnr = i_net2-aufnr and i_net1-vornr = i_net2-vornr, if (i_net1-ssavd NE i_net2-ssavd OR i_net1-ssedd NE i_net2-ssedd), write i_net1-aufnr, i_net1-vornr, i_net1-kdauf, i_net1-kdpos, i_net1-ltxa1, i_net1-projn, i_net1-matnr_lo, i_net1-sernr_lo, i_net1-arbpl, i_net1-erdat, i_net1-ssavd, i_net1-ssedd, i_net2-erdat, i_net2-ssavd, i_net2-ssedd to internal table, i_net3 (write i_net1-erdat as i_net3-erdat1, i_net2-erdat as i_net3-erdat2, i_net1-ssavd as i_net3-ssavd1, i_net2-ssavd as i_net3-ssavd2, i_net1-ssedd as i_net3-ssedd1 and i_net2-ssedd as i_net3-ssedd2). If there are no reecords in i_net3, display message “No data found for selection criteria” if P_R1 selected and send a flat file with message “No data found for selection criteria” if P_R2 is selected.

Rewarded with points

Regards

Edited by: chidambar dixit on May 4, 2008 12:48 PM

1 REPLY 1
Read only

Former Member
0 Likes
297

Hi,

Declare an internal table inet3 with required fields :

aufnr, vornr, kdauf, kdpos, ltxa1, projn, matnr_lo, sernr_lo,

arbpl, erdat1, ssavd1, ssedd1, erdat2, ssavd2, ssedd2.

parameters: dwn_file LIKE rlgrap-filename DEFAULT '/abap/'.

*Try the following code.

-


SORT i_net1 BY aufnr vornr.

SORT i_net2 BY aufnr vornr.

LOOP AT i_net1.

READ TABLE i_net2 WITH KEY aufnr = i_net1-aufnr and

vornr = i_net1-vornr

BINARY SEARCH.

IF sy-subrc = 0.

IF ( ( i_net1-ssavd NE i_net2-ssavd ) OR

( i_net1-ssedd NE i_net2-ssedd) ).

MOVE-CORRESPONDING inet1 TO i_net3.

MOVE: i_net1-erdat TO i_net3-erdat1,

i_net2-erdat TO i_net3-erdat2,

i_net1-ssavd TO i_net3-ssavd1,

i_net2-ssavd TO i_net3-ssavd2,

i_net1-ssedd TO i_net3-ssedd1,

i_net2-ssedd as i_net3-ssedd2.

ENDIF.

ENDIF.

ENDLOOP.

*for your requirement I suppose that P_R1 and P_R2 are radiobuttons.

*declare a message 'NNN' with 'No data found for selection criteria' in your message class in SE91

*and give that number in the following code.

IF i_net3 IS INITIAL[].

If P_R1 = 'X'.

MESSAGE INNN.

ENDIF.

IF P_R2 = 'X'.

OPEN DATASET dwn_file FOR OUTPUT IN TEXT MODE.

TRANSFER 'No data found for selection criteria' TO dwn_file.

CLOSE DATASET dwn_file.

ENDIF.

For condition when P_R2 is selected, the file is downloaded to application server.

Reward points if useful.

Regards,

Satya,