‎2007 Jan 24 4:15 AM
HI All,
I am calling a screen from a include program by the below code
form change_ct1 .
data : l_docno type zexc_rec-docno,
l_HIERNO type zexc_rec-HIERNO,
Added by Manik Dhakate
l_MATNR type zexc_rec-MATNR,
l_LFIMG type zexc_rec-lfimg,
l_NETPR type zexc_rec-netpr,
l_DUTYAMT type zexc_rec-grspr_duty,
l_CESSAMT type zexc_rec-grspr_cess.
End of Addition
Fields in perform Added by Manik Dhakate on 23.01.07
PERFORM get_ct1_document changing l_docno l_HIERNO l_MATNR l_LFIMG l_NETPR l_DUTYAMT l_CESSAMT.
CT1_KEY-DOCTYP = 'CT1C'.
MOVE v_lifnr TO CT1_KEY-lifnr.
MOVE l_docno TO CT1_KEY-docno.
MOVE l_HIERNO TO CT1_KEY-HIERNO.
Added by Manik Dhakate on 23.01.07
MOVE l_MATNR TO CT1_KEY-MATNR.
MOVE l_LFIMG To CT1_KEY-LFIMG.
MOVE l_NETPR to CT1_KEY-NETPR.
MOVE l_DUTYAMT to ct1_key-grspr_duty.
MOVE l_CESSAMT to CT1_KEY-grspr_cess.
End of Addition
v_docno = CT1_KEY-docno.
v_doctyp = 'CT1C'.
PERFORM lock_new_docno CHANGING rc.
IF rc = 0.
CALL SCREEN 200.
LEAVE SCREEN.
ELSE.
MESSAGE e020(zmsg).
ENDIF.
endform.
The code for the PERFORM get_ct1_document changing l_docno l_HIERNO l_MATNR l_LFIMG is as below
form get_ct1_document changing l_docno l_HIERNO l_MATNR l_LFIMG l_NETPR l_DUTYAMT l_CESSAMT.
data : lt_ct1 type standard table of zexc_rec with header line.
data : GS_PRIVATE TYPE SLIS_DATA_CALLER_EXIT,
GS_SELFIELD TYPE SLIS_SELFIELD,
G_EXIT(1) TYPE C.
select *
*LIFNR DOCNO DOCTYP HIERNO ITMNO
DATE1 MATNR MAKTX
from zexc_rec into table lt_ct1
where
lifnr = v_lifnr and
DOCTYP = 'CT1'.
if sy-subrc <> 0.
message e021(ZMSG).
endif.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE = 'CT1 Documents'
I_TABNAME = '1'
I_STRUCTURE_NAME = 'ZEXC_REC'
IS_PRIVATE = GS_PRIVATE
IMPORTING
ES_SELFIELD = GS_SELFIELD
E_EXIT = G_EXIT
TABLES
T_OUTTAB = LT_CT1[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE I000(0K) WITH SY-SUBRC.
ENDIF.
read table lt_ct1 index gs_selfield-TABINDEX.
For CT1 cancellation we increase hierarchy by 1 for same document
For ARE1 creation we need just CT1 doc no for referance
Hence this if..else...endif logic is used.
Sunil H / JCB Pune
if sy-subrc = 0.
if CT1_KEY-DOCTYP EQ 'ARE1'..
l_docno = LT_CT1-docno.
else.
l_docno = LT_CT1-docno.
l_HIERNO = LT_CT1-HIERNO + 1.
Added by Manik Dhakate on 23.01.07
l_MATNR = LT_CT1-MATNR.
l_LFIMG = LT_CT1-LFIMG.
l_NETPR = LT_CT1-NETPR.
l_DUTYAMT = LT_CT1-grspr_duty.
l_CESSAMT = LT_CT1-grspr_cess.
End of Addition
endif.
endif.
endform. " get_ct1_documents
Here in the sdcreen 200 i m getting only the record which is selected from the popup.
I want to show all the records with the document no. same as that of the selected row from the popup in the screen 200.
Please sugges the way to do this .
Thanks.
‎2007 Jan 24 5:53 AM
Hi Rahul,
In the perform get_ct1_document you doing a read statement for
read table lt_ct1 index gs_selfield-TABINDEX. this is correct to select which row has been selected .
Then you do a loop at lt_cti with document and transfer a internal table with the structure with fields l_docno l_HIERNO l_MATNR l_LFIMG l_NETPR l_DUTYAMT l_CESSAMT.
change the perform like this
PERFORM get_ct1_document changing your internal table with the above fields.
Then you post the to screen 200
This will work .
Please reward if useful.
‎2007 Jan 24 6:08 AM
u need to transfer the internal table instead of a field to screen 200 and by doing a loop u can display the records.
‎2007 Jan 24 6:28 AM
hi Gurus,
I have modified the functions as u said but it is giving the same result.
the modified functions are
form change_ct1 .
data : l_docno type zexc_rec-docno,
l_HIERNO type zexc_rec-HIERNO,
Added by Manik Dhakate
l_MATNR type zexc_rec-MATNR,
l_LFIMG type zexc_rec-lfimg,
l_NETPR type zexc_rec-netpr,
l_DUTYAMT type zexc_rec-grspr_duty,
l_CESSAMT type zexc_rec-grspr_cess.
End of Addition
Fields in perform Added by Manik Dhakate on 23.01.07
PERFORM get_ct1_document. "using it_chng[]."l_docno l_HIERNO l_MATNR l_LFIMG l_NETPR l_DUTYAMT l_CESSAMT.
if it_chng is not initial.
clear ct1_key[].
loop at it_chng.
CT1_KEY-DOCTYP = 'CT1C'.
MOVE it_chng-lifnr TO CT1_KEY-lifnr.
MOVE it_chng-docno TO CT1_KEY-docno.
MOVE it_chng-HIERNO TO CT1_KEY-HIERNO.
Added by Manik Dhakate on 23.01.07
MOVE it_chng-MATNR TO CT1_KEY-MATNR.
MOVE it_chng-LFIMG To CT1_KEY-LFIMG.
MOVE it_chng-NETPR to CT1_KEY-NETPR.
MOVE it_chng-grspr_duty to ct1_key-grspr_duty.
MOVE it_chng-grspr_cess to CT1_KEY-grspr_cess.
End of Addition
v_docno = CT1_KEY-docno.
v_doctyp = 'CT1C'.
modify ct1_key.
Append ct1_key.
clear it_chng.
endloop.
endif.
PERFORM lock_new_docno CHANGING rc.
IF rc = 0.
CALL SCREEN 200.
LEAVE SCREEN.
ELSE.
MESSAGE e020(zmsg).
ENDIF.
endform. " change_ct1
form get_ct1_document." using rt_chng type it_chng."l_docno l_HIERNO l_MATNR l_LFIMG l_NETPR l_DUTYAMT l_CESSAMT.
data : lt_ct1 type standard table of zexc_rec with header line.
data : GS_PRIVATE TYPE SLIS_DATA_CALLER_EXIT,
GS_SELFIELD TYPE SLIS_SELFIELD,
G_EXIT(1) TYPE C.
select *
*LIFNR DOCNO DOCTYP HIERNO ITMNO
DATE1 MATNR MAKTX
from zexc_rec into table lt_ct1
where
lifnr = v_lifnr and
DOCTYP = 'CT1'.
if sy-subrc <> 0.
message e021(ZMSG).
endif.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE = 'CT1 Documents'
I_TABNAME = '1'
I_STRUCTURE_NAME = 'ZEXC_REC'
IS_PRIVATE = GS_PRIVATE
IMPORTING
ES_SELFIELD = GS_SELFIELD
E_EXIT = G_EXIT
TABLES
T_OUTTAB = LT_CT1[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE I000(0K) WITH SY-SUBRC.
ENDIF.
read table lt_ct1 index gs_selfield-TABINDEX.
For CT1 cancellation we increase hierarchy by 1 for same document
For ARE1 creation we need just CT1 doc no for referance
Hence this if..else...endif logic is used.
Sunil H / JCB Pune
if sy-subrc = 0.
if CT1_KEY-DOCTYP EQ 'ARE1'.
it_chng-docno = LT_CT1-docno.
else.
it_chng-docno = LT_CT1-docno.
Added by Manik Dhakate on 24.01.07
select * from zexc_rec into corresponding fields
of table it_chng where docno = LT_CT1-docno
AND lifnr = LT_CT1-lifnr.
loop at it_chng.
it_chng-HIERNO = LT_CT1-HIERNO + 1.
Added by Manik Dhakate on 23.01.07
it_chng-MATNR = LT_CT1-MATNR.
it_chng-LFIMG = LT_CT1-LFIMG.
it_chng-NETPR = LT_CT1-NETPR.
it_chng-grspr_duty = LT_CT1-grspr_duty.
it_chng-grspr_cess = LT_CT1-grspr_cess.
Append it_chng.
Modify it_chng.
clear it_chng.
endloop.
End of Addition
endif.
endif.
endform. " get_ct1_documents