‎2011 Dec 05 10:23 AM
Hello!
I have a problem. In my riport I have a selection screen (1000), a main screen (2000), and a screen (400) this is called inside a loop, to fill some datas when you hit the print button.
CLEAR L_TOTAL.
SORT LT_EBAN BY BNFPO.
LOOP AT LT_EBAN.
GT_ITEM2-FIELD01 = SY-TABIX.
GT_ITEM2-FIELD02 = LT_EBAN-MATNR.
*---Part name, Type, Maker
SPLIT LT_EBAN-TXZ01 AT ',' INTO GT_ITEM2-FIELD03 GT_ITEM2-FIELD04 GT_ITEM2-FIELD05.
CONCATENATE GT_ITEM2-FIELD03 '/' GT_ITEM2-FIELD04 INTO DESCR.
ITEM = LT_EBAN-BNFPO.
CALL SCREEN 400 STARTING AT 20 7 ENDING AT 60 18.
*---Machine
GT_ITEM2-FIELD06 = ST_400-MACHINE.
....
After this, i could not use the LEAVE TO SCREEN 0, because it's not going back to secreen '2000' , I'm getting a blank 400 screen.
Thatswhy I used CALL SCREEN '2000', and it's fine.
But in the case of the Selection screen (1000) something is wrong.
On the screen 2000 I using this logic.
MODULE EXIT_2000 INPUT.
CASE OK_CODE.
WHEN 'BACK' OR 'EXIT'.
CLEAR OK_CODE.
CALL SELECTION-SCREEN '1000'.
LEAVE PROGRAM.
WHEN 'CANC'.
PERFORM EXIT_PROGRAM.
LEAVE PROGRAM.
ENDCASE.
CLEAR OK_CODE.
ENDMODULE. " exit_2000 INPUT
With this logic, the program is going to the SELECTION-SCREEN, when I hit the back button, and when we are already on the SELECTION-SCREEN, it's leaving the program. This is also ok.
But when I hit the back button, and on the SELECTION-SCREEN I want to run the program again, it's not going to the program logic, it's jumping to this CALL SELECTION-SCREEN '1000', and leaving of course.
START-OF-SELECTION.
PERFORM DSP1_PROC.
IF GT_DISPLAY[] IS INITIAL.
MESSAGE S208(00) WITH 'No data.'.
EXIT.
ENDIF.
IF S_RET = '1'.
MESSAGE I208 WITH 'Document not found'.
S_RET = ' '.
ELSE.
S_RET = ' '.
CALL SCREEN '2000'.
ENDIF.
So my question is, that the above logic, when I running the program first time It's working good, at the START-OF-SELECTION, but when I trying to runnig from the SELECTION-SCREEN "second time", from the START-OF-SELECTION it's jumping to the CALL SELECTION-SCREEN '1000'. How can I avoid this. I want that from the START-OF-SELECTION, never go to the CALL SELECTION-SCREEN '1000'.
Thank You
Edited by: Roland on Dec 5, 2011 11:27 AM
‎2011 Dec 05 11:06 AM
Hi,
Try using
SET SCREEN '0'.
LEAVE SCREEN.
when you are in screen 2000 to return to the selection screen
Regards,
Sharin
‎2011 Dec 05 11:06 AM
Hi,
Try using
SET SCREEN '0'.
LEAVE SCREEN.
when you are in screen 2000 to return to the selection screen
Regards,
Sharin
‎2011 Dec 05 11:18 AM
Thank You for Your fast reply.
It still not good. I think the problem is, that the program can not leaving the screen 400 properly.
MODULE USER_COMMAND_0400 INPUT.
CASE OK_CODE.
WHEN 'YES' OR 'PRINT'.
LEAVE TO SCREEN 0.
WHEN 'NO'.
CALL SCREEN '2000'.
ENDCASE.
ENDMODULE. " USER_COMMAND_0400 INPUT
MODULE EXIT INPUT.
CALL SCREEN '2000'.
ENDMODULE. " EXIT INPUT
If I'm using here not the CALL SCREEN '2000', then on the screen is a blank 400 screen is staying.
So maybe my logic is failed somewhere here at the screen 400, but I don't know where.
‎2011 Dec 05 11:41 AM
Hi
I think the problem is how you call the screen 400 (so popup):
The commands LEAVE TO SCREEN 0 or SET SCREEN 0. LEAVE SCREEN (they are the same) go to the point where the screen was called, that means just after CALL SCREEN 400.
But if this command is in a LOOP probably the screen 400 will be calling again.
If you want to call the popup once, you shouldn't place the call in a loop, but out of that, or you should go out from the loop after calling the popup 400
Max
‎2011 Dec 05 12:35 PM
Hi Max!
Yeah, I was thinking the same, that the problem is with that loop.
But I don't know, how can I solved in a different way, because when we hit the print button, we getting all the items from a table, and we starting looping on them. In the loop we passing the values to a GT_ITEM table, later this table is connected with an excell, so it will be printed out in an excell form.
So I have to call this screen so many times, how many items we have. Sometimes just 1, sometimes 4, 6, 9, and so on.
For this items I have to add 2 more fields, wich are uploaded by the user. ( The other fields are coming from the table)
So if I going out from the loop after the CALL SCREEN 400, I think the next item wont be get the values. Or maybe any of them, because this is before the APPEND GT_ITEM. So this methode wont be called, no data would be in the table, nothing will be printed.
*-Item
SELECT BNFPO MATNR TXZ01 MENGE MEINS ERNAM PREIS BEDNR EBELN EBELP
INTO CORRESPONDING FIELDS OF TABLE LT_EBAN
FROM EBAN
WHERE BANFN = GT_DISPLAY-BANFN
AND LOEKZ = ' '.
CLEAR L_TOTAL.
SORT LT_EBAN BY BNFPO.
LOOP AT LT_EBAN.
GT_ITEM2-FIELD01 = SY-TABIX.
GT_ITEM2-FIELD02 = LT_EBAN-MATNR.
*---Part name, Type, Maker
SPLIT LT_EBAN-TXZ01 AT ',' INTO GT_ITEM2-FIELD03 GT_ITEM2-FIELD04 GT_ITEM2-FIELD05.
CONCATENATE GT_ITEM2-FIELD03 '/' GT_ITEM2-FIELD04 INTO DESCR.
ITEM = LT_EBAN-BNFPO.
CALL SCREEN 400 STARTING AT 20 7 ENDING AT 60 18.
*---Machine
GT_ITEM2-FIELD06 = ST_400-MACHINE.
*---Using Qty
WRITE ST_400-USING UNIT LT_EBAN-MEINS TO GT_ITEM2-FIELD08.
*---Now Stock
CLEAR L_LABST.
SELECT SUM( LABST ) INTO L_LABST
FROM ZMM0460T
WHERE MATNR = LT_EBAN-MATNR
AND WERKS = '3A10'.
WRITE L_LABST UNIT LT_EBAN-MEINS TO GT_ITEM2-FIELD09.
WRITE LT_EBAN-MENGE UNIT LT_EBAN-MEINS TO GT_ITEM2-FIELD10.
IF NOT LT_EBAN-EBELN IS INITIAL.
CLEAR LS_EKPO.
SELECT SINGLE NETPR WAERS PEINH
INTO CORRESPONDING FIELDS OF LS_EKPO
FROM EKPO AS A INNER JOIN EKKO AS B ON A~EBELN EQ B~EBELN
WHERE A~EBELN = LT_EBAN-EBELN
AND A~EBELP = LT_EBAN-EBELP.
IF LS_EKPO-WAERS <> 'HUF'.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
DATE = SY-DATUM
FOREIGN_AMOUNT = LS_EKPO-NETPR
FOREIGN_CURRENCY = LS_EKPO-WAERS
LOCAL_CURRENCY = 'HUF'
IMPORTING
LOCAL_AMOUNT = LS_EKPO-NETPR.
ENDIF.
IF LS_EKPO-PEINH IS INITIAL. LS_EKPO-PEINH = 1. ENDIF.
LT_EBAN-PREIS = LS_EKPO-NETPR / LS_EKPO-PEINH.
ENDIF.
WRITE LT_EBAN-PREIS CURRENCY 'HUF' TO GT_ITEM2-FIELD11.
CONDENSE GT_ITEM2-FIELD11.
CONCATENATE GT_ITEM2-FIELD11 'Ft' INTO GT_ITEM2-FIELD11
SEPARATED BY SPACE.
L_NETWR = LT_EBAN-MENGE * LT_EBAN-PREIS.
WRITE L_NETWR CURRENCY 'HUF' TO GT_ITEM2-FIELD12.
CONDENSE GT_ITEM2-FIELD12.
CONCATENATE GT_ITEM2-FIELD12 'Ft' INTO GT_ITEM2-FIELD12
SEPARATED BY SPACE.
L_TOTAL = L_TOTAL + L_NETWR.
*---Unit
SELECT SINGLE UNIT INTO GT_ITEM2-FIELD13
FROM ZMM0500T
WHERE PERNR = LT_EBAN-BEDNR.
*---Name
SELECT SINGLE SNAME INTO GT_ITEM2-FIELD14
FROM PA0001
WHERE PERNR = LT_EBAN-BEDNR
AND ENDDA = '99991231'.
*---Append
GT_ITEM2-CNTR01 = ''.
APPEND GT_ITEM2. CLEAR: GT_ITEM2, ST_400, DESCR, ITEM.
ENDLOOP.
GT_ITEM2-FIELD11 = 'Total'.
WRITE L_TOTAL CURRENCY 'HUF' TO GT_ITEM2-FIELD12.
CONDENSE GT_ITEM2-FIELD12.
CONCATENATE GT_ITEM2-FIELD12 'Ft' INTO GT_ITEM2-FIELD12
SEPARATED BY SPACE.
GT_ITEM2-CNTR01 = 'B'.
APPEND GT_ITEM2. CLEAR GT_ITEM2.
ANy idea?
Thank You
Edited by: Roland on Dec 5, 2011 1:36 PM
Edited by: Roland on Dec 5, 2011 1:50 PM
‎2011 Dec 05 3:09 PM
Why don't you show all items in the poup in order to upload all extra-data (by user) at the same time?
Max
‎2011 Dec 15 3:01 PM
Hi,
According to me Sharin has pointed the issue...
You should only use leave to screen 0 when leaving screens (2000+400) instead of call screen again...
The flow should be something like:
- start-of-program
- call screen 2000
- call screen 400 (module 2000 pai)
- leave to screen 0 (module 400 pai)
- leave to screen 0 (module 2000 pai on exit)
The call selection screen statement or call screen 2000 in pai of screen 400 should not be used, so that the screens flow is respected.
Kr,
Manu.